Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
emulab
emulab-devel
Commits
7473dadb
Commit
7473dadb
authored
Apr 22, 2003
by
Mac Newbold
Browse files
Add toggle for idle_ignore (admins only).
parent
14ed7b52
Changes
2
Hide whitespace changes
Inline
Side-by-side
www/showstuff.php3
View file @
7473dadb
...
...
@@ -544,6 +544,7 @@ function SHOWEXP($pid, $eid) {
$batchstate
=
$exprow
[
batchstate
];
$priority
=
$exprow
[
priority
];
$swappable
=
$exprow
[
swappable
];
$idle_ignore
=
$exprow
[
idle_ignore
];
$swapreqs
=
$exprow
[
swap_requests
];
$lastswapreq
=
$exprow
[
last_swap_req
];
$nodes
=
$exprow
[
"count(r.node_id)"
];
...
...
@@ -555,6 +556,15 @@ function SHOWEXP($pid, $eid) {
else
$swappable
=
"No
<a href=
\"
toggle.php?type=swappable&value=1&pid=
$pid
&eid=
$eid
\"
>
<img src=
\"
redball.gif
\"
border=0 alt=
\"
Toggle
\"
></a>"
;
if
(
$idle_ignore
)
$idle_ignore
=
"Yes
<a href=
\"
toggle.php?type=idle_ignore&value=0&pid=
$pid
&eid=
$eid
\"
>
<img src=
\"
greenball.gif
\"
border=0 alt=
\"
Toggle
\"
></a>"
;
else
$idle_ignore
=
"No
<a href=
\"
toggle.php?type=idle_ignore&value=1&pid=
$pid
&eid=
$eid
\"
>
<img src=
\"
redball.gif
\"
border=0 alt=
\"
Toggle
\"
></a>"
;
#
...
...
@@ -615,6 +625,15 @@ function SHOWEXP($pid, $eid) {
<td class=
\"
left
\"
>
$swappable
</td>
</tr>
\n
"
;
# XXX: isadmin doesn't use the uid you give it, and we don't have a real
# uid to send here. so just make something up to match the prototype.
if
(
isadmin
(
123
))
{
echo
"<tr>
<td>Idle Ignore:</td>
<td class=
\"
left
\"
>
$idle_ignore
</td>
</tr>
\n
"
;
}
echo
"<tr>
<td>Priority: (0 is highest) </td>
<td class=
\"
left
\"
>
$priority
</td>
...
...
www/toggle.php
View file @
7473dadb
...
...
@@ -29,11 +29,12 @@ LOGGEDINORDIE($uid);
# (type & value are required, others are optional and vary by type)
# List of valid toggles
$toggles
=
array
(
"adminoff"
,
"swappable"
);
$toggles
=
array
(
"adminoff"
,
"swappable"
,
"idle_ignore"
);
# list of valid values for each toggle
$values
=
array
(
"adminoff"
=>
array
(
0
,
1
),
"swappable"
=>
array
(
0
,
1
)
);
$values
=
array
(
"adminoff"
=>
array
(
0
,
1
),
"swappable"
=>
array
(
0
,
1
),
"idle_ignore"
=>
array
(
0
,
1
)
);
if
(
!
in_array
(
$type
,
$toggles
))
{
USERERROR
(
"There is no toggle for
$type
!"
,
1
);
...
...
@@ -70,6 +71,20 @@ if ($type=="adminoff") {
DBQueryFatal
(
"update experiments set swappable=
$value
"
.
"where pid='
$pid
' and eid='
$eid
'"
);
}
elseif
(
$type
==
"idle_ignore"
)
{
# must be admin
if
(
!
(
$CHECKLOGIN_STATUS
&
CHECKLOGIN_ISADMIN
))
{
USERERROR
(
"You do not have permission to toggle
$type
!"
,
1
);
}
# require pid/eid
if
(
!
isset
(
$pid
)
||
!
isset
(
$eid
)
||
!
TBValidExperiment
(
$pid
,
$eid
))
{
USERERROR
(
"Experiment '
$pid
/
$eid
' is not valid!"
,
1
);
}
DBQueryFatal
(
"update experiments set idle_ignore=
$value
"
.
"where pid='
$pid
' and eid='
$eid
'"
);
#} elseif ($type=="foo") {
# Add more here...
#
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment