Changeset 238 for trunk/dns.cgi


Ignore:
Timestamp:
02/22/12 18:03:41 (13 years ago)
Author:
Kris Deugau
Message:

/trunk

Clean up some little annoyances:

  • set reverse zone default sort field in the session same as for domains, users, etc
  • handle regular-page template failures more gracefully by showing the parse error if the template exists, and fall back to the previous informationless "Bad page! no cookie!" if the template doesn't exist.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/dns.cgi

    r237 r238  
    7878  $session->param('domlistsortby','domain');
    7979  $session->param('domlistorder','ASC');
     80  $session->param('revzonessortby','revnet');
     81  $session->param('revzonesorder','ASC');
    8082  $session->param('useradminsortby','user');
    8183  $session->param('useradminorder','ASC');
     
    195197my $page;
    196198eval {
    197   $page = HTML::Template->new(filename => "$templatedir/$webvar{page}.tmpl");
     199  # sigh.  can't set loop_context_vars or global_vars once instantiated.
     200  $page = HTML::Template->new(filename => "$templatedir/$webvar{page}.tmpl",
     201        loop_context_vars => 1, global_vars => 1);
    198202};
    199203if ($@) {
    200   warn "Bad page $webvar{page} requested";
     204  my $msg = $@;
    201205  $page = HTML::Template->new(filename => "$templatedir/badpage.tmpl");
    202   $page->param(badpage => $q->escapeHTML($webvar{page}));
     206  if (-e "$templatedir/$webvar{page}.tmpl") {
     207    $page->param(badtemplate => $q->escapeHTML($msg));
     208  } else {
     209    warn "Bad page $webvar{page} requested";
     210    $page->param(badpage => $q->escapeHTML($webvar{page}));
     211  }
    203212  $webvar{page} = 'badpage';
    204213}
Note: See TracChangeset for help on using the changeset viewer.