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;
34 <script type=\"text/javascript\">
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 window.open(\"../cataloguing/plugin_launcher.pl?plugin_name=unimarc_field_60X.pl&index=$field_number&result=\"+defaultvalue,\"unimarc 600\",'width=700,height=300,toolbar=false,scrollbars=yes');
51 return ( $function_name, $res );
56 my $dbh = C4::Context->dbh;
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');
67 newauthority( $dbh, 'NC', $insert, $insert, '', 1, '' );
68 $search_string = $insert;
70 if ( $op eq "select" ) {
72 $dbh->prepare("select stdlib from bibliothesaurus where id=?");
74 my ($freelib_text) = $sti->fetchrow_array;
75 $result = $freelib_text;
77 my $Rsearch_string = "$search_string%";
78 my $authoritysep = C4::Context->preference('authoritysep');
79 my @splitted = /$authoritysep/, $search_string;
80 my $level = $#splitted + 1;
83 { # if no search pattern, returns only the 50 1st top level values
86 "select distinct freelib,father,level from bibliothesaurus where category='NC' and freelib like ? order by father,freelib"
92 "select distinct freelib,father,level from bibliothesaurus where category='NC' and level=0 and freelib like ? order by father,freelib limit 0,50"
95 $sti->execute($Rsearch_string);
97 while ( my ( $freelib, $father, $level ) = $sti->fetchrow ) {
100 $line{value} = "$father $freelib";
103 $line{value} = "$freelib";
105 $line{level} = $level + 1;
106 $line{father} = $father;
107 push @results, \%line;
109 my @DeeperResults = SearchDeeper( 'NC', $search_string );
110 my ( $template, $loggedinuser, $cookie ) = get_template_and_user(
112 template_name => "cataloguing/value_builder/unimarc_field_60X.tmpl",
115 authnotrequired => 0,
116 flagsrequired => { editcatalogue => 1 },
121 # builds collection list : search isbn and editor, in parent, then load collections from bibliothesaurus table
125 search_string => $search_string ? $search_string : $result,
126 results => \@results,
127 deeper => \@DeeperResults,
129 output_html_with_http_headers $input, $cookie, $template->output;