Commit 2a8dd2f1 authored by Leigh B Stoller's avatar Leigh B Stoller

Minor changes to image constraints, enable for admin/studly users.

parent 7568ff50
......@@ -557,7 +557,7 @@ function SPITFORM($formfields, $newuser, $errors)
}
if (isset($this_user) && !$this_user->webonly() &&
($ISCLOUD || ISADMIN() || STUDLY())) {
($ISCLOUD || ISADMINISTRATOR() || 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 || ISADMINISTRATOR() || 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";
......
......@@ -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');
}
};
/*
......
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