Commit b5e24ed2 authored by Leigh B Stoller's avatar Leigh B Stoller

Add support for disabling profile (versions). Mostly a bunch of little UI

changes and some checks to prevent a user from instantiating a disabled
version.
parent 32c3d934
...@@ -196,6 +196,8 @@ my %xmlfields = ...@@ -196,6 +196,8 @@ my %xmlfields =
"profile_shared" => ["shared", $SLOT_OPTIONAL|$SLOT_UPDATE], "profile_shared" => ["shared", $SLOT_OPTIONAL|$SLOT_UPDATE],
"profile_topdog" => ["topdog", $SLOT_OPTIONAL| "profile_topdog" => ["topdog", $SLOT_OPTIONAL|
$SLOT_UPDATE|$SLOT_ADMINONLY], $SLOT_UPDATE|$SLOT_ADMINONLY],
"profile_disabled" => ["disabled", $SLOT_OPTIONAL|
$SLOT_UPDATE|$SLOT_ADMINONLY],
"rspec" => ["rspec", $SLOT_REQUIRED|$SLOT_UPDATE], "rspec" => ["rspec", $SLOT_REQUIRED|$SLOT_UPDATE],
"script" => ["script", $SLOT_OPTIONAL|$SLOT_UPDATE], "script" => ["script", $SLOT_OPTIONAL|$SLOT_UPDATE],
); );
...@@ -403,6 +405,9 @@ if ($update) { ...@@ -403,6 +405,9 @@ if ($update) {
if (!defined($profile)) { if (!defined($profile)) {
fatal("Could not create new version of the profile"); fatal("Could not create new version of the profile");
} }
# Tell the web interface we created a new version.
$webtask->newProfile($profile->uuid())
if (defined($webtask));
} }
$profile->UpdateVersion({"rspec" => $update_args{"rspec"}}) $profile->UpdateVersion({"rspec" => $update_args{"rspec"}})
if (exists($update_args{"rspec"})); if (exists($update_args{"rspec"}));
...@@ -421,6 +426,14 @@ if ($update) { ...@@ -421,6 +426,14 @@ if ($update) {
$profile->UpdateMetaData(\%update_args) == 0 or $profile->UpdateMetaData(\%update_args) == 0 or
fatal("Could not update profile record"); fatal("Could not update profile record");
#
# Disabled is version specific right now.
#
if ($this_user->IsAdmin() &&
exists($update_args{"disabled"})) {
$profile->UpdateVersion({"disabled" => $update_args{"disabled"}});
}
# Bump the modtime. # Bump the modtime.
$profile->MarkModified(); $profile->MarkModified();
} }
......
...@@ -179,6 +179,10 @@ if (isset($profile)) { ...@@ -179,6 +179,10 @@ if (isset($profile)) {
$profile_array[$profile->uuid()] = $profile->name(); $profile_array[$profile->uuid()] = $profile->name();
$profilename = $profile->name(); $profilename = $profile->name();
} }
if ($profile->isDisabled()) {
SPITUSERERROR("This profile is disabled!");
exit();
}
} }
else { else {
# #
...@@ -209,7 +213,8 @@ else { ...@@ -209,7 +213,8 @@ else {
" v.profileid=p.profileid and ". " v.profileid=p.profileid and ".
" v.version=p.version ". " v.version=p.version ".
"$joinclause ". "$joinclause ".
"where locked is null and ($whereclause) ". "where locked is null and p.disabled=0 and ".
" v.disabled=0 and ($whereclause) ".
"order by p.topdog desc"); "order by p.topdog desc");
while ($row = mysql_fetch_array($query_result)) { while ($row = mysql_fetch_array($query_result)) {
$profile_array[$row["uuid"]] = $row["name"]; $profile_array[$row["uuid"]] = $row["name"];
...@@ -235,6 +240,10 @@ else { ...@@ -235,6 +240,10 @@ else {
SPITUSERERROR("No permission to use profile: $default"); SPITUSERERROR("No permission to use profile: $default");
exit(); exit();
} }
if ($obj->isDisabled()) {
SPITUSERERROR("This profile is disabled!");
exit();
}
$profile_array[$obj->uuid()] = $obj->name(); $profile_array[$obj->uuid()] = $obj->name();
$profile_default = $obj->uuid(); $profile_default = $obj->uuid();
} }
...@@ -304,9 +313,11 @@ function SPITFORM($formfields, $newuser, $errors) ...@@ -304,9 +313,11 @@ function SPITFORM($formfields, $newuser, $errors)
$showpicker = (isset($profile) ? 0 : 1); $showpicker = (isset($profile) ? 0 : 1);
if (isset($profilename)) { if (isset($profilename)) {
$profilename = "'$profilename'"; $profilename = "'$profilename'";
$profilevers = $profile->version();
} }
else { else {
$profilename = "null"; $profilename = "null";
$profilevers = "null";
} }
SPITHEADER(1); SPITHEADER(1);
...@@ -368,6 +379,7 @@ function SPITFORM($formfields, $newuser, $errors) ...@@ -368,6 +379,7 @@ function SPITFORM($formfields, $newuser, $errors)
echo "<script type='text/javascript'>\n"; echo "<script type='text/javascript'>\n";
echo " window.PROFILE = '" . $formfields["profile"] . "';\n"; echo " window.PROFILE = '" . $formfields["profile"] . "';\n";
echo " window.PROFILENAME= $profilename;\n"; echo " window.PROFILENAME= $profilename;\n";
echo " window.PROFILEVERS= $profilevers;\n";
echo " window.AJAXURL = 'server-ajax.php';\n"; echo " window.AJAXURL = 'server-ajax.php';\n";
echo " window.SHOWABOUT = $showabout;\n"; echo " window.SHOWABOUT = $showabout;\n";
echo " window.NOPPRSPEC = $nopprspec;\n"; echo " window.NOPPRSPEC = $nopprspec;\n";
......
...@@ -5,9 +5,11 @@ require(window.APT_OPTIONS.configObject, ...@@ -5,9 +5,11 @@ require(window.APT_OPTIONS.configObject,
'js/lib/text!template/aboutapt.html', 'js/lib/text!template/aboutapt.html',
'js/lib/text!template/aboutcloudlab.html', 'js/lib/text!template/aboutcloudlab.html',
'js/lib/text!template/waitwait-modal.html', 'js/lib/text!template/waitwait-modal.html',
'js/lib/text!template/rspectextview-modal.html',
'formhelpers', 'filestyle', 'marked', 'jacks', 'jquery-steps'], 'formhelpers', 'filestyle', 'marked', 'jacks', 'jquery-steps'],
function (_, Constraints, sup, ppstart, JacksEditor, wt, function (_, Constraints, sup, ppstart, JacksEditor, wt,
instantiateString, aboutaptString, aboutcloudString, waitwaitString) instantiateString, aboutaptString, aboutcloudString,
waitwaitString, rspecviewString)
{ {
'use strict'; 'use strict';
...@@ -17,7 +19,8 @@ function (_, Constraints, sup, ppstart, JacksEditor, wt, ...@@ -17,7 +19,8 @@ function (_, Constraints, sup, ppstart, JacksEditor, wt,
var profilelist = null; var profilelist = null;
var amdefault = null; var amdefault = null;
var selected_uuid = null; var selected_uuid = null;
var selected_rspec = null; var selected_rspec = null;
var selected_version = null;
var ispprofile = 0; var ispprofile = 0;
var webonly = 0; var webonly = 0;
var isadmin = 0; var isadmin = 0;
...@@ -76,6 +79,7 @@ function (_, Constraints, sup, ppstart, JacksEditor, wt, ...@@ -76,6 +79,7 @@ function (_, Constraints, sup, ppstart, JacksEditor, wt,
registered: registered, registered: registered,
profilename: window.PROFILENAME, profilename: window.PROFILENAME,
profileuuid: window.PROFILEUUID, profileuuid: window.PROFILEUUID,
profilevers: window.PROFILEVERS,
showpicker: showpicker, showpicker: showpicker,
cancopy: window.CANCOPY, cancopy: window.CANCOPY,
clustername: (window.ISCLOUD ? "CloudLab" : "APT"), clustername: (window.ISCLOUD ? "CloudLab" : "APT"),
...@@ -92,6 +96,7 @@ function (_, Constraints, sup, ppstart, JacksEditor, wt, ...@@ -92,6 +96,7 @@ function (_, Constraints, sup, ppstart, JacksEditor, wt,
}); });
$('#waitwait_div').html(waitwaitString); $('#waitwait_div').html(waitwaitString);
$('#rspecview_div').html(rspecviewString);
// The about panel. // The about panel.
if (window.SHOWABOUT) { if (window.SHOWABOUT) {
$('#about_div').html(window.ISCLOUD ? $('#about_div').html(window.ISCLOUD ?
...@@ -185,6 +190,26 @@ function (_, Constraints, sup, ppstart, JacksEditor, wt, ...@@ -185,6 +190,26 @@ function (_, Constraints, sup, ppstart, JacksEditor, wt,
return false; return false;
}); });
$('#show_xml_modal_button').click(function (event) {
//
// Show the XML source in the modal. This is used when we
// have a script, and the XML was generated. We show the
// XML, but it is not intended to be edited.
//
$('#rspec_modal_editbuttons').addClass("hidden");
$('#rspec_modal_viewbuttons').removeClass("hidden");
$('#modal_profile_rspec_textarea').val(selected_rspec);
$('#modal_profile_rspec_textarea').prop("readonly", true);
$('#modal_profile_rspec_div').addClass("hidden");
$('#modal_profile_rspec_textarea').removeClass("hidden");
$('#rspec_modal').modal({'backdrop':'static','keyboard':false});
$('#rspec_modal').modal('show');
});
$('#close_rspec_modal_button').click(function (event) {
$('#rspec_modal').modal('hide');
$('#modal_profile_rspec_textarea').val("");
});
// Profile picker search box. // Profile picker search box.
var profile_picker_timeout = null; var profile_picker_timeout = null;
...@@ -727,7 +752,8 @@ function (_, Constraints, sup, ppstart, JacksEditor, wt, ...@@ -727,7 +752,8 @@ function (_, Constraints, sup, ppstart, JacksEditor, wt,
$(selectedElement).addClass('selected'); $(selectedElement).addClass('selected');
} }
var continuation = function(rspec, description, name, amdefault, ispp) { var continuation = function(rspec, description, name, version,
amdefault, ispp) {
$('#showtopo_title').html("<h3>" + name + "</h3>"); $('#showtopo_title').html("<h3>" + name + "</h3>");
$('#showtopo_description').html(description); $('#showtopo_description').html(description);
sup.maketopmap('#showtopo_div', rspec, false, !multisite); sup.maketopmap('#showtopo_div', rspec, false, !multisite);
...@@ -739,7 +765,8 @@ function (_, Constraints, sup, ppstart, JacksEditor, wt, ...@@ -739,7 +765,8 @@ function (_, Constraints, sup, ppstart, JacksEditor, wt,
function ShowProfileSelectionInline(selectedElement, root, selectionPane) { function ShowProfileSelectionInline(selectedElement, root, selectionPane) {
editor = new JacksEditor(root, true, true, editor = new JacksEditor(root, true, true,
selectionPane, true, !multisite); selectionPane, true, !multisite);
var continuation = function(rspec, description, name, amdefault, ispp) { var continuation = function(rspec, description, name, version,
amdefault, ispp) {
if (rspec) if (rspec)
{ {
editor.show(rspec); editor.show(rspec);
...@@ -761,16 +788,19 @@ function (_, Constraints, sup, ppstart, JacksEditor, wt, ...@@ -761,16 +788,19 @@ function (_, Constraints, sup, ppstart, JacksEditor, wt,
$('#selected_profile').attr('value', profile_value); $('#selected_profile').attr('value', profile_value);
$('#selected_profile_text').html("" + profile_name); $('#selected_profile_text').html("" + profile_name);
var continuation = function(rspec, description, name, amdef, ispp) { var continuation = function(rspec, description, name, version,
amdef, ispp) {
$('#showtopo_title').html("<h3>" + name + "</h3>"); $('#showtopo_title').html("<h3>" + name + "</h3>");
$('#showtopo_description').html(description); $('#showtopo_description').html(description);
$('#selected_profile_description').html(description); $('#selected_profile_description').html(description);
$('#finalize_profile_name').val(name); $('#finalize_profile_name').text(name);
$('#finalize_profile_version').text(version);
ispprofile = ispp; ispprofile = ispp;
selected_uuid = profile_value; selected_uuid = profile_value;
selected_rspec = rspec; selected_rspec = rspec;
amdefault = amdef; selected_version = version;
amdefault = amdef;
CreateAggregateSelectors(rspec); CreateAggregateSelectors(rspec);
...@@ -815,7 +845,8 @@ function (_, Constraints, sup, ppstart, JacksEditor, wt, ...@@ -815,7 +845,8 @@ function (_, Constraints, sup, ppstart, JacksEditor, wt,
description = "Hmm, no description for this profile"; description = "Hmm, no description for this profile";
} }
continuation(json.value.rspec, description, continuation(json.value.rspec, description,
json.value.name, json.value.amdefault, json.value.name, json.value.version,
json.value.amdefault,
json.value.ispprofile); json.value.ispprofile);
} }
var $xmlthing = sup.CallServerMethod(ajaxurl, var $xmlthing = sup.CallServerMethod(ajaxurl,
......
...@@ -99,6 +99,8 @@ function (_, sup, filesize, JacksEditor, ShowImagingModal, moment, ppstart, ...@@ -99,6 +99,8 @@ function (_, sup, filesize, JacksEditor, ShowImagingModal, moment, ppstart,
button_label: window.BUTTONLABEL, button_label: window.BUTTONLABEL,
version_uuid: window.VERSION_UUID, version_uuid: window.VERSION_UUID,
profile_uuid: window.PROFILE_UUID, profile_uuid: window.PROFILE_UUID,
latest_uuid: window.LATEST_UUID,
latest_version: window.LATEST_VERSION,
candelete: window.CANDELETE, candelete: window.CANDELETE,
canmodify: window.CANMODIFY, canmodify: window.CANMODIFY,
canpublish: window.CANPUBLISH, canpublish: window.CANPUBLISH,
...@@ -109,6 +111,7 @@ function (_, sup, filesize, JacksEditor, ShowImagingModal, moment, ppstart, ...@@ -109,6 +111,7 @@ function (_, sup, filesize, JacksEditor, ShowImagingModal, moment, ppstart,
snapuuid: (window.SNAPUUID || null), snapuuid: (window.SNAPUUID || null),
general_error: (errors.error || ''), general_error: (errors.error || ''),
iscloud: window.ISCLOUD, iscloud: window.ISCLOUD,
disabled: window.DISABLED,
versions: versions, versions: versions,
withpublishing: window.WITHPUBLISHING, withpublishing: window.WITHPUBLISHING,
}); });
...@@ -349,6 +352,7 @@ function (_, sup, filesize, JacksEditor, ShowImagingModal, moment, ppstart, ...@@ -349,6 +352,7 @@ function (_, sup, filesize, JacksEditor, ShowImagingModal, moment, ppstart,
$('#profile_who_registered').change(function() { ProfileModified(); }); $('#profile_who_registered').change(function() { ProfileModified(); });
$('#profile_who_private').change(function() { ProfileModified(); }); $('#profile_who_private').change(function() { ProfileModified(); });
$('#profile_topdog').change(function() { ProfileModified(); }); $('#profile_topdog').change(function() { ProfileModified(); });
$('#profile_disabled').change(function() { ProfileModified(); });
/* /*
* A double click handler that will render the instructions * A double click handler that will render the instructions
......
...@@ -51,6 +51,7 @@ function (_, sup, moment, ppstart, ...@@ -51,6 +51,7 @@ function (_, sup, moment, ppstart,
history: window.HISTORY, history: window.HISTORY,
isadmin: window.ISADMIN, isadmin: window.ISADMIN,
canedit: window.CANEDIT, canedit: window.CANEDIT,
disabled: window.DISABLED,
withpublishing: window.WITHPUBLISHING, withpublishing: window.WITHPUBLISHING,
}); });
$('#page-body').html(show_html); $('#page-body').html(show_html);
......
...@@ -69,8 +69,11 @@ function SPITFORM($formfields, $errors) ...@@ -69,8 +69,11 @@ function SPITFORM($formfields, $errors)
$isadmin = (ISADMIN() ? 1 : 0); $isadmin = (ISADMIN() ? 1 : 0);
$multisite = 1; $multisite = 1;
$cloning = 0; $cloning = 0;
$disabled = 0;
$version_uuid = "null"; $version_uuid = "null";
$profile_uuid = "null"; $profile_uuid = "null";
$latest_uuid = "null";
$latest_version = "null";
if ($action == "edit") { if ($action == "edit") {
$button_label = "Save"; $button_label = "Save";
...@@ -83,12 +86,16 @@ function SPITFORM($formfields, $errors) ...@@ -83,12 +86,16 @@ function SPITFORM($formfields, $errors)
$canpublish = ($profile->CanPublish() ? 1 : 0); $canpublish = ($profile->CanPublish() ? 1 : 0);
$activity = ($profile->HasActivity() ? 1 : 0); $activity = ($profile->HasActivity() ? 1 : 0);
$ispp = ($profile->isParameterized() ? 1 : 0); $ispp = ($profile->isParameterized() ? 1 : 0);
$disabled = ($profile->isDisabled() ? 1 : 0);
if ($canmodify) { if ($canmodify) {
$title = "Modify Profile"; $title = "Modify Profile";
} }
else { else {
$title = "View Profile"; $title = "View Profile";
} }
$latest_profile = Profile::Lookup($profile->profile_uuid());
$latest_uuid = "'" . $latest_profile->uuid() . "'";
$latest_version = $latest_profile->version();
} }
else { else {
# New page action is now create, not copy or clone. # New page action is now create, not copy or clone.
...@@ -166,6 +173,8 @@ function SPITFORM($formfields, $errors) ...@@ -166,6 +173,8 @@ function SPITFORM($formfields, $errors)
echo " window.VIEWING = $viewing;\n"; echo " window.VIEWING = $viewing;\n";
echo " window.VERSION_UUID = $version_uuid;\n"; echo " window.VERSION_UUID = $version_uuid;\n";
echo " window.PROFILE_UUID = $profile_uuid;\n"; echo " window.PROFILE_UUID = $profile_uuid;\n";
echo " window.LATEST_UUID = $latest_uuid;\n";
echo " window.LATEST_VERSION = $latest_version;\n";
echo " window.UPDATED = $notifyupdate;\n"; echo " window.UPDATED = $notifyupdate;\n";
echo " window.SNAPPING = $notifyclone;\n"; echo " window.SNAPPING = $notifyclone;\n";
echo " window.AJAXURL = 'server-ajax.php';\n"; echo " window.AJAXURL = 'server-ajax.php';\n";
...@@ -173,6 +182,7 @@ function SPITFORM($formfields, $errors) ...@@ -173,6 +182,7 @@ function SPITFORM($formfields, $errors)
echo " window.CANDELETE= $candelete;\n"; echo " window.CANDELETE= $candelete;\n";
echo " window.CANMODIFY= $canmodify;\n"; echo " window.CANMODIFY= $canmodify;\n";
echo " window.CANPUBLISH= $canpublish;\n"; echo " window.CANPUBLISH= $canpublish;\n";
echo " window.DISABLED= $disabled;\n";
echo " window.ISADMIN = $isadmin;\n"; echo " window.ISADMIN = $isadmin;\n";
echo " window.MULTISITE = $multisite;\n"; echo " window.MULTISITE = $multisite;\n";
echo " window.HISTORY = $history;\n"; echo " window.HISTORY = $history;\n";
...@@ -356,6 +366,8 @@ if (! isset($create)) { ...@@ -356,6 +366,8 @@ if (! isset($create)) {
($profile->ispublic() ? "public" : "private")); ($profile->ispublic() ? "public" : "private"));
$defaults["profile_topdog"] = $defaults["profile_topdog"] =
($profile->topdog() ? "checked" : ""); ($profile->topdog() ? "checked" : "");
$defaults["profile_disabled"] =
($profile->isDisabled() ? "checked" : "");
# Warm fuzzy message. # Warm fuzzy message.
if (isset($_SESSION["notifyupdate"])) { if (isset($_SESSION["notifyupdate"])) {
...@@ -559,6 +571,15 @@ else { ...@@ -559,6 +571,15 @@ else {
fwrite($fp, "0"); fwrite($fp, "0");
} }
fwrite($fp, "</value></attribute>\n"); fwrite($fp, "</value></attribute>\n");
fwrite($fp, "<attribute name='profile_disabled'><value>");
if (isset($formfields["profile_disabled"]) &&
$formfields["profile_disabled"] == "checked") {
fwrite($fp, "1");
}
else {
fwrite($fp, "0");
}
fwrite($fp, "</value></attribute>\n");
} }
fwrite($fp, "</profile>\n"); fwrite($fp, "</profile>\n");
fclose($fp); fclose($fp);
...@@ -577,9 +598,9 @@ if ($action == "edit") { ...@@ -577,9 +598,9 @@ if ($action == "edit") {
} }
else { else {
$command .= " create -t $webtask_id "; $command .= " create -t $webtask_id ";
} if (isset($snapuuid)) {
if (isset($snapuuid)) { $command .= " -s " . escapeshellarg($snapuuid);
$command .= " -s " . escapeshellarg($snapuuid); }
} }
$command .= " $xmlname"; $command .= " $xmlname";
...@@ -612,15 +633,25 @@ if (count($errors)) { ...@@ -612,15 +633,25 @@ if (count($errors)) {
return; return;
} }
#
# Need the index to pass back through. But when its an edit operation,
# we have to let the backend tell us it created a new version, since
# we want to return to that.
#
if ($action == "edit") {
if ($webtask->TaskValue("newProfile")) {
$profile = Profile::Lookup($webtask->TaskValue("newProfile"));
}
}
else {
$profile = Profile::LookupByName($project, $formfields["profile_name"]);
}
# Done with this, unless doing a snapshot (needed for imaging status). # Done with this, unless doing a snapshot (needed for imaging status).
if (!isset($snapuuid)) { if (!isset($snapuuid)) {
$webtask->Delete(); $webtask->Delete();
} }
#
# Need the index to pass back through.
#
$profile = Profile::LookupByName($project, $formfields["profile_name"]);
if ($profile) { if ($profile) {
$uuid = $profile->uuid(); $uuid = $profile->uuid();
} }
......
...@@ -46,7 +46,8 @@ class Profile ...@@ -46,7 +46,8 @@ class Profile
# version with the uuid. # version with the uuid.
# #
$query_result = $query_result =
DBQueryWarn("select i.*,v.*,i.uuid as profile_uuid ". DBQueryWarn("select i.*,v.*,i.uuid as profile_uuid, ".
" i.disabled as profile_disabled ".
" from apt_profiles as i ". " from apt_profiles as i ".
"left join apt_profile_versions as v on ". "left join apt_profile_versions as v on ".
" v.profileid=i.profileid and ". " v.profileid=i.profileid and ".
...@@ -55,7 +56,8 @@ class Profile ...@@ -55,7 +56,8 @@ class Profile
if (!$query_result || !mysql_num_rows($query_result)) { if (!$query_result || !mysql_num_rows($query_result)) {
$query_result = $query_result =
DBQueryWarn("select i.*,v.*,i.uuid as profile_uuid ". DBQueryWarn("select i.*,v.*,i.uuid as profile_uuid, ".
" i.disabled as profile_disabled ".
" from apt_profile_versions as v ". " from apt_profile_versions as v ".
"left join apt_profiles as i on ". "left join apt_profiles as i on ".
" v.profileid=i.profileid ". " v.profileid=i.profileid ".
...@@ -65,7 +67,8 @@ class Profile ...@@ -65,7 +67,8 @@ class Profile
} }
elseif (is_null($version)) { elseif (is_null($version)) {
$query_result = $query_result =
DBQueryWarn("select i.*,v.*,i.uuid as profile_uuid ". DBQueryWarn("select i.*,v.*,i.uuid as profile_uuid, ".
" i.disabled as profile_disabled ".
" from apt_profiles as i ". " from apt_profiles as i ".
"left join apt_profile_versions as v on ". "left join apt_profile_versions as v on ".
" v.profileid=i.profileid and ". " v.profileid=i.profileid and ".
...@@ -75,7 +78,8 @@ class Profile ...@@ -75,7 +78,8 @@ class Profile
else { else {
$safe_version = addslashes($version); $safe_version = addslashes($version);
$query_result = $query_result =
DBQueryWarn("select i.*,v.*,i.uuid as profile_uuid ". DBQueryWarn("select i.*,v.*,i.uuid as profile_uuid, ".
" i.disabled as profile_disabled ".
" from apt_profile_versions as v ". " from apt_profile_versions as v ".
"left join apt_profiles as i on ". "left join apt_profiles as i on ".
" i.profileid=v.profileid ". " i.profileid=v.profileid ".
...@@ -117,6 +121,8 @@ class Profile ...@@ -117,6 +121,8 @@ class Profile
function locked() { return $this->field('status'); } function locked() { return $this->field('status'); }
function status() { return $this->field('locked'); } function status() { return $this->field('locked'); }
function topdog() { return $this->field('topdog'); } function topdog() { return $this->field('topdog'); }
function disabled() { return $this->field('disabled'); }
function profile_disabled() { return $this->field('profile_disabled'); }
function parent_profileid() { return $this->field('parent_profileid'); } function parent_profileid() { return $this->field('parent_profileid'); }
function parent_version() { return $this->field('parent_version'); } function parent_version() { return $this->field('parent_version'); }
...@@ -128,6 +134,10 @@ class Profile ...@@ -128,6 +134,10 @@ class Profile
function isParameterized() { function isParameterized() {
return ($this->paramdefs() != "" ? 1 : 0); return ($this->paramdefs() != "" ? 1 : 0);
} }
# A profile is disabled if version is disabled or entire profile is disabled
function isDisabled() {
return ($this->disabled() || $this->profile_disabled());
}
# Hmm, how does one cause an error in a php constructor? # Hmm, how does one cause an error in a php constructor?
function IsValid() { function IsValid() {
......
...@@ -61,6 +61,7 @@ $version_uuid = $profile->uuid(); ...@@ -61,6 +61,7 @@ $version_uuid = $profile->uuid();
$ispp = ($profile->isParameterized() ? 1 : 0); $ispp = ($profile->isParameterized() ? 1 : 0);
$history = ($profile->HasHistory() ? 1 : 0); $history = ($profile->HasHistory() ? 1 : 0);
$canedit = ($profile->CanEdit($this_user) ? 1 : 0); $canedit = ($profile->CanEdit($this_user) ? 1 : 0);
$disabled = ($profile->isDisabled() ? 1 : 0);
$defaults = array(); $defaults = array();
$defaults["profile_name"] = $profile->name(); $defaults["profile_name"] = $profile->name();
...@@ -111,6 +112,7 @@ echo " window.VERSION_UUID = '$version_uuid';\n"; ...@@ -111,6 +112,7 @@ echo " window.VERSION_UUID = '$version_uuid';\n";
echo " window.AJAXURL = 'server-ajax.php';\n"; echo " window.AJAXURL = 'server-ajax.php';\n";
echo " window.ISADMIN = $isadmin;\n"; echo " window.ISADMIN = $isadmin;\n";
echo " window.CANEDIT = $canedit;\n"; echo " window.CANEDIT = $canedit;\n";
echo " window.DISABLED = $disabled;\n";
echo " window.HISTORY = $history;\n"; echo " window.HISTORY = $history;\n";
echo " window.ISPPPROFILE = $ispp;\n"; echo " window.ISPPPROFILE = $ispp;\n";
echo " window.WITHPUBLISHING = $WITHPUBLISHING;\n"; echo " window.WITHPUBLISHING = $WITHPUBLISHING;\n";
......
...@@ -227,6 +227,30 @@ ...@@ -227,6 +227,30 @@
name='fully_bound' value="0"> name='fully_bound' value="0">
<div id='finalize_container' <div id='finalize_container'
class='col-lg-8 col-md-8 col-sm-8 col-xs-12'> class='col-lg-8 col-md-8 col-sm-8 col-xs-12'>
<div class='panel panel-default' style="margin-bottom: 5px">
<div class='panel-body'
style="padding-top: 5px; padding-bottom: 0px;">
<table class='table table-condensed nospaceafter border-none'
style="font-size: 14px; font-family: Arial,sans-serif;">
<tr>