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

  1. <!--  to hide script contents from old browsers
  2.  
  3.  
  4.  
  5. function go(msg)
  6. {
  7.     return(true);
  8. }
  9.  
  10.  
  11.  
  12. function verifyCallWaiting(cwData)
  13. {
  14.     var    validFlag=true;
  15.  
  16.     if (cwData.length > 0)    {
  17.         for (var x=0; x<cwData.length; x++)    {
  18.             if ("0123456789*#,".indexOf(cwData.charAt(x)) <0)    {
  19.                 validFlag=false;
  20.                 break;
  21.                 }
  22.             }
  23.         }
  24.     return(validFlag);
  25. }
  26.  
  27.  
  28.  
  29. function verifyPrefix(prefixData)
  30. {
  31.     var    validFlag=true;
  32.  
  33.     if (prefixData.length > 0)    {
  34.         for (var x=0; x<prefixData.length; x++)    {
  35.             if ("0123456789,".indexOf(prefixData.charAt(x)) <0)    {
  36.                 validFlag=false;
  37.                 break;
  38.                 }
  39.             }
  40.         }
  41.     return(validFlag);
  42. }
  43.  
  44.  
  45.  
  46. function checkData()
  47. {
  48.     if (verifyCallWaiting(document.forms[0].cwData.value) == false)    {
  49.         alert("Please enter a valid call waiting string. (It may contain numbers, asterisks, pound signs and commas.)");
  50.         parent.parent.globals.setFocus(document.forms[0].cwData);
  51.         return(false);
  52.         }
  53.     if (verifyPrefix(document.forms[0].prefixData.value) == false)    {
  54.         alert("Please enter a valid outside line string. (It may contain numbers and commas.)");
  55.         parent.parent.globals.setFocus(document.forms[0].prefixData);
  56.         return(false);
  57.         }
  58.     return(true);
  59. }
  60.  
  61.  
  62.  
  63. function loadData()
  64. {
  65.     netscape.security.PrivilegeManager.enablePrivilege("AccountSetup");
  66.  
  67.     // make sure all data objects/element exists and valid; otherwise, reload.  SUCKS!
  68.     if (((document.forms[0].cwData == "undefined") || (document.forms[0].cwData == "[object InputArray]")) ||
  69.         ((document.forms[0].cwOptions == "undefined") || (document.forms[0].cwOptions == "[object InputArray]")) ||
  70.         ((document.forms[0].prefixData == "undefined") || (document.forms[0].prefixData == "[object InputArray]")))
  71.     {
  72.         parent.controls.reloadDocument();
  73.         return;
  74.     }
  75.  
  76.     document.forms[0].cwData.value=parent.parent.globals.document.forms[0].cwData.value;
  77. //    document.forms[0].cwOFF.checked=parent.parent.globals.document.forms[0].cwOFF.checked;
  78. //    document.forms[0].cwOFF.checked=(document.forms[0].cwData.value=="") ? 0:1;
  79.  
  80.     var found=false;
  81.     for (var i = 0; i < document.forms[0].cwOptions.length; i++)    {
  82.         if (document.forms[0].cwOptions[i].value==parent.parent.globals.document.forms[0].cwData.value)    {
  83.             document.forms[0].cwOptions[i].selected=true;
  84.             found=true;
  85.             }
  86.         else    {
  87.             document.forms[0].cwOptions[i].selected=false;
  88.             }
  89.         }
  90.     if (found==false)    {
  91.         if (document.forms[0].cwData.value == "")    {
  92.             document.forms[0].cwOptions[0].text = "(Line Doesn't Have Call Waiting)";
  93.             document.forms[0].cwOptions[0].value = "";
  94.             }
  95.         else    {
  96.             document.forms[0].cwOptions[0].text = document.forms[0].cwData.value;
  97.             document.forms[0].cwOptions[0].value = document.forms[0].cwData.value;
  98.             }
  99.         document.forms[0].cwOptions[0].selected=true;
  100.         }
  101.     document.forms[0].prefixData.value=parent.parent.globals.document.forms[0].prefixData.value;
  102. //    document.forms[0].prefix.checked=parent.parent.globals.document.forms[0].prefix.checked;
  103. //    document.forms[0].prefix.checked=(document.forms[0].prefixData.value=="") ? 0:1;
  104.  
  105.     var theModem = parent.parent.globals.document.vars.modem.value;
  106.     var theModemType = parent.parent.globals.document.setupPlugin.GetModemType(theModem);
  107.     if (theModemType != null)    {
  108.         theModemType = theModemType.toUpperCase();
  109.         if (theModemType == "ISDN")    {
  110.             // do nothing
  111.             }
  112.         else    {
  113.             if (parent.parent.globals.document.forms[0].dialMethod.value == "PULSE")    {
  114.                 document.layers["dialingMethods"].document.forms[0].dialMethod[0].checked=false;
  115.                 document.layers["dialingMethods"].document.forms[0].dialMethod[1].checked=true;
  116.                 }
  117.             else    {
  118.  
  119.                 document.layers["dialingMethods"].document.forms[0].dialMethod[0].checked=true;
  120.                 document.layers["dialingMethods"].document.forms[0].dialMethod[1].checked=false;
  121.                 }
  122.             }
  123.         }
  124.     parent.parent.globals.setFocus(document.forms[0].cwData);
  125.     if (parent.controls.generateControls)    parent.controls.generateControls();
  126. }
  127.  
  128.  
  129.  
  130. function saveData()
  131. {
  132.     netscape.security.PrivilegeManager.enablePrivilege("AccountSetup");
  133.  
  134.     // make sure all form element are valid objects, otherwise just skip & return!
  135.     if (((document.forms[0].cwData == "undefined") || (document.forms[0].cwData == "[object InputArray]")) ||
  136.         ((document.forms[0].cwOptions == "undefined") || (document.forms[0].cwOptions == "[object InputArray]")) ||
  137.         ((document.forms[0].prefixData == "undefined") || (document.forms[0].prefixData == "[object InputArray]")))
  138.     {
  139.         parent.controls.reloadDocument();
  140.         return;
  141.     }
  142.  
  143. //    parent.parent.globals.document.forms[0].cwOFF.checked = document.forms[0].cwOFF.checked;
  144.     parent.parent.globals.document.forms[0].cwData.value = document.forms[0].cwData.value;
  145. //    parent.parent.globals.document.forms[0].prefix.checked = document.forms[0].prefix.checked;
  146.     parent.parent.globals.document.forms[0].prefixData.value = document.forms[0].prefixData.value;
  147.  
  148.     var theModem = parent.parent.globals.document.vars.modem.value;
  149.     var theModemType = parent.parent.globals.document.setupPlugin.GetModemType(theModem);
  150.     if (theModemType != null)    {
  151.         theModemType = theModemType.toUpperCase();
  152.         if (theModemType == "ISDN")    {
  153.             parent.parent.globals.document.forms[0].dialMethod.value = theModemType;
  154.             }
  155.         else    {
  156.             if (document.layers["dialingMethods"].document.forms[0].dialMethod[1].checked == true)    {
  157.                 parent.parent.globals.document.forms[0].dialMethod.value = document.layers["dialingMethods"].document.forms[0].dialMethod[1].value;
  158.                 }
  159.             else    {
  160.                 parent.parent.globals.document.forms[0].dialMethod.value = document.layers["dialingMethods"].document.forms[0].dialMethod[0].value;
  161.                 }
  162.             }
  163.         }
  164. }
  165.  
  166.  
  167.  
  168. function updateCWOptions(theObject)
  169. {
  170. /*
  171.     if (theObject.name=="cwOFF")    {
  172.         if (theObject.checked)    {
  173.             parent.parent.globals.setFocus(document.forms[0].cwData);
  174.             }
  175.         else    {
  176.             document.forms[0].cwData.value="";
  177.             document.forms[0].cwOFF.checked=0;
  178.             }
  179.         }
  180.     else
  181. */
  182.     if (theObject.name=="cwData")    {
  183.         document.forms[0].cwOptions[0].text = "(Line Doesn't Have Call Waiting)";
  184.         document.forms[0].cwOptions[0].value = "";
  185.         if (document.forms[0].cwData.value=="")    {
  186.             document.forms[0].cwOptions.selectedIndex = 0;
  187.             }
  188.         else    {
  189.             var found=0;
  190.             for (var x=1; x<document.forms[0].cwOptions.length; x++)    {
  191.                 if (document.forms[0].cwOptions[x].text == document.forms[0].cwData.value)    {
  192.                     found=x;
  193.                     break;
  194.                     }
  195.                 }
  196.             if (found<1)    {
  197.                 document.forms[0].cwOptions[0].text = document.forms[0].cwData.value;
  198.                 document.forms[0].cwOptions[0].value = document.forms[0].cwData.value;
  199.                 }
  200.             document.forms[0].cwOptions.selectedIndex = found;
  201.             }
  202.         }
  203.     else
  204.      if (theObject.name=="cwOptions")    {
  205.         document.forms[0].cwData.value=document.forms[0].cwOptions[document.forms[0].cwOptions.selectedIndex].value;
  206.         parent.parent.globals.setFocus(document.forms[0].cwData);
  207. //        document.forms[0].cwOFF.checked=1;
  208.         }
  209.     return(true);
  210. }
  211.  
  212.  
  213.  
  214. function updatePrefix(theObject)
  215. {
  216. /*
  217.     if (theObject.name=="prefix")    {
  218.         if (theObject.checked)    {
  219.             parent.parent.globals.setFocus(document.forms[0].prefixData);
  220.             }
  221.         else    {
  222.             document.forms[0].prefixData.value="";
  223.             document.forms[0].prefix.checked=0;
  224.             }
  225.         }
  226.     else if (theObject.name=="prefixData")    {
  227.         if (document.forms[0].prefixData.value=="")    {
  228.             document.forms[0].prefix.checked=0;
  229.             }
  230.         else    {
  231.             document.forms[0].prefix.checked=1;
  232.             }
  233.         }
  234. */
  235.     return(false);
  236. }
  237.  
  238.  
  239.  
  240. function generateDialingMethods()
  241. {
  242.     netscape.security.PrivilegeManager.enablePrivilege("AccountSetup");
  243.  
  244.     var theModem = parent.parent.globals.document.vars.modem.value;
  245.     var theModemType = parent.parent.globals.document.setupPlugin.GetModemType(theModem);
  246.     if (theModemType != null && theModemType.toUpperCase() != "ISDN")    
  247.     {
  248.         document.layers["dialingMethods"].visibility = "show";
  249.     }
  250.     else
  251.     {
  252.         document.layers["dialingMethods"].visibility = "hide";
  253.     }
  254. }
  255.  
  256.  
  257.  
  258. // end hiding contents from old browsers  -->
  259.