Changes to use onselect in threadpane. Make Next Message and Next Unread Message work

as well.
This commit is contained in:
putterman%netscape.com 1999-08-23 02:58:28 +00:00
parent 16daea328d
commit b0ead65322
7 changed files with 39 additions and 39 deletions

View File

@ -120,7 +120,7 @@ function ComposeMessage(type, format)
var tree = GetThreadTree();
if (tree)
{
var nodeList = tree.getElementsByAttribute("selected", "true");
var nodeList = tree.selectedItems;
var appCore = FindMessenger();
if (appCore)
appCore.SetWindow(window, statusFeedback);
@ -172,7 +172,7 @@ function NewMessage()
function GetNewMessages()
{
var folderTree = GetFolderTree();;
var selectedFolderList = folderTree.getElementsByAttribute("selected", "true");
var selectedFolderList = folderTree.selectedItems;
if(selectedFolderList.length > 0)
{
var selectedFolder = selectedFolderList[0];
@ -263,7 +263,7 @@ function MsgPreferences()
function GetSelectedFolderResource()
{
var folderTree = GetFolderTree();
var selectedFolderList = folderTree.getElementsByAttribute("selected", "true");
var selectedFolderList = folderTree.selectedItems;
var selectedFolder = selectedFolderList[0];
var uri = selectedFolder.getAttribute('id');
@ -316,11 +316,13 @@ function ToggleMessageRead(treeItem)
messenger.MarkMessageRead(tree.database, treeItem, unread);
}
function ThreadPaneSelectionChange()
function ThreadPaneSelectionChange(selectedElement)
{
var doc = GetThreadPane().document;
var tree = GetThreadTree();
var selArray = doc.getElementsByAttribute('selected', 'true');
var selArray = tree.selectedItems;
dump('In ThreadPaneSelectionChange(). Num Selected Items = ' + selArray.length);
dump('\n');
if ( selArray && (selArray.length == 1) )
LoadMessage(selArray[0]);
else
@ -336,38 +338,32 @@ function ClearMessagePane()
function GoNextMessage()
{
var doc = GetThreadPane().document;
var tree = GetThreadTree();
var selArray = doc.getElementsByAttribute('selected', 'true');
var selArray = tree.selectedItems;
if ( selArray && (selArray.length == 1) )
{
var nextMessage = GetNextMessage(selArray[0]);
if(nextMessage)
{
var selectedVal = selArray[0].getAttribute('selected');
dump('selectedVal = ' + selectedVal);
selArray[0].removeAttribute('selected');
nextMessage.setAttribute('selected', 'true');
tree.clearItemSelection();
tree.selectItem(nextMessage);
}
}
}
function GoNextUnreadMessage()
{
var doc = GetThreadPane().document;
var tree = GetThreadTree();
var selArray = doc.getElementsByAttribute('selected', 'true');
var selArray = tree.selectedItems;
if ( selArray && (selArray.length == 1) )
{
var nextMessage = GetNextUnreadMessage(selArray[0]);
if(nextMessage)
{
var selectedVal = selArray[0].getAttribute('selected');
dump('selectedVal = ' + selectedVal);
selArray[0].removeAttribute('selected');
nextMessage.setAttribute('selected', 'true');
tree.clearItemSelection();
tree.selectItem(nextMessage);
}
}
}

View File

@ -32,7 +32,7 @@ Rights Reserved.
<html:div flex="100%">
<tree style="height: 100%" datasources="rdf:null" id="threadTree"
onchange="top.ThreadPaneSelectionChange()"
onselect="top.ThreadPaneSelectionChange(event.target)"
containment="http://home.netscape.com/NC-rdf#MessageChild">
<template>

View File

@ -76,7 +76,7 @@ function MsgDeleteMessage(fromToolbar)
}
dump("tree is valid\n");
//get the selected elements
var messageList = tree.getElementsByAttribute("selected", "true");
var messageList = tree.selectedItems;
//get the current folder
messenger.DeleteMessages(tree, srcFolder, messageList);
}
@ -86,7 +86,7 @@ function MsgDeleteFolder()
{
//get the selected elements
var tree = GetFolderTree();
var folderList = tree.getElementsByAttribute("selected", "true");
var folderList = tree.selectedItems;
var i;
var folder, parent;
for(i = 0; i < folderList.length; i++)
@ -148,9 +148,11 @@ function MsgCopyMessage(destFolder)
if(tree)
{
//Get the selected messages to copy
var messageList = tree.getElementsByAttribute("selected", "true");
var messageList = tree.selectedItems;
//get the current folder
// dump('In copy messages. Num Selected Items = ' + messageList.length);
// dump('\n');
var srcFolder = GetThreadTreeFolder();
messenger.CopyMessages(tree.database, srcFolder, destFolder, messageList, false);
}
@ -166,7 +168,7 @@ function MsgMoveMessage(destFolder)
if(tree)
{
//Get the selected messages to copy
var messageList = tree.getElementsByAttribute("selected", "true");
var messageList = tree.selectedItems;
//get the current folder
var srcFolder = GetThreadTreeFolder();
messenger.CopyMessages(tree.database, srcFolder, destFolder, messageList, true);
@ -236,7 +238,7 @@ function MsgSortBySubject()
function MsgNewFolder()
{
var folderTree = GetFolderTree();
var selectedFolderList = folderTree.getElementsByAttribute("selected", "true");
var selectedFolderList = folderTree.selectedItems;
var selectedFolder = selectedFolderList[0];
if (selectedFolder)
{
@ -252,7 +254,7 @@ function MsgNewFolder()
function NewFolder(name)
{
var folderTree = GetFolderTree();
var selectedFolderList = folderTree.getElementsByAttribute("selected", "true");
var selectedFolderList = folderTree.selectedItems;
var selectedFolder = selectedFolderList[0];
messenger.NewFolder(folderTree.database, selectedFolder, name);
@ -294,7 +296,7 @@ function MsgRenameFolder()
var tree = GetFolderTree();
if (tree)
{
var folderList = tree.getElementsByAttribute("selected", "true");
var folderList = tree.selectedItems;
if (folderList && folderList.length == 1)
{
var folder = folderList[0];
@ -316,7 +318,7 @@ function RenameFolder(name)
var tree = GetFolderTree();
if (tree)
{
var folderList = tree.getElementsByAttribute("selected", "true");
var folderList = tree.selectedItems;
if (folderList && folderList.length == 1)
{
var folder = folderList[0];
@ -331,7 +333,7 @@ function MsgEmptyTrash()
var tree = GetFolderTree();
if (tree)
{
var folderList = tree.getElementsByAttribute("selected", "true");
var folderList = tree.selectedItems;
if (folderList)
{
var folder;
@ -354,7 +356,7 @@ function MsgCompactFolder()
var tree = GetFolderTree();
if (tree)
{
var folderList = tree.getElementsByAttribute("selected", "true");
var folderList = tree.selectedItems;
if (folderList)
{
var i;
@ -469,7 +471,7 @@ function MsgMarkMsgAsRead(markRead)
dump("\MsgMarkMsgAsRead from XUL\n");
var tree = GetThreadTree();
//get the selected elements
var messageList = tree.getElementsByAttribute("selected", "true");
var messageList = tree.selectedItems;
messenger.MarkMessagesRead(tree.database, messageList, markRead);
}
@ -478,7 +480,7 @@ function MsgMarkByDate() {}
function MsgMarkAllRead()
{
var folderTree = GetFolderTree();;
var selectedFolderList = folderTree.getElementsByAttribute("selected", "true");
var selectedFolderList = folderTree.selectedItems;
if(selectedFolderList.length > 0)
{
var selectedFolder = selectedFolderList[0];

View File

@ -183,9 +183,9 @@ Rights Reserved.
<!ENTITY goMenu.label ".Go">
<!ENTITY firstUnreadMsgCmd.label ".First Unread Message">
<!ENTITY firstFlaggedMsgCmd.label ".First Flagged Message">
<!ENTITY nextMenu.label ".Next">
<!ENTITY nextMsgCmd.label ".Message">
<!ENTITY nextUnreadMsgCmd.label ".Unread Message">
<!ENTITY nextMenu.label "Next">
<!ENTITY nextMsgCmd.label "Message">
<!ENTITY nextUnreadMsgCmd.label "Unread Message">
<!ENTITY nextFlaggedMsgCmd.label ".Flagged Message">
<!ENTITY prevMenu.label ".Previous">
<!ENTITY prevMsgCmd.label ".Message">

View File

@ -18,6 +18,7 @@ Communications Corporation. Portions created by Netscape are
Rights Reserved.
-->
<!ENTITY threadColumn.label "Thread">
<!ENTITY senderColumn.label "Sender">
<!ENTITY subjectColumn.label "Subject">
<!ENTITY dateColumn.label "Date">

View File

@ -183,9 +183,9 @@ Rights Reserved.
<!ENTITY goMenu.label ".Go">
<!ENTITY firstUnreadMsgCmd.label ".First Unread Message">
<!ENTITY firstFlaggedMsgCmd.label ".First Flagged Message">
<!ENTITY nextMenu.label ".Next">
<!ENTITY nextMsgCmd.label ".Message">
<!ENTITY nextUnreadMsgCmd.label ".Unread Message">
<!ENTITY nextMenu.label "Next">
<!ENTITY nextMsgCmd.label "Message">
<!ENTITY nextUnreadMsgCmd.label "Unread Message">
<!ENTITY nextFlaggedMsgCmd.label ".Flagged Message">
<!ENTITY prevMenu.label ".Previous">
<!ENTITY prevMsgCmd.label ".Message">

View File

@ -18,6 +18,7 @@ Communications Corporation. Portions created by Netscape are
Rights Reserved.
-->
<!ENTITY threadColumn.label "Thread">
<!ENTITY senderColumn.label "Sender">
<!ENTITY subjectColumn.label "Subject">
<!ENTITY dateColumn.label "Date">