4 # Copyright 2000-2002 Katipo Communications
6 # This file is part of Koha.
8 # Koha is free software; you can redistribute it and/or modify it under the
9 # terms of the GNU General Public License as published by the Free Software
10 # Foundation; either version 2 of the License, or (at your option) any later
13 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
14 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
15 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License along with
18 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
19 # Suite 330, Boston, MA 02111-1307 USA
30 sub plugin_javascript {
31 my ($dbh,$record,$tagslib,$field_number,$tabloop) = @_;
32 my $function_name= $field_number;
35 function Focus$function_name(subfield_managed) {
39 function Blur$function_name(subfield_managed) {
43 function Clic$function_name(index) {
44 defaultvalue=document.getElementById(\"$field_number\").value;
45 newin=window.open(\"plugin_launcher.pl?plugin_name=unimarc_field_700_701_702.pl&index=$field_number&result=\"+defaultvalue,\"unimarc 700\",'width=700,height=300,toolbar=false,scrollbars=yes');
51 return ($function_name,$res);
55 my $dbh = C4::Context->dbh;
56 # my $input = new CGI;
57 my $index= $input->param('index');
58 my $result= $input->param('result');
59 my $search_string= $input->param('search_string');
60 my $op = $input->param('op');
61 my $id = $input->param('id');
62 my $insert = $input->param('insert');
66 my ($a,$b,$c,$f) ; # the 4 managed subfields.
68 newauthority($dbh,'NP',$insert,$insert,'',1,'');
69 $search_string=$insert;
71 if ($op eq "select") {
72 my $sti = $dbh->prepare("select stdlib from bibliothesaurus where id=?");
74 my ($freelib_text) = $sti->fetchrow_array;
75 $result = $freelib_text;
76 # fill the 4 managed subfields
77 my @arr = split //,$result;
79 foreach my $x (@arr) {
86 if ($result =~ /.*;.*/) {
110 # remove trailing blanks
120 if ($search_string) {
121 # my $sti=$dbh->prepare("select id,freelib from bibliothesaurus where freelib like '".$search_string."%' and category ='$category'");
122 my $sti=$dbh->prepare("select id,freelib from bibliothesaurus where match (category,freelib) AGAINST (?) and category ='NP'");
123 $sti->execute($search_string);
124 while (my $line=$sti->fetchrow_hashref) {
125 $stdlib{$line->{'id'}} = "$line->{'freelib'}";
126 push(@freelib,$line->{'id'});
128 $select_list= CGI::scrolling_list( -name=>'id',
136 my ($template, $loggedinuser, $cookie)
137 = get_template_and_user({template_name => "cataloguing/value_builder/unimarc_field_700_701_702.tmpl",
140 authnotrequired => 0,
141 flagsrequired => { editcatalogue => 1},
144 # builds collection list : search isbn and editor, in parent, then load collections from bibliothesaurus table
145 $template->param(index => $index,
147 select_list => $select_list,
148 search_string => $search_string?$search_string:$result,
153 output_html_with_http_headers $input, $cookie, $template->output;