Commit 062bd816 authored by Mac Newbold's avatar Mac Newbold
Browse files

Make idleswap timeout editable via the web for admins only.

parent c4475f39
...@@ -165,6 +165,10 @@ if ($submit) { ...@@ -165,6 +165,10 @@ if ($submit) {
$str .= ",noidleswap_reason=\"$noidleswap\""; $str .= ",noidleswap_reason=\"$noidleswap\"";
$mail=1; $mail=1;
} }
if (isset($idleswap) && $idleswap !="" && $idleswap>0 && ISADMIN()) {
$str .= ",idleswap_timeout=\"".(60*$idleswap)."\"";
$mail=1;
}
if (isset($autoswap) && $autoswap !="" && $autoswap>0) { if (isset($autoswap) && $autoswap !="" && $autoswap>0) {
$str .= ",autoswap_timeout=\"".(60*$autoswap)."\""; $str .= ",autoswap_timeout=\"".(60*$autoswap)."\"";
$mail=1; $mail=1;
......
...@@ -582,7 +582,6 @@ function SHOWEXP($pid, $eid, $edit=0) { ...@@ -582,7 +582,6 @@ function SHOWEXP($pid, $eid, $edit=0) {
$autoswap_hrs= ($autoswap_timeout/60.0); $autoswap_hrs= ($autoswap_timeout/60.0);
$idleswap_hrs= ($idleswap_timeout/60.0); $idleswap_hrs= ($idleswap_timeout/60.0);
$idleswap_str= $idleswap_hrs." hour".($idleswap_hrs==1 ? "" : "s");
if ($edit) { if ($edit) {
# make this a form too # make this a form too
echo "<form action=\"showexp.php3?pid=$pid&eid=$eid\" method=POST>\n"; echo "<form action=\"showexp.php3?pid=$pid&eid=$eid\" method=POST>\n";
...@@ -590,13 +589,20 @@ function SHOWEXP($pid, $eid, $edit=0) { ...@@ -590,13 +589,20 @@ function SHOWEXP($pid, $eid, $edit=0) {
"name=noswap value=\"$noswap_reason\" size=30>"; "name=noswap value=\"$noswap_reason\" size=30>";
$noidleswap = "Why: <input type=text ". $noidleswap = "Why: <input type=text ".
"name=noidleswap value=\"$noidleswap_reason\" size=30>"; "name=noidleswap value=\"$noidleswap_reason\" size=30>";
$autoswap_str= "<input type=text size=2 name=autoswap ". $autoswap_str= "<input type=text size=3 name=autoswap ".
"value=\"$autoswap_hrs\"> hour".($autoswap_hrs==1 ? "" : "s"); "value=\"$autoswap_hrs\"> hour".($autoswap_hrs==1 ? "" : "s");
} else { } else {
$noswap = "(\"$noswap_reason\")"; $noswap = "(\"$noswap_reason\")";
$noidleswap = "(\"$noidleswap_reason\")"; $noidleswap = "(\"$noidleswap_reason\")";
$autoswap_str= $autoswap_hrs." hour".($autoswap_hrs==1 ? "" : "s"); $autoswap_str= $autoswap_hrs." hour".($autoswap_hrs==1 ? "" : "s");
} }
if ($edit && ISADMIN() ) {
# Admins can edit the idleswap time.
$idleswap_str= "<input type=text size=3 name=idleswap ".
"value=\"$idleswap_hrs\"> hour".($idleswap_hrs==1 ? "" : "s");
} else {
$idleswap_str= $idleswap_hrs." hour".($idleswap_hrs==1 ? "" : "s");
}
if ($swappable) if ($swappable)
$swappable = "Yes $swappable = "Yes
...@@ -706,9 +712,7 @@ function SHOWEXP($pid, $eid, $edit=0) { ...@@ -706,9 +712,7 @@ function SHOWEXP($pid, $eid, $edit=0) {
<td class=\"left\">$autoswap</td> <td class=\"left\">$autoswap</td>
</tr>\n"; </tr>\n";
# XXX: isadmin doesn't use the uid you give it, and we don't have a real if (ISADMIN()) {
# uid to send here. so just make something up to match the prototype.
if (isadmin(123)) {
echo "<tr> echo "<tr>
<td>Idle Ignore:</td> <td>Idle Ignore:</td>
<td class=\"left\">$idle_ignore</td> <td class=\"left\">$idle_ignore</td>
......
Supports Markdown
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