From 0e7f86db7e08b23e7c2ec572b38b6eb94f206bda Mon Sep 17 00:00:00 2001 From: tipaul Date: Thu, 12 Dec 2002 16:33:58 +0000 Subject: [PATCH] adding authentification with Auth.pm --- MARCdetail.pl | 13 ++++++++++-- .../default/en/acqui.simple/additem.tmpl | 6 +++--- .../default/en/user/userpage.tmpl | 4 ++-- search.pl | 21 ++++++++++++++++--- thesaurus_popup.pl | 13 +++++++++--- value_builder/unimarc_field_100.pl | 12 +++++++++-- value_builder/unimarc_field_225a.pl | 12 +++++++++-- value_builder/unimarc_field_700-4.pl | 12 +++++++++-- value_builder/unimarc_field_700_701_702.pl | 12 +++++++++-- 9 files changed, 84 insertions(+), 21 deletions(-) diff --git a/MARCdetail.pl b/MARCdetail.pl index b82d6facdd..28f7c0cf5a 100755 --- a/MARCdetail.pl +++ b/MARCdetail.pl @@ -40,6 +40,7 @@ The 10 firsts presents the biblio, the 11th one presents the items attached to t use strict; require Exporter; +use C4::Auth; use C4::Context; use C4::Output; use CGI; @@ -61,7 +62,15 @@ my $tagslib = &MARCgettagslib($dbh,1); my $record =MARCgetbiblio($dbh,$bibid); #warn $record->as_formatted(); # open template -my $template = gettemplate("catalogue/MARCdetail.tmpl",0); +my ($template, $loggedinuser, $cookie) + = get_template_and_user({template_name => "catalogue/MARCdetail.tmpl", + query => $query, + type => "intranet", + authnotrequired => 0, + flagsrequired => {catalogue => 1}, + debug => 1, + }); + # fill arrays my @loop_data =(); my $tag; @@ -144,5 +153,5 @@ $template->param(item_loop => \@item_value_loop, item_header_loop => \@header_value_loop, biblionumber => $biblionumber, bibid => $bibid); -print "Content-Type: text/html\n\n", $template->output; +print $query->header(-cookie => $cookie),$template->output; diff --git a/koha-tmpl/intranet-tmpl/default/en/acqui.simple/additem.tmpl b/koha-tmpl/intranet-tmpl/default/en/acqui.simple/additem.tmpl index 44d14efdf2..9cc7f063f8 100644 --- a/koha-tmpl/intranet-tmpl/default/en/acqui.simple/additem.tmpl +++ b/koha-tmpl/intranet-tmpl/default/en/acqui.simple/additem.tmpl @@ -73,13 +73,13 @@ -"> -"> -"> "> +"> +"> +"> diff --git a/koha-tmpl/intranet-tmpl/default/en/user/userpage.tmpl b/koha-tmpl/intranet-tmpl/default/en/user/userpage.tmpl index 2ae7067353..d78fbca636 100644 --- a/koha-tmpl/intranet-tmpl/default/en/user/userpage.tmpl +++ b/koha-tmpl/intranet-tmpl/default/en/user/userpage.tmpl @@ -1,4 +1,4 @@ - +

Logged in as: [Log Out]

