home *** CD-ROM | disk | FTP | other *** search
/ Your Business Pak / BusinessPak2.iso / Netscape / CD / as.z / asw.jar / 1step.js < prev    next >
Text File  |  1998-10-15  |  9KB  |  248 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. var    globals = parent.parent.globals;
  21. var plugin = globals.document.setupPlugin;
  22. var documentVars = globals.document.vars;
  23.  
  24. function go( msg )
  25. {
  26. //    parent.parent.globals.debug( "1step go" );
  27.     
  28.     if ( parent.parent.globals.document.vars.editMode.value == "yes" )
  29.         return true;
  30.     else
  31.         return checkData();
  32. }
  33.  
  34. function checkData()
  35. {
  36.     return true;
  37. }
  38.  
  39. function configureDialer( configFolder, acctSetupIni, regFile )
  40. {
  41. //    globals.debug( "Configuring dialer" );
  42.  
  43.     var        intlFlag = globals.GetNameValuePair( acctSetupIni, "Mode Selection", "IntlMode" );
  44.     intlFlag = intlFlag.toLowerCase();
  45.     
  46.     // * determine name of scripting file
  47.     var        scriptEnabledFlag = "FALSE";
  48.     var        scriptFile = globals.GetNameValuePair( regFile, "Dial-In Configuration", "ScriptFileName" );
  49.     if ( scriptFile != null && scriptFile != "" )
  50.     {
  51.         scriptFile = configFolder + scriptFile;
  52.         scriptEnabledFlag = "TRUE";
  53.     }
  54.     else
  55.     {
  56.         scriptFile = "";
  57.         scriptEnabledFlag = "FALSE";
  58.     }
  59.  
  60.     // * determine tty
  61.     var     ttyFlag = globals.GetNameValuePair( regFile, "Security", "SecurityDevice" );
  62.     ttyFlag = ttyFlag.toLowerCase();
  63.     if ( ttyFlag == "yes" )
  64.         ttyFlag = "TRUE";
  65.     else
  66.         ttyFlag = "FALSE";
  67.  
  68.     
  69.     // * determine outside line access string
  70.     var        outsideLineAccessStr = "";
  71.     if ( documentVars.prefixData.value != "" )
  72.     {
  73.         outsideLineAccessStr = documentVars.prefixData.value;
  74.         x = outsideLineAccessStr.indexOf( "," );
  75.         if ( x < 0 )
  76.             outsideLineAccessStr = outsideLineAccessStr + ",";
  77.     }
  78.  
  79.  
  80.     // * configure dialer for Registration Server
  81.     dialerData = plugin.newStringArray( 28 );        // increment this # as new dialer strings are added
  82.     dialerData[ 0 ]  = "FileName=" + regFile;
  83.     dialerData[ 1 ]  = "AccountName=" + globals.GetNameValuePair( regFile, "Dial-In Configuration", "SiteName" );
  84.     dialerData[ 2 ]  = "ISPPhoneNum=" + globals.GetNameValuePair( regFile, "Dial-In Configuration", "Phone" );
  85.     dialerData[ 3 ]  = "LoginName=" + globals.GetNameValuePair( regFile, "Dial-In Configuration", "Name" );
  86.     dialerData[ 4 ]  = "Password=" + globals.GetNameValuePair( regFile, "Dial-In Configuration", "Password" );
  87.     dialerData[ 5 ]  = "DNSAddress=" + globals.GetNameValuePair( regFile, "IP", "DNSAddress" );
  88.     dialerData[ 6 ]  = "DNSAddress2=" + globals.GetNameValuePair( regFile, "IP", "DNSAddress2" );
  89.     dialerData[ 7 ]  = "DomainName=" + globals.GetNameValuePair( regFile, "IP", "DomainName" );
  90.     dialerData[ 8 ]  = "IPAddress=" + globals.GetNameValuePair( regFile, "IP", "IPAddress" );
  91.     dialerData[ 9 ]  = "IntlMode=" + ( ( intlFlag == "yes" ) ? "TRUE" : "FALSE" );
  92.     dialerData[ 10 ] = "DialOnDemand=TRUE";
  93.     dialerData[ 11 ] = "ModemName=" + globals.document.vars.modem.value;
  94.     dialerData[ 12 ] = "ModemType=" + plugin.GetModemType( documentVars.modem.value );
  95.     dialerData[ 13 ] = "DialType=" + documentVars.dialMethod.value;
  96.     dialerData[ 14 ] = "OutsideLineAccess=" + outsideLineAccessStr;
  97.     dialerData[ 15 ] = "DisableCallWaiting=" + ( ( documentVars.cwData.value != "" ) ? "TRUE" : "FALSE" );
  98.     dialerData[ 16 ] = "DisableCallWaitingCode=" + documentVars.cwData.value;
  99.     dialerData[ 17 ] = "UserAreaCode=" + documentVars.modemAreaCode.value;                // XXX what to do if international mode?
  100.     dialerData[ 18 ] = "CountryCode=" + documentVars.countryCode.value;
  101.     dialerData[ 19 ] = "LongDistanceAccess=1";                                    // XXX
  102.     dialerData[ 20 ] = "DialAsLongDistance=TRUE";                                    // XXX
  103.     dialerData[ 21 ] = "DialAreaCode=TRUE";                                        // XXX
  104.     dialerData[ 22 ] = "ScriptEnabled=" + scriptEnabledFlag;
  105.     dialerData[ 23 ] = "ScriptFileName=" + scriptFile;
  106.     dialerData[ 24 ] = "NeedsTTYWindow=" + ttyFlag;
  107.     dialerData[ 25 ] = "Location=Home";
  108.      dialerData[ 26 ] = "DisconnectTime=" + globals.GetNameValuePair( acctSetupIni, "Mode Selection", "Dialer_Disconnect_After" );
  109.     dialerData[ 27 ] = "Path=Server";
  110.  
  111.     // * write out dialer data to Java Console
  112.     if ( documentVars.debugMode.value.toLowerCase() == "yes" )
  113.     {
  114.         globals.debug( "\nDialer data (for Registration Server): " );
  115.         var numElements = dialerData.length;
  116.         for ( var x = 0; x < numElements; x++ )
  117.             globals.debug( "        " + x + ": " + dialerData[ x ] );
  118.     }
  119.  
  120.     // * configure the dialer
  121.     plugin.DialerConfig( dialerData, true );
  122.  
  123. }
  124.  
  125. function loadData()
  126. {
  127.     netscape.security.PrivilegeManager.enablePrivilege( "AccountSetup" );
  128.  
  129.     if ( parent.controls.generateControls )
  130.         parent.controls.generateControls();
  131.  
  132.     // * only connect to reggie if editmode is off
  133.     if ( documentVars.editMode.value != "yes" )
  134.     {
  135.         var configFolder = globals.getConfigFolder( self );
  136.         var acctSetupIni = globals.getAcctSetupFilename( self );
  137.         var regFile = configFolder + documentVars.compServer.value;
  138.  
  139.  
  140.         var regSource = globals.GetNameValuePair( acctSetupIni, "Mode Selection", "RegSource" );
  141.         
  142.         var regCGI = globals.GetNameValuePair( regFile, "IP", "RegCGI" );
  143.         var regRoot = globals.GetNameValuePair( regFile, "Configuration", "RegRoot" );
  144.         var metadataMode = globals.GetNameValuePair( regFile, "Configuration", "MetadataMode" );
  145.         if ( metadataMode == "no" )
  146.             globals.debug( "MetadataMode==no, you will not be downloading necessary metadata" );
  147.         
  148.         if ( regCGI == null || regCGI == "" )
  149.         {
  150.             alert( "Internal problem determining the Registration Server." );
  151.             return;
  152.         }
  153.  
  154.         if ( regRoot == null )
  155.         {
  156.             alert( "Internal problem determining location of Registration Server data file repository (RegRoot)." );
  157.             return;
  158.         }
  159. /*
  160.         // * write out reggie data to Java Console
  161.         if ( documentVars.debugMode.value.toLowerCase() == "yes" )
  162.         {
  163.             globals.debug( "\nRegServer data: " + document.forms[ 0 ].action );
  164.             var numElements = document.forms[ 0 ].length;
  165.             for ( var x = 0; x < document.forms[ 0 ].length; x++ )
  166.                 globals.debug( "        " + x + ": " + document.forms[ 0 ].elements[ x ].name + "=" + document.forms[ 0 ].elements[ x ].value );
  167.         }
  168. */
  169.     
  170.         // * submit reggie data
  171.         navigator.preference( "security.warn_submit_insecure", false );
  172.         navigator.preference( "security.warn_entering_secure", false );
  173.         navigator.preference( "security.warn_leaving_secure", false );
  174.  
  175.         // * automatically submit form to registration server
  176.         //document.forms[ 0 ].submit();
  177.  
  178.         reggieData = plugin.newStringArray( 8 );        // increment this # as new dialer strings are added
  179.         reggieData[ 0 ] = "CST_PHONE_NUMBER=" + documentVars.modemPhoneNumber.value;
  180.         reggieData[ 1 ] = "REG_SOURCE=" + regSource;
  181.         reggieData[ 2 ] = "CLIENT_LANGUAGE=" + navigator.language;
  182.         reggieData[ 3 ] = "CST_AREA_CODE_1=" + documentVars.modemAreaCode.value;
  183.         reggieData[ 4 ] = "CST_AREA_CODE_2=" + documentVars.altAreaCode1.value;
  184.         reggieData[ 5 ] = "CST_AREA_CODE_3=" + documentVars.altAreaCode2.value;
  185.         reggieData[ 6 ] = "CST_AREA_CODE_4=" + documentVars.altAreaCode3.value;
  186.         reggieData[ 7 ] = "CST_COUNTRY_CODE=" + "1";
  187.         
  188.  
  189.         var localFlag = globals.GetNameValuePair( regFile, "Dial-In Configuration", "LocalMode" );
  190.         localFlag = localFlag.toLowerCase();
  191.         globals.debug( "localFlag:" + localFlag );
  192.         if ( localFlag != "yes" )
  193.         {
  194.             globals.debug( "LocalMode==no" );
  195.             var connectStatusFlag = plugin.IsDialerConnected();
  196.             if ( connectStatusFlag == true )
  197.             {
  198.                 if ( confirm( "Account Setup can't connect until you close your current connection. Close the connection now?" ) == false )
  199.                     return;
  200.                 plugin.DialerHangup();
  201.             }
  202.  
  203.             configureDialer( configFolder, acctSetupIni, regFile );
  204.  
  205.             // * check if we need to reboot
  206.             if ( plugin.NeedReboot() == true )
  207.             {
  208.                 // XXX hardcode in name of next screen???
  209.                 globals.forceReboot( "1step.htm" );        
  210.                 return;
  211.             }
  212.  
  213.             //globals.debug( "connecting..." );
  214.             if ( plugin.DialerConnect() == false )
  215.             {
  216.                 //globals.debug( "dialer not connected" );
  217.                 plugin.DialerHangup();
  218.                 // XXX hardcode in name of next screen???
  219.                 window.location.replace( "error2.htm" );                            
  220.                 return;
  221.             }
  222.             //globals.debug( "done..." );
  223.         }
  224.         
  225.         /*documentVars.countryCode.value;*/
  226.                 
  227.         //if ( localFlag != "yes" )
  228.         //    globals.set1StepMode( 1 );
  229.         
  230.         var        result = plugin.GenerateComparePage( globals.getFolder( self ), regCGI, regRoot, metadataMode, reggieData );
  231.         
  232.         plugin.DialerHangup();
  233.         //if ( localFlag != "yes" )
  234.         //    globals.oneStepSemaphore = true;
  235.         
  236.         if ( result == true )
  237.             window.location.replace( "compwrap.htm" );
  238.         else
  239.             window.location.replace( "error2.htm" );
  240.     }
  241. }
  242.  
  243. function saveData()
  244. {
  245. }
  246.  
  247. // end hiding contents from old browsers  -->
  248.