From 079deb4d2ae1ce4e9e618ee8848cf8c72e89ca5d Mon Sep 17 00:00:00 2001 From: finlayt Date: Wed, 11 Sep 2002 01:58:20 +0000 Subject: [PATCH] added these opac files temporarily as I sort out the new directory structure.... --- tmpl/detail.pl | 88 +++++++++++++++++++ tmpl/moredetail.pl | 199 ++++++++++++++++++++++++++++++++++++++++++ tmpl/opacmain.pl | 38 ++++++++ tmpl/opacsearch.pl | 38 ++++++++ tmpl/search.pl | 212 +++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 575 insertions(+) create mode 100755 tmpl/detail.pl create mode 100755 tmpl/moredetail.pl create mode 100755 tmpl/opacmain.pl create mode 100755 tmpl/opacsearch.pl create mode 100755 tmpl/search.pl diff --git a/tmpl/detail.pl b/tmpl/detail.pl new file mode 100755 index 0000000000..dabc97a437 --- /dev/null +++ b/tmpl/detail.pl @@ -0,0 +1,88 @@ +#!/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 () { + 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'}=@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 $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; + diff --git a/tmpl/moredetail.pl b/tmpl/moredetail.pl new file mode 100755 index 0000000000..49b6b57c3f --- /dev/null +++ b/tmpl/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/tmpl/opacmain.pl b/tmpl/opacmain.pl new file mode 100755 index 0000000000..379719bbac --- /dev/null +++ b/tmpl/opacmain.pl @@ -0,0 +1,38 @@ +#!/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 () { + 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; diff --git a/tmpl/opacsearch.pl b/tmpl/opacsearch.pl new file mode 100755 index 0000000000..8b5cd31f3a --- /dev/null +++ b/tmpl/opacsearch.pl @@ -0,0 +1,38 @@ +#!/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 () { + 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; diff --git a/tmpl/search.pl b/tmpl/search.pl new file mode 100755 index 0000000000..34e0587fa9 --- /dev/null +++ b/tmpl/search.pl @@ -0,0 +1,212 @@ +#!/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 () { + 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 $resultsarray=\@results; +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; + -- 2.39.5