Commit 5706e999 authored by Leigh Stoller's avatar Leigh Stoller

Search improvements (search by node and ip).

parent f188a552
......@@ -238,6 +238,20 @@ class Node
return 0;
}
function IsRemote() {
$type = $this->type();
$query_result =
DBQueryFatal("select isremotenode from node_types ".
"where type='$type'");
if (mysql_num_rows($query_result) == 0) {
return 0;
}
$row = mysql_fetch_array($query_result);
return $row["isremotenode"];
}
function NodeStatus() {
$node_id = $this->node_id();
......@@ -1334,13 +1348,13 @@ function ShowNodeHistory($node = null,
$opt .= "r";
}
if ($count) {
$opt .= " -n $count";
$opt .= " -n $count";
}
if ($date) {
$opt = " -d " . escapeshellarg($date);
$opt .= " -d " . escapeshellarg($date);
}
if ($IP) {
$opt = " -i " . escapeshellarg($IP);
$opt .= " -i " . escapeshellarg($IP);
}
if ($fp = popen("$TBSUEXEC_PATH nobody nobody ".
" webnode_history $opt $node_id", "r")) {
......@@ -1355,9 +1369,10 @@ function ShowNodeHistory($node = null,
$str History for All Nodes.
</b></center><br>\n";
} else {
$node_url = CreateURL("shownode", URLARG_NODEID, $node_id);
echo "<br>
<center><b>
$str History for Node $node_id.
$str History for Node <a href='$node_url'>$node_id</a>.
</b></center><br>\n";
}
......
......@@ -55,7 +55,7 @@ if (isset($IP)) {
# is a virtual node. We are going to pass IP through to the
# backend in either case.
#
if ($node && $node->isremotenode()) {
if ($node && $node->IsRemote()) {
unset($node);
}
}
......@@ -109,18 +109,40 @@ if ($count != 0) {
if ($datetime == "") {
$datetime = "mm/dd/yy HH:MM";
}
echo "<br>";
echo "<table class=stealth>\n";
# Only display search form for a specific node.
if ($node_id != "") {
echo "<br>";
echo "<form action=shownodehistory.php3?$opts method=post>
<b>Show Datetime:</b>
<input type=text
echo "<tr><form action=shownodehistory.php3?$opts method=get>
<td class=stealth><b>Show Datetime:</b>
<input type=text style=\"float:right\"
name=datetime
size=20
value=\"$datetime\">
<b><input type=submit name=search value=Search></b>\n";
echo "</form><br><br>\n";
}
value=\"$datetime\"></td>
<td class=stealth>
<b><input type=submit name=search1 value=Search></b></td>\n";
echo "</form></tr>\n";
}
echo "<tr><form action=shownodehistory.php3 method=get>
<td class=stealth><b>Search for Node:</b>
<input type=text align=right
name=node_id
size=20
value=\"$node_id\"></td>
<td class=stealth>
<b><input type=submit name=search2 value=Search></b></td>\n";
echo "</form></tr>\n";
echo "<tr><form action=shownodehistory.php3 method=get>
<td class=stealth><b>Search for IP:</b>
<input type=text style=\"float:right\"
name=IP
size=20
value=\"$IP\"></td>
<td class=stealth>
<b><input type=submit name=search3 value=Search></b></td>\n";
echo "</form></tr>\n";
echo "</table><br>\n";
if ($node_id != "" && $datetime != "" && $datetime != "mm/dd/yy HH:MM") {
if (strtotime($datetime)) {
......
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