3 # This file is part of Koha.
5 # Koha is free software; you can redistribute it and/or modify it
6 # under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 3 of the License, or
8 # (at your option) any later version.
10 # Koha is distributed in the hope that it will be useful, but
11 # WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with Koha; if not, see <http://www.gnu.org/licenses>.
19 use C4::Auth qw( get_template_and_user );
24 use C4::Output qw( output_html_with_http_headers );
25 use Koha::Util::FrameworkPlugin qw|date_entered|;
27 use constant FIXLEN_DATA_ELTS => 'baaaaaaa';
31 my $function_name = $params->{id};
32 my $dateentered = date_entered();
33 my $defaultval = FIXLEN_DATA_ELTS;
37 function Focus$function_name(event) {
38 if (!document.getElementById(event.data.id).value) {
39 var authtype=document.forms['f'].elements['authtypecode'].value;
40 var fieldval='$dateentered$defaultval';
41 document.getElementById(event.data.id).value=fieldval;
46 function Click$function_name(event) {
47 var authtype=document.forms['f'].elements['authtypecode'].value;
48 defaultvalue=document.getElementById(event.data.id).value;
49 newin=window.open(\"../cataloguing/plugin_launcher.pl?plugin_name=marc21_field_008_classifications.pl&index=\"+ event.data.id +\"&result=\"+defaultvalue+\"&authtypecode=\"+authtype,\"tag_editor\",'width=1000,height=600,toolbar=false,scrollbars=yes');
60 my $input = $params->{cgi};
61 my $index = $input->param('index');
62 my $result = $input->param('result');
63 my $authtype = $input->param('authtypecode') || '';
65 my $defaultval = FIXLEN_DATA_ELTS;
67 my ($template, $loggedinuser, $cookie) = get_template_and_user({
68 template_name => "cataloguing/value_builder/marc21_field_008_classifications.tt",
71 flagsrequired => { editcatalogue => '*' },
73 my $dateentered = date_entered();
74 $result = "$dateentered$defaultval" unless $result;
77 $f[$_]=substr($result,$_,$_==0?6:1);
79 $template->param(index => $index);
81 $f[0] = $dateentered if !$f[0] || $f[0]=~/\s/;
82 $template->param(f1 => $f[0]);
87 "f$_".($f[$_] eq '|'? 'pipe': $f[$_]) => $f[$_],
90 output_html_with_http_headers $input, $cookie, $template->output;
93 return { builder => $builder, launcher => $launcher };