From b18a49f86980de39c98a447060021f77f42669a8 Mon Sep 17 00:00:00 2001 From: finlayt Date: Wed, 18 Sep 2002 06:25:55 +0000 Subject: [PATCH] Have moved all the fully templated cgi-bin scripts for the opac into here. Also given them a new naming convention :-) --- opac/opac-detail.pl | 62 ++++++++++++ opac/opac-main.pl | 15 +++ opac/opac-moredetail.pl | 199 +++++++++++++++++++++++++++++++++++++ opac/opac-search.pl | 15 +++ opac/opac-searchresults.pl | 108 ++++++++++++++++++++ 5 files changed, 399 insertions(+) create mode 100755 opac/opac-detail.pl create mode 100755 opac/opac-main.pl create mode 100755 opac/opac-moredetail.pl create mode 100755 opac/opac-search.pl create mode 100755 opac/opac-searchresults.pl diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl new file mode 100755 index 0000000000..e588530249 --- /dev/null +++ b/opac/opac-detail.pl @@ -0,0 +1,62 @@ +#!/usr/bin/perl +use strict; +require Exporter; +use C4::Output; # contains picktemplate +use CGI; +use C4::Search; +use C4::Auth; + +my $query=new CGI; + +my ($loggedinuser, $cookie, $sessionID) = checkauth($query, 1); + +my $template = gettemplate ("detail.tmpl", "opac"); + +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'}=@items; + +$dat->{'additional'}=$addauthor->[0]->{'author'}; +for (my $i = 1; $i < $authorcount; $i++) { + $dat->{'additional'} .= "|" . $addauthor->[$i]->{'author'}; +} # for + +my @results; + +$results[0]=$dat; + +my $resultsarray=\@results; +my $itemsarray=\@items; +my $webarray=\@webbiblioitems; +my $sitearray=\@websites; + + +my $startfrom=$query->param('startfrom'); +($startfrom) || ($startfrom=0); + +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(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; + diff --git a/opac/opac-main.pl b/opac/opac-main.pl new file mode 100755 index 0000000000..1683b7f9fa --- /dev/null +++ b/opac/opac-main.pl @@ -0,0 +1,15 @@ +#!/usr/bin/perl +use strict; +require Exporter; +use CGI; + +use C4::Output; # gettemplate +use C4::Auth; # checkauth + +my $query = new CGI; + +my ($loggedinuser, $cookie, $sessionID) = checkauth($query, 1); + +my $template = gettemplate("opac-main.tmpl", "opac"); + +print "Content-Type: text/html\n\n", $template->output; diff --git a/opac/opac-moredetail.pl b/opac/opac-moredetail.pl new file mode 100755 index 0000000000..49b6b57c3f --- /dev/null +++ b/opac/opac-moredetail.pl @@ -0,0 +1,199 @@ +#!/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 $count=@items; + +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 +; +if ($type eq 'catmain'){ + print "Catalogue Maintenance
"; +} +print <$data->{'title'} ($data->{'author'})

+

+

