dialog behaviour fixes

This commit is contained in:
Andrew Dolgov 2010-11-17 10:12:50 +03:00
parent 76657c46b8
commit 439caa8b93
3 changed files with 38 additions and 27 deletions

View File

@ -2,7 +2,6 @@ var hotkeys_enabled = true;
var notify_silent = false; var notify_silent = false;
var last_progress_point = 0; var last_progress_point = 0;
var sanity_check_done = false; var sanity_check_done = false;
var dialogs = [];
/* add method to remove element from array */ /* add method to remove element from array */
@ -392,10 +391,9 @@ function closeInfoBox(cleanup) {
try { try {
enableHotkeys(); enableHotkeys();
var dialog = dialogs.pop(); dialog = dijit.byId("infoBox");
if (dialog) if (dialog) dialog.hide();
dialog.hide();
} catch (e) { } catch (e) {
//exception_error("closeInfoBox", e); //exception_error("closeInfoBox", e);
@ -438,9 +436,10 @@ function infobox_submit_callback2(transport) {
function infobox_callback2(transport) { function infobox_callback2(transport) {
try { try {
var dialog = false;
if (dijit.byId("infoBox")) { if (dijit.byId("infoBox")) {
dialogs.pop(); dialog = dijit.byId("infoBox");
dijit.byId("infoBox").destroy();
} }
//console.log("infobox_callback2"); //console.log("infobox_callback2");
@ -464,28 +463,28 @@ function infobox_callback2(transport) {
content = transport.responseText; content = transport.responseText;
} }
var dialog = new dijit.Dialog({ if (!dialog) {
title: title, dialog = new dijit.Dialog({
id: 'infoBox', title: title,
style: "width: 600px", id: 'infoBox',
onCancel: function() { style: "width: 600px",
dialogs.remove(this); onCancel: function() {
return true; return true;
}, },
onExecute: function() { onExecute: function() {
dialogs.remove(this); return true;
return true; },
}, onClose: function() {
onClose: function() { return true;
dialogs.remove(this); },
return true; content: content});
}, } else {
content: content}); dialog.attr('title', title);
dialog.attr('content', content);
}
dialog.show(); dialog.show();
dialogs.push(dialog);
notify(""); notify("");
} catch (e) { } catch (e) {
exception_error("infobox_callback2", e); exception_error("infobox_callback2", e);

View File

@ -1230,7 +1230,13 @@ function pref_hotkey_handler(e) {
closeInfoBox(); closeInfoBox();
} }
if (dialogs.length > 0 || !hotkeys_enabled) { var dialog = dijit.byId("infoBox");
var dialog_visible = false;
if (dialog)
dialog_visible = Element.visible(dialog.domNode);
if (dialog_visible || !hotkeys_enabled) {
console.log("hotkeys disabled"); console.log("hotkeys disabled");
return; return;
} }

View File

@ -743,7 +743,13 @@ function hotkey_handler(e) {
closeInfoBox(); closeInfoBox();
} }
if (dialogs.length > 0 || !hotkeys_enabled) { var dialog = dijit.byId("infoBox");
var dialog_visible = false;
if (dialog)
dialog_visible = Element.visible(dialog.domNode);
if (dialog_visible || !hotkeys_enabled) {
console.log("hotkeys disabled"); console.log("hotkeys disabled");
return; return;
} }