Commit ecab2742 authored by Leigh Stoller's avatar Leigh Stoller

A set of cosmetic changes. Actually one consmetic changes in a lot of

places. I refactored the "busy" logo stuff that is done in various
scripts in various formats into a couple of functions. I have not
changed all the code that does the busy thing, but I got a bunch this
time around. In menu.php I added a couple of functions (that spit out
little bits of javascript).

	STARTBUSY($msg)

	Display a centered message (ie: "Starting Swapout"), then a
	plead to be patient, and then the "busy" icon (spinning thing
	that my Mac does too).


	STOPBUSY();

	Clear the busy icon, and replace "Working ..." with "Done"


	CLEARBUSY();

	Clear the busy icon and delete "Working ..."


	PAGEREPLACE($url)

	Delay one second and then replace the current page with the
	new page.
parent b4fbf971
<?php
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2003 University of Utah and the Flux Group.
# Copyright (c) 2000-2003, 2006 University of Utah and the Flux Group.
# All rights reserved.
#
include("defs.php3");
......@@ -91,31 +91,16 @@ if (!$confirmed) {
#
TBGroupUnixInfo($pid, $pid, $unix_gid, $unix_name);
echo "<br>
Group '$gid' in project '$pid' is being removed!<br><br>
This will take a minute or two. <b>Please</b> do not click the Stop
button during this time. If you do not receive notification within
a reasonable amount of time, please contact $TBMAILADDR.<br>\n";
flush();
STARTBUSY("Group '$gid' in project '$pid' is being removed!");
#
# Run the script. They will remove the group directory and the unix group,
# and the DB state.
#
SUEXEC($uid, $unix_gid, "webrmgroup $pid $gid", 1);
SUEXEC($uid, $unix_gid, "webrmgroup $pid $gid", SUEXEC_ACTION_DIE);
STOPBUSY();
#
# Warm fuzzies.
#
echo "<br>
<b>Done!</b>
<br>\n";
#
# Back to ...
#
echo "<br>
<A href='showproject.php3?pid=$pid'>Back to Project page</a>\n";
PAGEREPLACE("showproject.php3?pid=$pid");
#
# Standard Testbed Footer
......
<?php
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2003 University of Utah and the Flux Group.
# Copyright (c) 2000-2003, 2006 University of Utah and the Flux Group.
# All rights reserved.
#
include("defs.php3");
......@@ -235,14 +235,7 @@ if (!$confirmed_twice) {
return;
}
echo "<br>
User '$target_uid' is being removed" .
(isset($target_pid) ? " from project '$target_pid' " : "") .
"!<br><br>
This will take a minute or two. <b>Please</b> do not click the Stop
button during this time. If you do not receive notification within
a reasonable amount of time, please contact $TBMAILADDR.<br>\n";
flush();
STARTBUSY("User '$target_uid' is being removed!");
#
# All the real work is done in the script.
......@@ -250,12 +243,9 @@ flush();
SUEXEC($uid, $TBADMINGROUP,
"webrmuser " . (isset($target_pid) ? "-p $target_pid " : " ") .
"$target_uid",
1);
SUEXEC_ACTION_DIE);
#
# Warm fuzzies.
#
echo "<br><br><b>Done</b><br><br>\n";
STOPBUSY();
#
# If a user was removed from a project, and that user no longer has
......
/*
* Some utility stuff.
*/
/* Clear the various 'loading' indicators. */
function ClearLoadingIndicators(done_msg)
{
var busyimg = document.getElementById('busy');
var loadingspan = document.getElementById('loading');
loadingspan.innerHTML = done_msg;
busyimg.style.display = "none";
busyimg.src = "1px.gif";
}
function ClearBusyIndicators(done_msg)
{
ClearLoadingIndicators(done_msg);
}
/* Replace the current page */
function PageReplace(URL)
{
window.location.replace(URL);
}
<?php
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2003 University of Utah and the Flux Group.
# Copyright (c) 2000-2003, 2006 University of Utah and the Flux Group.
# All rights reserved.
#
include("defs.php3");
......@@ -146,25 +146,19 @@ if (!$confirmed_twice) {
return;
}
echo "<br>
User '$target_uid' is being ${tag}!<br><br>
This will take a minute or two. <b>Please</b> do not click the Stop
button during this time. If you do not receive notification within
a reasonable amount of time, please contact $TBMAILADDR.\n";
flush();
DBQueryFatal("update users set status='$dbaction' ".
"where uid='$target_uid'");
STARTBUSY("User '$target_uid' is being ${tag}!");
#
# All the real work is done in the script.
#
SUEXEC($uid, $TBADMINGROUP, "webtbacct $action $target_uid", 1);
SUEXEC($uid, $TBADMINGROUP, "webtbacct $action $target_uid",
SUEXEC_ACTION_DIE);
#
# Warm fuzzies.
#
echo "<br><br><b>Done</b><br>\n";
/* Clear indicators */
STOPBUSY();
#
# Standard Testbed Footer
......
......@@ -11,6 +11,7 @@ $drewheader = 0;
$noheaders = 0;
$autorefresh = 0;
$currentusage = 1;
$currently_busy = 0;
$bodyclosestring = "";
#
......@@ -263,11 +264,10 @@ function WRITESIDEBAR() {
}
}
?>
<script type='text/javascript' language='javascript' src='textbox.js'></script>
<h3 class="menuheader">Information</h3>
<ul class="menu">
<?php
echo "<script type='text/javascript' language='javascript'
src='${BASEPATH}/textbox.js'></script>\n";
echo "<h3 class=menuheader>Information</h3><ul class=menu>\n";
if (0 == strcasecmp($THISHOMEBASE, "emulab.net")) {
$rootEmulab = 1;
} else {
......@@ -708,6 +708,9 @@ function PAGEBEGINNING( $title, $nobanner = 0, $nocontent = 0,
if ($autorefresh) {
echo "<meta HTTP-EQUIV=\"Refresh\" CONTENT=\"$autorefresh\">\n";
}
echo "<script type='text/javascript' language='javascript'
src='${BASEPATH}/emulab_sup.js'></script>\n";
if (! $nobanner ) {
echo "<map name=overlaymap>
<area shape=rect coords=\"100,60,339,100\"
......@@ -895,7 +898,12 @@ function ENDPAGE() {
#
function PAGEFOOTER($view = NULL) {
global $TBDOCBASE, $TBMAILADDR, $THISHOMEBASE, $BASEPATH, $TBBASE;
global $TBMAINSITE, $SSL_PROTOCOL, $bodyclosestring;
global $TBMAINSITE, $SSL_PROTOCOL, $bodyclosestring; $currently_busy;
if ($currently_busy) {
CLEARBUSY();
$currently_busy = 0;
}
if (!$view) {
$view = GETUSERVIEW();
......@@ -953,8 +961,9 @@ function PAGEFOOTER($view = NULL) {
function PAGEERROR($msg) {
global $drewheader, $noheaders;
if (! $drewheader && ! $noheaders)
if (! $drewheader && ! $noheaders) {
PAGEHEADER("Page Error");
}
echo "$msg\n";
......@@ -1078,4 +1087,57 @@ function GETUSERVIEW() {
}
}
function STARTBUSY($msg) {
global $currently_busy;
# Allow for a repeated call; Do nothing.
if ($currently_busy)
return;
echo "<center>\n";
echo "<b>$msg</b> ...<br>\n";
echo "This will take a few moments; please be <em>patient</em>.<br>\n";
echo "<br>\n";
echo "<img id='busy' src='busy.gif'>".
"<span id='loading'> Working ...</span>";
echo "<br><br>\n";
echo "</center>\n";
flush();
$currently_busy = 1;
}
function STOPBUSY() {
global $currently_busy;
if (!$currently_busy)
return;
echo "<script type='text/javascript' language='javascript'>\n";
echo "ClearBusyIndicators('<center><b>Done!</b></center>');\n";
echo "</script>\n";
flush();
$currently_busy = 0;
sleep(1);
}
function CLEARBUSY() {
global $currently_busy;
if (!$currently_busy)
return;
echo "<script type='text/javascript' language='javascript'>\n";
echo "ClearBusyIndicators('');\n";
echo "</script>\n";
flush();
$currently_busy = 0;
}
function PAGEREPLACE($newpage) {
echo "<script type='text/javascript' language='javascript'>\n";
echo "PageReplace('$newpage');\n";
echo "</script>\n";
flush();
}
?>
<?php
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2003, 2005 University of Utah and the Flux Group.
# Copyright (c) 2000-2003, 2005, 2006 University of Utah and the Flux Group.
# All rights reserved.
#
include("defs.php3");
......@@ -617,6 +617,8 @@ if (count($errors)) {
return;
}
PAGEHEADER("Modify User Information");
$usr_name = addslashes($formfields[usr_name]);
$usr_email = $formfields[usr_email];
$password1 = $formfields[password1];
......@@ -664,6 +666,8 @@ if (strcmp($usr_email, $dbusr_email)) {
"where uid='$target_uid'");
}
STARTBUSY("Making user profile changes");
#
# Now see if the user is requesting to change the password. We checked
# them above when the form was submitted.
......@@ -719,7 +723,8 @@ if ((isset($password1) && strcmp($password1, "")) &&
}
}
elseif (HASREALACCOUNT($uid) && HASREALACCOUNT($target_uid)) {
SUEXEC($uid, "nobody", "webtbacct passwd $target_uid", 1);
SUEXEC($uid, "nobody", "webtbacct passwd $target_uid",
SUEXEC_ACTION_DIE);
}
}
......@@ -843,10 +848,16 @@ if (strcmp($defaults[usr_name], $formfields[usr_name]) ||
}
}
STOPBUSY();
#
# Spit out a redirect so that the history does not include a post
# in it. The back button skips over the post and to the form.
#
header("Location: showuser.php3?target_uid=$target_uid#PROFILE");
PAGEREPLACE("showuser.php3?target_uid=$target_uid#PROFILE");
#
# Standard Testbed Footer
#
PAGEFOOTER();
?>
......@@ -47,12 +47,8 @@ function GetPNodes_cb(data) {
function ml_loadFinished() {
clearInterval(upInterval);
var busyimg = document.getElementById('busy');
var loadingspan = document.getElementById('loading');
ClearLoadingIndicators("<center><b>Done!</b></center>");
loadingspan.innerHTML = "";
busyimg.style.display = "none";
busyimg.src = "1px.gif";
nextState = LOG_STATE_LOADED;
}
......
<?php
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2005 University of Utah and the Flux Group.
# Copyright (c) 2000-2006 University of Utah and the Flux Group.
# All rights reserved.
#
include("defs.php3");
include("showstuff.php3");
#
# No header since we issue a redirect later.
# Standard Header
#
#
# Standard Testbed Header
#
PAGEHEADER("Create a Project Group");
ignore_user_abort(1);
#
......@@ -133,6 +138,8 @@ DBQueryFatal("INSERT INTO group_stats ".
#
TBGroupUnixInfo($group_pid, $group_pid, $unix_gid, $unix_name);
STARTBUSY("Creating project group $group_id.");
#
# Run the script. This will make the group directory, set the perms, etc.
#
......@@ -144,6 +151,8 @@ SUEXEC($uid, $unix_gid, "webmkgroup $group_pid $group_id", 1);
SUEXEC($uid, $unix_gid,
"webmodgroups -a $group_pid:$group_id:group_root $group_leader", 1);
STOPBUSY();
#
# Send an email message with a join link.
#
......@@ -165,10 +174,12 @@ TBMAIL("$group_leader_name '$group_leader' <$group_leader_email>",
"Errors-To: $TBMAIL_WWW");
#
# Spit out a redirect so that the history does not include a post
# in it. The back button skips over the post and to the form.
#
header("Location: showgroup.php3?pid=$group_pid&gid=$group_id");
# Redirect back to project page.
#
PAGEREPLACE("showgroup.php3?pid=$group_pid&gid=$group_id");
# No Testbed footer.
#
# Standard Testbed Footer
#
PAGEFOOTER();
?>
......@@ -130,7 +130,6 @@ function STARTLOG($pid, $eid)
}
</script>\n";
echo "<br>\n";
echo "<center>\n";
echo "<img id='busy' src='busy.gif'>
<span id='loading'> Working ...</span>";
......
......@@ -240,13 +240,7 @@ if ($instance) {
$guid = $instance->guid();
$version = $instance->vers();
echo "<br>\n";
echo "<center>\n";
echo "<b>Terminating template instance!</b> ... <br>\n";
echo "This will take a few minutes; please be patient.<br>\n";
echo "<br>\n";
echo "</center>\n";
flush();
STARTBUSY("Terminating template instance!");
}
#
......@@ -270,6 +264,10 @@ $retval = SUEXEC($uid, "$exp_pid,$unix_gid",
"webswapexp -s $inout $exp_pid $exp_eid")),
SUEXEC_ACTION_IGNORE);
if ($instance) {
CLEARBUSY();
}
#
# Fatal Error. Report to the user, even though there is not much he can
# do with the error. Also reports to tbops.
......@@ -349,6 +347,7 @@ else {
echo "<br><br>
While you are waiting, you can watch the log in realtime:<br>\n";
echo "</div>";
echo "<br>\n";
STARTLOG($pid, $eid);
}
}
......
......@@ -474,14 +474,7 @@ echo "<script type='text/javascript' language='javascript' ".
" src='template_sup.js'>\n";
echo "</script>\n";
echo "<center>\n";
echo "<b>Starting template creation!</b> ...<br>\n";
echo "This will take a few moments; please be patient.<br>\n";
echo "<br>\n";
echo "<img id='busy' src='busy.gif'><span id='loading'> Working ...</span>";
echo "<br><br>\n";
echo "</center>\n";
flush();
STARTBUSY("Starting template creation!");
# And run that script!
$retval = SUEXEC($uid, "$pid,$unix_gid",
......@@ -494,9 +487,7 @@ if ($deletensfile) {
}
/* Clear the various 'loading' indicators. */
echo "<script type='text/javascript' language='javascript'>\n";
echo "ClearLoadingIndicators();\n";
echo "</script>\n";
STOPBUSY();
#
# Fatal Error. Report to the user, even though there is not much he can
......@@ -520,17 +511,9 @@ if (preg_match("/^Template\s+(\w+)\/(\w+)\s+/",
$matches)) {
$guid = $matches[1];
$vers = $matches[2];
echo "<script type='text/javascript' language='javascript'>\n";
echo "PageReplace('template_show.php?guid=$guid&version=$vers');\n";
echo "</script>\n";
}
#
# In case the above fails.
#
echo "<center><b>Done!</b></center>";
echo "<br><br>\n";
PAGEREPLACE("template_show.php?guid=$guid&version=$vers");
}
#
# Standard Testbed Footer
......
......@@ -138,15 +138,7 @@ if (! $spew) {
" src='template_sup.js'>\n";
echo "</script>\n";
echo "<center>\n";
echo "<b>Starting export!</b> ...<br>\n";
echo "This will take a few moments; please be patient.<br>\n";
echo "<br>\n";
echo "<img id='busy' src='busy.gif'>
<span id='loading'> Working ...</span>";
echo "<br>\n";
echo "</center>\n";
flush();
STARTBUSY("Starting export");
sleep(1);
}
......@@ -207,11 +199,12 @@ $retval = SUEXEC($uid, "$pid,$unix_gid",
"-i $exptidx $guid/$version",
SUEXEC_ACTION_IGNORE);
if (! $spew) {
/* Clear the 'loading' indicators above */
echo "<script type='text/javascript' language='javascript'>\n";
echo "ClearLoadingIndicators();\n";
echo "</script>\n";
/* Clear the 'loading' indicators above */
if ($retval) {
CLEARBUSY();
}
else {
STOPBUSY();
}
#
......@@ -228,9 +221,8 @@ if ($retval) {
return;
}
echo "<script type='text/javascript' language='javascript'>\n";
echo "PageReplace('template_show.php?guid=$guid&version=$version');\n";
echo "</script>\n";
# Zap back to template page.
PAGEREPLACE("template_show.php?guid=$guid&version=$version");
#
# In case the above fails.
......
......@@ -344,26 +344,22 @@ TBGroupUnixInfo($pid, $gid, $unix_gid, $unix_name);
set_time_limit(0);
# Okay, we can spit back a header now that there is no worry of redirect.
PAGEHEADER("Start Experiment Template");
PAGEHEADER("Start Experiment Run");
echo "<font size=+2>Experiment Template <b>" .
echo "<font size=+2>Template <b>" .
MakeLink("template",
"guid=$guid&version=$version", "$guid/$version") .
"</b></font>\n";
"guid=$guid&version=$version", "$guid/$version") .
"</b>, Instance <b>" .
MakeLink("project", "pid=$pid", $pid) . "/" .
MakeLink("experiment", "pid=$pid&eid=$eid", $eid);
echo "</b></font>\n";
echo "<br><br>\n";
echo "<script type='text/javascript' language='javascript' ".
" src='template_sup.js'>\n";
echo "</script>\n";
echo "<center>\n";
echo "<b>Starting experiment run!</b> ...<br>\n";
echo "This will take a few moments; please be patient.<br>\n";
echo "<br>\n";
echo "<img id='busy' src='busy.gif'><span id='loading'> Working ...</span>";
echo "<br>\n";
echo "</center>\n";
flush();
STARTBUSY("Starting experiment run!");
#
# Run the backend script.
......@@ -372,10 +368,7 @@ $retval = SUEXEC($uid, "$pid,$unix_gid",
"webtemplate_exprun $command_options $guid/$version",
SUEXEC_ACTION_IGNORE);
/* Clear the 'loading' indicators above */
echo "<script type='text/javascript' language='javascript'>\n";
echo "ClearLoadingIndicators();\n";
echo "</script>\n";
CLEARBUSY();
if ($deletexmlfile) {
unlink($parameter_xmlfile);
......
......@@ -239,14 +239,7 @@ chmod($nsfile, 0666);
# Need this for running scripts.
TBGroupUnixInfo($pid, $gid, $unix_gid, $unix_name);
echo "<center>\n";
echo "<b>Starting template modification!</b> ...<br>\n";
echo "This will take a few moments; please be patient.<br>\n";
echo "<br>\n";
echo "<img id='busy' src='busy.gif'><span id='loading'> Working ...</span>";
echo "<br><br>\n";
echo "</center>\n";
flush();
STARTBUSY("Starting template modification!");
# And run that script!
$retval = SUEXEC($uid, "$pid,$unix_gid",
......@@ -257,9 +250,7 @@ $retval = SUEXEC($uid, "$pid,$unix_gid",
unlink($nsfile);
/* Clear the various 'loading' indicators. */
echo "<script type='text/javascript' language='javascript'>\n";
echo "ClearLoadingIndicators();\n";
echo "</script>\n";
STOPBUSY();
#
# Fatal Error. Report to the user, even though there is not much he can
......@@ -283,17 +274,9 @@ if (preg_match("/^Template\s+(\w+)\/(\w+)\s+/",
$matches)) {
$guid = $matches[1];
$vers = $matches[2];
echo "<script type='text/javascript' language='javascript'>\n";
echo "PageReplace('template_show.php?guid=$guid&version=$vers');\n";
echo "</script>\n";
}
#
# In case the above redirect fails.
#
echo "<center><b>Done!</b></center>";
echo "<br><br>\n";
PAGEREPLACE("template_show.php?guid=$guid&version=$vers");
}
#
# Standard Testbed Footer
......
......@@ -2,23 +2,6 @@
* Some utility stuff.
*/
/* Clear the various 'loading' indicators. */
function ClearLoadingIndicators()
{
var busyimg = document.getElementById('busy');
var loadingspan = document.getElementById('loading');
loadingspan.innerHTML = "";
busyimg.style.display = "none";
busyimg.src = "1px.gif";
}
/* Replace the current page */
function PageReplace(URL)
{
window.location.replace(URL);
}
/*
* Draw a box around template that is being displayed (in the graph).
* This turns on a div after setting its x,y,w,h, which we glean from
......
......@@ -570,14 +570,7 @@ echo "<script type='text/javascript' language='javascript' ".
" src='template_sup.js'>\n";
echo "</script>\n";
echo "<center>\n";
echo "<b>Starting template instantiation!</b> ...<br>\n";
echo "This will take several minutes; please be patient.<br>\n";
echo "<br>\n";
echo "<img id='busy' src='busy.gif'><span id='loading'> Working ...</span>";
echo "<br>\n";
echo "</center>\n";
flush();
STARTBUSY("Starting template instantiation!");
#
# Run the backend script.
......@@ -586,14 +579,7 @@ $retval = SUEXEC($uid, "$pid,$unix_gid",
"webtemplate_swapin $command_options -e $eid $guid/$version",
SUEXEC_ACTION_IGNORE);
/* Clear the 'loading' indicators above */
echo "<script type='text/javascript' language='javascript'>\n";
echo "ClearLoadingIndicators();\n";
echo "</script>\n";
if ($deletexmlfile) {
unlink($parameter_xmlfile);
}
CLEARBUSY();
#
# Fatal Error. Report to the user, even though there is not much he can
......
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