var defaultTabId = null;
var footerElements = new Array();
var changedElements = new Array();
+var data = new Array();
var formChanged = false;
var saveChangesId = null;
var lastErrorMessage = null;
var el = document.getElementById(prefix + '_' + element);
// Is element set?
- if (el == null || el == undefined) {
+ if ((el == null) || (el == undefined)) {
throw new '"' + prefix + '_' + element + '" does not exist.';
+ } else if ((el.style.display == undefined) || (el.style.display == '')) {
+ throw new '"' + prefix + '_' + element + '" has no style.display element.';
}
// Default is visible
- var isVisible = ((el.style.display == undefined) || ((el.style.display != 'none') && (el.style.display != '')));
+ var isVisible = (el.style.display != 'none');
+ //* DEBUG: */ alert(prefix + '_' + element + ':' + el.style.display + '=' + isVisible);
// Return status
return isVisible;
// Marks a tab navigation entry
function markTabNavigation (prefix, tab) {
- // Is process working?
- if (isElementVisible(prefix, 'process')) {
+ // Is progress working?
+ if (isElementVisible(prefix, 'progress')) {
// Then exit silently
return;
} // END - if
// Enables a given footer navigation element
function enableFooterNavigationPage (element) {
- // Remove the 'disabled' class and attribute
+ // Is it 'finish'?
if (element == 'finish') {
+ // Then without '_page' suffix
enableElement('input#finish');
} else {
+ // Regular element with '_page' suffix
enableElement('input#' + element + '_page');
+
+ // Disable 'finish' element
disableElement('input#finish');
}
}
function resetFooterNavigation () {
// Remove the 'disabled' class and attribute
for (var i = 0; i < footerElements.length; i++) {
- $('input#' + footerElements[i] + '_page').addClass('disabled');
- $('input#' + footerElements[i] + '_page').attr('disabled', 'disabled');
- $('input#' + footerElements[i] + '_page').blur();
+ disableElement('input#' + footerElements[i] + '_page');
} // END - for
+
+ // Disable this element
+ disableElement('input#finish');
}
// Getter for AJAX content
function getAjaxContent () {
// Is it defined?
- if ($('body').data('ajax_content') == undefined) {
+ if (data['ajax_content'] == undefined) {
// Not set
throw new 'ajax_content requested but not set.';
} // END - if
// Return it
- return $('body').data('ajax_content');
+ return data['ajax_content'];
+}
+
+// Setter for AJAX content
+function setAjaxContent (ajax_content) {
+ data['ajax_content'] = ajax_content;
}
// "Setter" for AJAX content but does decode the content
setAjaxContent(decoded);
}
-// Setter for AJAX content
-function setAjaxContent (ajax_content) {
- $('body').data('ajax_content', ajax_content);
-}
-
// Getter for AJAX success
function getAjaxSuccess () {
- return $('body').data('ajax_success');
+ return data['ajax_success'];
}
// Setter for AJAX success
function setAjaxSuccess (success) {
- $('body').data('ajax_success', success);
+ data['ajax_success'] = success;
}
// Set AJAX reply and decode JSON if requested
function setAjaxReply (reply, isJson) {
// Is it JSON URL-encoded content?
+ //* DEBUG: */ alert('setAjaxReply(): reply=' + reply + ',isJson=' + isJson);
if ((isJson != undefined) && (isJson == true)) {
// Decode URL-encoding (for some reason it must be here ...)
var localReply = decodeUrlEncoding(reply);
data: 'level=' + level + '&do=' + doValue + extra,
dataType: 'json',
async: false,
+ timeout: 10000,
// Called on success
success: function (ajax_content) {
});
// Return status
+ //* DEBUG: */ alert(getAjaxSuccess() + ':' + level + ',' + doValue + ',' + extra + ',' + isJson);
return getAjaxSuccess();
}
// Enables footer navigation buttons
function enableFooterNavigation (prefix, tabId) {
- // Is process working?
- if (isElementVisible(prefix, 'process')) {
+ // Is progress working?
+ if (isElementVisible(prefix, 'progress')) {
// Then exit silently
return;
} // END - if
// Requests an AJAX content
function requestAjaxContent (prefix, htmlId, tabId, footerNavigation) {
- // Is process working?
- if (isElementVisible(prefix, 'process')) {
+ // Is progress working?
+ if (isElementVisible(prefix, 'progress')) {
// Then exit silently
return;
} // END - if
// Register click-event for error window
$('#' + prefix + '_error_close').click(function () {
// Close the window
- closeErrorWindow(prefix);
+ closeErrorWindow(prefix, true, false);
});
// Register click-event for warning window
$('#' + prefix + '_warning_close').click(function () {
// Close the window
//* DEBUG: */ alert('displayTestWindow(): prefix=' + prefix + ' - calling closeWarningWindow()');
- closeWarningWindow(prefix);
+ closeWarningWindow(prefix, true, false);
});
// Request it from the AJAX backend
function displayChangedWarningWindow (prefix, button) {
// Fade out warning window, if open
//* DEBUG: */ alert('displayChangedWarningWindow(): prefix=' + prefix + ',button=' + button + ' - calling closeWarningWindow()');
- closeWarningWindow(prefix);
+ closeWarningWindow(prefix, true, false);
// Fade error out for eye-candy, if open
- closeErrorWindow(prefix);
+ closeErrorWindow(prefix, true, false);
// Fade it out for eye-candy
- closeProcessWindow(prefix);
+ closeProgressWindow(prefix, true, false);
// Abort here if warningDisplayed is still true
if (isElementVisible(prefix, 'warning')) {
// Displays the error window for given prefix and content
function displayErrorWindow (prefix, ajax_content) {
// Fade out warning window, if open
- //* DEBUG: */ alert('displayErrorWindow(): prefix=' + prefix + ' - calling closeWarningWindow()');
- closeWarningWindow(prefix);
+ //* DEBUG: */ alert('displayErrorWindow(): prefix=' + prefix + ',ajax_content=' + ajax_content.reply_content + ' - calling closeWarningWindow()');
+ closeWarningWindow(prefix, true, false);
// Fade it out for eye-candy
- closeErrorWindow(prefix);
+ closeErrorWindow(prefix, true, false);
// Fade it out for eye-candy
- closeProcessWindow(prefix);
+ closeProgressWindow(prefix, true, false);
// Abort here if errorDisplayed is still true
if (isElementVisible(prefix, 'error')) {
});
}
-// Displays the process window for given prefix and content
-function displayProcessWindow (prefix, ajax_content) {
+// Displays the progress window for given prefix and content
+function displayProgressWindow (prefix, ajax_content) {
// Fade out warning window, if open
- //* DEBUG: */ alert('displayProcessWindow(): prefix=' + prefix + ' - calling closeWarningWindow()');
- closeWarningWindow(prefix);
+ //* DEBUG: */ alert('displayProgressWindow(): prefix=' + prefix + ' - calling closeWarningWindow()');
+ closeWarningWindow(prefix, true, false);
// Fade it out for eye-candy
- closeErrorWindow(prefix);
+ closeErrorWindow(prefix, true, false);
// Fade it out for eye-candy
- closeProcessWindow(prefix);
+ closeProgressWindow(prefix, true, false);
- // Abort here if processDisplayed is still true
- if (isElementVisible(prefix, 'process')) {
+ // Abort here if progressDisplayed is still true
+ if (isElementVisible(prefix, 'progress')) {
// Make sure this doesn't happen
return;
} // END - if
- // Copy the response text to the process variable
+ // Copy the response text to the progress variable
if (ajax_content.reply_content != undefined) {
// Set HTML content
- setProcessContent(prefix, ajax_content.reply_content);
+ setProgressContent(prefix, ajax_content.reply_content);
} else {
- setProcessContent(prefix, ajax_content);
+ setProgressContent(prefix, ajax_content);
}
- // Fade the process in
- $('#' + prefix + '_process').fadeIn('slow', function() {
+ // Fade the progress in
+ $('#' + prefix + '_progress').fadeIn('slow', function() {
// Do nothing for now
});
}
-// Sets "process content"
-function setProcessContent (prefix, content) {
+// Sets "progress content"
+function setProgressContent (prefix, content) {
// Set HTML content
- $('#' + prefix + '_process_content').html(content);
+ $('#' + prefix + '_progress_content').html(content);
}
// Waits until the window has been closed
-function closeErrorLocked () {
+function closeErrorLocked (prefix) {
// Has all been loaded?
if (!isElementVisible(prefix, 'error')) {
// Then release ready()
$.holdReady(false);
} else {
// Recursive call again
- window.setTimeout('closeErrorLocked()', 10);
+ window.setTimeout('closeErrorLocked(' + prefix + ')', 10);
}
}
// Waits until the window has been closed
-function closeProcessLocked () {
+function closeProgressLocked (prefix) {
// Has all been loaded?
- if (!isElementVisible(prefix, 'process')) {
+ if (!isElementVisible(prefix, 'progress')) {
// Then release ready()
$.holdReady(false);
} else {
// Recursive call again
- window.setTimeout('closeProcessLocked()', 10);
+ window.setTimeout('closeProgressLocked(' + prefix + ')', 10);
}
}
// Shall this animation be "synchronized"?
if (waitClose == true) {
// Wait for the window has been closed
- closeErrorLocked();
+ closeErrorLocked(prefix);
} // END - if
} // END - if
}
-// Closes an process window
-function closeProcessWindow (prefix, waitClose, resetCurrentTabId) {
- // Is the process displayed?
- if (isElementVisible(prefix, 'process')) {
+// Closes an progress window
+function closeProgressWindow (prefix, waitClose, resetCurrentTabId) {
+ // Is the progress displayed?
+ if (isElementVisible(prefix, 'progress')) {
// Shall we wait ("sync") until the animation has completed?
if (waitClose == true) {
// Hold the ready status
} // END - if
// Yes, then fade it out
- $('#' + prefix + '_process').fadeOut('fast', function() {
+ $('#' + prefix + '_progress').fadeOut('fast', function() {
// Set current tab id to default
if (resetCurrentTabId == true) {
setCurrentTabId(defaultTabId);
// Shall this animation be "synchronized"?
if (waitClose == true) {
// Wait for the window has been closed
- closeProcessLocked();
+ closeProgressLocked(prefix);
} // END - if
} // END - if
}
// Waits until the window has been closed
-function closeWarningLocked () {
+function closeWarningLocked (prefix) {
// Has all been loaded?
if (!isElementVisible(prefix, 'warning')) {
// Then release ready()
$.holdReady(false);
} else {
// Recursive call again
- window.setTimeout('closeWarningLocked()', 10);
+ window.setTimeout('closeWarningLocked(' + prefix + ')', 10);
}
}
if (waitClose == true) {
// Wait for the window has been closed
//* DEBUG: */ alert('prefix=' + prefix + ',waitClose=' + waitClose + ' - LOCKED!');
- closeWarningLocked();
+ closeWarningLocked(prefix);
} // END - if
} // END - if
}
return;
} // END - if
- // Is process working?
- if (isElementVisible(prefix, 'process')) {
+ // Is progress working?
+ if (isElementVisible(prefix, 'progress')) {
// Then exit silently
return;
} // END - if
});
}
-// Processes the content from AJAX call
-function processAjaxResponseContent (prefix, ajax_content) {
+// Progresses the content from AJAX call
+function progressAjaxResponseContent (prefix, ajax_content) {
// By default all is failed
var isResponseDone = false;
// Saves changes by sending the data to the AJAX backend script
function saveChanges (prefix) {
- // Is process working?
- if (isElementVisible(prefix, 'process')) {
+ // Is progress working?
+ if (isElementVisible(prefix, 'progress')) {
// Then exit silently
return;
} // END - if
// Get the content
var ajax_content = getAjaxContent();
- // Process the returned content
- if (processAjaxResponseContent(prefix, ajax_content) == true) {
+ // Progress the returned content
+ if (progressAjaxResponseContent(prefix, ajax_content) == true) {
// Mark all elements as unchanged
markAllElementsAsUnchanged();
displayErrorWindow(prefix, '<div class="ajax_error_message">' + ajax_content.message + '</div>');
} else {
// This didn't work, why?
- displayErrorWindow(prefix, '<div class="ajax_error_message">processAjaxResponseContent() failed, please fix this.<br />\n' + lastErrorMessage + '</div>');
+ displayErrorWindow(prefix, '<div class="ajax_error_message">progressAjaxResponseContent() failed, please fix this.<br />\n' + lastErrorMessage + '</div>');
}
}
// Saves changed settings and continues with given tab
function doSaveChangesContinue (prefix, htmlId, tab) {
- // Is process working?
- if (isElementVisible(prefix, 'process')) {
+ // Is progress working?
+ if (isElementVisible(prefix, 'progress')) {
// Then exit silently
return;
} // END - if