[Koha-cvs] CVS: koha/html-template search.pl,1.13,1.14
Chris Cormack
rangi at users.sourceforge.net
Wed May 15 01:13:26 CEST 2002
Update of /cvsroot/koha/koha/html-template
In directory usw-pr-cvs1:/tmp/cvs-serv5971/html-template
Modified Files:
search.pl
Log Message:
Shifted picktemplate out into C4::Output.pm
Index: search.pl
===================================================================
RCS file: /cvsroot/koha/koha/html-template/search.pl,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -r1.13 -r1.14
*** search.pl 14 May 2002 21:54:41 -0000 1.13
--- search.pl 14 May 2002 23:13:24 -0000 1.14
***************
*** 6,15 ****
use CGI;
use C4::Search;
!
my $query=new CGI;
my $language='french';
! my $dbh=&C4Connect;
my %configfile;
--- 6,16 ----
use CGI;
use C4::Search;
! use C4::Output; # no contains picktemplate
!
my $query=new CGI;
my $language='french';
!
my %configfile;
***************
*** 38,41 ****
--- 39,45 ----
my $theme=picktemplate($includes, $templatebase);
+ my $subject=$query->param('subject');
+ # if its a subject we need to use the subject.tmpl
+ $templatebase=~ s/searchresults\.tmpl/subject\.tmpl/;
my $template = HTML::Template->new(filename => "$includes/templates/$theme/$templatebase", die_on_bad_params => 0, path => [$includes]);
***************
*** 49,53 ****
my $keyword=$query->param('keyword');
$search{'keyword'}=$keyword;
! my $subject=$query->param('subject');
$search{'subject'}=$subject;
my $author=$query->param('author');
--- 53,57 ----
my $keyword=$query->param('keyword');
$search{'keyword'}=$keyword;
!
$search{'subject'}=$subject;
my $author=$query->param('author');
***************
*** 116,139 ****
print "Content-Type: text/html\n\n", $template->output;
-
- sub picktemplate {
- my ($includes, $base) = @_;
- my $templates;
- opendir (D, "$includes/templates");
- my @dirlist=readdir D;
- foreach (@dirlist) {
- (next) if (/^\./);
- #(next) unless (/\.tmpl$/);
- (next) unless (-e "$includes/templates/$_/$base");
- $templates->{$_}=1;
- }
- my $sth=$dbh->prepare("select value from systempreferences where variable='template'");
- $sth->execute;
- my ($preftemplate) = $sth->fetchrow;
- if ($templates->{$preftemplate}) {
- return $preftemplate;
- } else {
- return 'default';
- }
-
- }
--- 120,121 ----
More information about the Koha-cvs
mailing list