showexp.php3 2.76 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
$expstate = TBExptState($exp_pid, $exp_eid);
47
48
SUBPAGESTART();
SUBMENUSTART("Experiment Options");
49

50
if ($expstate) {
51
    if (strcmp($expstate, $TB_EXPTSTATE_ACTIVE) == 0) {
Jay Lepreau's avatar
Jay Lepreau committed
52
	WRITESUBMENUBUTTON("Visualization, NS File, Mapping",
53
54
55
			   "shownsfile.php3?pid=$exp_pid&eid=$exp_eid");
    }
    elseif (strcmp($expstate, $TB_EXPTSTATE_SWAPPED) == 0) {
Jay Lepreau's avatar
Jay Lepreau committed
56
	WRITESUBMENUBUTTON("Visualization and NS File",
57
58
59
60
61
62
63
64
			   "shownsfile.php3?pid=$exp_pid&eid=$exp_eid");
    }
    else {
	WRITESUBMENUBUTTON("View NS File",
			   "shownsfile.php3?pid=$exp_pid&eid=$exp_eid");
    }

    # Swap option.
65
    if (strcmp($expstate, $TB_EXPTSTATE_SWAPPED) == 0) {
66
	WRITESUBMENUBUTTON("Swap this Experiment in",
67
		      "swapexp.php3?inout=in&pid=$exp_pid&eid=$exp_eid");
68
69
    }
    elseif (strcmp($expstate, $TB_EXPTSTATE_ACTIVE) == 0) {
70
	WRITESUBMENUBUTTON("Swap this Experiment out",
71
		      "swapexp.php3?inout=out&pid=$exp_pid&eid=$exp_eid");
72
73
74
    }
}

75
76
77
WRITESUBMENUBUTTON("Terminate this experiment",
		   "endexp.php3?pid=$exp_pid&eid=$exp_eid");

78
79
80
81
82
83
84
85
#
# Admin and project/experiment leader get this option.
#
if (TBExptAccessCheck($uid, $exp_pid, $exp_eid, $TB_EXPT_UPDATEACCOUNTS)) {
    WRITESUBMENUBUTTON("Update Mounts/Accounts",
		       "updateaccounts.php3?pid=$exp_pid&eid=$exp_eid");
}

86
87
88
89
#
# Admin folks get a swap request link to send email.
#
if (ISADMIN($uid)) {
90
    WRITESUBMENUBUTTON("Send a swap/terminate request",
91
			  "request_swapexp.php3?&pid=$exp_pid&eid=$exp_eid");
92
}
93
SUBMENUEND();
94
95
96
97
98
99

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

100
SUBPAGEEND();
101
102
103
104
105
106

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

107
108
109
110
111
112
113
114
115
116
117
if ($expstate &&
    (strcmp($expstate, $TB_EXPTSTATE_SWAPPING) == 0 ||
     strcmp($expstate, $TB_EXPTSTATE_ACTIVATING) == 0)) {

    echo "<script language=\"JavaScript\">
              <!--
	          doLoad(30000);
              //-->
          </script>\n";
}

118
119
120
121
#
# Standard Testbed Footer
# 
PAGEFOOTER();
122
?>