koha-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Koha-cvs] CVS: koha/tmpl detail.pl,NONE,1.1.2.1 moredetail.pl,NONE,1.1.


From: Finlay Thompson
Subject: [Koha-cvs] CVS: koha/tmpl detail.pl,NONE,1.1.2.1 moredetail.pl,NONE,1.1.2.1 opacmain.pl,NONE,1.1.2.1 opacsearch.pl,NONE,1.1.2.1 search.pl,NONE,1.1.2.1
Date: Tue, 10 Sep 2002 18:58:22 -0700

Update of /cvsroot/koha/koha/tmpl
In directory usw-pr-cvs1:/tmp/cvs-serv14120/tmpl

Added Files:
      Tag: rel-1-2
        detail.pl moredetail.pl opacmain.pl opacsearch.pl search.pl 
Log Message:

added these opac files temporarily as I sort out the new directory structure....


--- NEW FILE ---
#!/usr/bin/perl
use HTML::Template;
use strict;
require Exporter;
use C4::Database;
use C4::Output;  # contains picktemplate
use CGI;
use C4::Search;
 
my $query=new CGI;


my $language='french';


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 $biblionumber=$query->param('bib');
my $type='intra';

# change back when ive fixed request.pl
my @items = ItemInfo(undef, $biblionumber, $type);
my $dat=bibdata($biblionumber);
my ($authorcount, $addauthor)= &addauthor($biblionumber);
my ($webbiblioitemcount, @webbiblioitems) = &getwebbiblioitems($biblionumber);
my ($websitecount, @websites)             = &getwebsites($biblionumber);

$dat->{'count'address@hidden;

$dat->{'additional'}=$addauthor->[0]->{'author'};
for (my $i = 1; $i < $authorcount; $i++) {
        $dat->{'additional'} .= "|" . $addauthor->[$i]->{'author'};
} # for

my @results;

$results[0]=$dat;

my address@hidden;
my address@hidden;
my address@hidden;
my address@hidden;

my $includes=$configfile{'includes'};
($includes) || ($includes="/usr/local/www/hdl/htdocs/includes");
my $templatebase="opac/detail.tmpl";
my $startfrom=$query->param('startfrom');
($startfrom) || ($startfrom=0);
my $theme=picktemplate($includes, $templatebase);

my $template = HTML::Template->new(filename => 
"$includes/templates/$theme/$templatebase", die_on_bad_params => 0, path => 
[$includes]);

my $count=1;

# now to get the items into a hash we can use and whack that thru


$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 => $search);
$template->param(includesdir => $includes);
$template->param(BIBLIO_RESULTS => $resultsarray);
$template->param(ITEM_RESULTS => $itemsarray);
$template->param(WEB_RESULTS => $webarray);
$template->param(SITE_RESULTS => $sitearray);
print "Content-Type: text/html\n\n", $template->output;


--- NEW FILE ---
#!/usr/bin/perl

#script to display detailed information
#written 8/11/99

use strict;
#use DBI;
use C4::Search;
use C4::Koha;
use C4::Output;
use C4::Acquisitions;
use C4::Biblio;

use CGI;
my $input = new CGI;
print $input->header;
#whether it is called from the opac of the intranet
my $type=$input->param('type');
#setup colours
my $main;
my $secondary;
if ($type eq 'opac'){
  $main='#99cccc';
  $secondary='#efe5ef';
} else {
  $main='#cccc99';
  $secondary='#ffffcc';
}
print startpage();
print startmenu($type);
my $blah;

my $bib=$input->param('bib');
my $title=$input->param('title');
my $bi=$input->param('bi');
my $data=bibitemdata($bi);

my (@items)=itemissues($bi);
my ($order,$ordernum)=getorder($bi,$bib);
#print @items;
my address@hidden;

my $i=0;
print center();

