functions that were in C4::Interface::CGI::Output are now in C4::Output.
[koha.git] / cataloguing / value_builder / marc21_field_005.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 require Exporter;
24 use C4::Auth;
25 use C4::Context;
26 use C4::Output;
27 use CGI;
28 use C4::Search;
29 use MARC::Record;
30 use C4::Koha;
31
32
33 =head1
34
35 plugin_parameters : other parameters added when the plugin is called by the dopop function
36
37 =cut
38 sub plugin_parameters {
39 my ($dbh,$record,$tagslib,$i,$tabloop) = @_;
40 return "";
41 }
42
43 =head1
44
45 plugin_javascript : the javascript function called when the user enters the subfield.
46 contain 3 javascript functions :
47 * one called when the field is entered (OnFocus). Named FocusXXX
48 * one called when the field is leaved (onBlur). Named BlurXXX
49 * one called when the ... link is clicked (<a href="javascript:function">) named ClicXXX
50
51 returns :
52 * XXX
53 * a variable containing the 3 scripts.
54 the 3 scripts are inserted after the <input> in the html code
55
56 =cut
57 sub plugin_javascript {
58 my ($dbh,$record,$tagslib,$field_number,$tabloop) = @_;
59 my $function_name= "210c".(int(rand(100000))+1);
60
61 # find today's date
62 my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =
63                                                                localtime(time);
64 $year +=1900;
65 $mon +=1;
66 if (length($mon)==1) {
67         $mon = "0".$mon;
68 }
69 if (length($mday)==1) {
70         $mday = "0".$mday;
71 }
72 if (length($hour)==1) {
73         $hour = "0".$hour;
74 }
75 if (length($min)==1) {
76         $min = "0".$min;
77 }
78 if (length($sec)==1) {
79         $hour = "0".$sec;
80 }
81
82
83 my $date = "$year$mon$mday$hour$min$sec".".0";
84 my $res  = "
85 <script>
86 function Blur$function_name(index) {
87 //need this?
88 }
89
90 function Focus$function_name(subfield_managed) {
91         for (i=0 ; i<document.f.field_value.length ; i++) {
92                 if (document.f.tag[i].value == '005') {
93                         document.f.field_value[i].value = '$date';
94                 }
95         }
96 return 0;
97 }
98
99 function Clic$function_name(subfield_managed) {
100 }
101 </script>
102 ";
103 return ($function_name,$res);
104 }
105
106 =head1
107
108 plugin : the true value_builded. The screen that is open in the popup window.
109
110 =cut
111
112 sub plugin {
113 my ($input) = @_;
114 return "";
115 }
116
117 1;