Changeset 493


Ignore:
Timestamp:
09/23/10 20:58:52 (14 years ago)
Author:
Kris Deugau
Message:

/branches/htmlform

Convert dangling direct error print to template parameter (can't load node list for
search). See #3.
Remove dangling obsolete commented code fragments and subs (printRow and startTable).
See #3, #26.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/htmlform/cgi-bin/main.cgi

    r492 r493  
    150150elsif ($webvar{action} eq 'nodesearch') {
    151151  $sth = $ip_dbh->prepare("SELECT node_id, node_name FROM nodes ORDER BY node_type,node_id");
    152   $sth->execute() or print "DEBUG: failed retrieval from nodes: ".$sth->errstr,"<br>\n";
     152  $sth->execute() or $page->param(errmsg => $sth->errstr);
    153153  my @nodelist;
    154154  while (my ($nid,$nname) = $sth->fetchrow_array()) {
     
    183183finish($ip_dbh);
    184184
    185 #print qq(<div align=right style="position: absolute; right: 30px;">).
    186 #       qq(<a href="/ip/cgi-bin/admin.cgi">Admin tools</a></div><br>\n)
    187 #       if $IPDBacl{$authuser} =~ /A/;
    188 
    189185## Do all our printing here so we can generate errors and stick them into the slots in the templates.
    190186
     
    202198# properly... we exit explicitly.
    203199exit 0;
    204 
    205 
    206 # args are: a reference to an array with the row to be printed and the
    207 # class(stylesheet) to use for formatting.
    208 # if ommitting the class - call the sub as &printRow(\@array)
    209 sub printRow {
    210   my ($rowRef,$class) = @_;
    211 
    212   if (!$class) {
    213     print "<tr>\n";
    214   } else {
    215     print "<tr class=\"$class\">\n";
    216   }
    217 
    218 ELEMENT:  foreach my $element (@$rowRef) {
    219     if (!defined($element)) {
    220       print "<td></td>\n";
    221       next ELEMENT;
    222     }
    223     $element =~ s|\n|</br>|g;
    224     print "<td>$element</td>\n";
    225   }
    226   print "</tr>";
    227 } # printRow
    228 
    229 
    230 # Prints table headings.  Accepts any number of arguments;
    231 # each argument is a table heading.
    232 sub startTable {
    233   print qq(<center><table width="98%" cellspacing="0" class="center"><tr>);
    234 
    235   foreach(@_) {
    236     print qq(<td class="heading">$_</td>);
    237   }
    238   print "</tr>\n";
    239 } # startTable
    240200
    241201
     
    498458  $page->param(city => $poolcity);
    499459
    500 #  print qq(<center><div class="heading">Listing pool IPs for $cidr<br>\n).
    501 #       qq(($disp_alloctypes{$pooltype} in $poolcity)</div></center><br>\n);
    502460  # Only display net/gw/bcast if it's a "real" netblock and not a PPP(oE) lunacy
    503461  $page->param(realblock => $pooltype =~ /^.d$/);
     
    565523        "and type not like '_i' and type not like '_r' order by listorder");
    566524      $sth->execute;
    567       my @data = $sth->fetchrow_array;
    568525      my @typelist;
    569526      my $selflag = 0;
Note: See TracChangeset for help on using the changeset viewer.