3 # Copyright 2000-2002 Katipo Communications
5 # This file is part of Koha.
7 # Koha is free software; you can redistribute it and/or modify it under the
8 # terms of the GNU General Public License as published by the Free Software
9 # Foundation; either version 2 of the License, or (at your option) any later
12 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
13 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License along with
17 # Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
18 # Suite 330, Boston, MA 02111-1307 USA
31 sub plugin_parameters {
32 my ($dbh,$record,$tagslib,$i,$tabloop) = @_;
36 sub plugin_javascript {
37 my ($dbh,$record,$tagslib,$field_number,$tabloop) = @_;
38 my $function_name= "328".(int(rand(100000))+1);
40 <script type=\"text/javascript\">
42 function Focus$function_name(subfield_managed) {return 1;}
43 function Blur$function_name(subfield_managed) {return 1;}
44 function Clic$function_name(i) {
45 defaultvalue=document.getElementById(i).value;
46 newin=window.open(\"plugin_launcher.pl?plugin_name=labs_theses.pl&cat_auth=LABTHE&index=\"+i+\"&result=\"+defaultvalue,\"unimarc_field_328\",'width=700,height=700,toolbar=false,scrollbars=yes');
53 return ($function_name,$res);
58 my $dbh=C4::Context->dbh;
60 my $op = $query->param('op');
61 my $cat_auth=$query->param('cat_auth');
63 my $startfrom=$query->param('startfrom');
64 $startfrom=0 if(!defined $startfrom);
65 my ($template, $loggedinuser, $cookie);
67 my $search = $query->param('search');
69 if ($op eq "do_search") {
71 $resultsperpage= $query->param('resultsperpage');
72 $resultsperpage = 19 if(!defined $resultsperpage);
73 # my $upperlimit=$startfrom+$resultsperpage;
74 # builds tag and subfield arrays
75 my $strquery = "SELECT authorised_value, lib from authorised_values where category = ? and lib like ?";
76 # $strquery .= " LIMIT $startfrom,$upperlimit";
78 warn 'category : '.$cat_auth.' recherche :'.$search;
81 my $sth = $dbh->prepare($strquery);
82 $sth->execute($cat_auth,$search);
88 while (my $data = $sth->fetchrow_hashref){
89 my $libjs=$data->{'lib'};
90 # $libjs=~s#\'#\\\'#g;
91 my $authjs=$data->{'authorised_value'};
92 # $authjs=~s#\'#\\\'#g;
93 push @results, {'libjs'=>$libjs,
94 'lib'=>$data->{'lib'},
96 'auth_value'=>$data->{'authorised_value'}}
97 unless (($total<$startfrom) or ($total>$startfrom+$resultsperpage));
101 ($template, $loggedinuser, $cookie)
102 = get_template_and_user({template_name => "cataloguing/value_builder/labs_theses.tmpl",
105 authnotrequired => 1,
109 # multi page display gestion
111 my $displayprev=$startfrom;
112 if(($total - (($startfrom+1)*($resultsperpage))) > 0 ){
118 if ($total>$resultsperpage)
120 for (my $i=1; (($i<$total/$resultsperpage+1) && ($i<16)); $i++)
123 ($startfrom==($i-1)) && ($highlight=1);
124 push @numbers, { number => $i,
125 highlight => $highlight ,
127 startfrom => $resultsperpage*($i-1)};
131 my $from = $startfrom+1;
134 if($total < (($startfrom+1)*$resultsperpage))
138 $to = (($startfrom+1)*$resultsperpage);
140 $template->param(catresult => \@results,
142 index => $query->param('index')."",
143 startfrom=> $startfrom,
144 displaynext=> $displaynext,
145 displayprev=> $displayprev,
146 resultsperpage => $resultsperpage,
147 startfromnext => $startfrom+$resultsperpage,
148 startfromprev => $startfrom-$resultsperpage,
158 ($template, $loggedinuser, $cookie)
159 = get_template_and_user({template_name => "cataloguing/value_builder/labs_theses.tmpl",
162 authnotrequired => 1,
166 'search'=>$query->param('search'),
169 'index'=>''.$query->param('index')
170 ) if ($query->param('index'));
171 warn 'index : '.$query->param('index');
173 'cat_auth'=>$cat_auth
176 output_html_with_http_headers $query, $cookie, $template->output ;