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) ...@@ -557,7 +557,7 @@ function SPITFORM($formfields, $newuser, $errors)
} }
if (isset($this_user) && !$this_user->webonly() && if (isset($this_user) && !$this_user->webonly() &&
($ISCLOUD || ISADMIN() || STUDLY())) { ($ISCLOUD || ISADMINISTRATOR() || STUDLY())) {
$am_options = ""; $am_options = "";
while (list($am, $urn) = each($am_array)) { while (list($am, $urn) = each($am_array)) {
$amlist[$urn] = $am; $amlist[$urn] = $am;
...@@ -681,7 +681,7 @@ function SPITFORM($formfields, $newuser, $errors) ...@@ -681,7 +681,7 @@ function SPITFORM($formfields, $newuser, $errors)
SpitOopsModal("oops"); SpitOopsModal("oops");
if (isset($this_user) && !$this_user->webonly() && if (isset($this_user) && !$this_user->webonly() &&
($ISCLOUD || ISADMIN() || STUDLY())) { ($ISCLOUD || ISADMINISTRATOR() || STUDLY())) {
echo "<script type='text/plain' id='amlist-json'>\n"; echo "<script type='text/plain' id='amlist-json'>\n";
echo htmlentities(json_encode($amlist)); echo htmlentities(json_encode($amlist));
echo "</script>\n"; echo "</script>\n";
...@@ -702,6 +702,9 @@ function SPITFORM($formfields, $newuser, $errors) ...@@ -702,6 +702,9 @@ function SPITFORM($formfields, $newuser, $errors)
echo " window.ISADMIN = $isadmin;\n"; echo " window.ISADMIN = $isadmin;\n";
$multisite = (isset($this_user) ? 1 : 0); $multisite = (isset($this_user) ? 1 : 0);
echo " window.MULTISITE = $multisite;\n"; echo " window.MULTISITE = $multisite;\n";
$doconstraints = (isset($this_user) &&
(ISADMINISTRATOR() || STUDLY()) ? 1 : 0);
echo " window.DOCONSTRAINTS = $doconstraints;\n";
echo "</script>\n"; echo "</script>\n";
echo "<script src='js/lib/jquery-2.0.3.min.js?nocache=asdfasdf'></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"; echo "<script src='js/lib/bootstrap.js?nocache=asdfasdf'></script>\n";
......
...@@ -17,6 +17,7 @@ function (_, Constraints, sup, ppstart, JacksEditor, aboutaptString, aboutcloudS ...@@ -17,6 +17,7 @@ function (_, Constraints, sup, ppstart, JacksEditor, aboutaptString, aboutcloudS
var webonly = 0; var webonly = 0;
var isadmin = 0; var isadmin = 0;
var multisite = 0; var multisite = 0;
var doconstraints = 0;
var portal = null; var portal = null;
var registered = false; var registered = false;
var JACKS_NS = "http://www.protogeni.net/resources/rspec/ext/jacks/1"; var JACKS_NS = "http://www.protogeni.net/resources/rspec/ext/jacks/1";
...@@ -46,6 +47,7 @@ function (_, Constraints, sup, ppstart, JacksEditor, aboutaptString, aboutcloudS ...@@ -46,6 +47,7 @@ function (_, Constraints, sup, ppstart, JacksEditor, aboutaptString, aboutcloudS
multisite = window.MULTISITE; multisite = window.MULTISITE;
portal = window.PORTAL; portal = window.PORTAL;
ajaxurl = window.AJAXURL; ajaxurl = window.AJAXURL;
doconstraints = window.DOCONSTRAINTS;
$('#stepsContainer').steps({ $('#stepsContainer').steps({
headerTag: "h3", headerTag: "h3",
...@@ -714,8 +716,8 @@ function (_, Constraints, sup, ppstart, JacksEditor, aboutaptString, aboutcloudS ...@@ -714,8 +716,8 @@ function (_, Constraints, sup, ppstart, JacksEditor, aboutaptString, aboutcloudS
function onFoundImages(images) function onFoundImages(images)
{ {
if (1) { if (! doconstraints) {
// return true; return true;
} }
if (! _.isEqual(foundImages, images)) { if (! _.isEqual(foundImages, images)) {
foundImages = images; foundImages = images;
...@@ -729,7 +731,7 @@ function (_, Constraints, sup, ppstart, JacksEditor, aboutaptString, aboutcloudS ...@@ -729,7 +731,7 @@ function (_, Constraints, sup, ppstart, JacksEditor, aboutaptString, aboutcloudS
* Update the image constraints if anything changes. * Update the image constraints if anything changes.
*/ */
function UpdateImageConstraints() { function UpdateImageConstraints() {
if (!foundImages.length) { if (!foundImages.length || !doconstraints) {
return; return;
} }
...@@ -739,14 +741,17 @@ function (_, Constraints, sup, ppstart, JacksEditor, aboutaptString, aboutcloudS ...@@ -739,14 +741,17 @@ function (_, Constraints, sup, ppstart, JacksEditor, aboutaptString, aboutcloudS
alert("Could not get image info: " + json.value); alert("Could not get image info: " + json.value);
return; return;
} }
console.log('json', json.value); // This gets munged someplace, and so the printed value
console.log('foundImages', foundImages); // is not what actually comes back. Copy before print.
var mycopy = $.extend(true, {}, json.value);
console.log('json', mycopy);
if (1) { if (1) {
constraints = new Constraints(context); constraints = new Constraints(context);
constraints.addPossibles({ images: foundImages }); constraints.addPossibles({ images: foundImages });
allowWithSites(json.value[0].images, json.value[0].constraints); allowWithSites(json.value[0].images, json.value[0].constraints);
updateWhere(); 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