my $dewey = $data->{'dewey'};                                                  
$dewey =~ s/0+$//;                                                             
if ($dewey eq "000.") { $dewey = "";};                                         
if ($dewey < 10){$dewey='00'.$dewey;}                                          
if ($dewey < 100 && $dewey > 10){$dewey='0'.$dewey;}                           
if ($dewey <= 0){
  $dewey='';                                                                   
}               
$dewey=~ s/\.$//;
print <<printend
<br>
<a href=/cgi-bin/koha/request.pl?bib=$bib><img src=/images/requests.gif 
width=120 height=42 border=0 align=right border=0></a>
printend
;
if ($type eq 'catmain'){
  print "<FONT SIZE=6><em>Catalogue Maintenance</em></FONT><br>";
}
print <<printend
<FONT SIZE=6><em><a 
href=/cgi-bin/koha/detail.pl?bib=$bib&type=intra>$data->{'title'} 
($data->{'author'})</a></em></FONT><P>
<p>
<form action=/cgi-bin/koha/modbibitem.pl>
<input type=hidden name=bibitem value=$bi>
<input type=hidden name=biblio value=$bib>
<!-------------------BIBLIO ITEM------------>
<TABLE  CELLSPACING=0  CELLPADDING=5 border=1 align=left>
<TR VALIGN=TOP>
<td  bgcolor="99cc33" background="/images/background-mem.gif" 
><B>$data->{'biblioitemnumber'} GROUP - $data->{'description'} </b> </TD>
</TR>
<tr VALIGN=TOP  >
<TD width=210 >
<INPUT TYPE="image" name="submit"  VALUE="modify" height=42  WIDTH=93 BORDER=0 
src="/images/modify-mem.gif"> 
<INPUT TYPE="image" name="delete"  VALUE="delete" height=42  WIDTH=93 BORDER=0 
src="/images/delete-mem.gif"> 
<br>
<FONT SIZE=2  face="arial, helvetica">
<b>Biblionumber:</b> $bib<br>
<b>Item Type:</b> $data->{'itemtype'}<br>
<b>Loan Length:</b> $data->{'loanlength'}<br>
<b>Rental Charge:</b> $data->{'rentalcharge'}<br>
<b>Classification:</b> $data->{'classification'}$dewey$data->{'subclass'}<br>
<b>ISBN:</b> $data->{'isbn'}<br>
<b>Publisher:</b> $data->{'publishercode'} <br>
<b>Place:</b> $data->{'place'}<br>
<b>Date:</b> $data->{'publicationyear'}<br>
<b>Volume:</b> $data->{'volumeddesc'}<br>
<b>Pages:</b> $data->{'pages'}<br>
<b>Illus:</b> $data->{'illus'}<br>
<b>Size:</b> $data->{'size'}<br>
<b>Notes:</b> $data->{'bnotes'}<br>
<b>No. of Items:</b> $count

printend
;
if ($type eq 'catmain'){
  print "<br><a 
href=/cgi-bin/koha/maint/shiftbib.pl?bi=$data->{'biblioitemnumber'}&bib=$data->{'biblionumber'}>Shift
 to another biblio</a>";
 
}
print <<printend

</font>
</TD>
</tr>
</table>
</form>
printend
;

