home *** CD-ROM | disk | FTP | other *** search
- function LoadPrefsPage()
- {
- MM_preloadImages('/webaroo/e29f1fe6/images/webaroo_search_f2.gif','/webaroo/e29f1fe6/images/webaroo_contents_f2.gif','/webaroo/e29f1fe6/images/webaroo_prefs_f2.gif','/webaroo/e29f1fe6/images/webaroo_help_f2.gif');
- // following lines for rounded corners script
- if(NiftyCheck())
- {
- Rounded("div#leftnav","all","#FFAA44","#FFFFFF","smooth");
- Rounded("div#maincontent1","all","#FFAA44","#FFFFFF","smooth");
- Rounded("div#maincontent2","all","#FFAA44","#FFFFFF","smooth");
- Rounded("div#prefBannerStatusDiv","all","#FFAA44","#FF0000","smooth");
- }
-
- // initialize the DHTML History framework
- dhtmlHistory.initialize();
- // add ourselves as a DHTML History listener
- dhtmlHistory.addListener(GetPrefsPage);
- if (dhtmlHistory.isFirstLoad())
- {
- ShowPrefsPage(0,1);
- }
-
- // check if we are being loaded after successful save
- if(String(document.location).indexOf("saved=True")!=-1)
- {
- SetOperationStatus('prefBanner', "Your preferences have been saved.");
- }
- }
-
- //making these global so that we can use them while validation
- var proxyName, proxyPort, proxyUser, proxyPassword, launchWebaroo, startWebaroo, autoUpdate, mysiteautoUpdate, noProxyList;
-
-
- function GetCurrentSettingsFromServer()
- {
- var url = "/webaroo/e29f1fe6/settings?request=get";
- processXMLData(url);
- var listObject = xmlContent.getElementsByTagName('Response');
-
- for (var j=0;j<listObject.length;j++)
- {
- if (listObject[j].nodeType != 1) continue;
-
- var currentNodeObject=listObject[j];
-
- for (k=0;k<currentNodeObject.childNodes.length;k++)
- {
- if (currentNodeObject.childNodes[k].nodeType != 1) continue;
- switch(currentNodeObject.childNodes[k].nodeName)
- {
- case 'ProxyName':
- if(currentNodeObject.childNodes[k].firstChild != null)
- proxyName=currentNodeObject.childNodes[k].firstChild.nodeValue;
- else
- proxyName="";
- break;
- case 'ProxyPort':
- if(currentNodeObject.childNodes[k].firstChild != null)
- proxyPort=currentNodeObject.childNodes[k].firstChild.nodeValue;
- else
- proxyPort="";
- break;
- case 'NoProxyList':
- if(currentNodeObject.childNodes[k].firstChild != null)
- noProxyList=currentNodeObject.childNodes[k].firstChild.nodeValue;
- else
- noProxyList = "";
- break;
- case 'ProxyUser':
- if(currentNodeObject.childNodes[k].firstChild != null)
- proxyUser=currentNodeObject.childNodes[k].firstChild.nodeValue;
- else
- proxyUser="";
- break;
- case 'ProxyPassword':
- if(currentNodeObject.childNodes[k].firstChild != null)
- proxyPassword=currentNodeObject.childNodes[k].firstChild.nodeValue;
- else
- proxyPassword="";
- break;
- case 'LaunchWebaroo':
- if(currentNodeObject.childNodes[k].firstChild != null)
- launchWebaroo=currentNodeObject.childNodes[k].firstChild.nodeValue;
- else
- launchWebaroo = "false";
- break;
- case 'StartWebaroo':
- if(currentNodeObject.childNodes[k].firstChild != null)
- startWebaroo=currentNodeObject.childNodes[k].firstChild.nodeValue;
- else
- startWebaroo="true";
- break;
- case 'AutoUpdate':
- if(currentNodeObject.childNodes[k].firstChild != null)
- autoUpdate=currentNodeObject.childNodes[k].firstChild.nodeValue;
- else
- autoUpdate="true";
- break;
- case 'MySitesAutoUpdate':
- if(currentNodeObject.childNodes[k].firstChild != null)
- mysiteautoUpdate=currentNodeObject.childNodes[k].firstChild.nodeValue;
- else
- mysiteautoUpdate="true";
- break;
- }
- }
- }
-
- }
- function ShowSettings()
- {
- GetCurrentSettingsFromServer();
- SetCurrentSettings();
- }
-
-
- function SetCurrentSettings()
- {
- var prefForm = document.prefForm;
- prefForm.proxyAddress.value = proxyName;
- prefForm.proxyPort.value = (parseInt(proxyPort) != 0) ? proxyPort : "";
- prefForm.proxyUser.value = proxyUser;
- prefForm.proxyPassword.value = proxyPassword;
- prefForm.startWebaroo.checked = (startWebaroo == "true");
- var updateIndex = (autoUpdate== "true") ? 0 : 1;
- prefForm.updateOption[updateIndex].checked = true;
- prefForm.noProxyList.value = noProxyList;
-
- updateIndex = (mysiteautoUpdate == "true") ? 0 : 1;
- prefForm.mysiteupdateOption[updateIndex].checked = true;
-
- }
-
- function UserChangedAnySetting()
- {
- GetCurrentSettingsFromServer();
- var prefForm = document.prefForm;
- if ( prefForm.proxyAddress.value != proxyName ) return true;
- if ( prefForm.proxyPort.value != ((parseInt(proxyPort) != 0) ? proxyPort : "") ) return true;
- if ( prefForm.proxyUser.value != proxyUser ) return true;
- if ( prefForm.proxyPassword.value != proxyPassword ) return true;
- if ( prefForm.startWebaroo.checked != (startWebaroo == "true") ) return true;
- var updateIndex = (autoUpdate== "true") ? 0 : 1;
- if ( prefForm.updateOption[updateIndex].checked != true ) return true;
- if ( prefForm.noProxyList.value != noProxyList ) return true;
- updateIndex = (mysiteautoUpdate == "true") ? 0 : 1;
- if ( prefForm.mysiteupdateOption[updateIndex].checked != true ) return true;
- return false;
- }
-
- // returns empty string if no errors, else a string containing error message to be displayed to user
- function ValidatePreferences()
- {
- var prefForm = document.prefForm;
- var sPort = trim(prefForm.proxyPort.value);
- var sServerName = trim(prefForm.proxyAddress.value);
- sServerName = sServerName.replace(":\\\\","://");
- prefForm.proxyAddress.value = sServerName;
- var username = trim(prefForm.proxyUser.value);
- var password = prefForm.proxyPassword.value;
- var noProxyFor = prefForm.noProxyList.value;
- var has_errors = false;
- // clear all errors
- document.getElementById("proxyAddressError").innerHTML = "";
- document.getElementById("proxyPortError").innerHTML = "";
- document.getElementById("noProxyListError").innerHTML = "";
- document.getElementById("proxyUserError").innerHTML = "";
- document.getElementById("proxyPasswordError").innerHTML = "";
-
- if ( sServerName != "" && sServerName.indexOf("http://") == -1)
- {
- prefForm.proxyAddress.value = "http://" + prefForm.proxyAddress.value;
- sServerName = "http://" + sServerName;
- }
- // first see if there is any change at all
- if ( !UserChangedAnySetting() ) return "Nothing to save.";
- // see if server is given
- if(sServerName != "")
- {
- // port must be valid
- if (!IsNumeric(sPort))
- {
- document.getElementById("proxyPortError").innerHTML = "Required.";
- has_errors = true;
- }
- }
- if ( sPort != "" )
- {
- if( !IsNumeric(sPort))
- {
- has_errors = true;
- document.getElementById("proxyPortError").innerHTML = "Valid integer value required.";
- }
- if( sServerName == "")
- {
- has_errors = true;
- document.getElementById("proxyAddressError").innerHTML = "Required.";
- }
- }
- if ( noProxyFor != "" )
- {
- if(sServerName == "")
- {
- has_errors = true;
- document.getElementById("proxyAddressError").innerHTML = "Required.";
- }
- if(!IsNumeric(sPort))
- {
- has_errors = true;
- document.getElementById("proxyPortError").innerHTML = "Valid integer value Required.";
- }
-
- }
-
- if((username!="")||(password!="")) // Check server name is given
- {
- if(password == "")
- {
- has_errors = true;
- document.getElementById("proxyPasswordError").innerHTML = "Required.";
- }
- if(username == "")
- {
- has_errors = true;
- document.getElementById("proxyUserError").innerHTML = "Required.";
- }
- if(sServerName == "")
- {
- has_errors = true;
- document.getElementById("proxyAddressError").innerHTML = "Required.";
- }
- if(!IsNumeric(sPort))
- {
- has_errors = true;
- document.getElementById("proxyPortError").innerHTML = "Valid integer value Required.";
- }
- }
- // return validation_errors.join("<br>");
- return has_errors ? "Some fields require your attention. Please check the form." : "";
-
- }
-
- function ApplyPreferences()
- {
- // Clear the earlier status
- SetOperationStatus('prefBanner', "");
- validation_errors = ValidatePreferences();
- if(validation_errors == "")
- {
- var settingsXml = CreateSettingsXml();
- //var url = "/webaroo/e29f1fe6/settings?request=set";
- //sendXMLData(url, "XMLData=" + settingsXml);
- var prefForm = document.prefForm;
- prefForm.XMLData.value = settingsXml;
- prefForm.submit();
- }
- else
- SetOperationStatus('prefBanner', validation_errors);
- }
-
- function CreateSettingsXml()
- {
- var prefForm = document.prefForm;
-
- var settingsXml = '<XmlData>\n';
- settingsXml += '<Response>\n';
-
- settingsXml += '<ProxyName>' + prefForm.proxyAddress.value + '</ProxyName>\n';
- settingsXml += '<ProxyPort>' + prefForm.proxyPort.value + '</ProxyPort>\n';
- settingsXml += '<NoProxyList>' + prefForm.noProxyList.value + '</NoProxyList>\n';
- settingsXml += '<ProxyUser>' + prefForm.proxyUser.value + '</ProxyUser>\n';
- settingsXml += '<ProxyPassword><![CDATA[' + escape(prefForm.proxyPassword.value) + ']]></ProxyPassword>\n';
- settingsXml += '<StartWebaroo>' + prefForm.startWebaroo.checked + '</StartWebaroo>\n';
- settingsXml += '<LaunchWebaroo>false</LaunchWebaroo>\n';
- settingsXml += '<AutoUpdate>' + prefForm.updateOption[0].checked + '</AutoUpdate>\n';
- settingsXml += '<MySitesAutoUpdate>' + prefForm.mysiteupdateOption[0].checked + '</MySitesAutoUpdate>\n';
-
- settingsXml += '</Response>\n';
- settingsXml += '</XmlData>\n';
-
- return settingsXml;
- }
-
- function ClearPrefForm()
- {
- document.prefForm.proxyAddress.value = "";
- document.prefForm.proxyPort.value = "";
- document.prefForm.noProxyList.value = "";
- document.prefForm.proxyUser.value = "";
- document.prefForm.proxyPassword.value = "";
- document.prefForm.startWebaroo.checked = true;
- document.prefForm.updateOption[1].checked = true;
- document.prefForm.mysiteupdateOption[1].checked = true;
- }
- function GetPrefsPage(newLocation, historyData)
- {
- var currentLocation = window.location.href.split("#");
- if (currentLocation[0].indexOf("/webaroo/e29f1fe6/about") == -1)
- {
- return;
- }
- currentLocation = window.location.href.split("=");
- if(currentLocation.length >1)
- {
- var helpType = (parseInt(currentLocation[1]) != 0) ? currentLocation[1] : 1;
- ShowPrefsPage(0,helpType);
- }
- else
- ShowPrefsPage(0,1);
- }
-
- // I18N issue
- function ShowPrefsPage(addToHistory,aboutType)
- {
- if(addToHistory)
- {
- dhtmlHistory.add("HelpIndex="+ aboutType,"");
- }
- for (var i=1; i < 6; ++i)
- {
-
- document.getElementById('Div' + i).style.display="none";
- document.getElementById('Cell' + i).className="";
- }
-
- document.getElementById('Cell' + aboutType).className = "selected";
- document.getElementById('Div' + aboutType).style.display="block";
- // Clear the prefBanner Table to remove the earlier status message
- ClearTable('prefBanner');
- ShowSettings();
- }
-