Ignore:
Timestamp:
12/24/15 13:14:27 (9 years ago)
Author:
Kris Deugau
Message:

/trunk

Extend template-replacement from r793 to search.cgi and admin.cgi

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/cgi-bin/admin.cgi

    r789 r801  
    5555
    5656# Set up some globals
    57 $ENV{HTML_TEMPLATE_ROOT} = $thingroot."templates";
     57$ENV{HTML_TEMPLATE_ROOT} = $thingroot;
     58my @templatepath = [ "localtemplates", "templates" ];
    5859
    5960# Why not a global DB handle?  (And a global statement handle, as well...)
     
    7576# handle DB error output
    7677if ($webvar{action} eq 'dberr') {
    77   my $page = HTML::Template->new(filename => "admin/dberr.tmpl");
     78  my $page = HTML::Template->new(filename => "admin/dberr.tmpl", path => @templatepath);
    7879  $page->param(errmsg => $errstr);
    7980  print "Content-Type: text/html\n\n".$page->output;
     
    8283
    8384if ($IPDBacl{$authuser} !~ /A/) {
    84   my $page = HTML::Template->new(filename => "admin/aclerr.tmpl");
     85  my $page = HTML::Template->new(filename => "admin/aclerr.tmpl", path => @templatepath);
    8586##fixme:  need params for IPDB admin email and name
    8687  $page->param(ipdbadmin_email => 'ipdbadmin@example.com');
     
    9091}
    9192
    92 my $header = HTML::Template->new(filename => "admin/header.tmpl");
     93my $header = HTML::Template->new(filename => "admin/header.tmpl", path => @templatepath);
    9394$header->param(mainpage => 1) if $webvar{action} eq 'main';
    9495$header->param(webpath => $IPDB::webpath);
     
    9697
    9798my $page;
    98 if (-e "$ENV{HTML_TEMPLATE_ROOT}/admin/$webvar{action}.tmpl") {
    99   $page = HTML::Template->new(filename => "admin/$webvar{action}.tmpl");
     99if (-e "$ENV{HTML_TEMPLATE_ROOT}/templates/admin/$webvar{action}.tmpl") {
     100  $page = HTML::Template->new(filename => "admin/$webvar{action}.tmpl", path => @templatepath);
    100101} else {
    101   $page = HTML::Template->new(filename => "admin/dunno.tmpl");
     102  $page = HTML::Template->new(filename => "admin/dunno.tmpl", path => @templatepath);
    102103}
    103104
     
    481482
    482483# We print the footer here, so we don't have to do it elsewhere.
    483 my $footer = HTML::Template->new(filename => "footer.tmpl");
     484my $footer = HTML::Template->new(filename => "footer.tmpl", path => @templatepath);
    484485# we're already in the admin tools, no need to provide a bottom link.  maybe.
    485486#$footer->param(adminlink => ($IPDBacl{$authuser} =~ /A/));
Note: See TracChangeset for help on using the changeset viewer.