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 29-58
use C4::Output;
Link Here
|
29 |
use XML::LibXML; |
30 |
use XML::LibXML; |
30 |
use Koha::Util::FrameworkPlugin qw|date_entered|; |
31 |
use Koha::Util::FrameworkPlugin qw|date_entered|; |
31 |
|
32 |
|
32 |
sub plugin_javascript { |
33 |
my $builder = sub { |
33 |
my ($dbh, $record, $tagslib, $field_number, $tabloop) = @_; |
34 |
my ( $params ) = @_; |
34 |
|
35 |
|
35 |
my $lang = C4::Context->preference('DefaultLanguageField008' ); |
36 |
my $lang = C4::Context->preference('DefaultLanguageField008' ); |
36 |
$lang = "eng" unless $lang; |
37 |
$lang = "eng" unless $lang; |
37 |
$lang = pack("A3", $lang); |
38 |
$lang = pack("A3", $lang); |
38 |
|
39 |
|
39 |
my $function_name = $field_number; |
40 |
my $function_name = $params->{id}; |
40 |
my $dateentered = date_entered(); |
41 |
my $dateentered = date_entered(); |
41 |
my $res = " |
42 |
my $res = " |
42 |
<script type=\"text/javascript\"> |
43 |
<script type=\"text/javascript\"> |
43 |
//<![CDATA[ |
44 |
//<![CDATA[ |
44 |
|
45 |
|
45 |
function Focus$function_name(subfield_managed) { |
46 |
function Focus$function_name(subfield_managed) { |
46 |
if ( document.getElementById(\"$field_number\").value ) { |
47 |
if ( document.getElementById(\"$params->{id}\").value ) { |
47 |
} |
48 |
} |
48 |
else { |
49 |
else { |
49 |
document.getElementById(\"$field_number\").value='$dateentered' + 'b xxu||||| |||| 00| 0 $lang d'; |
50 |
document.getElementById(\"$params->{id}\").value='$dateentered' + 'b xxu||||| |||| 00| 0 $lang d'; |
50 |
} |
51 |
} |
51 |
return 1; |
52 |
return 1; |
52 |
} |
53 |
} |
53 |
|
54 |
|
54 |
function Clic$function_name(i) { |
55 |
function Click$function_name(i) { |
55 |
defaultvalue=document.getElementById(\"$field_number\").value; |
56 |
defaultvalue=document.getElementById(\"$params->{id}\").value; |
56 |
//Retrieve full leader string and pass it to the 008 tag editor |
57 |
//Retrieve full leader string and pass it to the 008 tag editor |
57 |
var leader_value = \$(\"input[id^='tag_000']\").val(); |
58 |
var leader_value = \$(\"input[id^='tag_000']\").val(); |
58 |
var leader_parameter = \"\"; |
59 |
var leader_parameter = \"\"; |
Lines 60-77
function Clic$function_name(i) {
Link Here
|
60 |
//Only add the parameter to the URL if there is a value to add |
61 |
//Only add the parameter to the URL if there is a value to add |
61 |
leader_parameter = \"&leader=\"+leader_value; |
62 |
leader_parameter = \"&leader=\"+leader_value; |
62 |
} |
63 |
} |
63 |
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'); |
64 |
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'); |
64 |
|
65 |
|
65 |
} |
66 |
} |
66 |
//]]> |
67 |
//]]> |
67 |
</script> |
68 |
</script> |
68 |
"; |
69 |
"; |
69 |
|
70 |
|
70 |
return ($function_name, $res); |
71 |
return $res; |
71 |
} |
72 |
}; |
72 |
|
73 |
|
73 |
sub plugin { |
74 |
my $launcher = sub { |
74 |
my ($input) = @_; |
75 |
my ( $params ) = @_; |
|
|
76 |
my $input = $params->{cgi}; |
75 |
my $lang = C4::Context->preference('DefaultLanguageField008' ); |
77 |
my $lang = C4::Context->preference('DefaultLanguageField008' ); |
76 |
$lang = "eng" unless $lang; |
78 |
$lang = "eng" unless $lang; |
77 |
$lang = pack("A3", $lang); |
79 |
$lang = pack("A3", $lang); |
Lines 163-166
sub plugin {
Link Here
|
163 |
material_configuration => $material_configuration, |
165 |
material_configuration => $material_configuration, |
164 |
); |
166 |
); |
165 |
output_html_with_http_headers $input, $cookie, $template->output; |
167 |
output_html_with_http_headers $input, $cookie, $template->output; |
166 |
} |
168 |
}; |
|
|
169 |
|
170 |
return { builder => $builder, launcher => $launcher }; |