// Init variables
var currentTabId = null;
-var processDisplayed = false;
-var errorDisplayed = false;
-var warningDisplayed = false;
var defaultTabId = null;
var footerElements = new Array();
var changedElements = new Array();
currentTabId = tabId;
}
+// Checks whether a given element is visible by checking 'display: none'
+function isElementVisible (prefix, element) {
+ // Get element
+ var el = document.getElementById(prefix + '_' + element);
+
+ // Is element set?
+ if (el == null || el == undefined) {
+ throw new '"' + prefix + '_' + element + '" does not exist.';
+ }
+
+ // Default is visible
+ var isVisible = ((el.style.display == undefined) || ((el.style.display != 'none') && (el.style.display != '')));
+
+ // Return status
+ return isVisible;
+}
+
// Marks a tab navigation entry
function markTabNavigation (prefix, tab) {
// Is process working?
- if (processDisplayed == true) {
+ if (isElementVisible(prefix, 'process')) {
// Then exit silently
return;
} // END - if
// Enables footer navigation buttons
function enableFooterNavigation (prefix, tabId) {
// Is process working?
- if (processDisplayed == true) {
+ if (isElementVisible(prefix, 'process')) {
// Then exit silently
return;
} // END - if
// Requests an AJAX content
function requestAjaxContent (prefix, htmlId, tabId, footerNavigation) {
// Is process working?
- if (processDisplayed == true) {
+ if (isElementVisible(prefix, 'process')) {
// Then exit silently
return;
} // END - if
// Enable element
enableElement(element);
});
-
- // Mark 'warning' as displayed
- warningDisplayed = true;
} else {
// Display error message
displayErrorWindow(prefix, getAjaxContent());
// Fade error out for eye-candy, if open
closeErrorWindow(prefix);
+ // Fade it out for eye-candy
+ closeProcessWindow(prefix);
+
// Abort here if warningDisplayed is still true
- if (warningDisplayed == true) {
+ if (isElementVisible(prefix, 'warning')) {
// Make sure this doesn't happen
return;
} // END - if
// Fade the warning in
$('#' + prefix + '_warning').fadeIn('slow', function() {
- // Mark warning as displayed
- warningDisplayed = true;
+ // Do nothing for now
});
} else {
// Display error message
// Fade it out for eye-candy
closeErrorWindow(prefix);
+ // Fade it out for eye-candy
+ closeProcessWindow(prefix);
+
// Abort here if errorDisplayed is still true
- if (errorDisplayed == true) {
+ if (isElementVisible(prefix, 'error')) {
// Make sure this doesn't happen
return;
} // END - if
// Fade the error in
$('#' + prefix + '_error').fadeIn('slow', function() {
- // Mark error as displayed
- errorDisplayed = true;
+ // Do nothing for now
});
}
closeProcessWindow(prefix);
// Abort here if processDisplayed is still true
- if (processDisplayed == true) {
+ if (isElementVisible(prefix, 'process')) {
// Make sure this doesn't happen
return;
} // END - if
// Copy the response text to the process variable
if (ajax_content.reply_content != undefined) {
- $('#' + prefix + '_process_content').html(ajax_content.reply_content);
+ // Set HTML content
+ setProcessContent(prefix, ajax_content.reply_content);
} else {
- $('#' + prefix + '_process_content').html(ajax_content);
+ setProcessContent(prefix, ajax_content);
}
// Fade the process in
$('#' + prefix + '_process').fadeIn('slow', function() {
- // Mark process as displayed
- processDisplayed = true;
+ // Do nothing for now
});
}
+// Sets "process content"
+function setProcessContent (prefix, content) {
+ // Set HTML content
+ $('#' + prefix + '_process_content').html(content);
+}
+
// Waits until the window has been closed
function closeErrorLocked () {
// Has all been loaded?
- if (errorDisplayed == false) {
+ if (!isElementVisible(prefix, 'error')) {
// Then release ready()
$.holdReady(false);
} else {
// Waits until the window has been closed
function closeProcessLocked () {
// Has all been loaded?
- if (processDisplayed == false) {
+ if (!isElementVisible(prefix, 'process')) {
// Then release ready()
$.holdReady(false);
} else {
// Closes an error window
function closeErrorWindow (prefix, waitClose, resetCurrentTabId) {
// Is the error displayed?
- if (errorDisplayed == true) {
+ if (isElementVisible(prefix, 'error')) {
// Shall we wait ("sync") until the animation has completed?
if (waitClose == true) {
// Hold the ready status
if (resetCurrentTabId == true) {
setCurrentTabId(defaultTabId);
} // END - if
-
- // Mark it as closed
- errorDisplayed = false;
});
// Shall this animation be "synchronized"?
// Closes an process window
function closeProcessWindow (prefix, waitClose, resetCurrentTabId) {
// Is the process displayed?
- if (processDisplayed == true) {
+ if (isElementVisible(prefix, 'process')) {
// Shall we wait ("sync") until the animation has completed?
if (waitClose == true) {
// Hold the ready status
if (resetCurrentTabId == true) {
setCurrentTabId(defaultTabId);
} // END - if
-
- // Mark it as closed
- processDisplayed = false;
});
// Shall this animation be "synchronized"?
// Waits until the window has been closed
function closeWarningLocked () {
// Has all been loaded?
- if (warningDisplayed == false) {
+ if (!isElementVisible(prefix, 'warning')) {
// Then release ready()
$.holdReady(false);
} else {
function closeWarningWindow (prefix, waitClose, resetCurrentTabId) {
//* DEBUG: */ alert('prefix=' + prefix + ',waitClose=' + waitClose + ' - ENTERED!');
// Is the warning displayed?
- if (warningDisplayed == true) {
+ if (isElementVisible(prefix, 'warning')) {
// Shall we wait ("sync") until the animation has completed?
//* DEBUG: */ alert('prefix=' + prefix + ',waitClose=' + waitClose + ',warningDisplayed=true');
if (waitClose == true) {
// Yes, then fade it out
$('#' + prefix + '_warning').fadeOut('fast', function() {
// Set current tab id to default
- //* DEBUG: */ alert('closeWarningWindow(): prefix=' + prefix + ',waitClose=' + waitClose + ',defaultTab=' + defaultTabId + ' - Calling setCurrentTabId()');
if (resetCurrentTabId == true) {
setCurrentTabId(defaultTabId);
} // END - if
-
- // Mark it as closed
- warningDisplayed = false;
- //* DEBUG: */ alert('closeWarningWindow(): waitClose=' + waitClose + ',resetCurrentTabId=' + resetCurrentTabId + ',warningDisplayed=false');
});
// Shall this animation be "synchronized"?
} // END - if
// Is process working?
- if (processDisplayed == true) {
+ if (isElementVisible(prefix, 'process')) {
// Then exit silently
return;
} // END - if
// Saves changes by sending the data to the AJAX backend script
function saveChanges (prefix) {
// Is process working?
- if (processDisplayed == true) {
+ if (isElementVisible(prefix, 'process')) {
// Then exit silently
return;
} // END - if
// Saves changed settings and continues with given tab
function doSaveChangesContinue (prefix, htmlId, tab) {
// Is process working?
- if (processDisplayed == true) {
+ if (isElementVisible(prefix, 'process')) {
// Then exit silently
return;
} // END - if