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.
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\">
43 function Focus$function_name(subfield_managed) {
47 function Blur$function_name(subfield_managed) {
51 function Clic$function_name(i) {
52 defaultvalue=document.f.field_value[i].value;
53 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');
60 return ($function_name,$res);
65 my $dbh=C4::Context->dbh;
67 my $op = $query->param('op');
68 my $cat_auth=$query->param('cat_auth');
70 my $startfrom=$query->param('startfrom');
71 $startfrom=0 if(!defined $startfrom);
72 my ($template, $loggedinuser, $cookie);
74 my $search = $query->param('search');
76 if ($op eq "do_search") {
78 $resultsperpage= $query->param('resultsperpage');
79 $resultsperpage = 19 if(!defined $resultsperpage);
80 # my $upperlimit=$startfrom+$resultsperpage;
81 # builds tag and subfield arrays
82 my $strquery = "SELECT authorised_value, lib from authorised_values where category = ? and lib like ?";
83 # $strquery .= " LIMIT $startfrom,$upperlimit";
85 warn 'category : '.$cat_auth.' recherche :'.$search;
88 my $sth = $dbh->prepare($strquery);
89 $sth->execute($cat_auth,$search);
95 while (my $data = $sth->fetchrow_hashref){
96 my $libjs=$data->{'lib'};
98 my $authjs=$data->{'authorised_value'};
100 push @results, {'libjs'=>$libjs,
101 'lib'=>$data->{'lib'},
103 'auth_value'=>$data->{'authorised_value'}}
104 unless (($total<$startfrom) or ($total>$startfrom+$resultsperpage));
108 ($template, $loggedinuser, $cookie)
109 = get_template_and_user({template_name => "value_builder/labs_theses.tmpl",
112 authnotrequired => 1,
116 # multi page display gestion
118 my $displayprev=$startfrom;
119 if(($total - (($startfrom+1)*($resultsperpage))) > 0 ){
125 if ($total>$resultsperpage)
127 for (my $i=1; (($i<$total/$resultsperpage+1) && ($i<16)); $i++)
130 ($startfrom==($i-1)) && ($highlight=1);
131 push @numbers, { number => $i,
132 highlight => $highlight ,
134 startfrom => $resultsperpage*($i-1)};
138 my $from = $startfrom+1;
141 if($total < (($startfrom+1)*$resultsperpage))
145 $to = (($startfrom+1)*$resultsperpage);
147 $template->param(catresult => \@results,
149 index => $query->param('index')."",
150 startfrom=> $startfrom,
151 displaynext=> $displaynext,
152 displayprev=> $displayprev,
153 resultsperpage => $resultsperpage,
154 startfromnext => $startfrom+$resultsperpage,
155 startfromprev => $startfrom-$resultsperpage,
165 ($template, $loggedinuser, $cookie)
166 = get_template_and_user({template_name => "value_builder/labs_theses.tmpl",
169 authnotrequired => 1,
173 'search'=>$query->param('search'),
176 'index'=>''.$query->param('index')
177 ) if ($query->param('index'));
178 warn 'index : '.$query->param('index');
180 'cat_auth'=>$cat_auth
183 output_html_with_http_headers $query, $cookie, $template->output ;