5 # Copyright 2000-2002 Katipo Communications
7 # This file is part of Koha.
9 # Koha is free software; you can redistribute it and/or modify it under the
10 # terms of the GNU General Public License as published by the Free Software
11 # Foundation; either version 2 of the License, or (at your option) any later
14 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
15 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
16 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
18 # You should have received a copy of the GNU General Public License along with
19 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
20 # Suite 330, Boston, MA 02111-1307 USA
31 sub plugin_javascript {
32 my ($dbh,$record,$tagslib,$field_number,$tabloop) = @_;
33 my $function_name= "100".(int(rand(100000))+1);
36 function Focus$function_name(subfield_managed) {
40 function Blur$function_name(subfield_managed) {
44 function Clic$function_name(index) {
45 defaultvalue=document.f.field_value[index].value;
46 newin=window.open(\"../plugin_launcher.pl?plugin_name=unimarc_field_700_701_702.pl&index=\"+index+\"&result=\"+defaultvalue,\"unimarc 700\",'width=700,height=300,toolbar=false,scrollbars=yes');
52 return ($function_name,$res);
57 my $dbh = C4::Context->dbh;
58 # my $input = new CGI;
59 my $index= $input->param('index');
60 my $result= $input->param('result');
61 my $search_string= $input->param('search_string');
62 my $op = $input->param('op');
63 my $id = $input->param('id');
64 my $insert = $input->param('insert');
68 my ($a,$b,$c,$f) ; # the 4 managed subfields.
70 newauthority($dbh,'NP',$insert,$insert,'',1,'');
71 $search_string=$insert;
73 if ($op eq "select") {
74 my $sti = $dbh->prepare("select stdlib from bibliothesaurus where id=?");
76 my ($freelib_text) = $sti->fetchrow_array;
77 $result = $freelib_text;
78 # fill the 4 managed subfields
79 my @arr = split //,$result;
81 foreach my $x (@arr) {
88 if ($result =~ /.*;.*/) {
112 # remove trailing blanks
122 if ($search_string) {
123 # my $sti=$dbh->prepare("select id,freelib from bibliothesaurus where freelib like '".$search_string."%' and category ='$category'");
124 my $sti=$dbh->prepare("select id,freelib from bibliothesaurus where match (category,freelib) AGAINST (?) and category ='NP'");
125 $sti->execute($search_string);
126 while (my $line=$sti->fetchrow_hashref) {
127 $stdlib{$line->{'id'}} = "$line->{'freelib'}";
128 push(@freelib,$line->{'id'});
130 $select_list= CGI::scrolling_list( -name=>'id',
138 my ($template, $loggedinuser, $cookie)
139 = get_template_and_user({template_name => "value_builder/unimarc_field_700_701_702.tmpl",
142 authnotrequired => 0,
143 flagsrequired => {parameters => 1},
146 # builds collection list : search isbn and editor, in parent, then load collections from bibliothesaurus table
147 $template->param(index => $index,
149 select_list => $select_list,
150 search_string => $search_string?$search_string:$result,
155 print $input->header(-cookie => $cookie),$template->output;