Adding a biblio can be executed in a popup now.
[koha.git] / cataloguing / value_builder / marc21_field_007.pl
1
2 #!/usr/bin/perl
3
4 # $Id$
5
6 # Copyright 2000-2002 Katipo Communications
7 #
8 # This file is part of Koha.
9 #
10 # Koha is free software; you can redistribute it and/or modify it under the
11 # terms of the GNU General Public License as published by the Free Software
12 # Foundation; either version 2 of the License, or (at your option) any later
13 # version.
14 #
15 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
16 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
17 # A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
18 #
19 # You should have received a copy of the GNU General Public License along with
20 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
21 # Suite 330, Boston, MA  02111-1307 USA
22
23 use strict;
24 use C4::Auth;
25 use CGI;
26 use C4::Context;
27
28 use C4::Search;
29 use C4::Output;
30
31 =head1
32
33 plugin_parameters : other parameters added when the plugin is called by the dopop function
34
35 =cut
36 sub plugin_parameters {
37 my ($dbh,$record,$tagslib,$i,$tabloop) = @_;
38 return "";
39 }
40
41 sub plugin_javascript {
42 my ($dbh,$record,$tagslib,$field_number,$tabloop) = @_;
43 my $function_name= "100".(int(rand(100000))+1);
44 my $res="
45 <script>
46 function Focus$function_name(subfield_managed) {
47 return 1;
48 }
49
50 function Blur$function_name(subfield_managed) {
51         return 1;
52 }
53
54 function Clic$function_name(i) {
55         defaultvalue=document.forms['f'].field_value[i].value;
56         newin=window.open(\"plugin_launcher.pl?plugin_name=marc21_field_007.pl&index=\"+i+\"&result=\"+defaultvalue,\"unimarc field 100\",'width=1000,height=600,toolbar=false,scrollbars=yes');
57
58 }
59 </script>
60 ";
61
62 return ($function_name,$res);
63 }
64 sub plugin {
65 my ($input) = @_;
66         my $index= $input->param('index');
67         my $result= $input->param('result');
68
69
70         my $dbh = C4::Context->dbh;
71
72 my ($template, $loggedinuser, $cookie)
73     = get_template_and_user({template_name => "value_builder/marc21_field_007.tmpl",
74                              query => $input,
75                              type => "intranet",
76                              authnotrequired => 0,
77                              flagsrequired => {editcatalogue => 1},
78                              debug => 1,
79                              });
80         $result = "ta" unless $result;
81         my $f0 = substr($result,0,1);
82         my $f1 = substr($result,1,4);
83
84         $template->param(                               index => $index,
85                                                         f0 => $f0,
86                                                         "f0$f0" => $f0,
87                                                         f1 => $f1,
88                                                         "f1$f1" => $f1,
89                                         );
90         output_html_with_http_headers $input, $cookie, $template->output;
91 }
92
93 1;