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
32 plugin_parameters : other parameters added when the plugin is called by the dopop function
35 sub plugin_parameters {
36 my ($dbh,$record,$tagslib,$i,$tabloop) = @_;
42 plugin_javascript : the javascript function called when the user enters the subfield.
43 contain 3 javascript functions :
44 * one called when the field is entered (OnFocus). Named FocusXXX
45 * one called when the field is leaved (onBlur). Named BlurXXX
46 * one called when the ... link is clicked (<a href="javascript:function">) named ClicXXX
50 * a variable containing the 3 scripts.
51 the 3 scripts are inserted after the <input> in the html code
54 sub plugin_javascript {
55 my ($dbh,$record,$tagslib,$field_number,$tabloop) = @_;
56 my $function_name= "210c".(int(rand(100000))+1);
57 #---- build editors list.
58 #---- the editor list is built from the "EDITORS" thesaurus
59 #---- this thesaurus category must be filled as follow :
60 #---- isbn_identifier authorityseparator editor authorityseparator collection
61 #---- sample : 2224 -- Cerf -- Sources chrétiennes
62 my $sth = $dbh->prepare("select father,stdlib from bibliothesaurus where category='EDITORS' and level=2");
65 my $authoritysep = C4::Context->preference("authoritysep");
66 while (my ($father,$stdlib) = $sth->fetchrow) {
67 push(@editors,"$father $stdlib");
71 function Focus$function_name(index) {
73 foreach my $editor (@editors) {
74 my @arr = split (/ $authoritysep /,$editor);
75 $res .='["'.$arr[0].'","'.$arr[1].'","'.$arr[2].'"],';
80 // search isbn subfield. it's 010a
82 for (i=0 ; i<document.f.field_value.length ; i++) {
83 if (document.f.tag[i].value == '010' && document.f.subfield[i].value == 'a') {
84 isbn_found=document.f.field_value[i].value;
87 for (i=0;i<=isbn_array.length;i++) {
88 if (isbn_found.substr(0,isbn_array[i][0].length) == isbn_array[i][0]) {
89 document.f.field_value[index].value =isbn_array[i][1];
94 function Blur$function_name(subfield_managed) {
98 function Clic$function_name(subfield_managed) {
99 defaultvalue=escape(document.forms[0].field_value[subfield_managed].value);
100 newin=window.open(\"../plugin_launcher.pl?plugin_name=unimarc_field_210c.pl&result=\"+defaultvalue+\"&index=$field_number\",\"value builder\",'width=500,height=400,toolbar=false,scrollbars=yes');
105 return ($function_name,$res);
110 plugin : the true value_builded. The screen that is open in the popup window.
116 my $index = $input->param("index");
117 my $result = $input->param("result");
118 print "Content-Type: text/html\n\n<META HTTP-EQUIV=Refresh CONTENT=\"0; URL=thesaurus_popup.pl?category=EDITORS&index=$index&result=$result\"></html>";