for (my $i=0;$i<$count;$i++){
print <<printend
<img src="/images/holder.gif" width=16 height=300 align=left>
<TABLE  CELLSPACING=0  CELLPADDING=5 border=1 align=left width=220 >            
                
<TR VALIGN=TOP>
<td  bgcolor="99cc33" background="/images/background-mem.gif"><B>BARCODE 
$items[$i]->{'barcode'}</b></TD>
</TR>
<tr VALIGN=TOP  >
<TD width=220 >
<form action=/cgi-bin/koha/moditem.pl method=post>
<input type=hidden name=bibitem value=$bi>
<input type=hidden name=item value=$items[$i]->{'itemnumber'}>
<input type=hidden name=type value=$type>
<INPUT TYPE="image" name="submit"  VALUE="modify" height=42  WIDTH=93 BORDER=0 
src="/images/modify-mem.gif"> 
<INPUT TYPE="image" name="delete"  VALUE="delete" height=42  WIDTH=93 BORDER=0 
src="/images/delete-mem.gif"> 
<br>
printend
;
$items[$i]->{'itemlost'}=~ s/0/No/;
$items[$i]->{'itemlost'}=~ s/1/Yes/;
$items[$i]->{'withdrawn'}=~ s/0/No/;
$items[$i]->{'withdrawn'}=~ s/1/Yes/;
$items[$i]->{'replacementprice'}+=0.00;

my $year=substr($items[$i]->{'timestamp0'},0,4);
my $mon=substr($items[$i]->{'timestamp0'},4,2);
my $day=substr($items[$i]->{'timestamp0'},6,2);
$items[$i]->{'timestamp0'}="$day/$mon/$year";

$items[$i]->{'dateaccessioned'} = slashifyDate($items[$i]->{'dateaccessioned'});
$items[$i]->{'datelastseen'} = slashifyDate($items[$i]->{'datelastseen'});

print <<printend
<FONT SIZE=2  face="arial, helvetica">
<b>Home Branch:</b> $items[$i]->{'homebranch'}<br>
<b>Last seen:</b> $items[$i]->{'datelastseen'}<br>
<b>Last borrowed:</b> $items[$i]->{'timestamp0'}<br>
printend
;
if ($items[$i] eq 'Available'){
  print "<b>Currently on issue to:</b><br>";
} else {
  print "<b>Currently on issue to:</b> <a 
href=/cgi-bin/koha/moremember.pl?bornum=$items[$i]->{'borrower0'}>$items[$i]->{'card'}</a><br>";
}
print <<printend
<b>Last Borrower 1:</b> $items[$i]->{'card0'}<br>
<b>Last Borrower 2:</b> $items[$i]->{'card1'}<br>
<b>Current Branch:</b> $items[$i]->{'holdingbranch'}<br>
<b>Replacement Price:</b> $items[$i]->{'replacementprice'}<br>
<b>Item lost:</b> $items[$i]->{'itemlost'}<br>
<b>Paid for:</b> $items[$i]->{'paidfor'}<br>
<b>Notes:</b> $items[$i]->{'itemnotes'}<br>
<b>Renewals:</b> $items[$i]->{'renewals'}<br>
<b><a 
href=/cgi-bin/koha/acqui/acquire.pl?recieve=$ordernum&biblio=$bib&invoice=$order->{'booksellerinvoicenumber'}&catview=yes>Accession</a>
 Date: $items[$i]->{'dateaccessioned'}<br>
printend
;
if ($items[$i]->{'wthdrawn'} eq '1'){
  $items[$i]->{'wthdrawn'}="Yes";
} else {
  $items[$i]->{'wthdrawn'}="No";
}
print <<printend
<b>Cancelled: $items[$i]->{'wthdrawn'}<br>
<b>Total Issues:</b> $items[$i]->{'issues'}<br>
<b>Group Number:</b> $bi <br>
<b>Biblio number:</b> $bib <br>



</font>
</TD>
</tr>
</table>
</form>
printend
;
}
print <<printend
<p>
</form>
printend
;


print endcenter();

print endmenu($type);
print endpage();

--- NEW FILE ---
#!/usr/bin/perl
use HTML::Template;
use strict;
require Exporter;
use C4::Database;
use C4::Output;  # contains picktemplate
use CGI;
use C4::Auth;

my $query = new CGI;
#my ($loggedinuser, $cookie, $sessionID) = checkauth($query);

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="opac/opac-main.tmpl";
my $theme=picktemplate($includes, $templatebase);

my $template = HTML::Template->new(filename => 
"$includes/templates/$theme/$templatebase", die_on_bad_params => 0, path => 
[$includes]);

#$template->param(SITE_RESULTS => $sitearray);
print "Content-Type: text/html\n\n", $template->output;

--- NEW FILE ---
#!/usr/bin/perl
use HTML::Template;
use strict;
require Exporter;
use C4::Database;
use C4::Output;  # contains picktemplate
use CGI;
use C4::Auth;

