home *** CD-ROM | disk | FTP | other *** search
/ Your Business Pak / BusinessPak2.iso / Netscape / CD / as.z / asw.jar / servers.js < prev    next >
Text File  |  1998-10-15  |  9KB  |  243 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()
  23. {
  24.     if (parent.parent.globals.document.vars.editMode.value == "yes")
  25.         return true;
  26.     else
  27.         return(checkData());
  28. }
  29.  
  30.  
  31.  
  32. function checkData()
  33. {
  34.     return(true);
  35. }
  36.  
  37.  
  38.  
  39. function updateMailProtocols(theObject)
  40. {
  41.     var popServer="";
  42.     var imapServer="";
  43.  
  44.     netscape.security.PrivilegeManager.enablePrivilege("AccountSetup");
  45.     
  46.     var providerFilename = parent.parent.globals.document.vars.providerFilename.value;
  47.     if (providerFilename != "")    {
  48.         popServer = parent.parent.globals.document.setupPlugin.GetNameValuePair(providerFilename, "Services", "POP_Server");
  49.         imapServer = parent.parent.globals.document.setupPlugin.GetNameValuePair(providerFilename, "Services", "IMAP_Server");
  50.         }
  51.  
  52.     if (theObject.name == "IMAP")    {
  53.         document.forms[0].POP.checked = false;
  54.         document.forms[0].IMAP.checked = true;
  55.         if (document.forms[0].Mail_Server.value == popServer || document.forms[0].Mail_Server.value == "")    {
  56.             document.forms[0].Mail_Server.value = imapServer;
  57.             }
  58.         }
  59.     else    {
  60.         document.forms[0].POP.checked = true;
  61.         document.forms[0].IMAP.checked = false;
  62.         if (document.forms[0].Mail_Server.value == imapServer || document.forms[0].Mail_Server.value == "")    {
  63.             document.forms[0].Mail_Server.value = popServer;
  64.             }
  65.         }
  66. }
  67.  
  68.  
  69.  
  70. function loadData()
  71. {
  72.     netscape.security.PrivilegeManager.enablePrivilege("AccountSetup");
  73.  
  74.     // make sure all data objects/element exists and valid; otherwise, reload.  SUCKS!
  75.     if (((document.forms[0].SMTP == "undefined") || (document.forms[0].SMTP == "[object InputArray]")) ||
  76.         ((document.forms[0].Mail_Server == "undefined") || (document.forms[0].Mail_Server == "[object InputArray]")) ||
  77.         ((document.forms[0].IMAP == "undefined") || (document.forms[0].IMAP == "[object InputArray]")) ||
  78.         ((document.forms[0].NNTP == "undefined") || (document.forms[0].NNTP == "[object InputArray]")) ||
  79.         ((document.forms[0].POP == "undefined") || (document.forms[0].POP == "[object InputArray]")))
  80.     {
  81.         parent.controls.reloadDocument();
  82.         return;
  83.     }
  84.  
  85.     document.forms[0].SMTP.value = parent.parent.globals.document.vars.SMTP.value;
  86.     document.forms[0].Mail_Server.value = parent.parent.globals.document.vars.mailServer.value;
  87.  
  88.     var providerFilename = parent.parent.globals.document.vars.providerFilename.value;
  89.  
  90.     var mailProtocol = parent.parent.globals.document.vars.mailProtocol.value;
  91.     mailProtocol = mailProtocol.toUpperCase();
  92.     if (mailProtocol == "IMAP")    {
  93.         document.forms[0].POP.checked = false;
  94.         document.forms[0].IMAP.checked = true;
  95.  
  96.         if (providerFilename != "" && document.forms[0].Mail_Server.value == "")    {
  97.             document.forms[0].Mail_Server.value = parent.parent.globals.document.setupPlugin.GetNameValuePair(providerFilename, "Services", "IMAP_Server");
  98.             }
  99.  
  100.         }
  101.     else    {
  102.         document.forms[0].POP.checked = true;
  103.         document.forms[0].IMAP.checked = false;
  104.  
  105.         if (providerFilename != "" && document.forms[0].Mail_Server.value == "")    {
  106.             document.forms[0].Mail_Server.value = parent.parent.globals.document.setupPlugin.GetNameValuePair(providerFilename, "Services", "POP_Server");
  107.             }
  108.  
  109.         }
  110.  
  111.     document.forms[0].NNTP.value = parent.parent.globals.document.vars.NNTP.value;
  112.     parent.parent.globals.setFocus(document.forms[0].SMTP);
  113.  
  114. /*
  115.     var theFile = parent.parent.globals.getAcctSetupFilename(self);
  116.  
  117.     var theData = parent.parent.globals.document.setupPlugin.GetNameValuePair(theFile, "Existing Acct Mode", "AskIMAP");
  118.     if (theData != null)    {
  119.         theData = theData.toLowerCase();
  120.         if (theData == "yes")    {
  121.  
  122.             // make sure all data objects/element exists and valid; otherwise, reload.  SUCKS!
  123.             if ((document.forms[0].IMAP == "undefined") || (document.forms[0].IMAP == "[object InputArray]")) {
  124.                 parent.controls.reloadDocument();
  125.                 return;
  126.                 }
  127.  
  128.             document.forms[0].IMAP.value = parent.parent.globals.document.vars.IMAP.value;
  129.             }
  130.         }
  131.     theData = parent.parent.globals.document.setupPlugin.GetNameValuePair(theFile, "Existing Acct Mode", "AskLDAP");
  132.     if (theData != null)    {
  133.         theData = theData.toLowerCase();
  134.         if (theData == "yes")    {
  135.             // make sure all data objects/element exists and valid; otherwise, reload.  SUCKS!
  136.             if ((document.forms[0].LDAP == "undefined") || (document.forms[0].LDAP == "[object InputArray]")) {
  137.                 parent.controls.reloadDocument();
  138.                 return;
  139.                 }
  140.             document.forms[0].LDAP.value = parent.parent.globals.document.vars.LDAP.value;
  141.             }
  142.         }
  143. */
  144.     if (parent.controls.generateControls)    parent.controls.generateControls();
  145. }
  146.  
  147.  
  148.  
  149. function saveData()
  150. {
  151.     netscape.security.PrivilegeManager.enablePrivilege("AccountSetup");
  152.  
  153.     // make sure all form element are valid objects, otherwise just skip & return!
  154.     if (((document.forms[0].SMTP == "undefined") || (document.forms[0].SMTP == "[object InputArray]")) ||
  155.         ((document.forms[0].Mail_Server == "undefined") || (document.forms[0].Mail_Server == "[object InputArray]")) ||
  156.         ((document.forms[0].IMAP == "undefined") || (document.forms[0].IMAP == "[object InputArray]")) ||
  157.         ((document.forms[0].NNTP == "undefined") || (document.forms[0].NNTP == "[object InputArray]")) ||
  158.         ((document.forms[0].POP == "undefined") || (document.forms[0].POP == "[object InputArray]")))
  159.     {
  160.         parent.controls.reloadDocument();
  161.         return;
  162.     }
  163.  
  164.     parent.parent.globals.document.vars.SMTP.value = document.forms[0].SMTP.value;
  165. //    parent.parent.globals.document.vars.POP.value = document.forms[0].POP.value;
  166.     parent.parent.globals.document.vars.NNTP.value = document.forms[0].NNTP.value;
  167.  
  168.     if (document.forms[0].IMAP.checked == true)    {
  169.         parent.parent.globals.document.vars.mailProtocol.value = document.forms[0].IMAP.value;
  170.         }
  171.     else    {
  172.         parent.parent.globals.document.vars.mailProtocol.value = document.forms[0].POP.value;
  173.         }
  174.     parent.parent.globals.document.vars.mailServer.value = document.forms[0].Mail_Server.value;
  175.  
  176. /*
  177.     var theFile = parent.parent.globals.getAcctSetupFilename(self);
  178.     var theData;
  179.  
  180.     theData = parent.parent.globals.document.setupPlugin.GetNameValuePair(theFile, "Existing Acct Mode", "AskIMAP");
  181.     if (theData != null)    {
  182.         theData = theData.toLowerCase();
  183.         if (theData == "yes")    {
  184.             parent.parent.globals.document.vars.IMAP.value=document.forms[0].IMAP.value;
  185.             }
  186.         }
  187.     theData = parent.parent.globals.document.setupPlugin.GetNameValuePair(theFile, "Existing Acct Mode", "AskLDAP");
  188.     if (theData != null)    {
  189.         theData = theData.toLowerCase();
  190.         if (theData == "yes")    {
  191.             parent.parent.globals.document.vars.LDAP.value=document.forms[0].LDAP.value;
  192.             }
  193.         }
  194. */
  195. }
  196.  
  197.  
  198.  
  199. /*
  200. function IMAPOptions()
  201. {
  202.     netscape.security.PrivilegeManager.enablePrivilege("AccountSetup");
  203.  
  204.     var theFile = parent.parent.globals.getAcctSetupFilename(self);
  205.  
  206.     var theData = parent.parent.globals.document.setupPlugin.GetNameValuePair(theFile, "Existing Acct Mode", "AskIMAP");
  207.     if (theData != null)    {
  208.         theData = theData.toLowerCase();
  209.         if (theData == "yes")    {
  210.             document.writeln("<TR><TD COLSPAN='3'><spacer type=vertical size=0></TD></TR>");
  211.             document.writeln("<TR><TD VALIGN='BOTTOM' ALIGN='RIGHT'>");
  212.             document.writeln("<FONT FACE='Humnst777 LT,Helvetica,Arial' POINT-SIZE='10' COLOR='#000000'><B>");
  213.             document.writeln("IMAP Mail Server:");
  214.             document.writeln("</B><spacer type=vertical size=2></FONT></TD><TD ALIGN='LEFT' VALIGN='BOTTOM'>");
  215.             document.writeln("<INPUT NAME='IMAP' TYPE='text' SIZE=32 MAXLENGTH=40></TD><TD></TD></TR>");
  216.  
  217.             }
  218.         }
  219. }
  220.  
  221.  
  222.  
  223. function LDAPOptions()
  224. {
  225.     netscape.security.PrivilegeManager.enablePrivilege("AccountSetup");
  226.  
  227.     var theFile = parent.parent.globals.getAcctSetupFilename(self);
  228.  
  229.     var theData = parent.parent.globals.document.setupPlugin.GetNameValuePair(theFile, "Existing Acct Mode", "AskLDAP");
  230.     if (theData != null)    {
  231.         theData = theData.toLowerCase();
  232.         if (theData == "yes")    {
  233.             document.writeln("<TD ALIGN=right>LDAP server(s):</TD>");
  234.             document.writeln("<TD><TEXTAREA ROWS=3 COLS=40 NAME='LDAP' TYPE='text'></TEXTAREA></TD>");
  235.             }
  236.         }
  237. }
  238. */
  239.  
  240.  
  241.  
  242. // end hiding contents from old browsers  -->
  243.