home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 35 Internet / 35-Internet.zip / mozil06.zip / bin / chrome / messenger.jar / content / messenger / am-identity-advanced.js < prev    next >
Text File  |  2001-02-14  |  2KB  |  78 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.org code.
  14.  *
  15.  * The Initial Developer of the Original Code is Netscape
  16.  * Communications 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. var serverList;
  25.  
  26. function init() {
  27.  
  28.     serverList = document.getElementById("smtpServerList");
  29.  
  30. }
  31.  
  32. function preSelectServer(key)
  33. {
  34.     if (!key) {
  35.         // no key, so preselect the "useDefault" item.
  36.         serverList.selectedItem = document.getElementById("useDefaultItem");
  37.         return;
  38.     }
  39.     
  40.     var preselectedItems = serverList.getElementsByAttribute("key", key);
  41.  
  42.     if (preselectedItems && preselectedItems.length > 0)
  43.         serverList.selectedItem = preselectedItems[0];
  44. }
  45.  
  46. function onLoad()
  47. {
  48.     init();
  49.     if (window.arguments && window.arguments[0]) {
  50.         selectedServerKey = window.arguments[0].smtpServerKey;
  51.         preSelectServer(selectedServerKey);
  52.     }
  53.  
  54.  
  55.     doSetOKCancel(onOk, 0);
  56. }
  57.  
  58. function onOk()
  59. {
  60.  
  61.     var selectedServerElement = serverList.selectedItem;
  62.     dump("selectedServerKey: " + selectedServerElement + "\n");
  63.  
  64.     var key = selectedServerElement.getAttribute("key");
  65.     if (key)
  66.         window.arguments[0].smtpServerKey = key;
  67.     else
  68.         window.arguments[0].smtpServerKey = null;
  69.     
  70.     window.close();
  71. }
  72.  
  73. function onSelected(event)
  74. {
  75.     serverList.setAttribute("selectedKey", event.target.getAttribute("key"));
  76.     dump("Something selected on " + event.target.localName + "\n");
  77. }
  78.