12 my $language='french';
16 open (KC, "/etc/koha.conf");
20 if (/(.*)\s*=\s*(.*)/) {
23 # Clean up white space at beginning and end
28 $configfile{$variable}=$value;
31 #print $query->header;
33 my $includes=$configfile{'includes'};
34 ($includes) || ($includes="/usr/local/www/hdl/htdocs/includes");
35 my $templatebase="catalogue/searchresults.tmpl";
36 my $startfrom=$query->param('startfrom');
37 ($startfrom) || ($startfrom=0);
38 ($templatename) || ($templatename=picktemplate($templatebase));
41 my $template = HTML::Template->new(filename => "$includes/templates/$theme/$templatebase", die_on_bad_params => 0, path => [$includes]);
46 # get all the search variables
47 # we assume that C4::Search will validate these values for us
49 my $keyword=$query->param('keyword');
50 $search{'keyword'}=$keyword;
51 my $subject=$query->param('subject');
52 $search{'subject'}=$subject;
53 my $author=$query->param('author');
54 $search{'author'}=$author;
55 my $illustrator=$query->param('illustrator');
56 $search{'param'}=$illustrator;
57 my $itemnumber=$query->param('itemnumber');
58 $search{'itemnumber'}=$itemnumber;
59 my $isbn=$query->param('isbn');
60 $search{'isbn'}=$isbn;
61 my $datebefore=$query->param('date-before');
62 $search{'date-before'}=$datebefore;
63 my $class=$query->param('class');
64 $search{'class'}=$class;
65 my $dewey=$query->param('dewey');
67 my $branch=$query->param('branch');
68 $search{'branch'}=$branch;
69 my $title=$query->param('title');
70 $search{'title'}=$title;
71 my $ttype=$query->param('ttype');
72 $search{'ttype'}=$ttype;
75 $search{'front'}=$query->param('front');
78 my ($count,@results)=catalogsearch($env,'',\%search,$num,$startfrom);
80 my $resultsarray=\@results;
84 $search=$search."&keyword=$keyword";
87 $search=$search."&subject=$subject";
90 $search=$search."&author=$author";
93 $search=$search."&class=$class";
96 $search=$search."&title=$title";
99 $search=$search."&dewey=$dewey";
101 $search.="&ttype=$ttype";
104 $template->param(startfrom => $startfrom+1);
105 $template->param(endat => $startfrom+20);
106 $template->param(numrecords => $count);
107 my $nextstartfrom=($startfrom+20<$count-20) ? ($startfrom+20) : ($count-20);
108 my $prevstartfrom=($startfrom-20>0) ? ($startfrom-20) : (0);
109 $template->param(nextstartfrom => $nextstartfrom);
110 $template->param(prevstartfrom => $prevstartfrom);
111 $template->param(template => $templatename);
112 $template->param(search => $search);
113 $template->param(SEARCH_RESULTS => $resultsarray);
114 $template->param(includesdir => $includes);
117 print "Content-Type: text/html\n\n", $template->output;
121 my ($includes, $base) = @_;
123 opendir (D, "$includes/templates");
124 my @dirlist=readdir D;
127 #(next) unless (/\.tmpl$/);
128 (next) unless (-e "$includes/templates/$_/$base");
131 my $sth=$dbh->prepare("select value from systempreferences where variable='template'");
133 my ($preftemplate) = $sth->fetchrow;
134 $preftemplate.='.tmpl';
135 if ($templates->{$preftemplate}) {
136 return $preftemplate;