home *** CD-ROM | disk | FTP | other *** search
/ Australian PC Authority 1999 May / may1999.iso / INTERNET / COMMUNIC / AS.Z / asw.jar / register.js < prev    next >
Encoding:
Text File  |  1997-12-09  |  11.4 KB  |  289 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.         // configure dialer for Registration Server
  83.     
  84.     
  85.         dialerData = parent.parent.globals.document.setupPlugin.newStringArray(28);        // increment this # as new dialer strings are added
  86.         dialerData[0]  = "FileName=" + theRegFile;
  87.         dialerData[1]  = "AccountName=" + parent.parent.globals.GetNameValuePair(theRegFile,"Dial-In Configuration","SiteName");
  88.         dialerData[2]  = "ISPPhoneNum=" + parent.parent.globals.GetNameValuePair(theRegFile,"Dial-In Configuration","Phone");
  89.         dialerData[3]  = "LoginName=" + parent.parent.globals.GetNameValuePair(theRegFile,"Dial-In Configuration","Name");
  90.         dialerData[4]  = "Password=" + parent.parent.globals.GetNameValuePair(theRegFile,"Dial-In Configuration","Password");
  91.         dialerData[5]  = "DNSAddress=" + parent.parent.globals.GetNameValuePair(theRegFile,"IP","DNSAddress");
  92.         dialerData[6]  = "DNSAddress2=" + parent.parent.globals.GetNameValuePair(theRegFile,"IP","DNSAddress2");
  93.         dialerData[7]  = "DomainName=" + parent.parent.globals.GetNameValuePair(theRegFile,"IP","DomainName");
  94.         dialerData[8]  = "IPAddress=" + parent.parent.globals.GetNameValuePair(theRegFile,"IP","IPAddress");
  95.         dialerData[9]  = "IntlMode=" + ((intlFlag=="yes") ? "TRUE":"FALSE");
  96.         dialerData[10] = "DialOnDemand=TRUE";
  97.         dialerData[11] = "ModemName=" + parent.parent.globals.document.vars.modem.value;
  98.         dialerData[12] = "ModemType=" + parent.parent.globals.document.setupPlugin.GetModemType(parent.parent.globals.document.vars.modem.value);
  99.         dialerData[13] = "DialType=" + parent.parent.globals.document.vars.dialMethod.value;
  100.         dialerData[14] = "OutsideLineAccess=" + outsideLineAccessStr;
  101.         dialerData[15] = "DisableCallWaiting=" + ((parent.parent.globals.document.vars.cwData.value != "") ? "TRUE":"FALSE");
  102.         dialerData[16] = "DisableCallWaitingCode=" + parent.parent.globals.document.vars.cwData.value;
  103.         dialerData[17] = "UserAreaCode=" + parent.parent.globals.document.vars.modemAreaCode.value;                // XXX what to do if international mode?
  104.         dialerData[18] = "CountryCode=" + parent.parent.globals.document.vars.countryCode.value;
  105.         dialerData[19] = "LongDistanceAccess=1";                                    // XXX
  106.         dialerData[20] = "DialAsLongDistance=TRUE";                                    // XXX
  107.         dialerData[21] = "DialAreaCode=TRUE";                                        // XXX
  108.         dialerData[22] = "ScriptEnabled=" + scriptEnabledFlag;
  109.         dialerData[23] = "ScriptFileName=" + theScriptFile;
  110.         dialerData[24] = "NeedsTTYWindow=" + ttyFlag;
  111.         dialerData[25] = "Location=Home";
  112.          dialerData[26] = "DisconnectTime=" + parent.parent.globals.GetNameValuePair(theFile,"Mode Selection","Dialer_Disconnect_After");
  113.         dialerData[27] = "Path=Server";
  114.     
  115.         // write out dialer data to Java Console
  116.  
  117.         if (parent.parent.globals.document.vars.debugMode.value.toLowerCase() == "yes")    {
  118.             parent.parent.globals.debug("\nDialer data (for Registration Server): ");
  119.             var numElements = dialerData.length;
  120.             for (var x=0; x<numElements; x++)    {
  121.                 parent.parent.globals.debug("        " + x + ": " + dialerData[x]);
  122.                 }
  123.             }
  124.     
  125.         parent.parent.globals.document.setupPlugin.DialerConfig(dialerData,true);
  126.     
  127.         // check if we need to reboot
  128.         
  129.         if (parent.parent.globals.document.setupPlugin.NeedReboot() == true)    {
  130.             parent.parent.globals.forceReboot("register.htm");        // XXX hardcode in name of next screen???
  131.             return;
  132.             }
  133.     
  134.         if (parent.parent.globals.document.setupPlugin.DialerConnect() == false)    {
  135.             parent.parent.globals.document.setupPlugin.DialerHangup();
  136.             window.location.replace("error.htm");                            // XXX hardcode in name of next screen???
  137.             return;
  138.             }
  139.     
  140.     
  141.         // get platform (XXX Macintosh should not be uppercased?)
  142.     
  143.         var thePlatform = new String(navigator.userAgent);
  144.         var x=thePlatform.indexOf("(")+1;
  145.         var y=thePlatform.indexOf(";",x+1);
  146.         thePlatform=thePlatform.substring(x,y);
  147.         
  148.         if (thePlatform == "Win16")        thePlatform = "WIN31";
  149.         else if (thePlatform == "Win95")    thePlatform = "WIN95";
  150.         else if (thePlatform == "WinNT")    thePlatform = "WINNT";
  151.     
  152.         // get registration server reference
  153.     /*
  154.         var theFolder = parent.parent.globals.getConfigFolder(self);
  155.         var theRegFile = parent.parent.globals.GetNameValuePair(theFile,"New Acct Mode","RegServer");
  156.         var theRegServer = "";
  157.         if (theRegFile == null || theRegFile == "")    {
  158.             theRegFile = parent.parent.globals.document.vars.regServer.value;
  159.             }
  160.         if (theRegFile == null || theRegFile == "")    {
  161.             alert("Internal problem determining the Registration Server.");
  162.             return;
  163.             }    
  164.         theRegFile = theFolder + theRegFile;
  165.     */
  166.         theRegServer = parent.parent.globals.GetNameValuePair(theRegFile,"IP","RegCGI");
  167.     
  168.         if (theRegServer == null || theRegServer == "")    {
  169.             alert("Internal problem determining the Registration Server.");
  170.             }
  171.     
  172.         // build TAPI phone number
  173.     
  174.         var theHomePhone="";
  175.         var thePhone="";
  176.         var theCountry="";
  177.         if (intlFlag == "yes")    {
  178.             theHomePhone = parent.parent.globals.document.vars.phoneNumber.value;
  179.             thePhone = parent.parent.globals.document.vars.modemPhoneNumber.value;
  180.             theCountry = parent.parent.globals.document.vars.country.value;
  181.             }
  182.         else    {
  183.             theHomePhone = "(" + parent.parent.globals.document.vars.areaCode.value + ") " + parent.parent.globals.document.vars.phoneNumber.value;
  184.             thePhone = "(" + parent.parent.globals.document.vars.modemAreaCode.value + ") " + parent.parent.globals.document.vars.modemPhoneNumber.value;
  185.             theCountry = "USA";
  186.             }
  187.     
  188.         // mangle year and month for submission to registration server
  189.     
  190.         var theYear = parseInt(parent.parent.globals.document.vars.year.value);
  191.         while (theYear >= 100)    {
  192.             theYear -= 100;
  193.             }
  194.         if (theYear<10)    {
  195.             theYear = "0" + theYear;
  196.             }
  197.     
  198.         var theMonth = parseInt(parent.parent.globals.document.vars.month.value);
  199.         theMonth += 1;
  200.     
  201.     
  202.         // the following values are commented out as the values are set in HTML
  203.     
  204.     /*
  205.         document.forms[0].RS_FORM_TYPE.value            = "custinfo";
  206.         document.forms[0].REG_SETUP_NAME.value            = "Account Setup";
  207.         document.forms[0].REG_SIGNUP_VERSION.value        = "4.0";
  208.         document.forms[0].REG_SCRIPTING.value            = "Yes";
  209.         document.forms[0].REG_SOURCE.value                = "test";
  210.         document.forms[0].REG_CHANNEL.value                = "";
  211.     */
  212.     
  213.     
  214.         // fill out custinfo form elements, then submit
  215.     
  216.         document.forms[0].REG_PLATFORM.value            = thePlatform;
  217.         document.forms[0].AS_INTLMODE.value                = intlFlag;
  218.     
  219.         document.forms[0].CST_LAST_NAME.value            = parent.parent.globals.document.vars.last.value;
  220.         document.forms[0].CST_FIRST_NAME.value            = parent.parent.globals.document.vars.first.value;
  221.         document.forms[0].CST_ORGANIZATION_NAME.value    = parent.parent.globals.document.vars.company.value;
  222.         document.forms[0].CST_STREET_1.value            = parent.parent.globals.document.vars.address1.value;
  223.         document.forms[0].CST_STREET_2.value            = parent.parent.globals.document.vars.address2.value;
  224.         document.forms[0].CST_STREET_3.value            = parent.parent.globals.document.vars.address3.value;
  225.         document.forms[0].CST_CITY.value                = parent.parent.globals.document.vars.city.value;
  226.         document.forms[0].CST_STATE_PROVINCE.value        = parent.parent.globals.document.vars.state.value;
  227.         document.forms[0].CST_POSTAL_CODE.value            = parent.parent.globals.document.vars.zip.value;
  228.         document.forms[0].CST_COUNTRY.value                = theCountry;
  229.         document.forms[0].CST_PHONE.value                = thePhone;
  230.         document.forms[0].CST_HOMEPHONE.value            = theHomePhone;        
  231.         document.forms[0].CST_CC_NO.value                = parent.parent.globals.document.vars.cardnumber.value;
  232.         document.forms[0].CST_CC_TYPE.value                = parent.parent.globals.document.vars.cardcode.value;
  233.         document.forms[0].CST_CC_MTH_EXPIRE.value        = theMonth;
  234.         document.forms[0].CST_CC_YEAR_EXPIRE.value        = theYear;
  235.         document.forms[0].CST_CC_CARDHOLDER.value        = parent.parent.globals.document.vars.cardname.value;
  236.     
  237.         document.forms[0].CST_JUNK_MAIL.value            = "";            // XXX
  238.     
  239.         document.forms[0].action=theRegServer;
  240.         
  241.         // for win32 platforms make sure we don't get ISP's with scripting
  242.  
  243.         if ((thePlatform == "WIN95") || (thePlatform == "WINNT"))    {
  244.             document.forms[0].REG_SCRIPTING.value        = "No";
  245.             }
  246.  
  247.         // declare animation support for appropriate platform
  248.  
  249.         if (thePlatform == "Macintosh")    {
  250.             document.forms[0].AS_MAC_ANIMATION_SUPPORT.value        = "YES";
  251.             document.forms[0].AS_WIN_ANIMATION_SUPPORT.value        = "NO";
  252.             }
  253.         else    {
  254.             document.forms[0].AS_MAC_ANIMATION_SUPPORT.value        = "NO";
  255.             document.forms[0].AS_WIN_ANIMATION_SUPPORT.value        = "YES";
  256.             }
  257.  
  258.  
  259.         // write out Milan data to Java Console
  260.     
  261.         if (parent.parent.globals.document.vars.debugMode.value.toLowerCase() == "yes")    {
  262.             parent.parent.globals.debug("\nRegServer (Milan) data: " + document.forms[0].action);
  263.             var numElements = document.forms[0].length;
  264.             for (var x=0; x<document.forms[0].length; x++)    {
  265.                 parent.parent.globals.debug("        " + x + ": " + document.forms[0].elements[x].name + "=" + document.forms[0].elements[x].value);
  266.                 }
  267.             }
  268.     
  269.         // submit Milan data
  270.  
  271.         navigator.preference("security.warn_submit_insecure",    false);
  272.         navigator.preference("security.warn_entering_secure",    false);
  273.         navigator.preference("security.warn_leaving_secure",    false);
  274.  
  275.         parent.parent.globals.setRegisterMode(1);
  276.         document.forms[0].submit();                                        // automatically submit form to registration server
  277.         }
  278. }
  279.  
  280.  
  281.  
  282. function saveData()
  283. {
  284. }
  285.  
  286.  
  287.  
  288. // end hiding contents from old browsers  -->
  289.