+ + + + + + + + + + +
$data->{'biblioitemnumber'} GROUP - $data->{'description'}
+ + +
+ +Biblionumber: $bib
+Item Type: $data->{'itemtype'}
+Loan Length: $data->{'loanlength'}
+Rental Charge: $data->{'rentalcharge'}
+Classification: $data->{'classification'}$dewey$data->{'subclass'}
+ISBN: $data->{'isbn'}
+Publisher: $data->{'publishercode'}
+Place: $data->{'place'}
+Date: $data->{'publicationyear'}
+Volume: $data->{'volumeddesc'}
+Pages: $data->{'pages'}
+Illus: $data->{'illus'}
+Size: $data->{'size'}
+Notes: $data->{'bnotes'}
+No. of Items: $count + +printend +; +if ($type eq 'catmain'){ + print "
{'biblioitemnumber'}&bib=$data->{'biblionumber'}>Shift to another biblio"; + +} +print < +
+
+printend +; + +for (my $i=0;$i<$count;$i++){ +print < + + + + + + + +
BARCODE $items[$i]->{'barcode'}
+
+ +{'itemnumber'}> + + + +
+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 < +Home Branch: $items[$i]->{'homebranch'}
+Last seen: $items[$i]->{'datelastseen'}
+Last borrowed: $items[$i]->{'timestamp0'}
+printend +; +if ($items[$i] eq 'Available'){ + print "Currently on issue to:
"; +} else { + print "Currently on issue to: {'borrower0'}>$items[$i]->{'card'}
"; +} +print <Last Borrower 1: $items[$i]->{'card0'}
+Last Borrower 2: $items[$i]->{'card1'}
+Current Branch: $items[$i]->{'holdingbranch'}
+Replacement Price: $items[$i]->{'replacementprice'}
+Item lost: $items[$i]->{'itemlost'}
+Paid for: $items[$i]->{'paidfor'}
+Notes: $items[$i]->{'itemnotes'}
+Renewals: $items[$i]->{'renewals'}
+{'booksellerinvoicenumber'}&catview=yes>Accession Date: $items[$i]->{'dateaccessioned'}
+printend +; +if ($items[$i]->{'wthdrawn'} eq '1'){ + $items[$i]->{'wthdrawn'}="Yes"; +} else { + $items[$i]->{'wthdrawn'}="No"; +} +print <Cancelled: $items[$i]->{'wthdrawn'}
+Total Issues: $items[$i]->{'issues'}
+Group Number: $bi
+Biblio number: $bib
+ + + + +
+ +printend +; +} +print < + +printend +; + + +print endcenter(); + +print endmenu($type); +print endpage(); diff --git a/opac/opac-search.pl b/opac/opac-search.pl new file mode 100755 index 0000000000..29faa2c4aa --- /dev/null +++ b/opac/opac-search.pl @@ -0,0 +1,15 @@ +#!/usr/bin/perl +use strict; +require Exporter; + +use C4::Output; # contains picktemplate +use CGI; +use C4::Auth; + +my $query = new CGI; +#my ($loggedinuser, $cookie, $sessionID) = checkauth($query); + +my $template = gettemplate("opac-search.tmpl", "opac"); + +#$template->param(SITE_RESULTS => $sitearray); +print "Content-Type: text/html\n\n", $template->output; diff --git a/opac/opac-searchresults.pl b/opac/opac-searchresults.pl new file mode 100755 index 0000000000..147f63647f --- /dev/null +++ b/opac/opac-searchresults.pl @@ -0,0 +1,108 @@ +#!/usr/bin/perl +use strict; +require Exporter; +use CGI; +use C4::Search; +use C4::Auth; +use C4::Output; # now contains picktemplate + +my $query=new CGI; + +my ($loggedinuser, $cookie, $sessionID) = checkauth($query, 1); + + +my $template; +my $subject=$query->param('subject'); +# if its a subject we need to use the subject.tmpl +if ($subject) { + $template = gettemplate ("subject.tmpl", "opac"); +} else { + $template = gettemplate ("searchresults.tmpl", "opac"); +} + +# get all the search variables +# we assume that C4::Search will validate these values for us +my @fields = ('keyword', 'subject', 'author', 'illustrator', 'itemnumber', 'isbn', 'date-before', 'date-after', 'class', 'dewey', 'branch', 'title', 'abstract', 'publisher'); + + + +# collect all the fields ... +my %search; +my $forminputs; +my $searchdesc = ''; +foreach my $field (@fields) { + $search{$field} = $query->param($field); + if ($search{$field}) { + push @$forminputs, {field => $field, value => $search{$field}}; + $searchdesc .= "$field = $search{$field}, "; + } +} +$search{'ttype'} = $query->param('ttype'); +push @$forminputs, {field => 'ttype', value => $search{'ttype'}}; + +if (my $subjectitems=$query->param('subjectitems')){ + $search{'subject'} = $subjectitems; + $searchdesc.="subject = $subjectitems, "; +} + +@$forminputs=() unless $forminputs; +$template->param(FORMINPUTS => $forminputs); + +# do the searchs .... +my $env; +$env->{itemcount}=1; +my $num=10; +my @results; +my $count; +my $startfrom = $query->param('startfrom'); +my $subjectitems=$query->param('subjectitems'); +if ($subjectitems) { + my $blah; + @results = subsearch(\$blah,$subjectitems, $num, $startfrom); + $count = $#results+1; +} else { + ($count, @results) = catalogsearch($env,'',\%search,$num,$startfrom); +} + +my $startfrom=$query->param('startfrom'); +($startfrom) || ($startfrom=0); + +my $resultsarray=\@results; +($resultsarray) || (@$resultsarray=()); + + +# sorting out which results to display. +$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); +$template->param(prevstartfrom => $prevstartfrom); + +$template->param(searchdesc => $searchdesc); +$template->param(SEARCH_RESULTS => $resultsarray); +$template->param(loggedinuser => $loggedinuser); + +my $numbers; +@$numbers = (); +if ($count>10) { + for (my $i=1; $i<$count/10+1; $i++) { + my $highlight=0; + my $themelang = $template->param('themelang'); + ($startfrom==($i-1)*10) && ($highlight=1); + push @$numbers, { number => $i, highlight => $highlight , startfrom => ($i-1)*10 }; + } +} + +$template->param(numbers => $numbers); + + +print $query->header(-cookie => $cookie), $template->output; + -- 2.39.5