Commit e46966b3 authored by Mac Newbold's avatar Mac Newbold

Show old and new swap settings in the email we send when values change.

parent 7db97feb
......@@ -219,11 +219,6 @@ if ($submit) {
$errors['Max Duration'] = "Time must be non-zero";
}
}
if (count($strs)>0) {
$str = implode(",",$strs);
DBQueryWarn("update experiments set $str ".
"where pid='$pid' and eid='$eid'");
}
if ($errors) {
echo "<table class=nogrid
align=center border=0 cellpadding=6 cellspacing=0>
......@@ -246,6 +241,23 @@ if ($submit) {
echo "</table><br>\n";
# Jump back into edit mode
$edit=1;
$mail=0;
} else {
$q = DBQueryFatal("select * from experiments ".
"where pid='$pid' and eid='$eid'");
$r = mysql_fetch_array($q);
$olds = ($r[swappable] ? "Yes" : "No");
$oldsr= $r[noswap_reason];
$oldi = ($r[idleswap] ? "Yes" : "No");
$oldit= $r[idleswap_timeout] / 60.0;
$oldir= $r[noidleswap_reason];
$olda = ($r[autoswap] ? "Yes" : "No");
$oldat= $r[autoswap_timeout] / 60.0;
if (count($strs)>0) {
$str = implode(",",$strs);
DBQueryWarn("update experiments set $str ".
"where pid='$pid' and eid='$eid'");
}
}
if ($mail) {
$q = DBQueryFatal("select * from experiments ".
......@@ -271,10 +283,14 @@ if ($submit) {
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 old settings were:\n".
#"Swappable:\t$olds\t($oldsr)\n".
"Idleswap:\t$oldi\t(after $oldit hrs)\t($oldir)\n".
"MaxDuration:\t$olda\t(after $oldat hrs)\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".
"MaxDuration:\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, ".
......
......@@ -98,16 +98,24 @@ elseif ($type=="swappable" || $type=="idleswap" || $type=="autoswap") {
$ir= $r[noidleswap_reason];
$a = ($r[autoswap] ? "Yes" : "No");
$at= $r[autoswap_timeout] / 60.0;
$olds = ($type=="swappable"? "Yes" : $s);
$oldi = ($type=="idleswap" ? "Yes" : $i);
$olda = ($type=="autoswap" ? "Yes" : $a);
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".
"\nThe old settings were:\n".
#"Swappable:\t$olds\t('$sr')\n".
"Idleswap:\t$oldi\t(after $it hrs)\t('$ir')\n".
"MaxDuration:\t$olda\t(after $at hrs)\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".
"MaxDuration:\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, ".
......
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