Changeset 376


Ignore:
Timestamp:
08/09/12 16:32:41 (12 years ago)
Author:
Kris Deugau
Message:

/trunk

Factor out another little code fragment: result, warning, and
error message output to templates.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/dns.cgi

    r375 r376  
    331331  }
    332332
    333   if ($session->param('resultmsg')) {
    334     $page->param(resultmsg => $session->param('resultmsg'));
    335     $session->clear('resultmsg');
    336   }
    337   if ($session->param('errmsg')) {
    338     $page->param(errmsg => $session->param('errmsg'));
    339     $session->clear('errmsg');
    340   }
     333  show_msgs();
    341334
    342335  $page->param(curpage => $webvar{page});
     
    442435  }
    443436
    444   if ($session->param('resultmsg')) {
    445     $page->param(resultmsg => $session->param('resultmsg'));
    446     $session->clear('resultmsg');
    447   }
    448   if ($session->param('errmsg')) {
    449     $page->param(errmsg => $session->param('errmsg'));
    450     $session->clear('errmsg');
    451   }
     437  show_msgs();
    452438
    453439  $page->param(curpage => $webvar{page});
     
    604590    }
    605591
    606     if ($session->param('resultmsg')) {
    607       $page->param(resultmsg => $session->param('resultmsg'));
    608       $session->clear('resultmsg');
    609     }
    610     if ($session->param('warnmsg')) {
    611       $page->param(warnmsg => $session->param('warnmsg'));
    612       $session->clear('warnmsg');
    613     }
    614     if ($session->param('errmsg')) {
    615       $page->param(errmsg => $session->param('errmsg'));
    616       $session->clear('errmsg');
    617     }
     592    show_msgs();
    618593
    619594  } # close "you can't edit default records" check
     
    849824  $page->param(delgrp => $permissions{admin} || $permissions{group_delete});
    850825
    851   if ($session->param('resultmsg')) {
    852     $page->param(resultmsg => $session->param('resultmsg'));
    853     $session->clear('resultmsg');
    854   }
    855   if ($session->param('warnmsg')) {
    856     $page->param(warnmsg => $session->param('warnmsg'));
    857     $session->clear('warnmsg');
    858   }
    859   if ($session->param('errmsg')) {
    860     $page->param(errmsg => $session->param('errmsg'));
    861     $session->clear('errmsg');
    862   }
     826  show_msgs();
    863827  $page->param(curpage => $webvar{page});
    864828
     
    11201084  $page->param(deluser => $permissions{admin} || $permissions{user_delete});
    11211085
    1122   if ($session->param('resultmsg')) {
    1123     $page->param(resultmsg => $session->param('resultmsg'));
    1124     $session->clear('resultmsg');
    1125   }
    1126   if ($session->param('warnmsg')) {
    1127     $page->param(warnmsg => $session->param('warnmsg'));
    1128     $session->clear('warnmsg');
    1129   }
    1130   if ($session->param('errmsg')) {
    1131     $page->param(errmsg => $session->param('errmsg'));
    1132     $session->clear('errmsg');
    1133   }
     1086  show_msgs();
    11341087  $page->param(curpage => $webvar{page});
    11351088
     
    13521305#  }
    13531306  list_locations();
     1307  show_msgs();
    13541308
    13551309# Permissions!
     
    14181372    $page->param(locname => ($webvar{locname} ? $webvar{locname} : ''));
    14191373    $page->param(iplist => ($webvar{iplist} ? $webvar{iplist} : ''));
     1374
     1375    show_msgs();
    14201376  }
    14211377
     
    17751731} # end changepage
    17761732
     1733# wrap up the usual suspects for result, warning, or error messages to be displayed
     1734sub show_msgs {
     1735  if ($session->param('resultmsg')) {
     1736    $page->param(resultmsg => $session->param('resultmsg'));
     1737    $session->clear('resultmsg');
     1738  }
     1739  if ($session->param('warnmsg')) {
     1740    $page->param(warnmsg => $session->param('warnmsg'));
     1741    $session->clear('warnmsg');
     1742  }
     1743  if ($session->param('errmsg')) {
     1744    $page->param(errmsg => $session->param('errmsg'));
     1745    $session->clear('errmsg');
     1746  }
     1747} # end show_msgs
     1748
    17771749sub fillsoa {
    17781750  my $defrec = shift;
Note: See TracChangeset for help on using the changeset viewer.