home *** CD-ROM | disk | FTP | other *** search
/ Chip 2002 January / 01_02.iso / software / netscape62win / mail.xpi / bin / chrome / messenger.jar / content / messenger / renameFolderDialog.js < prev    next >
Text File  |  2000-12-20  |  2KB  |  75 lines

  1. /* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  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, released
  14.  *  March 31, 1998.
  15.  *
  16.  *  The Initial Developer of the Original Code is Netscape
  17.  *  Communications Corporation. Portions created by Netscape are
  18.  *  Copyright (C) 1998-1999 Netscape Communications Corporation. All
  19.  *  Rights Reserved.
  20.  *
  21.  *  Contributor(s):
  22.  *    Fabian Guisset <hidday@geocities.com>
  23.  */
  24.  
  25. var dialog;
  26.  
  27. function onLoad()
  28. {
  29.   var arguments = window.arguments[0];
  30.  
  31.   dialog = {};
  32.  
  33.   dialog.OKButton = document.getElementById("ok");
  34.  
  35.   dialog.nameField = document.getElementById("name");
  36.   dialog.nameField.value = arguments.name;
  37.   dialog.nameField.select();
  38.   dialog.nameField.focus();
  39.  
  40.   // call this when OK is pressed
  41.   dialog.okCallback = arguments.okCallback;
  42.  
  43.   // pre select the folderPicker, based on what they selected in the folder pane
  44.   dialog.preselectedFolderURI = arguments.preselectedURI;
  45.  
  46.   moveToAlertPosition();
  47.   doEnabling();
  48.   doSetOKCancel(onOK, onCancel);
  49. }
  50.  
  51. function onOK()
  52. {
  53.   dialog.okCallback(dialog.nameField.value, dialog.preselectedFolderURI);
  54.  
  55.   return true;
  56. }
  57.  
  58. function onCancel()
  59. {
  60.   // close the window
  61.   return true;
  62. }
  63.  
  64. function doEnabling()
  65. {
  66.   if (dialog.nameField.value) {
  67.     if (dialog.OKButton.disabled)
  68.       dialog.OKButton.disabled = false;
  69.   } else {
  70.     if (!dialog.OKButton.disabled)
  71.       dialog.OKButton.disabled = true;
  72.   }
  73. }
  74.  
  75.