Lines 1-5
Link Here
|
1 |
#!/usr/bin/perl |
1 |
#!/usr/bin/perl |
2 |
|
2 |
|
|
|
3 |
# Converted to new plugin style (Bug 13437) |
4 |
|
3 |
# Copyright 2000-2002 Katipo Communications |
5 |
# Copyright 2000-2002 Katipo Communications |
4 |
# |
6 |
# |
5 |
# This file is part of Koha. |
7 |
# This file is part of Koha. |
Lines 17-24
Link Here
|
17 |
# You should have received a copy of the GNU General Public License |
19 |
# You should have received a copy of the GNU General Public License |
18 |
# along with Koha; if not, see <http://www.gnu.org/licenses>. |
20 |
# along with Koha; if not, see <http://www.gnu.org/licenses>. |
19 |
|
21 |
|
20 |
use strict; |
22 |
use Modern::Perl; |
21 |
#use warnings; FIXME - Bug 2505 |
|
|
22 |
use C4::Auth; |
23 |
use C4::Auth; |
23 |
use CGI qw ( -utf8 ); |
24 |
use CGI qw ( -utf8 ); |
24 |
use C4::Context; |
25 |
use C4::Context; |
Lines 36-65
sub date_entered {
Link Here
|
36 |
return substr($year, 2, 2) . sprintf("%0.2d", $mon) . sprintf("%0.2d", $mday); |
37 |
return substr($year, 2, 2) . sprintf("%0.2d", $mon) . sprintf("%0.2d", $mday); |
37 |
} |
38 |
} |
38 |
|
39 |
|
39 |
sub plugin_javascript { |
40 |
my $builder = sub { |
40 |
my ($dbh, $record, $tagslib, $field_number, $tabloop) = @_; |
41 |
my ( $params ) = @_; |
41 |
|
42 |
|
42 |
my $lang = C4::Context->preference('DefaultLanguageField008' ); |
43 |
my $lang = C4::Context->preference('DefaultLanguageField008' ); |
43 |
$lang = "eng" unless $lang; |
44 |
$lang = "eng" unless $lang; |
44 |
$lang = pack("A3", $lang); |
45 |
$lang = pack("A3", $lang); |
45 |
|
46 |
|
46 |
my $function_name = $field_number; |
47 |
my $function_name = $params->{id}; |
47 |
my $dateentered = date_entered(); |
48 |
my $dateentered = date_entered(); |
48 |
my $res = " |
49 |
my $res = " |
49 |
<script type=\"text/javascript\"> |
50 |
<script type=\"text/javascript\"> |
50 |
//<![CDATA[ |
51 |
//<![CDATA[ |
51 |
|
52 |
|
52 |
function Focus$function_name(subfield_managed) { |
53 |
function Focus$function_name(subfield_managed) { |
53 |
if ( document.getElementById(\"$field_number\").value ) { |
54 |
if ( document.getElementById(\"$params->{id}\").value ) { |
54 |
} |
55 |
} |
55 |
else { |
56 |
else { |
56 |
document.getElementById(\"$field_number\").value='$dateentered' + 'b xxu||||| |||| 00| 0 $lang d'; |
57 |
document.getElementById(\"$params->{id}\").value='$dateentered' + 'b xxu||||| |||| 00| 0 $lang d'; |
57 |
} |
58 |
} |
58 |
return 1; |
59 |
return 1; |
59 |
} |
60 |
} |
60 |
|
61 |
|
61 |
function Clic$function_name(i) { |
62 |
function Click$function_name(i) { |
62 |
defaultvalue=document.getElementById(\"$field_number\").value; |
63 |
defaultvalue=document.getElementById(\"$params->{id}\").value; |
63 |
//Retrieve full leader string and pass it to the 008 tag editor |
64 |
//Retrieve full leader string and pass it to the 008 tag editor |
64 |
var leader_value = \$(\"input[id^='tag_000']\").val(); |
65 |
var leader_value = \$(\"input[id^='tag_000']\").val(); |
65 |
var leader_parameter = \"\"; |
66 |
var leader_parameter = \"\"; |
Lines 67-84
function Clic$function_name(i) {
Link Here
|
67 |
//Only add the parameter to the URL if there is a value to add |
68 |
//Only add the parameter to the URL if there is a value to add |
68 |
leader_parameter = \"&leader=\"+leader_value; |
69 |
leader_parameter = \"&leader=\"+leader_value; |
69 |
} |
70 |
} |
70 |
newin=window.open(\"../cataloguing/plugin_launcher.pl?plugin_name=marc21_field_008.pl&index=$field_number&result=\"+defaultvalue+leader_parameter,\"tag_editor\",'width=1000,height=600,toolbar=false,scrollbars=yes'); |
71 |
newin=window.open(\"../cataloguing/plugin_launcher.pl?plugin_name=marc21_field_008.pl&index=$params->{id}&result=\"+defaultvalue+leader_parameter,\"tag_editor\",'width=1000,height=600,toolbar=false,scrollbars=yes'); |
71 |
|
72 |
|
72 |
} |
73 |
} |
73 |
//]]> |
74 |
//]]> |
74 |
</script> |
75 |
</script> |
75 |
"; |
76 |
"; |
76 |
|
77 |
|
77 |
return ($function_name, $res); |
78 |
return $res; |
78 |
} |
79 |
}; |
79 |
|
80 |
|
80 |
sub plugin { |
81 |
my $launcher = sub { |
81 |
my ($input) = @_; |
82 |
my ( $params ) = @_; |
|
|
83 |
my $input = $params->{cgi}; |
82 |
my $lang = C4::Context->preference('DefaultLanguageField008' ); |
84 |
my $lang = C4::Context->preference('DefaultLanguageField008' ); |
83 |
$lang = "eng" unless $lang; |
85 |
$lang = "eng" unless $lang; |
84 |
$lang = pack("A3", $lang); |
86 |
$lang = pack("A3", $lang); |
Lines 170-173
sub plugin {
Link Here
|
170 |
material_configuration => $material_configuration, |
172 |
material_configuration => $material_configuration, |
171 |
); |
173 |
); |
172 |
output_html_with_http_headers $input, $cookie, $template->output; |
174 |
output_html_with_http_headers $input, $cookie, $template->output; |
173 |
} |
175 |
}; |
|
|
176 |
|
177 |
return { builder => $builder, launcher => $launcher }; |