showexp.php3 2.71 KB
Newer Older
Leigh B. Stoller's avatar
Leigh B. Stoller committed
1
2
<?php
include("defs.php3");
3
include("showstuff.php3");
Leigh B. Stoller's avatar
Leigh B. Stoller committed
4

5
6
7
8
9
#
# Standard Testbed Header
#
PAGEHEADER("Show Experiment Information");

10
11
12
#
# Only known and logged in users can end experiments.
#
13
$uid = GETLOGIN();
14
LOGGEDINORDIE($uid);
Leigh B. Stoller's avatar
Leigh B. Stoller committed
15
16

#
Leigh B. Stoller's avatar
Leigh B. Stoller committed
17
# Verify page arguments.
18
# 
Leigh B. Stoller's avatar
Leigh B. Stoller committed
19
20
21
if (!isset($pid) ||
    strcmp($pid, "") == 0) {
    USERERROR("You must provide a Project ID.", 1);
22
23
}

Leigh B. Stoller's avatar
Leigh B. Stoller committed
24
25
26
27
28
29
if (!isset($eid) ||
    strcmp($eid, "") == 0) {
    USERERROR("You must provide an Experiment ID.", 1);
}
$exp_eid = $eid;
$exp_pid = $pid;
30

Leigh B. Stoller's avatar
Leigh B. Stoller committed
31
#
Leigh B. Stoller's avatar
Leigh B. Stoller committed
32
# Check to make sure this is a valid PID/EID tuple.
Leigh B. Stoller's avatar
Leigh B. Stoller committed
33
#
34
if (! TBValidExperiment($exp_pid, $exp_eid)) {
35
36
  USERERROR("The experiment $exp_eid is not a valid experiment ".
            "in project $exp_pid.", 1);
Leigh B. Stoller's avatar
Leigh B. Stoller committed
37
38
}

39
#
Leigh B. Stoller's avatar
Leigh B. Stoller committed
40
# Verify Permission.
41
#
Leigh B. Stoller's avatar
Leigh B. Stoller committed
42
43
if (! TBExptAccessCheck($uid, $exp_pid, $exp_eid, $TB_EXPT_READINFO)) {
    USERERROR("You do not have permission to view experiment $exp_eid!", 1);
Leigh B. Stoller's avatar
Leigh B. Stoller committed
44
45
}

46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
function WRITESIDEBARSUBBUTTON($text, $link) {
    echo "<!-- Table row for button $text -->
          <tr>
            <td valign=center align=left nowrap>
                <b>
         	 <a class=sidebarbutton href='$link'>$text</a>\n";
    #
    # XXX these blanks look bad in lynx, but add required
    #     spacing between menu and body
    #
    echo "       &nbsp;&nbsp;\n";

    echo "      </b>
            </td>
          </tr>\n";
}
62

63
64
65
66
67
68
69
70
71
72
echo "<table cellspacing=2 cellpadding=2 width='85%' border=0>\n";
echo "<tr>\n";
echo "   <td valign=top>\n";
echo "       <table cellspacing=2 cellpadding=2 border=0 width=200>\n";
echo "         <tr><td align=center><b>Experiment Options</b></td></tr>\n";
echo "         <tr></tr>\n";
WRITESIDEBARSUBBUTTON("View NS File and Assignment",
		      "shownsfile.php3?pid=$exp_pid&eid=$exp_eid");
WRITESIDEBARSUBBUTTON("Terminate this experiment",
		      "endexp.php3?pid=$exp_pid&eid=$exp_eid");
73

74
75
76
77
# Swap option.
$expstate = TBExptState($exp_pid, $exp_eid);
if ($expstate) {
    if (strcmp($expstate, $TB_EXPTSTATE_SWAPPED) == 0) {
78
79
	WRITESIDEBARSUBBUTTON("Swap this Experiment in",
		      "swapexp.php3?inout=in&pid=$exp_pid&eid=$exp_eid");
80
81
    }
    elseif (strcmp($expstate, $TB_EXPTSTATE_ACTIVE) == 0) {
82
83
	WRITESIDEBARSUBBUTTON("Swap this Experiment out",
		      "swapexp.php3?inout=out&pid=$exp_pid&eid=$exp_eid");
84
85
86
    }
}

87
88
89
90
#
# Admin folks get a swap request link to send email.
#
if (ISADMIN($uid)) {
91
92
    WRITESIDEBARSUBBUTTON("Send a swap/terminate request",
			  "request_swapexp.php3?&pid=$exp_pid&eid=$exp_eid");
93
}
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
echo "       </table>\n";
echo "   </td>\n";
echo "   <td valign=top align=left width='85%'>\n";

#
# Dump experiment record.
# 
SHOWEXP($exp_pid, $exp_eid);

echo "   </td>\n";
echo "</table>\n";

#
# Dump the node information.
#
SHOWNODES($exp_pid, $exp_eid);

111
112
113
114
#
# Standard Testbed Footer
# 
PAGEFOOTER();
115
?>