Commit b27efd96 authored by Leigh B. Stoller's avatar Leigh B. Stoller
Browse files

Add delete nodelog entry option in log listing.

Remove hot list for osids from big node listing to cut down on the
size of the html that gets spit out.
parent 251c1dd5
<?php
include("defs.php3");
include("showstuff.php3");
#
# Standard Testbed Header
#
PAGEHEADER("Delete a Node Log Entry");
#
# Only known and logged in users can end experiments.
#
$uid = GETLOGIN();
LOGGEDINORDIE($uid);
$isadmin = ISADMIN($uid);
#
# Must provide the IDs
#
if (!isset($node_id) ||
strcmp($node_id, "") == 0) {
USERERROR("The Node ID was not provided!", 1);
}
if (!isset($log_id) ||
strcmp($log_id, "") == 0) {
USERERROR("The Log ID was not provided!", 1);
}
#
# Only Admins can delete log entries.
#
if (! $isadmin) {
USERERROR("You do not have permission to delete log entries!", 1);
}
#
# Check to make sure that this is a valid nodeid
#
if (! TBValidNodeName($node_id)) {
USERERROR("The node $node_id is not a valid nodeid!", 1);
}
#
# We run this twice. The first time we are checking for a confirmation
# by putting up a form. The next time through the confirmation will be
# set. Or, the user can hit the cancel button, in which case we should
# probably redirect the browser back up a level.
#
if ($canceled) {
echo "<center><h2><br>
Log Entry Deletion canceled!
</h2></center>\n";
PAGEFOOTER();
return;
}
if (!$confirmed) {
echo "<center><h2><br>
Are you sure you want to delete this log entry?'
</h2>\n";
SHOWNODELOGENTRY($node_id, $log_id);
echo "<form action='deletenodelog.php3' method=post>";
echo "<input type=hidden name=node_id value='$node_id'>\n";
echo "<input type=hidden name=log_id value='$log_id'>\n";
echo "<b><input type=submit name=confirmed value=Confirm></b>\n";
echo "<b><input type=submit name=canceled value=Cancel></b>\n";
echo "</form>\n";
echo "</center>\n";
PAGEFOOTER();
return;
}
#
# Delete the record,
#
DBQueryFatal("delete from nodelog where ".
"node_id='$node_id' and log_id=$log_id");
SHOWNODELOG($node_id);
#
# New Entry option.
#
echo "<p><center>
Do you want to enter a log entry?
<A href='newnodelog_form.php3?node_id=$node_id'>Yes</a>
</center>\n";
#
# Standard Testbed Footer
#
PAGEFOOTER();
?>
......@@ -76,8 +76,7 @@ while ($row = mysql_fetch_array($query_result)) {
<td>$pid</td>
<td>$eid</td>\n";
if ($def_boot_osid)
echo "<td><A href='showosinfo.php3?osid=$def_boot_osid'>
$def_boot_osid</A></td>\n";
echo "<td>$def_boot_osid</td>\n";
else
echo "<td>&nbsp</td>\n";
......@@ -85,8 +84,7 @@ while ($row = mysql_fetch_array($query_result)) {
<td>$def_boot_cmd_line</td>\n";
if ($next_boot_osid)
echo "<td><A href='showosinfo.php3?osid=$next_boot_osid'>
$next_boot_osid</A></td>\n";
echo "<td>$next_boot_osid</td>\n";
else
echo "<td>&nbsp</td>\n";
......
......@@ -954,7 +954,7 @@ function SHOWNODE($node_id) {
}
#
# Show log
# Show log.
#
function SHOWNODELOG($node_id)
{
......@@ -979,6 +979,7 @@ function SHOWNODELOG($node_id)
echo "<table border=1 cellpadding=2 cellspacing=2 align='center'>\n";
echo "<tr>
<td align=center>Delete?</td>
<td align=center>Date</td>
<td align=center>ID</td>
<td align=center>Type</td>
......@@ -994,6 +995,9 @@ function SHOWNODELOG($node_id)
$entry = $row[entry];
echo "<tr>
<td align=center>
<A href='deletenodelog.php3?node_id=$node_id&log_id=$log_id'>
<img alt='o' src='redball.gif'></A></td>
<td>$date</td>
<td>$log_id</td>
<td>$type</td>
......@@ -1004,6 +1008,39 @@ function SHOWNODELOG($node_id)
echo "</table>\n";
}
#
# Show one log entry.
#
function SHOWNODELOGENTRY($node_id, $log_id)
{
$query_result =
DBQueryFatal("select * from nodelog where ".
"node_id='$node_id' and log_id=$log_id");
if (! mysql_num_rows($query_result)) {
return;
}
echo "<table border=1 cellpadding=2 cellspacing=2 align='center'>\n";
$row = mysql_fetch_array($query_result);
$type = $row[type];
$log_id = $row[log_id];
$reporter = $row[reporting_uid];
$date = $row[reported];
$entry = $row[entry];
echo "<tr>
<td>$date</td>
<td>$log_id</td>
<td>$type</td>
<td>$reporter</td>
<td>$entry</td>
</tr>\n";
echo "</table>\n";
}
#
# This is an included file.
#
......
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