@@ -86,4 +86,4 @@
- + diff --git a/search.pl b/search.pl index 81677bc025..f9dfc5f95b 100755 --- a/search.pl +++ b/search.pl @@ -20,6 +20,7 @@ use strict; require Exporter; use CGI; +use C4::Auth; use HTML::Template; use C4::Context; use C4::Search; @@ -37,12 +38,26 @@ my $startfrom=$query->param('startfrom'); ($startfrom) || ($startfrom=0); my $subject=$query->param('subject'); -my $template; # if it's a subject we need to use the subject.tmpl +my ($template, $loggedinuser, $cookie); if ($subject) { - $template = gettemplate("catalogue/subject.tmpl",0); + ($template, $loggedinuser, $cookie) + = get_template_and_user({template_name => "catalogue/subject.tmpl", + query => $query, + type => "intranet", + authnotrequired => 0, + flagsrequired => {catalogue => 1}, + debug => 1, + }); } else { - $template = gettemplate("catalogue/searchresults.tmpl", 0); + ($template, $loggedinuser, $cookie) + = get_template_and_user({template_name => "catalogue/searchresults.tmpl", + query => $query, + type => "intranet", + authnotrequired => 0, + flagsrequired => {catalogue => 1}, + debug => 1, + }); } # %env diff --git a/thesaurus_popup.pl b/thesaurus_popup.pl index 56bcc7fc02..3038b67157 100755 --- a/thesaurus_popup.pl +++ b/thesaurus_popup.pl @@ -22,6 +22,7 @@ # Suite 330, Boston, MA 02111-1307 USA use strict; +use C4::Auth; use CGI; use C4::Context; use HTML::Template; @@ -58,8 +59,14 @@ if ($op eq "add") { newauthority($dbh,$category,$insert,$insert,'',1,''); $search_string=$insert; } - -my $template = gettemplate("thesaurus_popup.tmpl",0); +my ($template, $loggedinuser, $cookie) + = get_template_and_user({template_name => "thesaurus_popup.tmpl", + query => $input, + type => "intranet", + authnotrequired => 0, + flagsrequired => {parameters => 1}, + debug => 1, + }); # /search thesaurus terms starting by search_string my @freelib; my %stdlib; @@ -86,6 +93,6 @@ $template->param(select_list => $select_list, category => $category, index => $index ); -print "Content-Type: text/html\n\n", $template->output; +print $input->header(-cookie => $cookie),$template->output; diff --git a/value_builder/unimarc_field_100.pl b/value_builder/unimarc_field_100.pl index 05a67fa35d..e2f0f282a7 100755 --- a/value_builder/unimarc_field_100.pl +++ b/value_builder/unimarc_field_100.pl @@ -20,6 +20,7 @@ # Suite 330, Boston, MA 02111-1307 USA use strict; +use C4::Auth; use CGI; use C4::Context; use HTML::Template; @@ -64,7 +65,14 @@ my ($input) = @_; my $dbh = C4::Context->dbh; - my $template = gettemplate("value_builder/unimarc_field_100.tmpl",0); +my ($template, $loggedinuser, $cookie) + = get_template_and_user({template_name => "value_builder/unimarc_field_100.tmpl", + query => $input, + type => "intranet", + authnotrequired => 0, + flagsrequired => {parameters => 1}, + debug => 1, + }); my $f1 = substr($result,0,8); my $f2 = substr($result,8,1); my $f3 = substr($result,9,4); @@ -74,7 +82,7 @@ my ($input) = @_; f3 => $f3, "f2$f2" => $f2, f4 => $f4); - print "Content-Type: text/html\n\n", $template->output; + print $input->header(-cookie => $cookie),$template->output; } 1; diff --git a/value_builder/unimarc_field_225a.pl b/value_builder/unimarc_field_225a.pl index 36617037b5..ee998718a1 100644 --- a/value_builder/unimarc_field_225a.pl +++ b/value_builder/unimarc_field_225a.pl @@ -20,6 +20,7 @@ # Suite 330, Boston, MA 02111-1307 USA use strict; +use C4::Auth; use CGI; use C4::Context; use HTML::Template; @@ -78,7 +79,14 @@ my ($input) = @_; my $isbn_found = $input->param('isbn_found'); my $dbh = C4::Context->dbh; my $authoritysep = C4::Context->preference("authoritysep"); - my $template = gettemplate("value_builder/unimarc_field_225a.tmpl",0); + my ($template, $loggedinuser, $cookie) + = get_template_and_user({template_name => "value_builder/unimarc_field_225a.tmpl", + query => $input, + type => "intranet", + authnotrequired => 0, + flagsrequired => {parameters => 1}, + debug => 1, + }); # builds collection list : search isbn and editor, in parent, then load collections from bibliothesaurus table my $sth = $dbh->prepare("select stdlib from bibliothesaurus where father=? and category='EDITORS'"); my @splited = split //, $isbn_found; @@ -100,7 +108,7 @@ my ($input) = @_; ); $template->param(index => $index, collection => $collection); - print "Content-Type: text/html\n\n", $template->output; + print $input->header(-cookie => $cookie),$template->output; } 1; diff --git a/value_builder/unimarc_field_700-4.pl b/value_builder/unimarc_field_700-4.pl index e010171266..bc0cac00bb 100755 --- a/value_builder/unimarc_field_700-4.pl +++ b/value_builder/unimarc_field_700-4.pl @@ -20,6 +20,7 @@ # Suite 330, Boston, MA 02111-1307 USA use strict; +use C4::Auth; use CGI; use C4::Context; use HTML::Template; @@ -84,12 +85,19 @@ my ($input) = @_; my $dbh = C4::Context->dbh; - my $template = gettemplate("value_builder/unimarc_field_700-4.tmpl",0); + my ($template, $loggedinuser, $cookie) + = get_template_and_user({template_name => "value_builder/unimarc_field_700-4.tmpl", + query => $input, + type => "intranet", + authnotrequired => 0, + flagsrequired => {parameters => 1}, + debug => 1, + }); $template->param(index => $index, index2 => $index2, "f1_$result" => "f1_".$result, ); - print "Content-Type: text/html\n\n", $template->output; + print $input->header(-cookie => $cookie),$template->output; } 1; diff --git a/value_builder/unimarc_field_700_701_702.pl b/value_builder/unimarc_field_700_701_702.pl index ee3027475f..24215b4069 100644 --- a/value_builder/unimarc_field_700_701_702.pl +++ b/value_builder/unimarc_field_700_701_702.pl @@ -20,6 +20,7 @@ # Suite 330, Boston, MA 02111-1307 USA use strict; +use C4::Auth; use CGI; use C4::Context; use HTML::Template; @@ -138,7 +139,14 @@ sub plugin { -labels=> \%stdlib ); } - my $template = gettemplate("value_builder/unimarc_field_700_701_702.tmpl",0); + my ($template, $loggedinuser, $cookie) + = get_template_and_user({template_name => "value_builder/unimarc_field_700_701_702.tmpl", + query => $input, + type => "intranet", + authnotrequired => 0, + flagsrequired => {parameters => 1}, + debug => 1, + }); # builds collection list : search isbn and editor, in parent, then load collections from bibliothesaurus table $template->param(index => $index, result =>$result, @@ -148,7 +156,7 @@ sub plugin { b => $b, c => $c, f => $f,); - print "Content-Type: text/html\n\n", $template->output; + print $input->header(-cookie => $cookie),$template->output; } 1; -- 2.39.5