Bug 11897: Add mising semi-colon to user*.sql
[koha.git] / cataloguing / value_builder / upload.pl
blobe26bca7f99536f110438fc685561dfe96979ba56
1 #!/usr/bin/perl
3 # Converted to new plugin style (Bug 6874/See also 13437)
5 # This file is part of Koha.
7 # Copyright (C) 2015 Rijksmuseum
8 # Copyright (C) 2011-2012 BibLibre
10 # Koha is free software; you can redistribute it and/or modify it
11 # under the terms of the GNU General Public License as published by
12 # the Free Software Foundation; either version 3 of the License, or
13 # (at your option) any later version.
15 # Koha is distributed in the hope that it will be useful, but
16 # WITHOUT ANY WARRANTY; without even the implied warranty of
17 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 # GNU General Public License for more details.
20 # You should have received a copy of the GNU General Public License
21 # along with Koha; if not, see <http://www.gnu.org/licenses>.
23 use Modern::Perl;
25 # This plugin does not use the plugin launcher. It refers to tools/upload.pl.
26 # That script and template support using it as a plugin.
28 # If the plugin is called with the pattern [id=some_hashvalue] in the
29 # corresponding field, it starts the upload script as a search, providing
30 # the possibility to delete the uploaded file. If the field is empty, you
31 # can upload a new file.
33 my $builder = sub {
34 my ( $params ) = @_;
35 return <<"SCRIPT";
36 <script type=\"text/javascript\">
37 function Click$params->{id}(event) {
38 var index = event.data.id;
39 var str = document.getElementById(index).value;
40 var myurl, term;
41 if( str && str.match(/id=([0-9a-f]+)/) ) {
42 term = RegExp.\$1;
43 myurl = '../tools/upload.pl?op=search&index='+index+'&term='+term+'&plugin=1';
44 } else {
45 myurl = '../tools/upload.pl?op=new&index='+index+'&plugin=1';
47 window.open( myurl, 'tag_editor', 'width=800,height=400,toolbar=false,scrollbars=yes' );
49 </script>
50 SCRIPT
53 return { builder => $builder };