shownodehistory.php3 1.94 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
<?php
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2005 University of Utah and the Flux Group.
# All rights reserved.
#
include("defs.php3");
include("showstuff.php3");

#
# Standard Testbed Header
#
PAGEHEADER("Node History");

#
# Only known and logged in users can do this.
#
$uid = GETLOGIN();
LOGGEDINORDIE($uid);
$isadmin = ISADMIN($uid);

if (!$isadmin) {
    USERERROR("Cannot view node history.", 1);
}

#
# Verify form arguments.
# 
if (!isset($showall)) {
    $showall = 0;
}
32 33 34 35 36 37
if (!isset($count)) {
    $count = 20;
}
if (!isset($reverse)) {
    $reverse = 1;
}
38 39 40 41 42 43 44 45 46 47 48 49

if (!isset($node_id) || strcmp($node_id, "") == 0) {
    $node_id = "";
} else {
    #
    # Check to make sure that this is a valid nodeid
    #
    if (!TBValidNodeName($node_id)) {
	USERERROR("$node_id is not a valid node name!", 1);
    }
}

50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86
$opts="node_id=$node_id&count=$count&reverse=$reverse";
echo "<b>Show records: ";
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";
}
87

88
SHOWNODEHISTORY($node_id, $showall, $count, $reverse);
89 90 91 92 93 94

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