Commit 868a18ea authored by Robert Ricci's avatar Robert Ricci

Add some more error checking, and change the look again. I still

can't make it look anything but ugly....
parent 3b49f503
...@@ -52,6 +52,11 @@ if (count($selected_nodes)) { ...@@ -52,6 +52,11 @@ if (count($selected_nodes)) {
} }
$whereclause = implode(" OR ",$equal_clauses); $whereclause = implode(" OR ",$equal_clauses);
$whereclause_qualified = implode(" OR ",$equal_clauses_qualified); $whereclause_qualified = implode(" OR ",$equal_clauses_qualified);
} else {
if ($delete || $calc || $create || $research || $swap || $newtype ||
$newprefix || $addnumber || $renumber) {
USERERROR("At least one node must be selected!",1);
}
} }
# #
...@@ -240,7 +245,7 @@ if ($renumber) { ...@@ -240,7 +245,7 @@ if ($renumber) {
# #
$query_result = DBQueryFatal("SELECT n.new_node_id, node_id, n.type, IP, " . $query_result = DBQueryFatal("SELECT n.new_node_id, node_id, n.type, IP, " .
"DATE_FORMAT(created,'%M %e %H:%i:%s') as created, i.MAC, " . "DATE_FORMAT(created,'%M %e %H:%i:%s') as created, i.MAC, " .
"i.switch_id, i.switch_card, i.switch_port " . "i.switch_id, i.switch_card, i.switch_port, n.temporary_IP " .
"FROM new_nodes AS n " . "FROM new_nodes AS n " .
"LEFT JOIN node_types AS t on n.type=t.type " . "LEFT JOIN node_types AS t on n.type=t.type " .
"LEFT JOIN new_interfaces AS i ON n.new_node_id=i.new_node_id " . "LEFT JOIN new_interfaces AS i ON n.new_node_id=i.new_node_id " .
...@@ -249,6 +254,8 @@ $query_result = DBQueryFatal("SELECT n.new_node_id, node_id, n.type, IP, " . ...@@ -249,6 +254,8 @@ $query_result = DBQueryFatal("SELECT n.new_node_id, node_id, n.type, IP, " .
?> ?>
<h3><a href="newnodes_list.php3">Refresh this page</a></h3>
<form action="newnodes_list.php3" method="get" name="nodeform"> <form action="newnodes_list.php3" method="get" name="nodeform">
<script language="JavaScript"> <script language="JavaScript">
...@@ -275,6 +282,7 @@ function deselectAll(form) { ...@@ -275,6 +282,7 @@ function deselectAll(form) {
<th>Control MAC</th> <th>Control MAC</th>
<th>Control Port</th> <th>Control Port</th>
<th>Interfaces</th> <th>Interfaces</th>
<th>Temporary IP</th>
<th>Created</th> <th>Created</th>
</tr> </tr>
...@@ -287,6 +295,7 @@ while ($row = mysql_fetch_array($query_result)) { ...@@ -287,6 +295,7 @@ while ($row = mysql_fetch_array($query_result)) {
$IP = $row["IP"]; $IP = $row["IP"];
$created = $row["created"]; $created = $row["created"];
$mac = $row["MAC"]; $mac = $row["MAC"];
$tempIP = $row["temporary_IP"];
if ($row["switch_id"]) { if ($row["switch_id"]) {
$port = "$row[switch_id].$row[switch_card]/$row[switch_port]"; $port = "$row[switch_id].$row[switch_card]/$row[switch_port]";
} else { } else {
...@@ -309,6 +318,7 @@ while ($row = mysql_fetch_array($query_result)) { ...@@ -309,6 +318,7 @@ while ($row = mysql_fetch_array($query_result)) {
echo " <td>$mac</td>\n"; echo " <td>$mac</td>\n";
echo " <td>$port</td>\n"; echo " <td>$port</td>\n";
echo " <td>$interfaces</td>\n"; echo " <td>$interfaces</td>\n";
echo " <td>$tempIP</td>\n";
echo " <td>$created</td>\n"; echo " <td>$created</td>\n";
echo " </tr>\n"; echo " </tr>\n";
} }
...@@ -316,7 +326,7 @@ while ($row = mysql_fetch_array($query_result)) { ...@@ -316,7 +326,7 @@ while ($row = mysql_fetch_array($query_result)) {
?> ?>
<tr> <tr>
<td align="center" colspan=9> <td align="center" colspan=10>
<input type="button" name="SelectAll" value="Select All" <input type="button" name="SelectAll" value="Select All"
onClick="selectAll(document.nodeform.elements['selected[]'])"> onClick="selectAll(document.nodeform.elements['selected[]'])">
&nbsp; &nbsp;
...@@ -327,7 +337,7 @@ while ($row = mysql_fetch_array($query_result)) { ...@@ -327,7 +337,7 @@ while ($row = mysql_fetch_array($query_result)) {
</table> </table>
<br> <h3>Actions</h3>
<table> <table>
<tr> <tr>
...@@ -336,12 +346,12 @@ while ($row = mysql_fetch_array($query_result)) { ...@@ -336,12 +346,12 @@ while ($row = mysql_fetch_array($query_result)) {
</tr> </tr>
<tr> <tr>
<th>Set Node ID Prefix</th> <th>Set Node ID Prefix (eg. 'pc')</th>
<td><input type="text" width="10" name="newprefix"></td> <td><input type="text" width="10" name="newprefix"></td>
</tr> </tr>
<tr> <tr>
<th>Add to Node ID</th> <th>Add to Node ID Suffix (integer, can be negative)</th>
<td><input type="text" width="10" name="addnumber"></td> <td><input type="text" width="10" name="addnumber"></td>
</tr> </tr>
...@@ -356,32 +366,28 @@ while ($row = mysql_fetch_array($query_result)) { ...@@ -356,32 +366,28 @@ while ($row = mysql_fetch_array($query_result)) {
<table> <table>
<tr> <tr>
<th>0</th> <th>0 -&gt;</th>
<td><input type="text" size=2 name="remap[0]"></td> <td><input type="text" size=2 name="remap[0]"></td>
</tr> </tr>
<tr> <tr>
<th>1</th> <th>1 -&gt;</th>
<td><input type="text" size=2 name="remap[1]"></td> <td><input type="text" size=2 name="remap[1]"></td>
</tr> </tr>
<tr> <tr>
<th>2</th> <th>2 -&gt;</th>
<td><input type="text" size=2 name="remap[2]"></td> <td><input type="text" size=2 name="remap[2]"></td>
</tr> </tr>
<tr> <tr>
<th>3</th> <th>3 -&gt;</th>
<td><input type="text" size=2 name="remap[3]"></td> <td><input type="text" size=2 name="remap[3]"></td>
</tr> </tr>
<tr> <tr>
<th>4</th> <th>4 -&gt;</th>
<td><input type="text" size=2 name="remap[4]"></td> <td><input type="text" size=2 name="remap[4]"></td>
</tr> </tr>
<tr> </table>
<td colspan=2>
<input type="submit" value="Re-number interfaces of selected nodes" <input type="submit" value="Re-number interfaces of selected nodes"
name="renumber"> name="renumber">
</td>
</tr>
</table>
<br><br> <br><br>
...@@ -389,7 +395,7 @@ while ($row = mysql_fetch_array($query_result)) { ...@@ -389,7 +395,7 @@ while ($row = mysql_fetch_array($query_result)) {
<br><br> <br><br>
<input type="submit" value="Swap Node IDs and IPs for selected nodes" name="swap"> <input type="submit" value="Swap Node IDs and IPs for selected nodes" name="swap">
<br><br> <br><br>
<input type="submit" value="Re-search switches for selected nodes" name="research"> <input type="submit" value="Search switch ports for selected nodes" name="research">
<br><br> <br><br>
<input type="submit" value="Create selected nodes" name="create"> <input type="submit" value="Create selected nodes" name="create">
<br><br> <br><br>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment