home *** CD-ROM | disk | FTP | other *** search
/ Online Praxis 1998 March / Image.iso / CD-ROM / NETSCAPE / CCK / INSTBLDR.Z / asw.jar / register.js < prev    next >
Encoding:
Text File  |  1998-02-27  |  13.1 KB  |  328 lines

  1. <!--  to hide script contents from old browsers
  2.  
  3.  
  4.  
  5. function go(msg)
  6. {
  7.     if (parent.parent.globals.document.vars.editMode.value == "yes")
  8.         return true;
  9.     else
  10.         return(checkData());
  11. }
  12.  
  13.  
  14.  
  15. function checkData()
  16. {
  17.     return(true);
  18. }
  19.  
  20.  
  21.  
  22. function loadData()
  23. {
  24.     netscape.security.PrivilegeManager.enablePrivilege("AccountSetup");
  25.  
  26.     if (parent.controls.generateControls)    parent.controls.generateControls();
  27.  
  28.     if (parent.parent.globals.document.vars.editMode.value != "yes")    {        // only connect to reggie if editmode is off
  29.  
  30.         var connectStatusFlag = parent.parent.globals.document.setupPlugin.IsDialerConnected();
  31.         if (connectStatusFlag == true)    {
  32.             if (confirm("Account Setup can't connect until you close your current connection. Close the connection now?") == false)    {
  33.                 return;
  34.                 }
  35.             parent.parent.globals.document.setupPlugin.DialerHangup();
  36.             }
  37.  
  38.         var theFolder = parent.parent.globals.getConfigFolder(self);
  39.         var theFile = parent.parent.globals.getAcctSetupFilename(self);
  40.         var theRegFile = theFolder + parent.parent.globals.document.vars.regServer.value;
  41.         var intlFlag = parent.parent.globals.GetNameValuePair(theFile,"Mode Selection","IntlMode");
  42.         intlFlag = intlFlag.toLowerCase();
  43.  
  44.     
  45.     
  46.         // determine name of scripting file
  47.     
  48.         var scriptEnabledFlag = "FALSE";
  49.         var theScriptFile = parent.parent.globals.GetNameValuePair(theRegFile,"Dial-In Configuration","ScriptFileName");
  50.         if (theScriptFile != null && theScriptFile != "")    {
  51.             theScriptFile = theFolder + theScriptFile;
  52.             scriptEnabledFlag = "TRUE";
  53.             }
  54.         else    {
  55.             theScriptFile="";
  56.             scriptEnabledFlag = "FALSE";
  57.             }
  58.     
  59.     
  60.         // determine tty
  61.     
  62.         var ttyFlag = parent.parent.globals.GetNameValuePair(theRegFile,"Security","SecurityDevice");
  63.         ttyFlag = ttyFlag.toLowerCase();
  64.         if (ttyFlag == "yes")    {
  65.             ttyFlag = "TRUE";
  66.             }
  67.         else    {
  68.             ttyFlag = "FALSE";
  69.             }
  70.     
  71.         
  72.         // determine outside line access string
  73.         
  74.         var outsideLineAccessStr = "";
  75.         if (parent.parent.globals.document.vars.prefixData.value != "")    {
  76.             outsideLineAccessStr = parent.parent.globals.document.vars.prefixData.value;
  77.             x = outsideLineAccessStr.indexOf(",");
  78.             if (x<0)    outsideLineAccessStr = outsideLineAccessStr + ",";
  79.             }
  80.     
  81.     
  82.         // Fix #75735
  83.         // Allow IAS files to specify DialAsLongDistance and DialAreaCode flags
  84.         // Else check international mode and turn them off
  85.         // Else check against ISP & user area codes and turn them off it they match
  86.         var dialAsLongDistance =  parent.parent.globals.GetNameValuePair(theRegFile,"Dial-In Configuration","DialAsLongDistance");
  87.         dialAsLongDistance = dialAsLongDistance.toLowerCase();
  88.  
  89.         var dialAreaCode = parent.parent.globals.GetNameValuePair(theRegFile,"Dial-In Configuration","DialAreaCode");
  90.         dialAreaCode = dialAreaCode.toLowerCase();
  91.  
  92.         if ((dialAsLongDistance != null && dialAsLongDistance!="") || (dialAreaCode != null && dialAreaCode!="") ) {
  93.             // compare these dialer flags against "no" because the default we want is "TRUE"
  94.             var dialAsLongDistanceFlag = (dialAsLongDistance=="no") ? "FALSE":"TRUE";
  95.             var dialAreaCodeFlag = (dialAreaCode == "no") ? "FALSE":"TRUE";
  96.             }
  97.         else if (intlFlag == "yes")    {
  98.             var dialAsLongDistanceFlag = "FALSE";
  99.             var dialAreaCodeFlag = "FALSE";
  100.             }
  101.         else    {
  102.             var dialAsLongDistanceFlag = "TRUE";
  103.             var dialAreaCodeFlag = "TRUE";
  104.  
  105.             var ispAreaCode="";
  106.             var ispPhoneNum = parent.parent.globals.GetNameValuePair(theRegFile,"Dial-In Configuration","Phone");
  107.             if (ispPhoneNum != null && ispPhoneNum!="")    {
  108.                 var x=ispPhoneNum.indexOf("(");
  109.                 if (x>=0)    {
  110.                     var y=ispPhoneNum.indexOf(")",x+1);
  111.                     ispAreaCode=ispPhoneNum.substring(x+1,y);
  112.                     }
  113.                 }
  114.             var userAreaCode=parent.parent.globals.document.vars.modemAreaCode.value;
  115.             if (ispAreaCode == userAreaCode)    {
  116.                 dialAsLongDistanceFlag="FALSE";
  117.                 dialAreaCodeFlag = "FALSE";
  118.                 }
  119.             }
  120.  
  121.         // configure dialer for Registration Server
  122.     
  123.     
  124.         dialerData = parent.parent.globals.document.setupPlugin.newStringArray(28);        // increment this # as new dialer strings are added
  125.         dialerData[0]  = "FileName=" + theRegFile;
  126.         dialerData[1]  = "AccountName=" + parent.parent.globals.GetNameValuePair(theRegFile,"Dial-In Configuration","SiteName");
  127.         dialerData[2]  = "ISPPhoneNum=" + parent.parent.globals.GetNameValuePair(theRegFile,"Dial-In Configuration","Phone");
  128.         dialerData[3]  = "LoginName=" + parent.parent.globals.GetNameValuePair(theRegFile,"Dial-In Configuration","Name");
  129.         dialerData[4]  = "Password=" + parent.parent.globals.GetNameValuePair(theRegFile,"Dial-In Configuration","Password");
  130.         dialerData[5]  = "DNSAddress=" + parent.parent.globals.GetNameValuePair(theRegFile,"IP","DNSAddress");
  131.         dialerData[6]  = "DNSAddress2=" + parent.parent.globals.GetNameValuePair(theRegFile,"IP","DNSAddress2");
  132.         dialerData[7]  = "DomainName=" + parent.parent.globals.GetNameValuePair(theRegFile,"IP","DomainName");
  133.         dialerData[8]  = "IPAddress=" + parent.parent.globals.GetNameValuePair(theRegFile,"IP","IPAddress");
  134.         dialerData[9]  = "IntlMode=" + ((intlFlag=="yes") ? "TRUE":"FALSE");
  135.         dialerData[10] = "DialOnDemand=TRUE";
  136.         dialerData[11] = "ModemName=" + parent.parent.globals.document.vars.modem.value;
  137.         dialerData[12] = "ModemType=" + parent.parent.globals.document.setupPlugin.GetModemType(parent.parent.globals.document.vars.modem.value);
  138.         dialerData[13] = "DialType=" + parent.parent.globals.document.vars.dialMethod.value;
  139.         dialerData[14] = "OutsideLineAccess=" + outsideLineAccessStr;
  140.         dialerData[15] = "DisableCallWaiting=" + ((parent.parent.globals.document.vars.cwData.value != "") ? "TRUE":"FALSE");
  141.         dialerData[16] = "DisableCallWaitingCode=" + parent.parent.globals.document.vars.cwData.value;
  142.         dialerData[17] = "UserAreaCode=" + parent.parent.globals.document.vars.modemAreaCode.value;                // XXX what to do if international mode?
  143.         dialerData[18] = "CountryCode=" + parent.parent.globals.document.vars.countryCode.value;
  144.         dialerData[19] = "LongDistanceAccess=1";                                    // XXX
  145.         dialerData[20]  = "DialAsLongDistance=" + dialAsLongDistanceFlag;  // As processed above (fix #75735)
  146.         dialerData[21]  = "DialAreaCode=" + dialAreaCodeFlag;              // As processed above (fix #75735)
  147.         dialerData[22] = "ScriptEnabled=" + scriptEnabledFlag;
  148.         dialerData[23] = "ScriptFileName=" + theScriptFile;
  149.         dialerData[24] = "NeedsTTYWindow=" + ttyFlag;
  150.         dialerData[25] = "Location=Home";
  151.          dialerData[26] = "DisconnectTime=" + parent.parent.globals.GetNameValuePair(theFile,"Mode Selection","Dialer_Disconnect_After");
  152.         dialerData[27] = "Path=Server";
  153.     
  154.         // write out dialer data to Java Console
  155.  
  156.         if (parent.parent.globals.document.vars.debugMode.value.toLowerCase() == "yes")    {
  157.             parent.parent.globals.debug("\nDialer data (for Registration Server): ");
  158.             var numElements = dialerData.length;
  159.             for (var x=0; x<numElements; x++)    {
  160.                 parent.parent.globals.debug("        " + x + ": " + dialerData[x]);
  161.                 }
  162.             }
  163.     
  164.         parent.parent.globals.document.setupPlugin.DialerConfig(dialerData,true);
  165.     
  166.         // check if we need to reboot
  167.         
  168.         if (parent.parent.globals.document.setupPlugin.NeedReboot() == true)    {
  169.             parent.parent.globals.forceReboot("register.htm");        // XXX hardcode in name of next screen???
  170.             return;
  171.             }
  172.     
  173.         if (parent.parent.globals.document.setupPlugin.DialerConnect() == false)    {
  174.             parent.parent.globals.document.setupPlugin.DialerHangup();
  175.             window.location.replace("error.htm");                            // XXX hardcode in name of next screen???
  176.             return;
  177.             }
  178.     
  179.     
  180.         // get platform (XXX Macintosh should not be uppercased?)
  181.     
  182.         var thePlatform = new String(navigator.userAgent);
  183.         var x=thePlatform.indexOf("(")+1;
  184.         var y=thePlatform.indexOf(";",x+1);
  185.         thePlatform=thePlatform.substring(x,y);
  186.         
  187.         if (thePlatform == "Win16")        thePlatform = "WIN31";
  188.         else if (thePlatform == "Win95")    thePlatform = "WIN95";
  189.         else if (thePlatform == "WinNT")    thePlatform = "WINNT";
  190.     
  191.         // get registration server reference
  192.     /*
  193.         var theFolder = parent.parent.globals.getConfigFolder(self);
  194.         var theRegFile = parent.parent.globals.GetNameValuePair(theFile,"New Acct Mode","RegServer");
  195.         var theRegServer = "";
  196.         if (theRegFile == null || theRegFile == "")    {
  197.             theRegFile = parent.parent.globals.document.vars.regServer.value;
  198.             }
  199.         if (theRegFile == null || theRegFile == "")    {
  200.             alert("Internal problem determining the Registration Server.");
  201.             return;
  202.             }    
  203.         theRegFile = theFolder + theRegFile;
  204.     */
  205.         theRegServer = parent.parent.globals.GetNameValuePair(theRegFile,"IP","RegCGI");
  206.     
  207.         if (theRegServer == null || theRegServer == "")    {
  208.             alert("Internal problem determining the Registration Server.");
  209.             }
  210.     
  211.         // build TAPI phone number
  212.     
  213.         var theHomePhone="";
  214.         var thePhone="";
  215.         var theCountry="";
  216.         if (intlFlag == "yes")    {
  217.             theHomePhone = parent.parent.globals.document.vars.phoneNumber.value;
  218.             thePhone = parent.parent.globals.document.vars.modemPhoneNumber.value;
  219.             theCountry = parent.parent.globals.document.vars.country.value;
  220.             }
  221.         else    {
  222.             theHomePhone = "(" + parent.parent.globals.document.vars.areaCode.value + ") " + parent.parent.globals.document.vars.phoneNumber.value;
  223.             thePhone = "(" + parent.parent.globals.document.vars.modemAreaCode.value + ") " + parent.parent.globals.document.vars.modemPhoneNumber.value;
  224.             theCountry = "USA";
  225.             }
  226.     
  227.         // mangle year and month for submission to registration server
  228.     
  229.         var theYear = parseInt(parent.parent.globals.document.vars.year.value);
  230.         while (theYear >= 100)    {
  231.             theYear -= 100;
  232.             }
  233.         if (theYear<10)    {
  234.             theYear = "0" + theYear;
  235.             }
  236.     
  237.         var theMonth = parseInt(parent.parent.globals.document.vars.month.value);
  238.         theMonth += 1;
  239.     
  240.     
  241.         // the following values are commented out as the values are set in HTML
  242.     
  243.     /*
  244.         document.forms[0].RS_FORM_TYPE.value            = "custinfo";
  245.         document.forms[0].REG_SETUP_NAME.value            = "Account Setup";
  246.         document.forms[0].REG_SIGNUP_VERSION.value        = "4.0";
  247.         document.forms[0].REG_SCRIPTING.value            = "Yes";
  248.         document.forms[0].REG_SOURCE.value                = "test";
  249.         document.forms[0].REG_CHANNEL.value                = "";
  250.     */
  251.     
  252.     
  253.         // fill out custinfo form elements, then submit
  254.     
  255.         document.forms[0].REG_PLATFORM.value            = thePlatform;
  256.         document.forms[0].AS_INTLMODE.value                = intlFlag;
  257.     
  258.         document.forms[0].CST_LAST_NAME.value            = parent.parent.globals.document.vars.last.value;
  259.         document.forms[0].CST_FIRST_NAME.value            = parent.parent.globals.document.vars.first.value;
  260.         document.forms[0].CST_ORGANIZATION_NAME.value    = parent.parent.globals.document.vars.company.value;
  261.         document.forms[0].CST_STREET_1.value            = parent.parent.globals.document.vars.address1.value;
  262.         document.forms[0].CST_STREET_2.value            = parent.parent.globals.document.vars.address2.value;
  263.         document.forms[0].CST_STREET_3.value            = parent.parent.globals.document.vars.address3.value;
  264.         document.forms[0].CST_CITY.value                = parent.parent.globals.document.vars.city.value;
  265.         document.forms[0].CST_STATE_PROVINCE.value        = parent.parent.globals.document.vars.state.value;
  266.         document.forms[0].CST_POSTAL_CODE.value            = parent.parent.globals.document.vars.zip.value;
  267.         document.forms[0].CST_COUNTRY.value                = theCountry;
  268.         document.forms[0].CST_PHONE.value                = thePhone;
  269.         document.forms[0].CST_HOMEPHONE.value            = theHomePhone;        
  270.         document.forms[0].CST_CC_NO.value                = parent.parent.globals.document.vars.cardnumber.value;
  271.         document.forms[0].CST_CC_TYPE.value                = parent.parent.globals.document.vars.cardcode.value;
  272.         document.forms[0].CST_CC_MTH_EXPIRE.value        = theMonth;
  273.         document.forms[0].CST_CC_YEAR_EXPIRE.value        = theYear;
  274.         document.forms[0].CST_CC_CARDHOLDER.value        = parent.parent.globals.document.vars.cardname.value;
  275.     
  276.         document.forms[0].CST_JUNK_MAIL.value            = "";            // XXX
  277.     
  278.         document.forms[0].action=theRegServer;
  279.         
  280.         // for win32 platforms make sure we don't get ISP's with scripting
  281.  
  282.         if ((thePlatform == "WIN95") || (thePlatform == "WINNT"))    {
  283.             document.forms[0].REG_SCRIPTING.value        = "No";
  284.             }
  285.  
  286.         // declare animation support for appropriate platform
  287.  
  288.         if (thePlatform == "Macintosh")    {
  289.             document.forms[0].AS_MAC_ANIMATION_SUPPORT.value        = "YES";
  290.             document.forms[0].AS_WIN_ANIMATION_SUPPORT.value        = "NO";
  291.             }
  292.         else    {
  293.             document.forms[0].AS_MAC_ANIMATION_SUPPORT.value        = "NO";
  294.             document.forms[0].AS_WIN_ANIMATION_SUPPORT.value        = "YES";
  295.             }
  296.  
  297.  
  298.         // write out Milan data to Java Console
  299.     
  300.         if (parent.parent.globals.document.vars.debugMode.value.toLowerCase() == "yes")    {
  301.             parent.parent.globals.debug("\nRegServer (Milan) data: " + document.forms[0].action);
  302.             var numElements = document.forms[0].length;
  303.             for (var x=0; x<document.forms[0].length; x++)    {
  304.                 parent.parent.globals.debug("        " + x + ": " + document.forms[0].elements[x].name + "=" + document.forms[0].elements[x].value);
  305.                 }
  306.             }
  307.     
  308.         // submit Milan data
  309.  
  310.         navigator.preference("security.warn_submit_insecure",    false);
  311.         navigator.preference("security.warn_entering_secure",    false);
  312.         navigator.preference("security.warn_leaving_secure",    false);
  313.  
  314.         parent.parent.globals.setRegisterMode(1);
  315.         document.forms[0].submit();                                        // automatically submit form to registration server
  316.         }
  317. }
  318.  
  319.  
  320.  
  321. function saveData()
  322. {
  323. }
  324.  
  325.  
  326.  
  327. // end hiding contents from old browsers  -->
  328.