8 use C4::Output; # no contains picktemplate
13 my $language='french';
17 open (KC, "/etc/koha.conf");
21 if (/(.*)\s*=\s*(.*)/) {
24 # Clean up white space at beginning and end
29 $configfile{$variable}=$value;
32 #print $query->header;
34 my $includes=$configfile{'includes'};
35 ($includes) || ($includes="/usr/local/www/hdl/htdocs/includes");
36 my $templatebase="catalogue/searchresults.tmpl";
37 my $startfrom=$query->param('startfrom');
38 ($startfrom) || ($startfrom=0);
39 my $theme=picktemplate($includes, $templatebase);
41 my $subject=$query->param('subject');
42 # if its a subject we need to use the subject.tmpl
44 $templatebase=~ s/searchresults\.tmpl/subject\.tmpl/;
45 $theme=picktemplate($includes, $templatebase);
48 my $template = HTML::Template->new(filename => "$includes/templates/$theme/$templatebase", die_on_bad_params => 0, path => [$includes]);
53 # get all the search variables
54 # we assume that C4::Search will validate these values for us
56 my $keyword=$query->param('keyword');
57 $search{'keyword'}=$keyword;
59 $search{'subject'}=$subject;
60 my $author=$query->param('author');
61 $search{'author'}=$author;
62 my $illustrator=$query->param('illustrator');
63 $search{'param'}=$illustrator;
64 my $itemnumber=$query->param('itemnumber');
65 $search{'itemnumber'}=$itemnumber;
66 my $isbn=$query->param('isbn');
67 $search{'isbn'}=$isbn;
68 my $datebefore=$query->param('date-before');
69 $search{'date-before'}=$datebefore;
70 my $class=$query->param('class');
71 $search{'class'}=$class;
72 my $dewey=$query->param('dewey');
74 my $branch=$query->param('branch');
75 $search{'branch'}=$branch;
76 my $title=$query->param('title');
77 $search{'title'}=$title;
78 my $abstract=$query->param('abstract');
79 $search{'abstract'}=$abstract;
80 my $publisher=$query->param('publisher');
81 $search{'publisher'}=$publisher;
83 my $ttype=$query->param('ttype');
84 $search{'ttype'}=$ttype;
87 ($keyword) && (push @$forminputs, { line => "keyword=$keyword"});
88 ($subject) && (push @$forminputs, { line => "subject=$subject"});
89 ($author) && (push @$forminputs, { line => "author=$author"});
90 ($illustrator) && (push @$forminputs, { line => "illustrator=$illustrator"});
91 ($itemnumber) && (push @$forminputs, { line => "itemnumber=$itemnumber"});
92 ($isbn) && (push @$forminputs, { line => "isbn=$isbn"});
93 ($datebefore) && (push @$forminputs, { line => "date-before=$datebefore"});
94 ($class) && (push @$forminputs, { line => "class=$class"});
95 ($dewey) && (push @$forminputs, { line => "dewey=$dewey"});
96 ($branch) && (push @$forminputs, { line => "branch=$branch"});
97 ($title) && (push @$forminputs, { line => "title=$title"});
98 ($ttype) && (push @$forminputs, { line => "ttype=$ttype"});
99 ($abstract) && (push @$forminputs, { line => "abstract=$abstract"});
100 ($publisher) && (push @$forminputs, { line => "publisher=$publisher"});
101 $template->param(FORMINPUTS => $forminputs);
103 # I think it is (or was) a search from the "front" page... [st]
104 $search{'front'}=$query->param('front');
107 my ($count,@results)=catalogsearch($env,'',\%search,$num,$startfrom);
109 my $resultsarray=\@results;
113 $search=$search."&keyword=$keyword";
116 $search=$search."&subject=$subject";
119 $search=$search."&author=$author";
122 $search=$search."&class=$class";
125 $search=$search."&title=$title";
128 $search=$search."&dewey=$dewey";
130 $search.="&ttype=$ttype";
133 $template->param(startfrom => $startfrom+1);
134 $template->param(endat => $startfrom+$num);
135 $template->param(numrecords => $count);
136 my $nextstartfrom=($startfrom+$num<$count-$num) ? ($startfrom+$num) : ($count-$num);
137 my $prevstartfrom=($startfrom-$num>0) ? ($startfrom-$num) : (0);
138 $template->param(nextstartfrom => $nextstartfrom);
139 $template->param(prevstartfrom => $prevstartfrom);
140 $template->param(search => $search);
141 $template->param(SEARCH_RESULTS => $resultsarray);
142 $template->param(includesdir => $includes);
145 print "Content-Type: text/html\n\n", $template->output;