new UI - Global Settings - implement UpdateGlobalSettings action.

This commit is contained in:
Jessica Wang 2010-10-08 10:37:28 -07:00
parent cde98c9ba3
commit 089de3ae6a
4 changed files with 67 additions and 1 deletions

View File

@ -91,5 +91,6 @@ please.confirm.you.want.to.lock.account.that.will.prevent.account.access.to.the.
please.confirm.you.want.to.enable.account = Please confirm you want to enable account.
please.select.an.available.zone.to.associate.your.new.ip.with..acquiring.additional.ip.may.cost.you.an.additional.dollars.per.month. = Please select an availability zone to associate your new IP with. Acquiring additional IP may cost you an additional dollars per month.
please.confirm.you.want.to.release.this.IP.address = Please confirm you want to release this IP address
please.restart.your.management.server.for.your.new.settings.to.take.effect = Please RESTART your management server for your new settings to take effect

View File

@ -62,7 +62,9 @@
</div>
<div class="grid_row_cell" style="width: 79%;">
<div class="row_celltitles" id="value">
</div>
</div>
<input class="text" id="value_edit" style="width: 200px; display: none;" type="text" />
<div id="value_edit_errormsg" style="display:none"></div>
</div>
</div>
<div class="grid_rows odd">
@ -82,3 +84,9 @@
</div>
</div>
</div>
<div id="dialog_alert_restart_management_server" title="Alert" style="display:none">
<p>
<%=t.t("please.restart.your.management.server.for.your.new.settings.to.take.effect")%>
</p>
</div>

View File

@ -1,5 +1,41 @@
function afterLoadGlobalSettingJSP() {
var $detailsTab = $("#right_panel_content #tab_content_details");
//edit button ***
var $readonlyFields = $detailsTab.find("#value");
var $editFields = $detailsTab.find("#value_edit");
initializeEditFunction($readonlyFields, $editFields, doUpdateGlobalSetting);
//initialize dialogs
initDialogWithOK("dialog_alert_restart_management_server");
}
function doUpdateGlobalSetting() {
// validate values
var $detailsTab = $("#right_panel_content #tab_content_details");
var isValid = true;
isValid &= validateString("Value", $detailsTab.find("#value_edit"), $detailsTab.find("#value_edit_errormsg"), true);
if (!isValid)
return;
var jsonObj = $detailsTab.data("jsonObj");
var name = jsonObj.name;
var value = trim($detailsTab.find("#value_edit").val());
$.ajax({
data: createURL("command=updateConfiguration&name="+todb(name)+"&value="+todb(value)+"&response=json"),
dataType: "json",
success: function(json) {
$detailsTab.find("#value").text(value);
//no embedded object returned, so....
jsonObj.value = value;
globalSettingToMidmenu(jsonObj, $("#"+globalSettingGetMidmenuId(jsonObj)));
$("#dialog_alert_restart_management_server").dialog("open");
}
});
}
function globalSettingGetMidmenuId(jsonObj) {
@ -29,5 +65,6 @@ function globalSettingJsonToDetailsTab(jsonObj) {
$detailsTab.data("jsonObj", jsonObj);
$detailsTab.find("#name").text(fromdb(jsonObj.name));
$detailsTab.find("#value").text(fromdb(jsonObj.value));
$detailsTab.find("#value_edit").val(fromdb(jsonObj.value));
$detailsTab.find("#description").text(fromdb(jsonObj.description));
}

View File

@ -781,6 +781,26 @@ function initDialog(elementId, width1) {
}
}
function initDialogWithOK(elementId, width1) {
if(width1 == null) {
$("#"+elementId).dialog({
autoOpen: false,
modal: true,
zIndex: 2000,
buttons: { "OK": function() { $(this).dialog("close"); } }
});
}
else {
$("#"+elementId).dialog({
width: width1,
autoOpen: false,
modal: true,
zIndex: 2000,
buttons: { "OK": function() { $(this).dialog("close"); } }
});
}
}
function disableMultipleSelectionInMidMenu() {
$("#midmenu_container").selectable("destroy"); //Most pages don't need multiple selection in middle menu.
}