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-stable
Commits
1c189079
Commit
1c189079
authored
Apr 08, 2010
by
Leigh B Stoller
Browse files
Add support for toggling the skipvlans control.
parent
1358a9af
Changes
2
Hide whitespace changes
Inline
Side-by-side
www/experiment_defs.php
View file @
1c189079
...
...
@@ -307,6 +307,7 @@ class Experiment
function
locked
()
{
return
$this
->
field
(
'expt_locked'
);
}
function
elabinelab
()
{
return
$this
->
field
(
'elab_in_elab'
);}
function
lockdown
()
{
return
$this
->
field
(
'lockdown'
);
}
function
skipvlans
()
{
return
$this
->
field
(
'skipvlans'
);
}
function
created
()
{
return
$this
->
field
(
'expt_created'
);
}
function
swapper
()
{
return
$this
->
field
(
'expt_swap_uid'
);}
function
swappable
()
{
return
$this
->
field
(
'swappable'
);}
...
...
@@ -439,6 +440,20 @@ class Experiment
return
0
;
}
#
# Flip lockdown bit.
#
function
SetSkipVlans
(
$mode
)
{
$idx
=
$this
->
idx
();
$mode
=
(
$mode
?
1
:
0
);
$query_result
=
DBQueryFatal
(
"update experiments set skipvlans='
$mode
' "
.
"where idx='
$idx
'"
);
return
0
;
}
function
GetLogfile
()
{
$this
->
Refresh
();
...
...
@@ -707,6 +722,7 @@ class Experiment
$mnet_cores
=
$exprow
[
"modelnet_cores"
];
$mnet_edges
=
$exprow
[
"modelnet_edges"
];
$lockdown
=
$exprow
[
"lockdown"
];
$skipvlans
=
$exprow
[
"skipvlans"
];
$exptidx
=
$exprow
[
"idx"
];
$archive_idx
=
$exprow
[
"archive_idx"
];
$dpdb
=
$exprow
[
"dpdb"
];
...
...
@@ -1005,6 +1021,17 @@ class Experiment
"&type=lockdown&value=
$lockflip
>Toggle</a>)
</td>
</tr>
\n
"
;
if
(
ISADMIN
())
{
$thisflip
=
(
$skipvlans
?
0
:
1
);
$flipval
=
(
$skipvlans
?
"Yes"
:
"No"
);
echo
"<tr>
<td>Skip Vlans:</td>
<td>
$flipval
(<a href=toggle.php?pid=
$pid
&eid=
$eid
"
.
"&type=skipvlans&value=
$thisflip
>Toggle</a>)
</td>
</tr>
\n
"
;
}
}
if
(
$batchmode
)
{
...
...
www/toggle.php
View file @
1c189079
<?php
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-200
8
University of Utah and the Flux Group.
# Copyright (c) 2000-20
1
0 University of Utah and the Flux Group.
# All rights reserved.
#
include
(
"defs.php3"
);
...
...
@@ -24,7 +24,8 @@ $isadmin = ISADMIN();
# List of valid toggles
$toggles
=
array
(
"adminon"
,
"webfreeze"
,
"cvsweb"
,
"lockdown"
,
"stud"
,
"cvsrepo_public"
,
"workbench"
,
"hiderun"
,
"widearearoot"
);
"cvsrepo_public"
,
"workbench"
,
"hiderun"
,
"widearearoot"
,
"skipvlans"
);
# list of valid values for each toggle
$values
=
array
(
"adminon"
=>
array
(
0
,
1
),
...
...
@@ -32,6 +33,7 @@ $values = array("adminon" => array(0,1),
"cvsweb"
=>
array
(
0
,
1
),
"stud"
=>
array
(
0
,
1
),
"lockdown"
=>
array
(
0
,
1
),
"skipvlans"
=>
array
(
0
,
1
),
"cvsrepo_public"
=>
array
(
0
,
1
),
"workbench"
=>
array
(
0
,
1
),
"widearearoot"
=>
array
(
0
,
1
),
...
...
@@ -43,6 +45,7 @@ $optargs = array("adminon" => array(),
"cvsweb"
=>
array
(
"user"
=>
1
),
"stud"
=>
array
(
"user"
=>
1
),
"lockdown"
=>
array
(
"pid"
=>
1
,
"eid"
=>
1
),
"skipvlans"
=>
array
(
"pid"
=>
1
,
"eid"
=>
1
),
"cvsrepo_public"
=>
array
(
"pid"
=>
1
),
"workbench"
=>
array
(
"pid"
=>
1
),
"widearearoot"
=>
array
(
"user"
=>
1
),
...
...
@@ -142,6 +145,17 @@ elseif ($type == "lockdown") {
$zapurl
=
CreateURL
(
"showexp"
,
$experiment
);
$experiment
->
SetLockDown
(
$value
);
}
elseif
(
$type
==
"skipvlans"
)
{
# must be admin
if
(
!
$isadmin
)
{
USERERROR
(
"You do not have permission to toggle
$type
!"
,
1
);
}
if
(
!
(
$experiment
=
Experiment
::
LookupByPidEid
(
$pid
,
$eid
)))
{
PAGEARGERROR
(
"Experiment
$pid
/
$eid
is not a valid experiment!"
);
}
$zapurl
=
CreateURL
(
"showexp"
,
$experiment
);
$experiment
->
SetSkipVlans
(
$value
);
}
elseif
(
$type
==
"cvsrepo_public"
)
{
# Must validate the pid since we allow non-admins to do this.
if
(
!
TBvalid_pid
(
$pid
))
{
...
...
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