2001-09-29 00:14:13 +04:00
|
|
|
/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
|
|
|
/* ***** BEGIN LICENSE BLOCK *****
|
2004-04-17 22:33:16 +04:00
|
|
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
2000-06-16 11:43:42 +04:00
|
|
|
*
|
2004-04-17 22:33:16 +04:00
|
|
|
* The contents of this file are subject to the Mozilla Public License Version
|
|
|
|
* 1.1 (the "License"); you may not use this file except in compliance with
|
|
|
|
* the License. You may obtain a copy of the License at
|
|
|
|
* http://www.mozilla.org/MPL/
|
2000-06-16 11:43:42 +04:00
|
|
|
*
|
2001-09-29 00:14:13 +04:00
|
|
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
|
|
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
|
|
* for the specific language governing rights and limitations under the
|
|
|
|
* License.
|
2000-06-16 11:43:42 +04:00
|
|
|
*
|
|
|
|
* The Original Code is mozilla.org code.
|
|
|
|
*
|
2004-04-17 22:33:16 +04:00
|
|
|
* The Initial Developer of the Original Code is
|
2001-09-29 00:14:13 +04:00
|
|
|
* Netscape Communications Corporation.
|
|
|
|
* Portions created by the Initial Developer are Copyright (C) 1998
|
|
|
|
* the Initial Developer. All Rights Reserved.
|
2000-06-16 11:43:42 +04:00
|
|
|
*
|
|
|
|
* Contributor(s):
|
2004-04-17 22:33:16 +04:00
|
|
|
* Alec Flett <alecf@netscape.com>
|
|
|
|
* Seth Spitzer <sspitzer@netscape.com>
|
2001-09-29 00:14:13 +04:00
|
|
|
*
|
|
|
|
* Alternatively, the contents of this file may be used under the terms of
|
2004-04-17 22:33:16 +04:00
|
|
|
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
|
|
|
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
2001-09-29 00:14:13 +04:00
|
|
|
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
|
|
* of those above. If you wish to allow use of your version of this file only
|
|
|
|
* under the terms of either the GPL or the LGPL, and not to allow others to
|
2004-04-17 22:33:16 +04:00
|
|
|
* use your version of this file under the terms of the MPL, indicate your
|
2001-09-29 00:14:13 +04:00
|
|
|
* decision by deleting the provisions above and replace them with the notice
|
|
|
|
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
|
|
* the provisions above, a recipient may use your version of this file under
|
2004-04-17 22:33:16 +04:00
|
|
|
* the terms of any one of the MPL, the GPL or the LGPL.
|
2001-09-29 00:14:13 +04:00
|
|
|
*
|
|
|
|
* ***** END LICENSE BLOCK ***** */
|
2000-06-16 11:43:42 +04:00
|
|
|
|
2001-02-23 02:32:13 +03:00
|
|
|
var gMessengerBundle;
|
2000-06-16 11:43:42 +04:00
|
|
|
|
fix for #17402, stationary -> stationery.
r=alecf
major fixes for the new folder / rename folder / subscribe dialogs.
we no longer use an html select for the folder picker.
now we use cascading menu popups, like the copy and move menus.
this fixes a lot of bugs, and allows pre-flighting to finally work.
our folder data source has some new properies:
CanFileMessages, CanSubscribe, CanRename, and CanCreateSubfolders
we use these to determine what cascading menu to build, what to disable, etc.
also, nsMessenger::NewFolder() and nsMessenger::RenameFolder() were changes to
take a nsIRDFResource instead of a nsIDOMXULElement. Before we were
passing through to the back end the selected xul element, now we pass
the resource in.
other cool side effects:
in the copy & move menus, you don't get the choice to file or copy to a server, on folders
in the rename dialog, you can't pick a server, on a folder
in the new folder dialog, you can't pick the imap inbox. (* more needs to be done here.)
bugs fixed: #14773, #14254, #20599, #20646
r=alecf
a couple bullet proofing fixes to prevent some crashes reported on fullcircle
r=bienvenu
1999-12-03 11:10:09 +03:00
|
|
|
// call this from dialog onload() to set the menu item to the correct value
|
|
|
|
function MsgFolderPickerOnLoad(pickerID)
|
|
|
|
{
|
|
|
|
var uri = null;
|
|
|
|
try {
|
|
|
|
uri = window.arguments[0].preselectedURI;
|
|
|
|
}
|
|
|
|
catch (ex) {
|
|
|
|
uri = null;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (uri) {
|
1999-12-04 21:29:05 +03:00
|
|
|
//dump("on loading, set titled button to " + uri + "\n");
|
|
|
|
|
|
|
|
// verify that the value we are attempting to
|
|
|
|
// pre-flight the menu with is valid for this
|
|
|
|
// picker type
|
2001-12-10 10:44:03 +03:00
|
|
|
var msgfolder = GetMsgFolderFromUri(uri, true);
|
1999-12-04 21:29:05 +03:00
|
|
|
if (!msgfolder) return;
|
|
|
|
|
|
|
|
var verifyFunction = null;
|
|
|
|
|
1999-12-24 12:18:36 +03:00
|
|
|
switch (pickerID) {
|
|
|
|
case "msgNewFolderPicker":
|
|
|
|
verifyFunction = msgfolder.canCreateSubfolders;
|
|
|
|
break;
|
|
|
|
case "msgRenameFolderPicker":
|
|
|
|
verifyFunction = msgfolder.canRename;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
verifyFunction = msgfolder.canFileMessages;
|
|
|
|
break;
|
1999-12-04 21:29:05 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
if (verifyFunction) {
|
|
|
|
SetFolderPicker(uri,pickerID);
|
|
|
|
}
|
fix for #17402, stationary -> stationery.
r=alecf
major fixes for the new folder / rename folder / subscribe dialogs.
we no longer use an html select for the folder picker.
now we use cascading menu popups, like the copy and move menus.
this fixes a lot of bugs, and allows pre-flighting to finally work.
our folder data source has some new properies:
CanFileMessages, CanSubscribe, CanRename, and CanCreateSubfolders
we use these to determine what cascading menu to build, what to disable, etc.
also, nsMessenger::NewFolder() and nsMessenger::RenameFolder() were changes to
take a nsIRDFResource instead of a nsIDOMXULElement. Before we were
passing through to the back end the selected xul element, now we pass
the resource in.
other cool side effects:
in the copy & move menus, you don't get the choice to file or copy to a server, on folders
in the rename dialog, you can't pick a server, on a folder
in the new folder dialog, you can't pick the imap inbox. (* more needs to be done here.)
bugs fixed: #14773, #14254, #20599, #20646
r=alecf
a couple bullet proofing fixes to prevent some crashes reported on fullcircle
r=bienvenu
1999-12-03 11:10:09 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function PickedMsgFolder(selection,pickerID)
|
|
|
|
{
|
2002-09-11 09:03:36 +04:00
|
|
|
var selectedUri = selection.getAttribute('id');
|
|
|
|
SetFolderPicker(selectedUri,pickerID);
|
fix for #17402, stationary -> stationery.
r=alecf
major fixes for the new folder / rename folder / subscribe dialogs.
we no longer use an html select for the folder picker.
now we use cascading menu popups, like the copy and move menus.
this fixes a lot of bugs, and allows pre-flighting to finally work.
our folder data source has some new properies:
CanFileMessages, CanSubscribe, CanRename, and CanCreateSubfolders
we use these to determine what cascading menu to build, what to disable, etc.
also, nsMessenger::NewFolder() and nsMessenger::RenameFolder() were changes to
take a nsIRDFResource instead of a nsIDOMXULElement. Before we were
passing through to the back end the selected xul element, now we pass
the resource in.
other cool side effects:
in the copy & move menus, you don't get the choice to file or copy to a server, on folders
in the rename dialog, you can't pick a server, on a folder
in the new folder dialog, you can't pick the imap inbox. (* more needs to be done here.)
bugs fixed: #14773, #14254, #20599, #20646
r=alecf
a couple bullet proofing fixes to prevent some crashes reported on fullcircle
r=bienvenu
1999-12-03 11:10:09 +03:00
|
|
|
}
|
|
|
|
|
2005-08-03 00:16:45 +04:00
|
|
|
function SetFolderPickerElement(uri, picker)
|
fix for #17402, stationary -> stationery.
r=alecf
major fixes for the new folder / rename folder / subscribe dialogs.
we no longer use an html select for the folder picker.
now we use cascading menu popups, like the copy and move menus.
this fixes a lot of bugs, and allows pre-flighting to finally work.
our folder data source has some new properies:
CanFileMessages, CanSubscribe, CanRename, and CanCreateSubfolders
we use these to determine what cascading menu to build, what to disable, etc.
also, nsMessenger::NewFolder() and nsMessenger::RenameFolder() were changes to
take a nsIRDFResource instead of a nsIDOMXULElement. Before we were
passing through to the back end the selected xul element, now we pass
the resource in.
other cool side effects:
in the copy & move menus, you don't get the choice to file or copy to a server, on folders
in the rename dialog, you can't pick a server, on a folder
in the new folder dialog, you can't pick the imap inbox. (* more needs to be done here.)
bugs fixed: #14773, #14254, #20599, #20646
r=alecf
a couple bullet proofing fixes to prevent some crashes reported on fullcircle
r=bienvenu
1999-12-03 11:10:09 +03:00
|
|
|
{
|
2002-09-11 09:03:36 +04:00
|
|
|
var msgfolder = GetMsgFolderFromUri(uri, true);
|
2001-02-23 02:32:13 +03:00
|
|
|
|
2002-09-11 09:03:36 +04:00
|
|
|
if (!msgfolder)
|
|
|
|
return;
|
fix for #17402, stationary -> stationery.
r=alecf
major fixes for the new folder / rename folder / subscribe dialogs.
we no longer use an html select for the folder picker.
now we use cascading menu popups, like the copy and move menus.
this fixes a lot of bugs, and allows pre-flighting to finally work.
our folder data source has some new properies:
CanFileMessages, CanSubscribe, CanRename, and CanCreateSubfolders
we use these to determine what cascading menu to build, what to disable, etc.
also, nsMessenger::NewFolder() and nsMessenger::RenameFolder() were changes to
take a nsIRDFResource instead of a nsIDOMXULElement. Before we were
passing through to the back end the selected xul element, now we pass
the resource in.
other cool side effects:
in the copy & move menus, you don't get the choice to file or copy to a server, on folders
in the rename dialog, you can't pick a server, on a folder
in the new folder dialog, you can't pick the imap inbox. (* more needs to be done here.)
bugs fixed: #14773, #14254, #20599, #20646
r=alecf
a couple bullet proofing fixes to prevent some crashes reported on fullcircle
r=bienvenu
1999-12-03 11:10:09 +03:00
|
|
|
|
2002-09-11 09:03:36 +04:00
|
|
|
var selectedValue = null;
|
|
|
|
var serverName;
|
1999-12-04 04:43:12 +03:00
|
|
|
|
2002-09-11 09:03:36 +04:00
|
|
|
if (msgfolder.isServer)
|
|
|
|
selectedValue = msgfolder.name;
|
|
|
|
else {
|
|
|
|
if (msgfolder.server)
|
|
|
|
serverName = msgfolder.server.prettyName;
|
|
|
|
else {
|
|
|
|
dump("Can't find server for " + uri + "\n");
|
|
|
|
serverName = "???";
|
|
|
|
}
|
2006-06-17 17:17:39 +04:00
|
|
|
|
2006-07-20 03:16:09 +04:00
|
|
|
switch (picker.id) {
|
2006-06-17 17:17:39 +04:00
|
|
|
case "runFiltersFolder":
|
2002-09-11 09:03:36 +04:00
|
|
|
selectedValue = msgfolder.name;
|
2006-06-17 17:17:39 +04:00
|
|
|
break;
|
|
|
|
case "msgTrashFolderPicker":
|
|
|
|
selectedValue = msgfolder.name;
|
|
|
|
break;
|
|
|
|
default:
|
2002-09-11 09:03:36 +04:00
|
|
|
if (!gMessengerBundle)
|
|
|
|
gMessengerBundle = document.getElementById("bundle_messenger");
|
|
|
|
selectedValue = gMessengerBundle.getFormattedString("verboseFolderFormat",
|
|
|
|
[msgfolder.name, serverName]);
|
2006-06-17 17:17:39 +04:00
|
|
|
break;
|
2002-09-11 09:03:36 +04:00
|
|
|
}
|
|
|
|
}
|
fix for #17402, stationary -> stationery.
r=alecf
major fixes for the new folder / rename folder / subscribe dialogs.
we no longer use an html select for the folder picker.
now we use cascading menu popups, like the copy and move menus.
this fixes a lot of bugs, and allows pre-flighting to finally work.
our folder data source has some new properies:
CanFileMessages, CanSubscribe, CanRename, and CanCreateSubfolders
we use these to determine what cascading menu to build, what to disable, etc.
also, nsMessenger::NewFolder() and nsMessenger::RenameFolder() were changes to
take a nsIRDFResource instead of a nsIDOMXULElement. Before we were
passing through to the back end the selected xul element, now we pass
the resource in.
other cool side effects:
in the copy & move menus, you don't get the choice to file or copy to a server, on folders
in the rename dialog, you can't pick a server, on a folder
in the new folder dialog, you can't pick the imap inbox. (* more needs to be done here.)
bugs fixed: #14773, #14254, #20599, #20646
r=alecf
a couple bullet proofing fixes to prevent some crashes reported on fullcircle
r=bienvenu
1999-12-03 11:10:09 +03:00
|
|
|
|
2002-09-11 09:03:36 +04:00
|
|
|
picker.setAttribute("label",selectedValue);
|
|
|
|
picker.setAttribute("uri",uri);
|
fix for #17402, stationary -> stationery.
r=alecf
major fixes for the new folder / rename folder / subscribe dialogs.
we no longer use an html select for the folder picker.
now we use cascading menu popups, like the copy and move menus.
this fixes a lot of bugs, and allows pre-flighting to finally work.
our folder data source has some new properies:
CanFileMessages, CanSubscribe, CanRename, and CanCreateSubfolders
we use these to determine what cascading menu to build, what to disable, etc.
also, nsMessenger::NewFolder() and nsMessenger::RenameFolder() were changes to
take a nsIRDFResource instead of a nsIDOMXULElement. Before we were
passing through to the back end the selected xul element, now we pass
the resource in.
other cool side effects:
in the copy & move menus, you don't get the choice to file or copy to a server, on folders
in the rename dialog, you can't pick a server, on a folder
in the new folder dialog, you can't pick the imap inbox. (* more needs to be done here.)
bugs fixed: #14773, #14254, #20599, #20646
r=alecf
a couple bullet proofing fixes to prevent some crashes reported on fullcircle
r=bienvenu
1999-12-03 11:10:09 +03:00
|
|
|
}
|
2005-08-03 00:16:45 +04:00
|
|
|
|
|
|
|
function SetFolderPicker(uri,pickerID)
|
|
|
|
{
|
|
|
|
SetFolderPickerElement(uri, document.getElementById(pickerID));
|
|
|
|
}
|