Commit 32beb94b authored by Mike Hibler's avatar Mike Hibler

Dinks. I'm done dinkin now. Really.

parent dee46d59
...@@ -29,6 +29,12 @@ if (!$isadmin) { ...@@ -29,6 +29,12 @@ if (!$isadmin) {
if (!isset($showall)) { if (!isset($showall)) {
$showall = 0; $showall = 0;
} }
if (!isset($count)) {
$count = 20;
}
if (!isset($reverse)) {
$reverse = 1;
}
if (!isset($node_id) || strcmp($node_id, "") == 0) { if (!isset($node_id) || strcmp($node_id, "") == 0) {
$node_id = ""; $node_id = "";
...@@ -41,11 +47,45 @@ if (!isset($node_id) || strcmp($node_id, "") == 0) { ...@@ -41,11 +47,45 @@ if (!isset($node_id) || strcmp($node_id, "") == 0) {
} }
} }
echo "<b>Show: $opts="node_id=$node_id&count=$count&reverse=$reverse";
<a href='shownodehistory.php3?node_id=$node_id'>allocated only</a>, echo "<b>Show records: ";
<a href='shownodehistory.php3?node_id=$node_id&showall=1'>all</a>"; if ($showall) {
echo "<a href='shownodehistory.php3?$opts'>allocated only</a>,
all";
} else {
echo "allocated only,
<a href='shownodehistory.php3?$opts&showall=1'>all</a>";
}
$opts="node_id=$node_id&count=$count&showall=$showall";
echo "<br><b>Order by: ";
if ($reverse == 0) {
echo "<a href='shownodehistory.php3?$opts&reverse=1'>lastest first</a>,
earliest first";
} else {
echo "lastest first,
<a href='shownodehistory.php3?$opts&reverse=0'>earliest first</a>";
}
$opts="node_id=$node_id&showall=$showall&reverse=$reverse";
echo "<br><b>Show number: ";
if ($count != 20) {
echo "<a href='shownodehistory.php3?$opts&count=20'>first 20</a>, ";
} else {
echo "first 20, ";
}
if ($count != -20) {
echo "<a href='shownodehistory.php3?$opts&count=-20'>last 20</a>, ";
} else {
echo "last 20, ";
}
if ($count != 0) {
echo "<a href='shownodehistory.php3?$opts&count=0'>all</a>";
} else {
echo "all";
}
SHOWNODEHISTORY($node_id, $showall); SHOWNODEHISTORY($node_id, $showall, $count, $reverse);
# #
# Standard Testbed Footer # Standard Testbed Footer
......
...@@ -2216,13 +2216,14 @@ function SHOWNODE($node_id, $flags = 0) { ...@@ -2216,13 +2216,14 @@ function SHOWNODE($node_id, $flags = 0) {
# #
# Show history. # Show history.
# #
function SHOWNODEHISTORY($node_id, $showall = 0) function SHOWNODEHISTORY($node_id, $showall = 0, $count = 20, $reverse = 1)
{ {
global $TBSUEXEC_PATH; global $TBSUEXEC_PATH;
$atime = 0; $atime = 0;
$ftime = 0; $ftime = 0;
$rtime = 0; $rtime = 0;
$dtime = 0; $dtime = 0;
$nodestr = "";
$opt = "-ls"; $opt = "-ls";
if (!$showall) { if (!$showall) {
...@@ -2230,6 +2231,13 @@ function SHOWNODEHISTORY($node_id, $showall = 0) ...@@ -2230,6 +2231,13 @@ function SHOWNODEHISTORY($node_id, $showall = 0)
} }
if ($node_id == "") { if ($node_id == "") {
$opt .= "A"; $opt .= "A";
$nodestr = "<th>Node</th>";
}
if ($reverse) {
$opt .= "r";
}
if ($count) {
$opt .= " -n $count";
} }
if ($fp = popen("$TBSUEXEC_PATH nobody nobody webnodehistory $opt $node_id", "r")) { if ($fp = popen("$TBSUEXEC_PATH nobody nobody webnodehistory $opt $node_id", "r")) {
if (!$showall) { if (!$showall) {
...@@ -2237,14 +2245,22 @@ function SHOWNODEHISTORY($node_id, $showall = 0) ...@@ -2237,14 +2245,22 @@ function SHOWNODEHISTORY($node_id, $showall = 0)
} else { } else {
$str = ""; $str = "";
} }
if ($node_id == "") {
echo "<br>
<center>
$str History for All Nodes.
</center><br>\n";
} else {
echo "<br> echo "<br>
<center> <center>
$str History for Node $node_id. $str History for Node $node_id.
</center><br>\n"; </center><br>\n";
}
echo "<table border=1 cellpadding=2 cellspacing=2 align='center'>\n"; echo "<table border=1 cellpadding=2 cellspacing=2 align='center'>\n";
echo "<tr> echo "<tr>
$nodestr
<th>Pid</th> <th>Pid</th>
<th>Eid</th> <th>Eid</th>
<th>Allocated By</th> <th>Allocated By</th>
...@@ -2295,13 +2311,24 @@ function SHOWNODEHISTORY($node_id, $showall = 0) ...@@ -2295,13 +2311,24 @@ function SHOWNODEHISTORY($node_id, $showall = 0)
} else { } else {
$eid = $results[6]; $eid = $results[6];
} }
if ($node_id == "") {
echo "<tr> echo "<tr>
<td>$nodeid</td>
<td>$pid</td> <td>$pid</td>
<td>$eid</td> <td>$eid</td>
<td>$uid</td> <td>$uid</td>
<td>$datestr</td> <td>$datestr</td>
<td>$durstr</td> <td>$durstr</td>
</tr>\n"; </tr>\n";
} else {
echo "<tr>
<td>$pid</td>
<td>$eid</td>
<td>$uid</td>
<td>$datestr</td>
<td>$durstr</td>
</tr>\n";
}
} }
$line = fgets($fp, 1024); $line = fgets($fp, 1024);
} }
......
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