bug 7018: fixed an issue where dialog boxes were not correctly being cleaned up when you navigated in the UI. Essentially they were being duplicated.

- Fixed issue where the "change" event on the Add Volume dialog was being duplicated.
bug 7018: resolved fixed
This commit is contained in:
will 2010-11-18 16:52:43 -08:00
parent d222a52ccb
commit fc7d519c4b
3 changed files with 23 additions and 23 deletions

View File

@ -395,14 +395,14 @@ $(document).ready(function() {
}
// Dialogs
initDialog("dialog_confirmation");
initDialogWithOK("dialog_info");
initDialog("dialog_confirmation", 150, false);
initDialogWithOK("dialog_info", 150, false);
initDialogWithOK("dialog_alert");
initDialogWithOK("dialog_alert", 150, false);
$("#dialog_alert").siblings(".ui-widget-header").css("background", "url('/client/css/images/ui-bg_errorglass_30_ffffff_1x400.png') repeat-x scroll 50% 50% #393939");
$("#dialog_alert").siblings(".ui-dialog-buttonpane").find(".ui-state-default").css("background", "url('/client/css/images/ui-bg_errorglass_30_ffffff_1x400.png') repeat-x scroll 50% 50% #393939");
initDialogWithOK("dialog_error");
initDialogWithOK("dialog_error", 150, false);
$("#dialog_error").siblings(".ui-widget-header").css("background", "url('/client/css/images/ui-bg_errorglass_30_ffffff_1x400.png') repeat-x scroll 50% 50% #393939");
$("#dialog_error").siblings(".ui-dialog-buttonpane").find(".ui-state-default").css("background", "url('/client/css/images/ui-bg_errorglass_30_ffffff_1x400.png') repeat-x scroll 50% 50% #393939");
@ -415,7 +415,7 @@ $(document).ready(function() {
$("#dialog_session_expired").siblings(".ui-widget-header").css("background", "url('/client/css/images/ui-bg_errorglass_30_ffffff_1x400.png') repeat-x scroll 50% 50% #393939");
$("#dialog_session_expired").siblings(".ui-dialog-buttonpane").find(".ui-state-default").css("background", "url('/client/css/images/ui-bg_errorglass_30_ffffff_1x400.png') repeat-x scroll 50% 50% #393939");
initDialogWithOK("dialog_info_please_select_one_item_in_middle_menu");
initDialogWithOK("dialog_info_please_select_one_item_in_middle_menu", 150, false);
// Check whether the session is valid.
g_mySession = $.cookie("JSESSIONID");

View File

@ -840,13 +840,13 @@ function setTemplateStateInRightPanel(stateValue, $stateField) {
$stateField.text(stateValue).removeClass("status_green").addClass("status_red");
}
function initDialog(elementId, width1) {
function initDialog(elementId, width1, addToActive) {
if(width1 == null) {
activateDialog($("#"+elementId).dialog({
autoOpen: false,
modal: true,
zIndex: 2000
}));
}), addToActive);
}
else {
activateDialog($("#"+elementId).dialog({
@ -854,18 +854,18 @@ function initDialog(elementId, width1) {
autoOpen: false,
modal: true,
zIndex: 2000
}));
}), addToActive);
}
}
function initDialogWithOK(elementId, width1) {
function initDialogWithOK(elementId, width1, addToActive) {
if(width1 == null) {
activateDialog($("#"+elementId).dialog({
autoOpen: false,
modal: true,
zIndex: 2000,
buttons: { "OK": function() { $(this).dialog("close"); } }
}));
}), addToActive);
}
else {
activateDialog($("#"+elementId).dialog({
@ -874,7 +874,7 @@ function initDialogWithOK(elementId, width1) {
modal: true,
zIndex: 2000,
buttons: { "OK": function() { $(this).dialog("close"); } }
}));
}), addToActive);
}
}
@ -976,7 +976,7 @@ function listMidMenuItems(commandString, jsonResponse1, jsonResponse2, rightPane
$(this).find("#action_menu").hide();
return false;
});
removeDialogs();
afterLoadRightPanelJSPFn();
listMidMenuItems2(commandString, jsonResponse1, jsonResponse2, toMidmenuFn, toRightPanelFn, getMidmenuIdFn, isMultipleSelectionInMidMenu, true);
});
@ -1786,8 +1786,10 @@ function handleError(XMLHttpResponse, handleErrorCallback) {
// FUNCTION: Adds a Dialog to the list of active Dialogs so that
// when you shift from one tab to another, we clean out the dialogs
var activeDialogs = new Array();
function activateDialog(dialog) {
activeDialogs[activeDialogs.length] = dialog;
function activateDialog(dialog, addToActive) {
if (addToActive == undefined || addToActive) {
activeDialogs[activeDialogs.length] = dialog;
}
//bind Enter-Key-pressing event handler to the dialog
dialog.keypress(function(event) {

View File

@ -63,19 +63,17 @@ function afterLoadVolumeJSP() {
var offerings = json.listdiskofferingsresponse.diskoffering;
var volumeDiskOfferingSelect = $("#dialog_add_volume").find("#volume_diskoffering").empty();
if (offerings != null && offerings.length > 0) {
if (offerings != null && offerings.length > 0) {
for (var i = 0; i < offerings.length; i++) {
var $option = $("<option value='" + offerings[i].id + "'>" + fromdb(offerings[i].displaytext) + "</option>");
$option.data("jsonObj", offerings[i]);
volumeDiskOfferingSelect.append($option);
}
$("#dialog_add_volume").find("#volume_diskoffering").change();
}
for (var i = 0; i < offerings.length; i++) {
var $option = $("<option value='" + offerings[i].id + "'>" + fromdb(offerings[i].displaytext) + "</option>");
$option.data("jsonObj", offerings[i]);
volumeDiskOfferingSelect.append($option);
}
$("#dialog_add_volume").find("#volume_diskoffering").change();
}
}
});
$("#dialog_add_volume").find("#volume_diskoffering").bind("change", function(event) {
$("#dialog_add_volume").find("#volume_diskoffering").unbind("change").bind("change", function(event) {
var jsonObj = $(this).find("option:selected").data("jsonObj");
if(jsonObj.isCustomized == true) {
$("#dialog_add_volume").find("#size_container").show();