home *** CD-ROM | disk | FTP | other *** search
/ Your Business Pak / BusinessPak2.iso / Netscape / CD / as.z / asw.jar / download.js < prev    next >
Text File  |  1998-10-15  |  5KB  |  156 lines

  1. /* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil -*-
  2.  *
  3.  * The contents of this file are subject to the Netscape Public License
  4.  * Version 1.0 (the "NPL"); you may not use this file except in
  5.  * compliance with the NPL.  You may obtain a copy of the NPL at
  6.  * http://www.mozilla.org/NPL/
  7.  *
  8.  * Software distributed under the NPL is distributed on an "AS IS" basis,
  9.  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL
  10.  * for the specific language governing rights and limitations under the
  11.  * NPL.
  12.  *
  13.  * The Initial Developer of this code under the NPL is Netscape
  14.  * Communications Corporation.  Portions created by Netscape are
  15.  * Copyright (C) 1998 Netscape Communications Corporation.  All Rights
  16.  * Reserved.
  17.  */
  18. <!--  to hide script contents from old browsers
  19.  
  20.  
  21.  
  22. function go( msg )
  23. {
  24. //    parent.parent.globals.debug( "download go" );
  25.     
  26.     netscape.security.PrivilegeManager.enablePrivilege( "AccountSetup" );
  27.  
  28.     // * skip if we're in edit mode
  29.     if ( parent.parent.globals.document.vars.editMode.value != "yes" )
  30.     {
  31.         // * if "RegServer" specified in ACCTSET.INI, use it
  32.         var theFile = parent.parent.globals.getAcctSetupFilename( self );
  33.         var intlFlag = parent.parent.globals.GetNameValuePair( theFile, "Mode Selection", "IntlMode" );
  34.         intlFlag = intlFlag.toLowerCase();
  35.         var theRegFile = parent.parent.globals.GetNameValuePair( theFile, "New Acct Mode", "CompServer" );
  36.         
  37.         if ( theRegFile != null && theRegFile != "" )
  38.         {
  39.             parent.parent.globals.document.vars.compServer.value = theRegFile;
  40.         }
  41.         else
  42.         {
  43.             // * otherwise, if multiple .NRS files exist, get list selection and determine appropriate .NRS file
  44.             var pathName = parent.parent.globals.getConfigFolder( self );
  45.             var theList = parent.parent.globals.document.setupPlugin.GetFolderContents( pathName,".NRS" );
  46.  
  47.             if ( theList != null )
  48.             {
  49.                 if ( theList.length > 1 )
  50.                 {
  51.                     if ( document.forms[ 0 ].compServerList.selectedIndex < 0 )
  52.                     {
  53.                         alert( "Please select an Internet account server." );
  54.                         return false;
  55.                     }
  56.                     
  57.                     for ( var x = 0; x < theList.length; x++ )    
  58.                     {
  59.                         var file = parent.parent.globals.getConfigFolder( self ) + theList[ x ];
  60.                         var name = parent.parent.globals.document.setupPlugin.GetNameValuePair( file, "Dial-In Configuration", "SiteName" );
  61.     
  62.                         if ( name == document.forms[ 0 ].compServerList.options[ document.forms[ 0 ].compServerList.selectedIndex ].text )
  63.                         {
  64.                             parent.parent.globals.document.vars.compServer.value = theList[ x ];
  65.                             break;
  66.                         }
  67.                     }
  68.                     
  69.                     if ( parent.parent.globals.document.vars.compServer.value == "" )
  70.                     {
  71.                         alert( "Internal problem locating appropriate registration server file." );
  72.                         return false;
  73.                     }
  74.                 }
  75.                 else if ( theList.length == 1 )
  76.                 {
  77.                     parent.parent.globals.document.vars.compServer.value = theList[ 0 ];
  78.                 }
  79.                 else
  80.                 {
  81.                     alert( "Internal problem locating a registration server file." );
  82.                     return false;
  83.                 }
  84.             }
  85.             else
  86.             {
  87.                 alert( "Internal problem locating appropriate registration server file." );
  88.                 return false;
  89.             }
  90.         }
  91.         return true;
  92.     }
  93.     else
  94.     {
  95.         return false;
  96.     }
  97. }
  98.  
  99.  
  100.  
  101. function checkData()
  102. {
  103.     return true;
  104. }
  105.  
  106.  
  107.  
  108. function loadData()
  109. {
  110.     if ( parent.controls.generateControls )
  111.         parent.controls.generateControls();
  112. }
  113.  
  114.  
  115.  
  116. function saveData()
  117. {
  118. }
  119.  
  120.  
  121.  
  122. function generateRegServerList()
  123. {
  124.     netscape.security.PrivilegeManager.enablePrivilege( "AccountSetup" );
  125.  
  126.     // if RegServer is not specified in ACCTSET.INI and multiple .NRS files exist, build list
  127.  
  128.     var theFile = parent.parent.globals.getAcctSetupFilename( self );
  129.     var theRegFile = parent.parent.globals.GetNameValuePair( theFile, "New Acct Mode", "CompServer" );
  130.     
  131.     if ( theRegFile == null || theRegFile == "" )
  132.     {
  133.         var pathName = parent.parent.globals.getConfigFolder( self );
  134.         var theList = parent.parent.globals.document.setupPlugin.GetFolderContents( pathName, ".NRS" );
  135.         if ( theList != null )
  136.         {
  137.             if ( theList.length > 1 )    
  138.             {
  139.                 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='compServerList'>");
  140.                 for ( var x = 0; x < theList.length; x++ )
  141.                 {
  142.                     var file = parent.parent.globals.getConfigFolder( self ) + theList[ x ];
  143.                     var name = parent.parent.globals.document.setupPlugin.GetNameValuePair( file, "Dial-In Configuration", "SiteName" );
  144.                     var selected = ( x== 0 ) ? " SELECTED" : "";
  145.                     document.writeln( "<OPTION VALUE='" + name + "'" + selected + ">" + name );
  146.                 }
  147.                 document.writeln( "</SELECT></FORM></TD></TR></TABLE>" );
  148.             }
  149.         }
  150.     }
  151. }
  152.  
  153.  
  154.  
  155. // end hiding contents from old browsers  -->
  156.