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
17 # with Koha; if not, write to the Free Software Foundation, Inc.,
18 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21 #use warnings; FIXME - Bug 2505
32 sub plugin_parameters {
33 my ($dbh,$record,$tagslib,$i,$tabloop) = @_;
37 sub plugin_javascript {
38 my ($dbh,$record,$tagslib,$field_number,$tabloop) = @_;
39 my $function_name= "328".(int(rand(100000))+1);
41 <script type=\"text/javascript\">
44 function Focus$function_name(subfield_managed) {
48 function Blur$function_name(subfield_managed) {
52 function Clic$function_name(i) {
53 defaultvalue=document.f.field_value[i].value;
54 newin=window.open(\"../cataloguing/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');
61 return ($function_name,$res);
66 my $dbh=C4::Context->dbh;
68 my $op = $query->param('op');
69 my $cat_auth=$query->param('cat_auth');
71 my $startfrom=$query->param('startfrom');
72 $startfrom=0 if(!defined $startfrom);
73 my ($template, $loggedinuser, $cookie);
75 my $search = $query->param('search');
77 if ($op eq "do_search") {
79 $resultsperpage= $query->param('resultsperpage');
80 $resultsperpage = 19 if(!defined $resultsperpage);
81 # my $upperlimit=$startfrom+$resultsperpage;
82 # builds tag and subfield arrays
83 my $strquery = "SELECT authorised_value, lib from authorised_values where category = ? and lib like ?";
84 # $strquery .= " LIMIT $startfrom,$upperlimit";
86 warn 'category : '.$cat_auth.' recherche :'.$search;
89 my $sth = $dbh->prepare($strquery);
90 $sth->execute($cat_auth,$search);
96 while (my $data = $sth->fetchrow_hashref){
97 my $libjs=$data->{'lib'};
99 my $authjs=$data->{'authorised_value'};
100 $authjs=~s#\'#\\\'#g;
101 push @results, {'libjs'=>$libjs,
102 'lib'=>$data->{'lib'},
104 'auth_value'=>$data->{'authorised_value'}}
105 unless (($total<$startfrom) or ($total>$startfrom+$resultsperpage));
109 ($template, $loggedinuser, $cookie)
110 = get_template_and_user({template_name => "value_builder/labs_theses.tmpl",
113 authnotrequired => 1,
117 # multi page display gestion
119 my $displayprev=$startfrom;
120 if(($total - (($startfrom+1)*($resultsperpage))) > 0 ){
126 if ($total>$resultsperpage)
128 for (my $i=1; (($i<$total/$resultsperpage+1) && ($i<16)); $i++)
131 ($startfrom==($i-1)) && ($highlight=1);
132 push @numbers, { number => $i,
133 highlight => $highlight ,
135 startfrom => $resultsperpage*($i-1)};
139 my $from = $startfrom+1;
142 if($total < (($startfrom+1)*$resultsperpage))
146 $to = (($startfrom+1)*$resultsperpage);
148 $template->param(catresult => \@results,
150 index => $query->param('index')."",
151 startfrom=> $startfrom,
152 displaynext=> $displaynext,
153 displayprev=> $displayprev,
154 resultsperpage => $resultsperpage,
155 startfromnext => $startfrom+$resultsperpage,
156 startfromprev => $startfrom-$resultsperpage,
166 ($template, $loggedinuser, $cookie)
167 = get_template_and_user({template_name => "value_builder/labs_theses.tmpl",
170 authnotrequired => 1,
174 'search'=>$query->param('search'),
177 'index'=>''.$query->param('index')
178 ) if ($query->param('index'));
179 warn 'index : '.$query->param('index');
181 'cat_auth'=>$cat_auth
184 output_html_with_http_headers $query, $cookie, $template->output ;