partial 1481: adding back missing updateitem.pl script
[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
37 sub plugin_parameters {
38 my ($dbh,$record,$tagslib,$i,$tabloop) = @_;
39 return "";
40 }
41
42 sub plugin_javascript {
43 my ($dbh,$record,$tagslib,$field_number,$tabloop) = @_;
44 my $function_name= $field_number;
45 my $res="
46 <script type=\"text/javascript\">
47 //<![CDATA[
48
49 function Focus$function_name(subfield_managed) {
50 return 1;
51 }
52
53 function Blur$function_name(subfield_managed) {
54         return 1;
55 }
56
57 function Clic$function_name(i) {
58         defaultvalue=document.getElementById(\"$field_number\").value;
59         newin=window.open(\"plugin_launcher.pl?plugin_name=marc21_field_007.pl&index=$field_number&result=\"+defaultvalue,\"unimarc field 100\",'width=1000,height=600,toolbar=false,scrollbars=yes');
60
61 }
62 //]]>
63 </script>
64 ";
65
66 return ($function_name,$res);
67 }
68 sub plugin {
69 my ($input) = @_;
70         my $index= $input->param('index');
71         my $result= $input->param('result');
72
73
74         my $dbh = C4::Context->dbh;
75
76 my ($template, $loggedinuser, $cookie)
77     = get_template_and_user({template_name => "cataloguing/value_builder/marc21_field_007.tmpl",
78                              query => $input,
79                              type => "intranet",
80                              authnotrequired => 0,
81                              flagsrequired => {editcatalogue => 1},
82                              debug => 1,
83                              });
84         $result = "ta" unless $result;
85         my $f0 = substr($result,0,1);
86         my $f1 = substr($result,1,4);
87
88         $template->param(                               index => $index,
89                                                         f0 => $f0,
90                                                         "f0$f0" => $f0,
91                                                         f1 => $f1,
92                                                         "f1$f1" => $f1,
93                                         );
94         output_html_with_http_headers $input, $cookie, $template->output;
95 }
96
97 1;