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-imap-advanced.js < prev    next >
Text File  |  2001-02-14  |  2KB  |  72 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. // pull stuff out of window.arguments
  25. var server=window.arguments[0];
  26.  
  27. // initialize the controls with the "server" argument
  28.  
  29. var gControls;
  30. function getControls() {
  31.     if (!gControls)
  32.         gControls = document.getElementsByAttribute("imap_persist", "true");
  33.     return gControls;
  34. }
  35.     
  36. function onLoad()
  37. {
  38.     var controls = getControls();
  39.  
  40.     for (var i=0; i<controls.length; i++) {
  41.  
  42.         var slot = controls[i].id;
  43.         var val = server[slot];
  44.  
  45.         if (controls[i].localName.toLowerCase() == "checkbox")
  46.             controls[i].checked = val;
  47.         else
  48.             controls[i].value = val;
  49.     }
  50.  
  51.     doSetOKCancel(onOk, 0);
  52. }
  53.  
  54. // save the controls back to the "server" array
  55. function onOk()
  56. {
  57.     var controls = getControls();
  58.     
  59.     for (var i=0; i<controls.length; i++) {
  60.         var slot = controls[i].id;
  61.         if (slot) {
  62.             if (controls[i].localName.toLowerCase() == "checkbox") {
  63.                  server[slot] = controls[i].checked;
  64.             }
  65.             else
  66.                 server[slot] = controls[i].value;
  67.         }
  68.     }
  69.  
  70.     return true;
  71. }
  72.