Commit 2935e2b5 authored by Mac Newbold's avatar Mac Newbold

Make the mail that gets sent when they change the swap settings a little

more useful, by including the reasons and such.

Also add a similar email message when they change the reasons or timeouts.
parent e3fe037b
......@@ -156,16 +156,53 @@ if ($submit) {
$noidleswap = addslashes(str_replace('"',"",$noidleswap));
# exp name is always sent...
$str = "expt_name=\"$exp_name\"";
$mail=0;
if (isset($noswap) && $noswap !="") {
$str .= ",noswap_reason=\"$noswap\"";
$mail=1;
}
if (isset($noidleswap) && $noidleswap !="") {
$str .= ",noidleswap_reason=\"$noidleswap\"";
$mail=1;
}
if (isset($autoswap) && $autoswap !="" && $autoswap>0) {
$str .= ",autoswap_timeout=\"".(60*$autoswap)."\"";
$mail=1;
}
DBQueryWarn("update experiments set $str where pid='$pid' and eid='$eid'");
if ($mail) {
$q = DBQueryFatal("select * from experiments ".
"where pid='$pid' and eid='$eid'");
$r = mysql_fetch_array($q);
$s = ($r[swappable] ? "Yes" : "No");
$sr= $r[noswap_reason];
$i = ($r[idleswap] ? "Yes" : "No");
$it= $r[idleswap_timeout] / 60.0;
$ir= $r[noidleswap_reason];
$a = ($r[autoswap] ? "Yes" : "No");
$at= $r[autoswap_timeout] / 60.0;
$cuid = $r[expt_head_uid];
$suid= $r[expt_swap_uid];
TBUserInfo($uid, $user_name, $user_email);
TBUserInfo($cuid, $cname, $cemail);
TBUserInfo($suid, $sname, $semail);
TBMAIL($TBMAIL_OPS,"$pid/$eid swap settings changed",
"\nThe swap settings for $pid/$eid have changed.\n".
"\nThe reasons and/or timeouts have changed.\n".
"\nThe new settings are:\n".
"Swappable:\t$s\t('$sr')\n".
"Idleswap:\t$i\t(after $it hrs)\t('$ir')\n".
"Autoswap:\t$a\t(after $at hrs)\n".
"\nCreator:\t$cuid ($cname <$cemail>)\n".
"Swapper:\t$suid ($sname <$semail>)\n".
"\nIf it is necessary to change these settings, ".
"please reply to this message \nto notify the user, ".
"then change the settings here:\n\n".
"$TBBASE/showexp.php3?pid=$pid&eid=$eid\n\n".
"Thanks,\nTestbed WWW\n",
"From: $user_name <$user_email>\n".
"Errors-To: $TBMAIL_WWW");
}
}
# Dump (possibly updated) experiment record.
......
......@@ -76,14 +76,36 @@ if ($type=="adminoff") {
# Send mail on these changes...
if ($type!="autoswap" && $value=="0") {
$q = DBQueryFatal("select * from experiments ".
"where pid='$pid' and eid='$eid'");
$r = mysql_fetch_array($q);
$s = ($r[swappable] ? "Yes" : "No");
$sr= $r[noswap_reason];
$i = ($r[idleswap] ? "Yes" : "No");
$it= $r[idleswap_timeout] / 60.0;
$ir= $r[noidleswap_reason];
$a = ($r[autoswap] ? "Yes" : "No");
$at= $r[autoswap_timeout] / 60.0;
$cuid = $r[expt_head_uid];
$suid= $r[expt_swap_uid];
TBUserInfo($uid, $user_name, $user_email);
TBUserInfo($cuid, $cname, $cemail);
TBUserInfo($suid, $sname, $semail);
TBMAIL($TBMAIL_OPS,"$pid/$eid swap settings changed",
"\nThe swap settings for $pid/$eid have changed.\n".
"\nThe $type bit has been cleared.\n".
"\nPlease check the reason they give, and change it ".
"if needed, by going to:\n\n".
"\nThe new settings are:\n".
"Swappable:\t$s\t('$sr')\n".
"Idleswap:\t$i\t(after $it hrs)\t('$ir')\n".
"Autoswap:\t$a\t(after $at hrs)\n".
"\nCreator:\t$cuid ($cname <$cemail>)\n".
"Swapper:\t$suid ($sname <$semail>)\n".
"\nIf it is necessary to change these settings, ".
"please reply to this message \nto notify the user, ".
"then change the settings here:\n\n".
"$TBBASE/showexp.php3?pid=$pid&eid=$eid\n\n".
"Thanks,\nTestbed WWW\n",
"From: $TBMAIL_OPS\n".
"From: $user_name <$user_email>\n".
"Errors-To: $TBMAIL_WWW");
}
......
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