Skip to content
GitLab
Menu
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
2a8dd2f1
Commit
2a8dd2f1
authored
Sep 25, 2015
by
Leigh B Stoller
Browse files
Minor changes to image constraints, enable for admin/studly users.
parent
7568ff50
Changes
2
Hide whitespace changes
Inline
Side-by-side
www/aptui/instantiate.php
View file @
2a8dd2f1
...
...
@@ -557,7 +557,7 @@ function SPITFORM($formfields, $newuser, $errors)
}
if
(
isset
(
$this_user
)
&&
!
$this_user
->
webonly
()
&&
(
$ISCLOUD
||
ISADMIN
()
||
STUDLY
()))
{
(
$ISCLOUD
||
ISADMIN
ISTRATOR
()
||
STUDLY
()))
{
$am_options
=
""
;
while
(
list
(
$am
,
$urn
)
=
each
(
$am_array
))
{
$amlist
[
$urn
]
=
$am
;
...
...
@@ -681,7 +681,7 @@ function SPITFORM($formfields, $newuser, $errors)
SpitOopsModal
(
"oops"
);
if
(
isset
(
$this_user
)
&&
!
$this_user
->
webonly
()
&&
(
$ISCLOUD
||
ISADMIN
()
||
STUDLY
()))
{
(
$ISCLOUD
||
ISADMIN
ISTRATOR
()
||
STUDLY
()))
{
echo
"<script type='text/plain' id='amlist-json'>
\n
"
;
echo
htmlentities
(
json_encode
(
$amlist
));
echo
"</script>
\n
"
;
...
...
@@ -702,6 +702,9 @@ function SPITFORM($formfields, $newuser, $errors)
echo
" window.ISADMIN =
$isadmin
;
\n
"
;
$multisite
=
(
isset
(
$this_user
)
?
1
:
0
);
echo
" window.MULTISITE =
$multisite
;
\n
"
;
$doconstraints
=
(
isset
(
$this_user
)
&&
(
ISADMINISTRATOR
()
||
STUDLY
())
?
1
:
0
);
echo
" window.DOCONSTRAINTS =
$doconstraints
;
\n
"
;
echo
"</script>
\n
"
;
echo
"<script src='js/lib/jquery-2.0.3.min.js?nocache=asdfasdf'></script>
\n
"
;
echo
"<script src='js/lib/bootstrap.js?nocache=asdfasdf'></script>
\n
"
;
...
...
www/aptui/js/instantiate.js
View file @
2a8dd2f1
...
...
@@ -17,6 +17,7 @@ function (_, Constraints, sup, ppstart, JacksEditor, aboutaptString, aboutcloudS
var
webonly
=
0
;
var
isadmin
=
0
;
var
multisite
=
0
;
var
doconstraints
=
0
;
var
portal
=
null
;
var
registered
=
false
;
var
JACKS_NS
=
"
http://www.protogeni.net/resources/rspec/ext/jacks/1
"
;
...
...
@@ -46,6 +47,7 @@ function (_, Constraints, sup, ppstart, JacksEditor, aboutaptString, aboutcloudS
multisite
=
window
.
MULTISITE
;
portal
=
window
.
PORTAL
;
ajaxurl
=
window
.
AJAXURL
;
doconstraints
=
window
.
DOCONSTRAINTS
;
$
(
'
#stepsContainer
'
).
steps
({
headerTag
:
"
h3
"
,
...
...
@@ -714,8 +716,8 @@ function (_, Constraints, sup, ppstart, JacksEditor, aboutaptString, aboutcloudS
function
onFoundImages
(
images
)
{
if
(
1
)
{
//
return true;
if
(
!
doconstraints
)
{
return
true
;
}
if
(
!
_
.
isEqual
(
foundImages
,
images
))
{
foundImages
=
images
;
...
...
@@ -729,7 +731,7 @@ function (_, Constraints, sup, ppstart, JacksEditor, aboutaptString, aboutcloudS
* Update the image constraints if anything changes.
*/
function
UpdateImageConstraints
()
{
if
(
!
foundImages
.
length
)
{
if
(
!
foundImages
.
length
||
!
doconstraints
)
{
return
;
}
...
...
@@ -739,14 +741,17 @@ function (_, Constraints, sup, ppstart, JacksEditor, aboutaptString, aboutcloudS
alert
(
"
Could not get image info:
"
+
json
.
value
);
return
;
}
console
.
log
(
'
json
'
,
json
.
value
);
console
.
log
(
'
foundImages
'
,
foundImages
);
// This gets munged someplace, and so the printed value
// is not what actually comes back. Copy before print.
var
mycopy
=
$
.
extend
(
true
,
{},
json
.
value
);
console
.
log
(
'
json
'
,
mycopy
);
if
(
1
)
{
constraints
=
new
Constraints
(
context
);
constraints
.
addPossibles
({
images
:
foundImages
});
allowWithSites
(
json
.
value
[
0
].
images
,
json
.
value
[
0
].
constraints
);
updateWhere
();
$
(
'
#stepsContainer .actions a[href="#finish"]
'
).
removeAttr
(
'
disabled
'
);
$
(
'
#stepsContainer .actions a[href="#finish"]
'
)
.
removeAttr
(
'
disabled
'
);
}
};
/*
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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