[Koha-cvs] CVS: koha/html-template cmsd.tmpl,NONE,1.1 default.tmpl,NONE,1.1 cmsdsearchresults.tmpl,1.5,1.6 search.pl,1.8,1.9 searchresults.tmpl,1.7,1.8
Steve Tonnesen
tonnesen at users.sourceforge.net
Tue May 14 01:05:47 CEST 2002
Update of /cvsroot/koha/koha/html-template
In directory usw-pr-cvs1:/tmp/cvs-serv4129
Modified Files:
cmsdsearchresults.tmpl search.pl searchresults.tmpl
Added Files:
cmsd.tmpl default.tmpl
Log Message:
Changes:
- templates are expected to be found in
INCLUDESDIR/templates/catalogue/searchresults/default.tmpl
- Works with default Search.pm from cvs
--- NEW FILE ---
<TMPL_INCLUDE NAME="/usr/share/koha/intranet/htdocs/includes/cat-top.inc">
<center>
<table border=0 cellspacing=0 cellpadding=2>
<tr bgcolor=#ccccff background="/images/background-mem.gif">
<th>Title</th>
<th>Author</th>
<th>Dewey</th></tr>
<TMPL_LOOP NAME=SEARCH_RESULTS>
<tr>
<td><a href=/cgi-bin/koha/detail.pl?type=intra&bib=<TMPL_VAR NAME=biblionumber ESCAPE=HTML>><TMPL_VAR NAME=title></a></td>
<td><a href=/cgi-bin/koha/search.pl?type=intra&author=<TMPL_VAR NAME=author ESCAPE=HTML>><TMPL_VAR NAME=author></a></td>
<td align=right><TMPL_VAR NAME=dewey></td>
</tr>
</TMPL_LOOP>
<tr background="/images/background-mem.gif"><td colspan=3 bgcolor=#ccccff>
<table border=0 cellpadding=0 cellspacing=0 width=100%>
<tr><td align=left>
<a href=newsearch.pl?template=<TMPL_VAR NAME="template">&startfrom=<TMPL_VAR NAME="prevstartfrom">>Previous Records</a>
</td><td align=right>
<a href=newsearch.pl?template=<TMPL_VAR NAME="template">&startfrom=<TMPL_VAR NAME="nextstartfrom">>Next Records</a>
</td></tr>
</table>
</td></tr>
</table>
<br>
Results <TMPL_VAR NAME="startfrom"> through <TMPL_VAR NAME="endat"> of <TMPL_VAR NAME="numrecords"> records.
<hr>
<TMPL_INCLUDE NAME="/usr/share/koha/intranet/htdocs/includes/cat-bottom.inc">
--- NEW FILE ---
<TMPL_INCLUDE NAME="/usr/share/koha/intranet/htdocs/includes/cat-top.inc">
<center>
<table border=0 cellspacing=0 cellpadding=0>
<tr bgcolor=#ccccff><th>Title</th><th>Author</th><th>Item Count</th><th>Biblionumber</th></tr>
<TMPL_LOOP NAME=SEARCH_RESULTS>
<tr>
<td><a href=/cgi-bin/koha/detail.pl?type=intra&bib=<TMPL_VAR NAME=biblionumber ESCAPE=HTML>><TMPL_VAR NAME=title></a></td>
<td> <TMPL_VAR NAME=author> </td>
<td align=center> <TMPL_VAR NAME=itemcount> </td>
<td> <TMPL_VAR NAME=biblionumber> </td>
</tr>
</TMPL_LOOP>
<tr><td colspan=4 bgcolor=#ccccff>
<table border=0 cellpadding=0 cellspacing=0 width=100%>
<tr><td align=left>
<a href=newsearch.pl?template=<TMPL_VAR NAME="template">&startfrom=<TMPL_VAR NAME="prevstartfrom">>Previous Records</a>
</td><td align=right>
<a href=newsearch.pl?template=<TMPL_VAR NAME="template">&startfrom=<TMPL_VAR NAME="nextstartfrom">>Next Records</a>
</td></tr>
</table>
</td></tr>
</table>
<br>
Results <TMPL_VAR NAME="startfrom"> through <TMPL_VAR NAME="endat"> of <TMPL_VAR NAME="numrecords"> records.
<hr>
<TMPL_INCLUDE NAME="/usr/share/koha/intranet/htdocs/includes/cat-bottom.inc">
Index: cmsdsearchresults.tmpl
===================================================================
RCS file: /cvsroot/koha/koha/html-template/cmsdsearchresults.tmpl,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** cmsdsearchresults.tmpl 10 May 2002 22:34:36 -0000 1.5
--- cmsdsearchresults.tmpl 13 May 2002 23:05:45 -0000 1.6
***************
*** 13,18 ****
</tr>
</TMPL_LOOP>
! <tr><td colspan=3 bgcolor=#ccccff><a href=search.pl?template=<TMPL_VAR NAME="template">&startfrom=<TMPL_VAR NAME="nextstartfrom">>Next Records</a></td></tr>
</table>
<hr>
</body>
--- 13,28 ----
</tr>
</TMPL_LOOP>
! <tr><td colspan=3 bgcolor=#ccccff>
! <table border=0 cellpadding=0 cellspacing=0 width=100%>
! <tr><td align=left>
! <a href=search.pl?template=<TMPL_VAR NAME="template">&startfrom=<TMPL_VAR NAME="prevstartfrom">>Previous Records</a>
! </td><td align=right>
! <a href=search.pl?template=<TMPL_VAR NAME="template">&startfrom=<TMPL_VAR NAME="nextstartfrom">>Next Records</a>
! </td></tr>
! </table>
! </td></tr>
</table>
+ <br>
+ Results <TMPL_VAR NAME="startfrom"> through <TMPL_VAR NAME="endat"> of <TMPL_VAR NAME="numrecords"> records.
<hr>
</body>
Index: search.pl
===================================================================
RCS file: /cvsroot/koha/koha/html-template/search.pl,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -r1.8 -r1.9
*** search.pl 13 May 2002 22:29:27 -0000 1.8
--- search.pl 13 May 2002 23:05:45 -0000 1.9
***************
*** 1,3 ****
! #!/usr/bin/perl -w
use HTML::Template;
use strict;
--- 1,3 ----
! #!/usr/bin/perl
use HTML::Template;
use strict;
***************
*** 9,26 ****
my $query=new CGI;
- # temporary variable for testing. Replace from /etc/koha.conf
! my $templatedir="/usr/share/koha/intranet/htdocs/includes/templates";
my $templatename=$query->param('template');
my $startfrom=$query->param('startfrom');
($startfrom) || ($startfrom=0);
! ($templatename) || ($templatename="$templatedir/searchresults.tmpl");
- my $dbh=&C4Connect;
! my $template = HTML::Template->new(filename => $templatename, die_on_bad_params => 0);
##my @results;
--- 9,45 ----
my $query=new CGI;
! my $language='french';
! my $dbh=&C4Connect;
+ my %configfile;
+ open (KC, "/etc/koha.conf");
+ while (<KC>) {
+ chomp;
+ (next) if (/^\s*#/);
+ if (/(.*)\s*=\s*(.*)/) {
+ my $variable=$1;
+ my $value=$2;
+ # Clean up white space at beginning and end
+ $variable=~s/^\s*//g;
+ $variable=~s/\s*$//g;
+ $value=~s/^\s*//g;
+ $value=~s/\s*$//g;
+ $configfile{$variable}=$value;
+ }
+ }
+ my $includes=$configfile{'includes'};
+ ($includes) || ($includes="/usr/local/www/hdl/htdocs/includes");
+ my $templatebase="$includes/templates/catalogue/searchresults/";
my $templatename=$query->param('template');
my $startfrom=$query->param('startfrom');
($startfrom) || ($startfrom=0);
! ($templatename) || ($templatename='default.tmpl');
! $templatename=picktemplate($templatebase);
! my $template = HTML::Template->new(filename => "$templatebase$templatename", die_on_bad_params => 0);
##my @results;
***************
*** 31,49 ****
#}
! my $blah;
my %search;
! my $keyword='bear';
$search{'keyword'}=$keyword;
! my ($count, @results) = &KeywordSearch(\$blah, 'intra', \%search, 20, $startfrom);
! my $resultshash=\@results;
! $template->param(startfrom => $startfrom);
! $startfrom+=20;
! $template->param(nextstartfrom => $startfrom);
$template->param(template => $templatename);
! $template->param(SEARCH_RESULTS => $resultshash);
print "Content-Type: text/html\n\n", $template->output;
--- 50,95 ----
#}
! my $env;
! $env->{itemcount}=1;
my %search;
! my $keyword='tree';
$search{'keyword'}=$keyword;
! my ($count, @results) = &KeywordSearch($env, 'intra', \%search, 20, $startfrom);
+ my $resultsarray=\@results;
! $template->param(startfrom => $startfrom+1);
! $template->param(endat => $startfrom+20);
! $template->param(numrecords => $count);
! my $nextstartfrom=($startfrom+20<$count-20) ? ($startfrom+20) : ($count-20);
! my $prevstartfrom=($startfrom-20>0) ? ($startfrom-20) : (0);
! $template->param(nextstartfrom => $nextstartfrom);
! $template->param(prevstartfrom => $prevstartfrom);
$template->param(template => $templatename);
! $template->param(SEARCH_RESULTS => $resultsarray);
print "Content-Type: text/html\n\n", $template->output;
+
+
+ sub picktemplate {
+ my ($base) = @_;
+ my $templates;
+ opendir (D, $base);
+ my @dirlist=readdir D;
+ foreach (@dirlist) {
+ (next) unless (/\.tmpl$/);
+ $templates->{$_}=1;
+ }
+ my $sth=$dbh->prepare("select value from systempreferences where variable='template'");
+ $sth->execute;
+ my ($preftemplate) = $sth->fetchrow;
+ $preftemplate.='.tmpl';
+ if ($templates->{$preftemplate}) {
+ return $preftemplate;
+ } else {
+ return 'default.tmpl';
+ }
+
+ }
Index: searchresults.tmpl
===================================================================
RCS file: /cvsroot/koha/koha/html-template/searchresults.tmpl,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -r1.7 -r1.8
*** searchresults.tmpl 10 May 2002 22:38:08 -0000 1.7
--- searchresults.tmpl 13 May 2002 23:05:45 -0000 1.8
***************
*** 1,18 ****
! <html>
! <head><title>Search Results</title>
! </head>
! <body>
<TMPL_INCLUDE NAME="searchheader.tmpl">
<table border=0 cellspacing=0 cellpadding=0>
! <tr bgcolor=#ccccff><th>Title</th><th>Author</th><th>Biblionumber</th></tr>
<TMPL_LOOP NAME=SEARCH_RESULTS>
<tr>
<td> <TMPL_VAR NAME=title> </td>
<td> <TMPL_VAR NAME=author> </td>
<td> <TMPL_VAR NAME=biblionumber> </td>
</tr>
</TMPL_LOOP>
! <tr><td colspan=3 bgcolor=#ccccff><a href=search.pl?template=<TMPL_VAR NAME="template">&startfrom=<TMPL_VAR NAME="nextstartfrom">>Next Records</a></td></tr>
</table>
<hr>
</body>
--- 1,26 ----
! <TMPL_INCLUDE NAME="/usr/share/koha/intranet/htdocs/includes/cat-top.inc">
<TMPL_INCLUDE NAME="searchheader.tmpl">
<table border=0 cellspacing=0 cellpadding=0>
! <tr bgcolor=#ccccff><th>Title</th><th>Author</th><th>Item Count</th><th>Biblionumber</th></tr>
<TMPL_LOOP NAME=SEARCH_RESULTS>
<tr>
<td> <TMPL_VAR NAME=title> </td>
<td> <TMPL_VAR NAME=author> </td>
+ <td align=center> <TMPL_VAR NAME=itemcount> </td>
<td> <TMPL_VAR NAME=biblionumber> </td>
</tr>
</TMPL_LOOP>
! <tr><td colspan=4 bgcolor=#ccccff>
! <table border=0 cellpadding=0 cellspacing=0 width=100%>
! <tr><td align=left>
! <a href=search.pl?template=<TMPL_VAR NAME="template">&startfrom=<TMPL_VAR NAME="prevstartfrom">>Previous Records</a>
! </td><td align=right>
! <a href=search.pl?template=<TMPL_VAR NAME="template">&startfrom=<TMPL_VAR NAME="nextstartfrom">>Next Records</a>
! </td></tr>
! </table>
! </td></tr>
</table>
+ <br>
+ Results <TMPL_VAR NAME="startfrom"> through <TMPL_VAR NAME="endat"> of <TMPL_VAR NAME="numrecords"> records.
<hr>
</body>
More information about the Koha-cvs
mailing list