fix for #20798. on preflight the folder picker with valid folders.

also, rename SetTitleButton -> SetFolderPicker.  remove dump statements.
This commit is contained in:
sspitzer%netscape.com 1999-12-04 18:29:05 +00:00
Родитель 2e91e607c0
Коммит e27a6ecd40
3 изменённых файлов: 46 добавлений и 13 удалений

Просмотреть файл

@ -27,14 +27,14 @@ function onInit() {
initFolderDisplay("identity.stationeryFolder", "msgStationeryFolderPicker");
initFolderDisplay("identity.junkMailFolder", "msgJunkMailFolderPicker");
initBccSelf();
dump("document is " + document + "\n");
//dump("document is " + document + "\n");
}
function initFolderDisplay(fieldname, pickerID) {
var formElement = document.getElementById(fieldname);
var uri = formElement.value;
SetTitleButton(uri,pickerID);
SetFolderPicker(uri,pickerID);
}
function initBccSelf() {
@ -54,8 +54,6 @@ function setDivText(divid, str) {
function onSave()
{
dump("in onSave()\n");
SaveUriFromPicker("identity.fccFolder", "msgFccFolderPicker");
SaveUriFromPicker("identity.draftFolder", "msgDraftsFolderPicker");
SaveUriFromPicker("identity.stationeryFolder", "msgStationeryFolderPicker");
@ -66,10 +64,10 @@ function SaveUriFromPicker(fieldName, pickerID)
{
var picker = document.getElementById(pickerID);
var uri = picker.getAttribute("uri");
dump("uri = " + uri + "\n");
//dump("uri = " + uri + "\n");
formElement = document.getElementById(fieldName);
dump("old value = " + formElement.value + "\n");
//dump("old value = " + formElement.value + "\n");
formElement.value = uri;
dump("new value = " + formElement.value + "\n");
//dump("new value = " + formElement.value + "\n");
}

Просмотреть файл

@ -1,7 +1,7 @@
// call this from dialog onload() to set the menu item to the correct value
function MsgFolderPickerOnLoad(pickerID)
{
dump("in MsgFolderPickerOnLoad()\n");
//dump("in MsgFolderPickerOnLoad()\n");
var uri = null;
try {
uri = window.arguments[0].preselectedURI;
@ -11,18 +11,46 @@ function MsgFolderPickerOnLoad(pickerID)
}
if (uri) {
dump("on loading, set titled button to " + uri + "\n");
SetTitleButton(uri,pickerID);
//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
var msgfolder = GetMsgFolderFromUri(uri);
if (!msgfolder) return;
var verifyFunction = null;
if (pickerID == "msgSubscribeFolderPicker") {
verifyFunction = msgfolder.canSubscribe;
}
else if (pickerID == "msgNewFolderPicker") {
verifyFunction = msgfolder.canCreateSubfolders;
}
else if (pickerID == "msgRenameFolderPicker") {
verifyFunction = msgfolder.canRename;
}
else if ((pickerID == "msgFccFolderPicker") || (pickerID == "msgDraftsFolderPicker") || (pickerID == "msgStationeryFolderPicker") || (pickerID == "msgJunkMailFolderPicker")) {
verifyFunction = msgfolder.canFileMessages;
}
else {
dump("this should never happen\n");
return;
}
if (verifyFunction) {
SetFolderPicker(uri,pickerID);
}
}
}
function PickedMsgFolder(selection,pickerID)
{
var selectedUri = selection.getAttribute('id');
SetTitleButton(selectedUri,pickerID);
SetFolderPicker(selectedUri,pickerID);
}
function SetTitleButton(uri,pickerID)
function SetFolderPicker(uri,pickerID)
{
var picker = document.getElementById(pickerID);
var msgfolder = GetMsgFolderFromUri(uri);

Просмотреть файл

@ -5,7 +5,7 @@ function newFolderNameOnLoad(pickerDOMID)
{
pickerID = pickerDOMID;
doSetOKCancel(newFolderNameOKButtonCallback, 0);
doSetOKCancel(newFolderNameOKButtonCallback, newFolderNameCancelButtonCallback);
// look in arguments[0] for parameters
if (window.arguments && window.arguments[0])
@ -49,3 +49,10 @@ function newFolderNameOKButtonCallback()
return true;
}
function newFolderNameCancelButtonCallback()
{
// close the window
dump("in newFolderNameCancelButtonCallback\n");
return true;
}