Commit 97e75cbd authored by Leigh Stoller's avatar Leigh Stoller

Only admins see any multisite stuff, all this will get yanked later.

Also turn on experiment name.
parent 467d1eeb
......@@ -470,7 +470,7 @@ function SPITFORM($formfields, $newuser, $errors)
# Spit out an experient name box, which is optional and prefilled
# with a default.
#
if ($this_user && ISADMIN()) {
if ($this_user) {
$thisclass = "form-group";
if ($errors && array_key_exists("name", $errors)) {
$thisclass .= " has-error";
......@@ -657,6 +657,8 @@ function SPITFORM($formfields, $newuser, $errors)
if ($newuser) {
echo "window.APT_OPTIONS.isNewUser = true;\n";
}
$isadmin = (isset($this_user) && ISADMIN() ? 1 : 0);
echo " window.ISADMIN = $isadmin;\n";
echo "</script>\n";
echo "<script src='js/lib/jquery-2.0.3.min.js'></script>\n";
echo "<script src='js/lib/bootstrap.js'></script>\n";
......
......@@ -67,8 +67,11 @@ function (_, editModalString, editInlineString)
alert('Failed to fetch Jacks context from ' + contextUrl);
}
function JacksEditor (root, isViewer, isInline, withoutSelection, withoutMenu)
function JacksEditor (root, isViewer, isInline,
withoutSelection, withoutMenu, withoutMultiSite)
{
console.info("foo");
console.info(withoutMultiSite);
this.root = root;
this.instance = null;
this.input = null;
......@@ -77,6 +80,7 @@ function (_, editModalString, editInlineString)
this.mode = 'editor';
this.selectionPane = true;
this.menu = true;
this.multisite = true;
if (isViewer)
{
this.mode = 'viewer';
......@@ -94,6 +98,9 @@ function (_, editModalString, editInlineString)
if (withoutMenu) {
this.menu = false;
}
if (withoutMultiSite) {
this.multisite = false;
}
this.render();
}
......@@ -122,7 +129,7 @@ function (_, editModalString, editInlineString)
mode: this.mode,
source: 'rspec',
root: '#edit_nopicker',
multiSite: true,
multiSite: this.multisite,
nodeSelect: this.selectionPane,
readyCallback: _.bind(this.jacksReady, this),
show: {
......
......@@ -15,6 +15,7 @@ function (_, Constraints, sup, ppstart, JacksEditor, aboutaptString, aboutcloudS
var selected_rspec = null;
var ispprofile = 0;
var webonly = 0;
var isadmin = 0;
var portal = null;
var registered = false;
var JACKS_NS = "http://www.protogeni.net/resources/rspec/ext/jacks/1";
......@@ -40,6 +41,9 @@ function (_, Constraints, sup, ppstart, JacksEditor, aboutaptString, aboutcloudS
window.APT_OPTIONS.initialize(ppstart);
registered = window.REGISTERED;
webonly = window.WEBONLY;
console.info("bar");
isadmin = window.ISADMIN;
console.info(isadmin);
portal = window.PORTAL;
ajaxurl = window.AJAXURL;
......@@ -55,6 +59,7 @@ function (_, Constraints, sup, ppstart, JacksEditor, aboutaptString, aboutcloudS
$('#stepsContainer-p-1 > div').attr('style','display:block');
ppstart.StartPP({uuid : selected_uuid,
registered : registered,
isadmin : isadmin,
amlist : amlist,
amdefault : amdefault,
callback : ConfigureDone,
......@@ -330,14 +335,15 @@ function (_, Constraints, sup, ppstart, JacksEditor, aboutaptString, aboutcloudS
var continuation = function(rspec, description, name, amdefault, ispp) {
$('#showtopo_title').html("<h3>" + name + "</h3>");
$('#showtopo_description').html(description);
sup.maketopmap('#showtopo_div', rspec, false);
sup.maketopmap('#showtopo_div', rspec, false, !isadmin);
};
GetProfile($(selectedElement).attr('value'), continuation);
}
// Used to generate the topology on Tab 3 of the wizard for non-pp profiles
function ShowProfileSelectionInline(selectedElement, root, selectionPane) {
editor = new JacksEditor(root, true, true, selectionPane, true);
editor = new JacksEditor(root, true, true,
selectionPane, true, !isadmin);
var continuation = function(rspec, description, name, amdefault, ispp) {
editor.show(rspec);
};
......@@ -494,7 +500,7 @@ function (_, Constraints, sup, ppstart, JacksEditor, aboutaptString, aboutcloudS
sites[siteid] = siteid;
});
if (Object.keys(sites) == 0) {
if (!isadmin || Object.keys(sites) == 0) {
$("#site_selector").addClass("hidden");
$("#nosite_selector").removeClass("hidden");
// Clear the form data.
......
......@@ -32,6 +32,7 @@ function (_, sup, filesize, JacksEditor, ShowImagingModal, moment, ppstart,
var myCodeMirror = null;
var genilibwarned= false;
var isppprofile = false;
var isadmin = 0;
var manageTemplate = _.template(manageString);
var waitwaitTemplate = _.template(waitwaitString);
var rendererTemplate = _.template(rendererString);
......@@ -51,6 +52,7 @@ function (_, sup, filesize, JacksEditor, ShowImagingModal, moment, ppstart,
profile_uuid = window.PROFILE_UUID;
ajaxurl = window.AJAXURL;
isppprofile = window.ISPPPROFILE;
isadmin = window.ISADMIN;
var fields = JSON.parse(_.unescape($('#form-json')[0].textContent));
var errors = JSON.parse(_.unescape($('#error-json')[0].textContent));
......@@ -115,7 +117,8 @@ function (_, sup, filesize, JacksEditor, ShowImagingModal, moment, ppstart,
$('#waitwait_div').html(waitwait_html);
var showtopo_html = showtopoTemplate({});
$('#showtopomodal_div').html(showtopo_html);
editor = new JacksEditor($('#editmodal_div'));
editor = new JacksEditor($('#editmodal_div'),
false, false, false, false, !isadmin);
var renderer_html = rendererTemplate({});
$('#renderer_div').html(renderer_html);
var oops_html = oopsTemplate({});
......
......@@ -70,7 +70,8 @@ function (sup, moment)
}
sup.ShowModal("#quickvm_topomodal");
$("#quickvm_topomodal").one("shown.bs.modal", function () {
sup.maketopmap('#showtopo_nopicker', json.value.rspec, false);
sup.maketopmap('#showtopo_nopicker',
json.value.rspec, false, !window.ISADMIN);
});
};
var $xmlthing = sup.CallServerMethod(ajaxurl,
......
......@@ -19,6 +19,7 @@ function(_, sup, JacksEditor, ppmodalString, ppbodyString, chooserString)
var amlist = null;
var amdefault = null;
var registered = true;
var isadmin = 0;
var callback_done = null;
var button_label = "Instantiate";
var RSPEC = null;
......@@ -247,6 +248,7 @@ function(_, sup, JacksEditor, ppmodalString, ppbodyString, chooserString)
registered = args.registered;
amlist = args.amlist;
amdefault = args.amdefault;
isadmin = args.isadmin;
if (bodyTemplate) {
GenerateModalBody(defaults, null);
......@@ -254,7 +256,8 @@ function(_, sup, JacksEditor, ppmodalString, ppbodyString, chooserString)
return;
}
// Caller might already have an editor instance.
editor = new JacksEditor($('#inline_jacks'), true, true, true, true);
editor = new JacksEditor($('#inline_jacks'), true, true,
true, true, !isadmin);
// Callback; instead of instantiate, send rspec to callback.
if (_.has(args, "callback")) {
callback_done = args.callback;
......
......@@ -45,14 +45,14 @@ var jacksInstance;
var jacksInput;
var jacksOutput;
function maketopmap(divname, xml, showinfo)
function maketopmap(divname, xml, showinfo, withoutMultiSite)
{
if (! jacksInstance)
{
jacksInstance = new window.Jacks({
mode: 'viewer',
source: 'rspec',
multiSite: true,
multiSite: (withoutMultiSite ? false : true),
root: divname,
nodeSelect: showinfo,
readyCallback: function (input, output) {
......
......@@ -90,7 +90,8 @@ function (_, sup, moment, ppstart,
});
$('#quickvm_topomodal').on('shown.bs.modal', function() {
sup.maketopmap("#showtopo_nopicker",
$('#profile_rspec_textarea').val(), true);
$('#profile_rspec_textarea').val(),
true, !window.ISADMIN);
});
// The Show Source button.
......
......@@ -221,6 +221,8 @@ echo "<!-- This is the topology view modal -->
echo "<script type='text/javascript'>\n";
echo " window.AJAXURL = 'server-ajax.php';\n";
$isadmin = (isset($this_user) && ISADMIN() ? 1 : 0);
echo " window.ISADMIN = $isadmin;\n";
echo "</script>\n";
echo "<script src='js/lib/jquery-2.0.3.min.js'></script>\n";
echo "<script src='js/lib/jquery.tablesorter.min.js'></script>\n";
......
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