From d04d6cace7018d57184905d1ba3da97ec185f00e Mon Sep 17 00:00:00 2001 From: tonnesen Date: Wed, 9 Oct 2002 18:09:16 +0000 Subject: [PATCH] switched from picktemplate() to gettemplate() --- acqui.simple/marcimport.pl | 27 +++++++++------------------ detail.pl | 2 +- marc/MARCdetail.pl | 14 +++----------- moredetail.pl | 2 +- opac/opac-detail.pl | 2 +- opac/opac-searchresults.pl | 2 +- userpage.pl | 2 +- 7 files changed, 17 insertions(+), 34 deletions(-) diff --git a/acqui.simple/marcimport.pl b/acqui.simple/marcimport.pl index 9b677097f1..098812314b 100755 --- a/acqui.simple/marcimport.pl +++ b/acqui.simple/marcimport.pl @@ -178,9 +178,7 @@ sub ProcessRecord { if ($record) { $oldkoha=MARCmarc2koha($dbh,$record); } - my $templatebase="marcimport/marcimportdetail.tmpl"; - my $theme=picktemplate($includes, $templatebase); - my $template = HTML::Template->new(filename => "$includes/templates/$theme/$templatebase", die_on_bad_params => 0, path => [$includes]); + my $template=gettemplate('marcimport/marcimportdetail.tmpl"; $oldkoha->{additionalauthors} =~ s/ \| /\n/g; $oldkoha =~ s/\|/\n/g; $template->param($oldkoha); @@ -247,9 +245,7 @@ sub ListFileRecords { requireDBI($dbh,"ListFileRecords"); - my $templatebase="marcimport/ListFileRecords.tmpl"; - my $theme=picktemplate($includes, $templatebase); - my $template = HTML::Template->new(filename => "$includes/templates/$theme/$templatebase", die_on_bad_params => 0, path => [$includes]); + my $template=gettemplate('marcimport/ListFileRecords.tmpl"; # File can be z3950 search query or uploaded MARC data @@ -578,9 +574,7 @@ sub uploadmarc { requireDBI($dbh,"uploadmarc"); - my $templatebase="marcimport/uploadmarc.tmpl"; - my $theme=picktemplate($includes, $templatebase); - my $template = HTML::Template->new(filename => "$includes/templates/$theme/$templatebase", die_on_bad_params => 0, path => [$includes]); + my $template=gettemplate('marcimport/uploadmarc.tmpl"; $template->param(SCRIPT_NAME => $ENV{'SCRIPT_NAME'}); # print "Main Menu
\n"; my $sth=$dbh->prepare("select id,name from uploadedmarc"); @@ -604,9 +598,7 @@ sub manual { sub mainmenu { - my $templatebase="marcimport/mainmenu.tmpl"; - my $theme=picktemplate($includes, $templatebase); - my $template = HTML::Template->new(filename => "$includes/templates/$theme/$templatebase", die_on_bad_params => 0, path => [$includes]); + my $template=gettemplate('marcimport/mainmenu.tmpl"; $template->param(SCRIPT_NAME => $ENV{'SCRIPT_NAME'}); print "Content-Type: text/html\n\n", $template->output; } # sub mainmenu @@ -745,9 +737,7 @@ sub AcceptBiblioitem { print STDERR "Error in marcimport.pl/Acceptbiblioitem : numrecord not defined\n"; print "Error in marcimport.pl/Acceptbiblioitem : numrecord not defined : contact administrator\n"; } - my $templatebase="marcimport/AcceptBiblioitem.tmpl"; - my $theme=picktemplate($includes, $templatebase); - my $template = HTML::Template->new(filename => "$includes/templates/$theme/$templatebase", die_on_bad_params => 0, path => [$includes]); + my $template=gettemplate('marcimport/AcceptBiblioitem.tmpl"; my $oldkoha = MARCmarc2koha($dbh,$record); # See if it already exists @@ -851,9 +841,7 @@ sub AcceptItemCopy { use strict; my ( $dbh, $input )=@_; - my $templatebase="marcimport/AcceptItemCopy.tmpl"; - my $theme=picktemplate($includes, $templatebase); - my $template = HTML::Template->new(filename => "$includes/templates/$theme/$templatebase", die_on_bad_params => 0, path => [$includes]); + my $template=gettemplate('marcimport/AcceptItemCopy.tmpl"; my $error; @@ -993,6 +981,9 @@ sub FormatMarcText { #--------------- # $Log$ +# Revision 1.15 2002/10/09 18:09:16 tonnesen +# switched from picktemplate() to gettemplate() +# # Revision 1.14 2002/10/05 09:56:14 arensb # Merged with arensb-context branch: use C4::Context->dbh instead of # &C4Connect, and generally prefer C4::Context over C4::Database. diff --git a/detail.pl b/detail.pl index b94272d504..e729bb2dc8 100755 --- a/detail.pl +++ b/detail.pl @@ -21,7 +21,7 @@ use HTML::Template; use strict; require Exporter; use C4::Context; -use C4::Output; # contains picktemplate +use C4::Output; # contains gettemplate use CGI; use C4::Search; use C4::Auth; diff --git a/marc/MARCdetail.pl b/marc/MARCdetail.pl index ada2a2e8f5..0451a8bbc2 100755 --- a/marc/MARCdetail.pl +++ b/marc/MARCdetail.pl @@ -21,7 +21,7 @@ use strict; use HTML::Template; require Exporter; # FIXME - Is this really necessary? use C4::Context; -use C4::Output; # contains picktemplate +use C4::Output; # contains gettemplate use CGI; use C4::Search; use MARC::Record; @@ -35,11 +35,7 @@ my $tag=$query->param('tag'); if (! defined $tag) { $tag='2XX';} #print STDERR "BIB : $biblionumber // TAG : $tag\n"; if (! defined $biblionumber) { - my $includes = C4::Context->config('includes') || - "/usr/local/www/hdl/htdocs/includes"; - my $templatebase="MARCdetailbiblioselect.tmpl"; - my $theme=picktemplate($includes, $templatebase); - my $template = HTML::Template->new(filename => "$includes/templates/$theme/$templatebase", die_on_bad_params => 0, path => [$includes]); + my $template = gettemplate("MARCdetailbiblioselect.tmpl"); print "Content-Type: text/html\n\n", $template->output; } else { @@ -52,11 +48,7 @@ sub showmarcrecord { my $sth=$dbh->prepare("select liblibrarian from marc_subfield_structure where tagfield=? and tagsubfield=?"); my $record =MARCgetbiblio($dbh,$biblionumber); # open template - my $templatebase="catalogue/MARCdetail.tmpl"; - my $includes = C4::Context->config('includes') || - "/usr/local/www/hdl/htdocs/includes"; - my $theme=picktemplate($includes, $templatebase); - my $template = HTML::Template->new(filename => "$includes/templates/$theme/$templatebase", die_on_bad_params => 0, path => [$includes]); + my $template = gettemplate("MARCdetail.tmpl"); # fill arrays my @loop_data =(); my @fields = $record->field($tag); diff --git a/moredetail.pl b/moredetail.pl index 07bc6d849c..674f82f2b5 100755 --- a/moredetail.pl +++ b/moredetail.pl @@ -24,7 +24,7 @@ use C4::Koha; use CGI; use C4::Search; use C4::Acquisitions; -use C4::Output; # contains picktemplate +use C4::Output; # contains gettemplate my $query=new CGI; diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl index 3e48936e54..2aaeb85fb3 100755 --- a/opac/opac-detail.pl +++ b/opac/opac-detail.pl @@ -1,7 +1,7 @@ #!/usr/bin/perl use strict; require Exporter; -use C4::Output; # contains picktemplate +use C4::Output; # contains gettemplate use CGI; use C4::Search; use C4::Auth; diff --git a/opac/opac-searchresults.pl b/opac/opac-searchresults.pl index 8e8623292b..27f9aebe6a 100755 --- a/opac/opac-searchresults.pl +++ b/opac/opac-searchresults.pl @@ -4,7 +4,7 @@ require Exporter; use CGI; use C4::Search; use C4::Auth; -use C4::Output; # now contains picktemplate +use C4::Output; # now contains gettemplate my $query=new CGI; diff --git a/userpage.pl b/userpage.pl index 00766b6c8c..3e6b99156d 100755 --- a/userpage.pl +++ b/userpage.pl @@ -21,7 +21,7 @@ use HTML::Template; use strict; require Exporter; use C4::Context; -use C4::Output; # contains picktemplate +use C4::Output; use CGI; use C4::Search; use C4::Auth; -- 2.20.1