Commit ae987100 authored by Leigh Stoller's avatar Leigh Stoller

Take the submenu code from the experiments info page, and generalize

(somewhat) so that we can do submenu easily in other pages.
parent c7a300e6
...@@ -526,4 +526,58 @@ function PAGEERROR($msg) { ...@@ -526,4 +526,58 @@ function PAGEERROR($msg) {
PAGEFOOTER(); PAGEFOOTER();
die(""); die("");
} }
#
# Sub Page/Menu Stuff
#
function WRITESUBMENUBUTTON($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";
}
#
# Start/End a page within a page.
#
function SUBPAGESTART() {
echo "<table cellspacing=2 cellpadding=2 width='85%' border=0>\n
<tr>\n
<td valign=top>\n";
}
function SUBPAGEEND() {
echo " </td>\n
</tr>\n
</table>\n";
}
#
# Start/End a sub menu, located in the upper left of the main frame.
# Note that these cannot be used outside of the SUBPAGE macros above.
#
function SUBMENUSTART($title) {
echo " <table cellspacing=2 cellpadding=2 border=0 width=200>\n
<tr>\n
<td align=center><b>$title</b></td>\n
</tr>\n
<tr></tr>\n";
}
function SUBMENUEND() {
echo " </table>\n
</td>\n
<td valign=top align=left width='85%'>\n";
}
?> ?>
...@@ -43,47 +43,26 @@ if (! TBExptAccessCheck($uid, $exp_pid, $exp_eid, $TB_EXPT_READINFO)) { ...@@ -43,47 +43,26 @@ if (! TBExptAccessCheck($uid, $exp_pid, $exp_eid, $TB_EXPT_READINFO)) {
USERERROR("You do not have permission to view experiment $exp_eid!", 1); USERERROR("You do not have permission to view experiment $exp_eid!", 1);
} }
function WRITESIDEBARSUBBUTTON($text, $link) { SUBPAGESTART();
echo "<!-- Table row for button $text --> SUBMENUSTART("Experiment Options");
<tr> WRITESUBMENUBUTTON("View NS File and Node Assignment",
<td valign=center align=left nowrap> "shownsfile.php3?pid=$exp_pid&eid=$exp_eid");
<b> WRITESUBMENUBUTTON("Terminate this experiment",
<a class=sidebarbutton href='$link'>$text</a>\n"; "endexp.php3?pid=$exp_pid&eid=$exp_eid");
#
# XXX these blanks look bad in lynx, but add required
# spacing between menu and body
#
echo " &nbsp;&nbsp;\n";
echo " </b>
</td>
</tr>\n";
}
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 Node Assignment",
"shownsfile.php3?pid=$exp_pid&eid=$exp_eid");
WRITESIDEBARSUBBUTTON("Terminate this experiment",
"endexp.php3?pid=$exp_pid&eid=$exp_eid");
# Swap option. # Swap option.
$expstate = TBExptState($exp_pid, $exp_eid); $expstate = TBExptState($exp_pid, $exp_eid);
if ($expstate) { if ($expstate) {
if (strcmp($expstate, $TB_EXPTSTATE_SWAPPED) == 0) { if (strcmp($expstate, $TB_EXPTSTATE_SWAPPED) == 0) {
WRITESIDEBARSUBBUTTON("Swap this Experiment in", WRITESUBMENUBUTTON("Swap this Experiment in",
"swapexp.php3?inout=in&pid=$exp_pid&eid=$exp_eid"); "swapexp.php3?inout=in&pid=$exp_pid&eid=$exp_eid");
WRITESIDEBARSUBBUTTON("Graphic Visualization of Topology", WRITESUBMENUBUTTON("Graphic Visualization of Topology",
"vistopology.php3?pid=$exp_pid&eid=$exp_eid"); "vistopology.php3?pid=$exp_pid&eid=$exp_eid");
} }
elseif (strcmp($expstate, $TB_EXPTSTATE_ACTIVE) == 0) { elseif (strcmp($expstate, $TB_EXPTSTATE_ACTIVE) == 0) {
WRITESIDEBARSUBBUTTON("Swap this Experiment out", WRITESUBMENUBUTTON("Swap this Experiment out",
"swapexp.php3?inout=out&pid=$exp_pid&eid=$exp_eid"); "swapexp.php3?inout=out&pid=$exp_pid&eid=$exp_eid");
WRITESIDEBARSUBBUTTON("Graphic Visualization of Topology", WRITESUBMENUBUTTON("Graphic Visualization of Topology",
"vistopology.php3?pid=$exp_pid&eid=$exp_eid"); "vistopology.php3?pid=$exp_pid&eid=$exp_eid");
} }
} }
...@@ -92,21 +71,17 @@ if ($expstate) { ...@@ -92,21 +71,17 @@ if ($expstate) {
# Admin folks get a swap request link to send email. # Admin folks get a swap request link to send email.
# #
if (ISADMIN($uid)) { if (ISADMIN($uid)) {
WRITESIDEBARSUBBUTTON("Send a swap/terminate request", WRITESUBMENUBUTTON("Send a swap/terminate request",
"request_swapexp.php3?&pid=$exp_pid&eid=$exp_eid"); "request_swapexp.php3?&pid=$exp_pid&eid=$exp_eid");
} }
echo " </table>\n"; SUBMENUEND();
echo " </td>\n";
echo " <td valign=top align=left width='85%'>\n";
# #
# Dump experiment record. # Dump experiment record.
# #
SHOWEXP($exp_pid, $exp_eid); SHOWEXP($exp_pid, $exp_eid);
echo " </td>\n"; SUBPAGEEND();
echo " </tr>\n";
echo "</table>\n";
# #
# Dump the node information. # Dump the node information.
......
...@@ -57,9 +57,23 @@ if (!$isadmin) { ...@@ -57,9 +57,23 @@ if (!$isadmin) {
} }
} }
SHOWGROUP($pid, $gid); SUBPAGESTART();
SUBMENUSTART("Group Options");
WRITESUBMENUBUTTON("Edit this Group",
"editgroup_form.php3?pid=$pid&gid=$gid");
#
# A delete option, but not for the default group!
#
if (strcmp($gid, $pid)) {
WRITESUBMENUBUTTON("Delete this Group",
"deletegroup.php3?pid=$pid&gid=$gid");
}
SUBMENUEND();
SHOWGROUP($pid, $gid);
SHOWGROUPMEMBERS($pid, $gid); SHOWGROUPMEMBERS($pid, $gid);
SUBPAGEEND();
# #
# A list of Group experiments. # A list of Group experiments.
...@@ -88,23 +102,6 @@ if (mysql_num_rows($query_result)) { ...@@ -88,23 +102,6 @@ if (mysql_num_rows($query_result)) {
echo "</table>\n"; echo "</table>\n";
} }
#
# An edit option.
#
echo "<br>
<center>
<A href='editgroup_form.php3?pid=$pid&gid=$gid'>Edit</a> this Group?
</center>\n";
#
# A delete option, but not for the default group!
#
if (strcmp($gid, $pid)) {
echo "<p>
<A href='deletegroup.php3?pid=$pid&gid=$gid'>Delete</a> this Group?
\n";
}
# #
# Standard Testbed Footer # Standard Testbed Footer
# #
......
...@@ -18,8 +18,11 @@ function SHOWPROJECT($pid, $thisuid) { ...@@ -18,8 +18,11 @@ function SHOWPROJECT($pid, $thisuid) {
} }
$row = mysql_fetch_array($query_result); $row = mysql_fetch_array($query_result);
echo "<table align=center border=1>\n"; echo "<center>
<h3>Project Profile</h3>
</center>
<table align=center border=1>\n";
$proj_created = $row[created]; $proj_created = $row[created];
$proj_expires = $row[expires]; $proj_expires = $row[expires];
$proj_name = $row[name]; $proj_name = $row[name];
......
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