Changeset 238


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.
Location:
trunk
Files:
3 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}
  • trunk/templates/badpage.tmpl

    r173 r238  
    11<!-- <TMPL_VAR NAME=sid> -->
    22<div id="badpage">
     3<TMPL_IF badpage>
    34Bad page requested:
    45<div class="errmsg">
     
    67</div>
    78Press the 'Back' button on your browser to continue.
     9</TMPL_IF>
     10<TMPL_IF badtemplate>
     11Template error:
     12<div class="warnmsg">
     13<TMPL_VAR NAME=badtemplate>
    814</div>
     15</TMPL_IF>
     16</div>
  • trunk/templates/menu.tmpl

    r224 r238  
    88<a href="dns.cgi?sid=<TMPL_VAR NAME=sid>&amp;page=log">Log</a><br />
    99<TMPL_IF maydefrec><a href="dns.cgi?sid=<TMPL_VAR NAME=sid>&amp;page=reclist&amp;id=<TMPL_VAR NAME=group>&amp;defrec=y">Default Records</a><br />
    10 <TMPL_IF mayrdns><A href="dns.cgi?sid=<TMPL_VAR NAME=sid>&amp;page=reclist&amp;id=<TMPL_VAR NAME=group>&amp;defrec=y&amp;revrec=y">Default Reverse Records</a><br /></TMPL_IF></TMPL_IF>
     10<TMPL_IF mayrdns><a href="dns.cgi?sid=<TMPL_VAR NAME=sid>&amp;page=reclist&amp;id=<TMPL_VAR NAME=group>&amp;defrec=y&amp;revrec=y">Default Reverse Records</a><br /></TMPL_IF></TMPL_IF>
    1111<TMPL_IF mayimport><a href="dns.cgi?sid=<TMPL_VAR NAME=sid>&amp;page=axfr">AXFR Import</a><br /></TMPL_IF>
    1212<TMPL_IF maybulk><a href="dns.cgi?sid=<TMPL_VAR NAME=sid>&amp;page=bulkdomain">Bulk Domain Operations</a><br /></TMPL_IF>
Note: See TracChangeset for help on using the changeset viewer.