gecko-dev/cmd/dialup/as_html/download.js

156 строки
4.6 KiB
JavaScript
Исходник Обычный вид История

1998-04-09 08:11:30 +04:00
/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
* compliance with the NPL. You may obtain a copy of the NPL at
* http://www.mozilla.org/NPL/
*
* Software distributed under the NPL is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
* for the specific language governing rights and limitations under the
* NPL.
*
* The Initial Developer of this code under the NPL is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 1998 Netscape Communications Corporation. All Rights
* Reserved.
*/
<!-- to hide script contents from old browsers
function go( msg )
{
1998-05-01 14:29:17 +04:00
parent.parent.globals.debug( "download go" );
1998-04-09 08:11:30 +04:00
netscape.security.PrivilegeManager.enablePrivilege( "AccountSetup" );
1998-05-01 14:29:17 +04:00
// * skip if we're in edit mode
1998-04-09 08:11:30 +04:00
if ( parent.parent.globals.document.vars.editMode.value != "yes" )
{
1998-05-01 14:29:17 +04:00
// * if "RegServer" specified in ACCTSET.INI, use it
1998-04-09 08:11:30 +04:00
var theFile = parent.parent.globals.getAcctSetupFilename( self );
var intlFlag = parent.parent.globals.GetNameValuePair( theFile, "Mode Selection", "IntlMode" );
intlFlag = intlFlag.toLowerCase();
var theRegFile = parent.parent.globals.GetNameValuePair( theFile, "New Acct Mode", "RegServer" );
if ( theRegFile != null && theRegFile != "" )
{
parent.parent.globals.document.vars.regServer.value = theRegFile;
}
else
{
1998-05-01 14:29:17 +04:00
// * otherwise, if multiple .IAS files exist, get list selection and determine appropriate .IAS file
1998-04-09 08:11:30 +04:00
var pathName = parent.parent.globals.getConfigFolder( self );
var theList = parent.parent.globals.document.setupPlugin.GetFolderContents( pathName,".IAS" );
if ( theList != null )
{
if ( theList.length > 1 )
{
if ( document.forms[ 0 ].regServerList.selectedIndex < 0 )
{
alert( "Please select an Internet account server." );
return false;
}
for ( var x = 0; x < theList.length; x++ )
{
var file = parent.parent.globals.getConfigFolder( self ) + theList[ x ];
var name = parent.parent.globals.document.setupPlugin.GetNameValuePair( file, "Dial-In Configuration", "SiteName" );
if ( name == document.forms[ 0 ].regServerList.options[ document.forms[ 0 ].regServerList.selectedIndex ].text )
{
parent.parent.globals.document.vars.regServer.value = theList[ x ];
break;
}
}
if ( parent.parent.globals.document.vars.regServer.value == "" )
{
alert( "Internal problem locating appropriate registration server file." );
return false;
}
}
else if ( theList.length == 1 )
{
parent.parent.globals.document.vars.regServer.value = theList[ 0 ];
}
else
{
alert( "Internal problem locating a registration server file." );
return false;
}
}
else
{
alert( "Internal problem locating appropriate registration server file." );
return false;
}
}
return true;
}
else
{
return false;
}
}
function checkData()
{
return true;
}
function loadData()
{
if ( parent.controls.generateControls )
parent.controls.generateControls();
}
function saveData()
{
}
function generateRegServerList()
{
netscape.security.PrivilegeManager.enablePrivilege( "AccountSetup" );
// if RegServer is not specified in ACCTSET.INI and multiple .IAS files exist, build list
var theFile = parent.parent.globals.getAcctSetupFilename( self );
var theRegFile = parent.parent.globals.GetNameValuePair( theFile, "New Acct Mode", "RegServer" );
if ( theRegFile == null || theRegFile == "" )
{
var pathName = parent.parent.globals.getConfigFolder( self );
var theList = parent.parent.globals.document.setupPlugin.GetFolderContents( pathName, ".IAS" );
if ( theList != null )
{
if ( theList.length > 1 )
{
document.writeln( "<TABLE CELLPADDING=2 CELLSPACING=0 ID='minspace'><TR><TD ALIGN=LEFT VALIGN=TOP HEIGHT=25><spacer type=vertical size=2><B>Select an Internet account server:</B></TD><TD ALIGN=LEFT VALIGN=TOP><FORM><SELECT NAME='regServerList'>");
for ( var x = 0; x < theList.length; x++ )
{
var file = parent.parent.globals.getConfigFolder( self ) + theList[ x ];
var name = parent.parent.globals.document.setupPlugin.GetNameValuePair( file, "Dial-In Configuration", "SiteName" );
var selected = ( x== 0 ) ? " SELECTED" : "";
document.writeln( "<OPTION VALUE='" + name + "'" + selected + ">" + name );
}
document.writeln( "</SELECT></FORM></TD></TR></TABLE>" );
}
}
}
}
// end hiding contents from old browsers -->