my $query = new CGI;
#my ($loggedinuser, $cookie, $sessionID) = checkauth($query);

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="opac/opac-search.tmpl";
my $theme=picktemplate($includes, $templatebase);

my $template = HTML::Template->new(filename => 
"$includes/templates/$theme/$templatebase", die_on_bad_params => 0, path => 
[$includes]);

#$template->param(SITE_RESULTS => $sitearray);
print "Content-Type: text/html\n\n", $template->output;

--- NEW FILE ---
#!/usr/bin/perl
use HTML::Template;
use strict;
require Exporter;
use C4::Database;
use CGI;
use C4::Search;
use C4::Auth;
use C4::Output; # now contains picktemplate
  
my $query=new CGI;
#my $type=$query->param('type');
#(-e "opac") && ($type='opac');
my $type = 'opac';

my ($loggedinuser, $cookie, $sessionID) = checkauth($query, ($type eq 'opac') ? 
(1) : (0));


my $language='french';


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;
 }
}
#print $query->header;

my $includes=$configfile{'includes'};
($includes) || ($includes="/usr/local/www/hdl/htdocs/includes");
my $templatebase="opac/searchresults.tmpl";
my $startfrom=$query->param('startfrom');
($startfrom) || ($startfrom=0);
my $theme=picktemplate($includes, $templatebase);

my $subject=$query->param('subject');
# if its a subject we need to use the subject.tmpl
if ($subject) {
    $templatebase=~ s/searchresults\.tmpl/subject\.tmpl/;
    $theme=picktemplate($includes, $templatebase);
}

my $template = HTML::Template->new(filename => 
"$includes/templates/$theme/$templatebase", die_on_bad_params => 0, path => 
[$includes]);

my $env;
$env->{itemcount}=1;

# get all the search variables
# we assume that C4::Search will validate these values for us
my %search;
my $keyword=$query->param('keyword');
$search{'keyword'}=$keyword;

$search{'subject'}=$subject;
my $author=$query->param('author');
$search{'author'}=$author;
$search{'authoresc'}=$author;
#$search{'authorhtmlescaped'}=~s/ /%20/g;
my $illustrator=$query->param('illustrator');
$search{'param'}=$illustrator;
my $itemnumber=$query->param('itemnumber');
$search{'itemnumber'}=$itemnumber;
my $isbn=$query->param('isbn');
$search{'isbn'}=$isbn;
my $datebefore=$query->param('date-before');
$search{'date-before'}=$datebefore;
my $class=$query->param('class');
$search{'class'}=$class;
my $dewey=$query->param('dewey');
$search{'dewey'};
my $branch=$query->param('branch');
$search{'branch'}=$branch;
my $title=$query->param('title');
$search{'title'}=$title;
my $abstract=$query->param('abstract');
$search{'abstract'}=$abstract;
my $publisher=$query->param('publisher');
$search{'publisher'}=$publisher;

my $ttype=$query->param('ttype');
$search{'ttype'}=$ttype;

my $forminputs;
($keyword) && (push @$forminputs, { line => "keyword=$keyword"});
($subject) && (push @$forminputs, { line => "subject=$subject"});
($author) && (push @$forminputs, { line => "author=$author"});
($illustrator) && (push @$forminputs, { line => "illustrator=$illustrator"});
($itemnumber) && (push @$forminputs, { line => "itemnumber=$itemnumber"});
($isbn) && (push @$forminputs, { line => "isbn=$isbn"});
($datebefore) && (push @$forminputs, { line => "date-before=$datebefore"});
($class) && (push @$forminputs, { line => "class=$class"});
($dewey) && (push @$forminputs, { line => "dewey=$dewey"});
($branch) && (push @$forminputs, { line => "branch=$branch"});
($title) && (push @$forminputs, { line => "title=$title"});
($ttype) && (push @$forminputs, { line => "ttype=$ttype"});
($abstract) && (push @$forminputs, { line => "abstract=$abstract"});
($publisher) && (push @$forminputs, { line => "publisher=$publisher"});
($forminputs) || (@$forminputs=());
$template->param(FORMINPUTS => $forminputs);
# whats this for?
# I think it is (or was) a search from the "front" page...   [st]
$search{'front'}=$query->param('front');

