// Functions related to user authentication function cookiesAreEnabled() { // Test whether cookies are enabled by attempting to set a cookie and then // change its value var c = "areYourCookiesEnabled=0"; document.cookie = c; var dc = document.cookie; // Cookie not set? Fail if (dc.indexOf(c) == -1) return 0; // Change test cookie c = "areYourCookiesEnabled=1"; document.cookie = c; dc = document.cookie; // Cookie not changed? fail if (dc.indexOf(c) == -1) return 0; // Delete cookie document.cookie = "areYourCookiesEnabled=; expires=Thu, 01-Jan-70 00:00:01 GMT"; return 1; } function setLoginVars() { // Indicate if JS is enabled document.getElementById('js_enabled').value = 1; // Indicate if cookies are enabled document.getElementById('cookies_enabled').value = cookiesAreEnabled(); // Copy login and password length to alternative vars since current vars will // be removed from the request by zope's authentication mechanism. document.getElementById('login_name').value = document.getElementById('__ac_name').value; password = document.getElementById('__ac_password'); emptyPassword = document.getElementById('pwd_empty'); if (password.value.length==0) emptyPassword.value = '1'; else emptyPassword.value = '0'; } // AJAX machinery var isIe = (navigator.appName == "Microsoft Internet Explorer"); // AJAX machinery var xhrObjects = new Array(); // An array of XMLHttpRequest objects function XhrObject() { // Wraps a XmlHttpRequest object this.freed = 1; // Is this xhr object already dealing with a request or not? this.xhr = false; if (window.XMLHttpRequest) this.xhr = new XMLHttpRequest(); else this.xhr = new ActiveXObject("Microsoft.XMLHTTP"); this.hook = ''; /* The ID of the HTML element in the page that will be replaced by result of executing the Ajax request. */ this.onGet = ''; /* The name of a Javascript function to call once we receive the result. */ this.info = {}; /* An associative array for putting anything else. */ } function getAjaxChunk(pos) { // This function is the callback called by the AJAX machinery (see function // askAjaxChunk below) when an Ajax response is available. // First, find back the correct XMLHttpRequest object if ( (typeof(xhrObjects[pos]) != 'undefined') && (xhrObjects[pos].freed == 0)) { var hook = xhrObjects[pos].hook; if (xhrObjects[pos].xhr.readyState == 1) { // The request has been initialized: display the waiting radar var hookElem = document.getElementById(hook); if (hookElem) hookElem.innerHTML = "
<\/div>"; } if (xhrObjects[pos].xhr.readyState == 4) { // We have received the HTML chunk var hookElem = document.getElementById(hook); if (hookElem && (xhrObjects[pos].xhr.status == 200)) { hookElem.innerHTML = xhrObjects[pos].xhr.responseText; // Call a custom Javascript function if required if (xhrObjects[pos].onGet) { xhrObjects[pos].onGet(xhrObjects[pos], hookElem); } // Eval inner scripts if any. var innerScripts = document.getElementsByName("appyHook"); for (var i=0; i