dmose%mozilla.org 68d3ee8a2a updating license to xPL 1.1
git-svn-id: svn://10.0.0.236/trunk@52535 18797224-902f-48f8-a5cc-f745e15eee43
1999-11-02 07:16:31 +00:00

168 lines
5.9 KiB
JavaScript

/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil -*-
*
* The contents of this file are subject to the Netscape Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/NPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s):
*/
<!-- to hide script contents from old browsers
//the file that includes this must also include settings.js!
// Request privilege
var thePlatform = new String(navigator.userAgent);
var x=thePlatform.indexOf("(")+1;
var y=thePlatform.indexOf(";",x+1);
thePlatform=thePlatform.substring(x,y);
if (thePlatform != "Macintosh") {
compromisePrincipals(); // work around for the security check
}
function loadData()
{
var acctSetupFile = parent.parent.globals.getAcctSetupFilename(parent.parent.globals);
var forceExisting = "";
var forceNew = "";
var showPhones = "";
var asFormName = "asglobals";
var oneStepMode = "";
modeSectionName = "Mode Selection";
newSectionName = "New Acct Mode";
existingSectionName = "Existing Acct Mode";
//set the online/offline flags
forceExisting = parent.parent.globals.GetNameValuePair(acctSetupFile,modeSectionName,"ForceExisting");
forceNew = parent.parent.globals.GetNameValuePair(acctSetupFile,modeSectionName,"ForceNew");
oneStepMode = parent.parent.globals.GetNameValuePair(acctSetupFile,modeSectionName,"OneStepMode");
if ((forceNew != null) && (forceNew != "") && (forceNew == "yes"))
{
setRadio(asFormName, "asmode", 0);
}
else if ((forceExisting != null) && (forceExisting != "") && (forceExisting == "yes"))
{
setRadio(asFormName, "asmode", 1);
}
else if (oneStepMode == "no")
{
setRadio(asFormName, "asmode", 3);
}
else
{
setRadio(asFormName, "asmode", 2);
}
//set the intlMode flag
setCheckBox(asFormName, "intmode", parent.parent.globals.GetNameValuePair(acctSetupFile,modeSectionName,"IntlMode"));
//set the two other options flags
setCheckBox(asFormName, "Show_Intro_Screens", parent.parent.globals.GetNameValuePair(acctSetupFile,modeSectionName,"Show_Intro_Screens"));
var Dialer_Idle_Time = parseInt(parent.parent.globals.GetNameValuePair(acctSetupFile,modeSectionName,"Dialer_Disconnect_After"));
if (Dialer_Idle_Time == null || isNaN(Dialer_Idle_Time) || Dialer_Idle_Time == "null" || Dialer_Idle_Time == "" || Dialer_Idle_Time < 5)
Dialer_Idle_Time = 15; //default idle time
setText(asFormName, "Dialer_Disconnect_After", Dialer_Idle_Time);
if (parent.controls.generateControls)
parent.controls.generateControls();
}//function loadData()
function fixIdleTime()
{
var asFormName = "asglobals";
var Dialer_Idle_Time = parseInt(getText(asFormName,"Dialer_Disconnect_After"));
if (Dialer_Idle_Time.toString() == "NaN" || Dialer_Idle_Time > 99)
{
Dialer_Idle_Time = 15; // default dialer idle time
}
else if (Dialer_Idle_Time < 5)
Dialer_Idle_Time = 5; //minimum dialer idle time
setText(asFormName, "Dialer_Disconnect_After", Dialer_Idle_Time);
}
function checkData()
{
fixIdleTime();
return true;
}
function saveData()
{
var acctSetupFile = parent.parent.globals.getAcctSetupFilename(parent.parent.globals);
var asFormName = "asglobals";
modeSectionName = "Mode Selection";
newSectionName = "New Acct Mode";
existingSectionName = "Existing Acct Mode";
parent.parent.globals.SetNameValuePair(acctSetupFile, modeSectionName,"IntlMode", getCheckBox(asFormName,"intmode"));
var modeRadio = getRadio(asFormName, "asmode");
var modeRadioString = new String(modeRadio);
if (modeRadioString == "yes")
{
//debug("SaveData: Ext no, New yes");
parent.parent.globals.SetNameValuePair(acctSetupFile, modeSectionName, "ForceNew", "yes");
parent.parent.globals.SetNameValuePair(acctSetupFile, modeSectionName, "ForceExisting", "no");
parent.parent.globals.SetNameValuePair(acctSetupFile, modeSectionName, "OneStepMode", "yes");
parent.parent.globals.document.vars.path.value = "New Path";
}
else if (modeRadioString == "no")
{
//debug("SaveData: New no, Ext yes");
parent.parent.globals.SetNameValuePair(acctSetupFile, modeSectionName, "ForceNew", "no");
parent.parent.globals.SetNameValuePair(acctSetupFile, modeSectionName, "ForceExisting", "yes");
parent.parent.globals.SetNameValuePair(acctSetupFile, modeSectionName, "OneStepMode", "yes");
parent.parent.globals.document.vars.path.value = "Existing Path";
}
else if (modeRadioString == "3")
{
parent.parent.globals.SetNameValuePair(acctSetupFile, modeSectionName, "ForceNew", "no");
parent.parent.globals.SetNameValuePair(acctSetupFile, modeSectionName, "ForceExisting", "no");
parent.parent.globals.SetNameValuePair(acctSetupFile, modeSectionName, "OneStepMode", "no");
}
else
{
//debug("SaveData: both no");
parent.parent.globals.SetNameValuePair(acctSetupFile, modeSectionName, "ForceNew", "no");
parent.parent.globals.SetNameValuePair(acctSetupFile, modeSectionName, "ForceExisting", "no");
parent.parent.globals.SetNameValuePair(acctSetupFile, modeSectionName, "OneStepMode", "yes");
}
//set dialer idle time, show_intro screens and OneStepMode
parent.parent.globals.SetNameValuePair(acctSetupFile, modeSectionName, "Show_Intro_Screens", getCheckBox(asFormName, "Show_Intro_Screens"));
parent.parent.globals.SetNameValuePair(acctSetupFile, modeSectionName, "Dialer_Disconnect_After", getText(asFormName, "Dialer_Disconnect_After"));
}
// end hiding contents from old browsers -->