home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 35 Internet / 35-Internet.zip / mozil06.zip / bin / chrome / messenger.jar / content / messenger / smtpEditOverlay.js < prev    next >
Text File  |  2001-02-14  |  3KB  |  96 lines

  1. /* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
  2.  *
  3.  * The contents of this file are subject to the Netscape Public
  4.  * License Version 1.1 (the "License"); you may not use this file
  5.  * except in compliance with the License. You may obtain a copy of
  6.  * the License at http://www.mozilla.org/NPL/
  7.  *
  8.  * Software distributed under the License is distributed on an "AS
  9.  * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
  10.  * implied. See the License for the specific language governing
  11.  * rights and limitations under the License.
  12.  *
  13.  * The Original Code is Mozilla Communicator client code.
  14.  *
  15.  * The Initial Developer of the Original Code is Netscape Communications
  16.  * Corporation.  Portions created by Netscape are
  17.  * Copyright (C) 1998 Netscape Communications Corporation. All
  18.  * Rights Reserved.
  19.  *
  20.  * Contributor(s):
  21.  * Alec Flett <alecf@netscape.com>
  22.  */
  23.  
  24. // be real hacky with document.getElementById until document.controls works
  25. // with the new XUL widgets
  26.  
  27. var gSmtpUsername;
  28. var gSmtpHostname;
  29. var gSmtpUseUsername;
  30. var gSmtpSavePassword;
  31.  
  32. var gSavedUsername="";
  33.  
  34. function initSmtpSettings(server) {
  35.  
  36.     gSmtpUsername = document.getElementById("smtp.username");
  37.     gSmtpHostname = document.getElementById("smtp.hostname");
  38.     gSmtpUseUsername = document.getElementById("smtp.useUsername");
  39.     gSmtpAuthMethod = document.getElementById("smtp.authMethod");
  40.     
  41.     if (server) {
  42.         gSmtpHostname.value = server.hostname;
  43.         gSmtpUsername.value = server.username;
  44.         gSmtpAuthMethod.setAttribute("value", server.authMethod);
  45.         // radio groups not implemented
  46.         //document.getElementById("smtp.trySSL").value = server.trySSL;
  47.  
  48.     }
  49.  
  50.     if (gSmtpAuthMethod.getAttribute("value") == "1")
  51.         gSmtpUseUsername.checked = true;
  52.     
  53.     dump("gSmtpAuthMethod = <" + gSmtpAuthMethod.localName + ">\n");
  54.     dump("gSmtpAuthMethod.value = " + gSmtpAuthMethod.getAttribute("value") + "\n");
  55.     
  56.     onUseUsername(gSmtpUseUsername, false);
  57.     updateControls();
  58. }
  59.  
  60. function saveSmtpSettings(server)
  61. {
  62.  
  63.     if (gSmtpUseUsername.checked)
  64.         gSmtpAuthMethod.setAttribute("value", "1");
  65.     else
  66.         gSmtpAuthMethod.setAttribute("value", "0");
  67.  
  68.     dump("Saving to " + server + "\n");
  69.     if (server) {
  70.         server.hostname = gSmtpHostname.value;
  71.         server.authMethod = (gSmtpUseUsername.checked ? 1 : 0);
  72.         dump("Saved authmethod = " + server.authMethod +
  73.              " but checked = " + gSmtpUseUsername.checked + "\n");
  74.         server.username = gSmtpUsername.value;
  75.     }
  76. }
  77.  
  78. function onUseUsername(checkbox, dofocus)
  79. {
  80.     if (checkbox.checked) {
  81.         gSmtpUsername.removeAttribute("disabled");
  82.         if (dofocus)
  83.             gSmtpUsername.focus();
  84.         if (gSavedUsername && gSavedUsername != "")
  85.             gSmtpUsername.value = gSavedUsername;
  86.     } else {
  87.         gSavedUsername = gSmtpUsername.value;
  88.         gSmtpUsername.value = "";
  89.         gSmtpUsername.setAttribute("disabled", "true");
  90.     }        
  91. }
  92.  
  93. function updateControls() {
  94.  
  95. }
  96.