deletenodelog.php3 2 KB
Newer Older
1
<?php
Leigh Stoller's avatar
Leigh Stoller committed
2 3
#
# EMULAB-COPYRIGHT
4
# Copyright (c) 2000-2007 University of Utah and the Flux Group.
Leigh Stoller's avatar
Leigh Stoller committed
5 6
# All rights reserved.
#
7
include("defs.php3");
8
include_once("node_defs.php");
9 10 11 12 13 14 15 16 17

#
# Standard Testbed Header
#
PAGEHEADER("Delete a Node Log Entry");

#
# Only known and logged in users can end experiments.
#
18 19 20
$this_user = CheckLoginOrDie();
$uid       = $this_user->uid();
$isadmin   = ISADMIN();
21 22

#
23 24 25 26 27 28
# Verify page arguments.
#
$reqargs = RequiredPageArguments("node", PAGEARG_NODE,
				 "log_id", PAGEARG_STRING);
$optargs = OptionalPageArguments("canceled", PAGEARG_BOOLEAN,
				 "confirmed", PAGEARG_BOOLEAN);
29 30 31 32

#
# Only Admins can delete log entries.
#
33
if (! ($isadmin || OPSGUY())) {
34 35 36
    USERERROR("You do not have permission to delete log entries!", 1);
}

37 38
# Need these below
$node_id = $node->node_id();
39 40 41 42 43 44 45

#
# 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.
#
46
if (isset($canceled) && $canceled) {
47 48 49 50 51 52 53 54
    echo "<center><h2><br>
          Log Entry Deletion canceled!
          </h2></center>\n";
    
    PAGEFOOTER();
    return;
}

55
if (!isset($confirmed)) {
56 57 58 59
    echo "<center><h2><br>
          Are you sure you want to delete this log entry?'
          </h2>\n";

60 61 62
    $node->ShowLogEntry($log_id);

    $url = CreateURL("deletenodelog", $node, "log_id", $log_id);
63
    
64
    echo "<form action='$url' method=post>";
65 66 67 68 69 70 71 72 73 74 75 76
    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,
#
77 78
$node->DeleteNodeLog($log_id);
$node->ShowLog();
79 80 81 82

#
# New Entry option.
#
83
$url = CreateURL("newnodelog_form", $node);
84 85
echo "<p><center>
           Do you want to enter a log entry?
86
           <A href='$url'>Yes</a>
87 88 89 90 91 92 93
         </center>\n";

#
# Standard Testbed Footer
# 
PAGEFOOTER();
?>