Changeset 395


Ignore:
Timestamp:
02/19/10 16:24:54 (14 years ago)
Author:
Kris Deugau
Message:

/branches/stable

Finish basic node tracking - add link in header, extend search tool to

handle the appropriate lookup

Location:
branches/stable
Files:
3 edited

Legend:

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

    r394 r395  
    127127elsif($webvar{action} eq 'finaldelete') {
    128128  finalDelete();
     129}
     130elsif ($webvar{action} eq 'nodesearch') {
     131  open HTML, "<../nodesearch.html";
     132  my $html = join('',<HTML>);
     133  close HTML;
     134
     135  $sth = $ip_dbh->prepare("SELECT node_id, node_name FROM nodes ORDER BY node_type,node_id");
     136  $sth->execute() or print "DEBUG: failed retrieval from nodes: ".$sth->errstr,"<br>\n";
     137  my $nodes = '';
     138  while (my ($nid,$nname) = $sth->fetchrow_array()) {
     139    $nodes .= "<option value='$nid'>$nname</option>\n";
     140  }
     141  $html =~ s/\$\$NODELIST\$\$/$nodes/;
     142
     143  print $html;
    129144}
    130145
  • branches/stable/cgi-bin/search.cgi

    r389 r395  
    187187    printError "No matches found.  Try eliminating one of the criteria,".
    188188        " or making one or more criteria more general.";
     189  } else {
     190    # Add the limit/offset clauses
     191    $sql .= " order by cidr";
     192    $sql .= " limit $RESULTS_PER_PAGE offset $offset" if $RESULTS_PER_PAGE != 0;
     193    # And tell the user.
     194    print "<div class=heading>Searching...............</div>\n";
     195    queryResults($sql, $webvar{page}, $count);
     196  }
     197
     198} elsif ($webvar{stype} eq 'n') {
     199  # Node search.
     200
     201  my $sql = "SELECT cidr,custid,type,city,description FROM searchme".
     202        " WHERE cidr IN (SELECT block FROM noderef WHERE node_id=$webvar{node})";
     203
     204  # Find the offset for multipage results
     205  my $offset = ($webvar{page}-1)*$RESULTS_PER_PAGE;
     206
     207  # Find out how many rows the "core" query will return.
     208  my $count = countRows($sql);
     209
     210  if ($count == 0) {
     211    printError "No customers currently listed as connected through this node.";
    189212  } else {
    190213    # Add the limit/offset clauses
  • branches/stable/header.inc

    r379 r395  
    6060  </tr>
    6161</tbody></table>
    62 <table width="98%" border=0><tr><td align=right><a href="javascript:popNotes('/ip/changes.html')">Recent Changes</a></td></tr></table>
     62<table width="98%" border=0><tr><td align=right>
     63<a href="/ip/cgi-bin/main.cgi?action=nodesearch">Find by connection point</a>&nbsp; &nbsp;
     64<a href="javascript:popNotes('/ip/changes.html')">Recent Changes</a>
     65</td></tr></table>
    6366<br>
Note: See TracChangeset for help on using the changeset viewer.