my $num=10;
my @results;
my $count;
if (my $subject=$query->param('subjectitems')) {
    my $blah;
    @results=subsearch(\$blah,$subject);
    $count=$#results+1;
} else {
    ($count,@results)=catalogsearch($env,'',\%search,$num,$startfrom);
}

#my address@hidden;
my $resultsarray;

foreach my $result (@results) {
    $result->{'authorhtmlescaped'}=$result->{'author'};
    $result->{'authorhtmlescaped'}=~s/ /%20/g;
    ($result->{'copyrightdate'}==0) && ($result->{'copyrightdate'}='');
    ($type eq 'opac') ? ($result->{'opac'}=1) : ($result->{'opac'}=0);
    push (@$resultsarray, $result);
}
($resultsarray) || (@$resultsarray=());
my $search="num=20";
my $searchdesc='';
if ($keyword){
    $search=$search."&keyword=$keyword";
    $searchdesc.="keyword $keyword, ";
}
if (my $subjectitems=$query->param('subjectitems')){
    $search=$search."&subjectitems=$subjectitems";
    $searchdesc.="subject $subjectitems, ";
}
if ($subject){
    $search=$search."&subject=$subject";
    $searchdesc.="subject $subject, ";
}
if ($author){
    $search=$search."&author=$author";
    $searchdesc.="author $author, ";
}
if ($class){
    $search=$search."&class=$class";
    $searchdesc.="class $class, ";
}
if ($title){
    $search=$search."&title=$title";
    $searchdesc.="title $title, ";
}
if ($dewey){
    $search=$search."&dewey=$dewey";
    $searchdesc.="dewey $dewey, ";
}
$search.="&ttype=$ttype";

$search=~ s/ /%20/g;
$template->param(startfrom => $startfrom+1);
($startfrom+$num<=$count) ? ($template->param(endat => $startfrom+$num)) : 
($template->param(endat => $count));
$template->param(numrecords => $count);
my $nextstartfrom=($startfrom+$num<$count) ? ($startfrom+$num) : (-1);
my $prevstartfrom=($startfrom-$num>=0) ? ($startfrom-$num) : (-1);
$template->param(nextstartfrom => $nextstartfrom);
my $displaynext=1;
my $displayprev=0;
($nextstartfrom==-1) ? ($displaynext=0) : ($displaynext=1);
($prevstartfrom==-1) ? ($displayprev=0) : ($displayprev=1);
$template->param(displaynext => $displaynext);
$template->param(displayprev => $displayprev);
($type eq 'opac') ? ($template->param(opac => 1)) : ($template->param(opac => 
0));
$template->param(prevstartfrom => $prevstartfrom);
$template->param(search => $search);
$template->param(searchdesc => $searchdesc);
$template->param(SEARCH_RESULTS => $resultsarray);
$template->param(includesdir => $includes);
$template->param(loggedinuser => $loggedinuser);

my $numbers;
@$numbers=();
if ($count>10) {
    for (my $i=1; $i<$count/10+1; $i++) {
    ($title) && (push @$forminputs, { line => "title=$title"});
        my $highlight=0;
        ($startfrom==($i-1)*10) && ($highlight=1);
        my $formelements='';
        foreach (@$forminputs) {
            my $line=$_->{line};
            $formelements.="$line&";
        }
        $formelements=~s/ /+/g;
        push @$numbers, { number => $i, highlight => $highlight , FORMELEMENTS 
=> $formelements, FORMINPUTS => $forminputs, startfrom => ($i-1)*10, opac => 
(($type eq 'opac') ? (1) : (0))};
    }
}

$template->param(numbers => $numbers);



print $query->header(-cookie => $cookie), $template->output;





reply via email to

[Prev in Thread] Current Thread [Next in Thread]