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 $ttype=$query->param('ttype');
79 $search{'ttype'}=$ttype;
82 ($keyword) && (push @$forminputs, { line => "keyword=$keyword"});
83 ($subject) && (push @$forminputs, { line => "subject=$subject"});
84 ($author) && (push @$forminputs, { line => "author=$author"});
85 ($illustrator) && (push @$forminputs, { line => "illustrator=$illustrator"});
86 ($itemnumber) && (push @$forminputs, { line => "itemnumber=$itemnumber"});
87 ($isbn) && (push @$forminputs, { line => "isbn=$isbn"});
88 ($datebefore) && (push @$forminputs, { line => "date-before=$datebefore"});
89 ($class) && (push @$forminputs, { line => "class=$class"});
90 ($dewey) && (push @$forminputs, { line => "dewey=$dewey"});
91 ($branch) && (push @$forminputs, { line => "branch=$branch"});
92 ($title) && (push @$forminputs, { line => "title=$title"});
93 ($ttype) && (push @$forminputs, { line => "ttype=$ttype"});
94 $template->param(FORMINPUTS => $forminputs);
96 # I think it is (or was) a search from the "front" page... [st]
97 $search{'front'}=$query->param('front');
100 my ($count,@results)=catalogsearch($env,'',\%search,$num,$startfrom);
102 my $resultsarray=\@results;
106 $search=$search."&keyword=$keyword";
109 $search=$search."&subject=$subject";
112 $search=$search."&author=$author";
115 $search=$search."&class=$class";
118 $search=$search."&title=$title";
121 $search=$search."&dewey=$dewey";
123 $search.="&ttype=$ttype";
126 $template->param(startfrom => $startfrom+1);
127 $template->param(endat => $startfrom+20);
128 $template->param(numrecords => $count);
129 my $nextstartfrom=($startfrom+20<$count-20) ? ($startfrom+20) : ($count-20);
130 my $prevstartfrom=($startfrom-20>0) ? ($startfrom-20) : (0);
131 $template->param(nextstartfrom => $nextstartfrom);
132 $template->param(prevstartfrom => $prevstartfrom);
133 $template->param(search => $search);
134 $template->param(SEARCH_RESULTS => $resultsarray);
135 $template->param(includesdir => $includes);
138 print "Content-Type: text/html\n\n", $template->output;