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
24 use C4::Interface::CGI::Output;
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);
41 function Focus$function_name(subfield_managed) {
45 function Blur$function_name(subfield_managed) {
49 function Clic$function_name(i) {
50 defaultvalue=document.f.field_value[i].value;
51 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');
57 return ($function_name,$res);
62 my $dbh=C4::Context->dbh;
64 my $op = $query->param('op');
65 my $cat_auth=$query->param('cat_auth');
67 my $startfrom=$query->param('startfrom');
68 $startfrom=0 if(!defined $startfrom);
69 my ($template, $loggedinuser, $cookie);
71 my $search = $query->param('search');
73 if ($op eq "do_search") {
75 $resultsperpage= $query->param('resultsperpage');
76 $resultsperpage = 19 if(!defined $resultsperpage);
77 # my $upperlimit=$startfrom+$resultsperpage;
78 # builds tag and subfield arrays
79 my $strquery = "SELECT authorised_value, lib from authorised_values where category = ? and lib like ?";
80 # $strquery .= " LIMIT $startfrom,$upperlimit";
82 warn 'category : '.$cat_auth.' recherche :'.$search;
85 my $sth = $dbh->prepare($strquery);
86 $sth->execute($cat_auth,$search);
92 while (my $data = $sth->fetchrow_hashref){
93 my $libjs=$data->{'lib'};
95 my $authjs=$data->{'authorised_value'};
97 push @results, {'libjs'=>$libjs,
98 'lib'=>$data->{'lib'},
100 'auth_value'=>$data->{'authorised_value'}}
101 unless (($total<$startfrom) or ($total>$startfrom+$resultsperpage));
105 ($template, $loggedinuser, $cookie)
106 = get_template_and_user({template_name => "value_builder/labs_theses.tmpl",
109 authnotrequired => 1,
113 # multi page display gestion
115 my $displayprev=$startfrom;
116 if(($total - (($startfrom+1)*($resultsperpage))) > 0 ){
122 if ($total>$resultsperpage)
124 for (my $i=1; (($i<$total/$resultsperpage+1) && ($i<16)); $i++)
127 ($startfrom==($i-1)) && ($highlight=1);
128 push @numbers, { number => $i,
129 highlight => $highlight ,
131 startfrom => $resultsperpage*($i-1)};
135 my $from = $startfrom+1;
138 if($total < (($startfrom+1)*$resultsperpage))
142 $to = (($startfrom+1)*$resultsperpage);
144 $template->param(catresult => \@results,
146 index => $query->param('index')."",
147 startfrom=> $startfrom,
148 displaynext=> $displaynext,
149 displayprev=> $displayprev,
150 resultsperpage => $resultsperpage,
151 startfromnext => $startfrom+$resultsperpage,
152 startfromprev => $startfrom-$resultsperpage,
162 ($template, $loggedinuser, $cookie)
163 = get_template_and_user({template_name => "value_builder/labs_theses.tmpl",
166 authnotrequired => 1,
170 'search'=>$query->param('search'),
173 'index'=>''.$query->param('index')
174 ) if ($query->param('index'));
175 warn 'index : '.$query->param('index');
177 'cat_auth'=>$cat_auth
180 output_html_with_http_headers $query, $cookie, $template->output ;