Fix for 25984. Adding sort direction indicators to thread pane column headers. r=putterman

This commit is contained in:
dimator%netscape.com 2000-08-04 17:37:29 +00:00
Родитель 5e1788b38b
Коммит 0590d1c246
2 изменённых файлов: 84 добавлений и 12 удалений

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

@ -386,6 +386,7 @@ function FindThreadPaneColumnBySortResource(sortID)
//If it's not true then use the direction passed in.
function SortThreadPane(column, sortKey, secondarySortKey, toggleCurrentDirection, direction)
{
dump("In SortThreadPane\n");
var node = document.getElementById(column);
if(!node)
return false;
@ -404,6 +405,8 @@ function SortThreadPane(column, sortKey, secondarySortKey, toggleCurrentDirectio
}
}
UpdateSortIndicator(column, direction);
var folder = GetSelectedFolder();
if(folder)
{
@ -426,6 +429,75 @@ function SortThreadPane(column, sortKey, secondarySortKey, toggleCurrentDirectio
return result;
}
//------------------------------------------------------------
// Sets the column header sort icon based on the requested
// column and direction.
//
// Notes:
// (1) This function relies on the first part of the
// <treecell id> matching the <treecol id>. The treecell
// id must have a "Header" suffix.
// (2) By changing the "sortDirection" attribute, a different
// CSS style will be used, thus changing the icon based on
// the "sortDirection" parameter.
//------------------------------------------------------------
function UpdateSortIndicator(column,sortDirection)
{
// Find the <treerow> element
var treerow = document.getElementById("headRow");
//The SortThreadPane function calls the Sender/Recipient column 'AuthorColumn'
//but it's treecell header id is actually 'SenderColumnHeader', so we need to flip
//it here so that the css can handle changing it's style correctly.
if(column == "AuthorColumn"){
column = "SenderColumn";
}
//Sorting by UnreadButtonColumn and FlaggedButtonColumn causes
//display problems in their respective column headers, so we disable
//the changing of their header appearances. (We also need to remove the
//sort indicator from the other columns, because sorting by FlaggedButton
//and UnreadButton is still taking place, only not being indicated.)
if(column == "UnreadButtonColumn" || column == "FlaggedButtonColumn"){
var treecell = treerow.getElementsByTagName("treecell");
// Loop through each treecell...
var node_count = treecell.length;
for (var i=0; i < node_count; i++)
{
treecell[i].removeAttribute('sortDirection');
}
return;
}
var id = column + "Header";
if (treerow)
{
// Grab all of the <treecell> elements
var treecell = treerow.getElementsByTagName("treecell");
if (treecell)
{
// Loop through each treecell...
var node_count = treecell.length;
for (var i=0; i < node_count; i++)
{
// Is this the requested column ?
if (id == treecell[i].getAttribute("id"))
{
// Set the sortDirection so the class (CSS) will add the
// appropriate icon to the header cell
treecell[i].setAttribute('sortDirection',sortDirection);
}
else
{
// This is not the sorted row
treecell[i].removeAttribute('sortDirection');
}
}
}
}
}
function SortFolderPane(column, sortKey)
{
var node = FindInSidebar(window, column);
@ -439,7 +511,7 @@ function SortFolderPane(column, sortKey)
function SortColumn(node, sortKey, secondarySortKey, direction)
{
dump('In sortColumn\n');
dump('In SortColumn\n');
var xulSortService = Components.classes["component://netscape/rdf/xul-sort-service"].getService();
if (xulSortService)

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

@ -106,17 +106,17 @@ Rights Reserved.
<treehead>
<treerow id="headRow">
<treecell display="Thread" onclick="return top.ChangeThreadView();" class="treecell-header treecell-inset-header threadColumnHeader" tooltip="aTooltip" tooltiptext="&threadColumnHeader.tooltip;" id="ThreadColumnHeader"/>
<treecell class="treecell-header treecell-inset-header" value="&subjectColumn.label;" onclick="return top.MsgSortBySubject();"/>
<treecell class="treecell-header treecell-inset-header" onclick="return top.MsgSortBySender();" value="&senderColumn.label;" id="SenderColumnHeader"/>
<treecell class="treecell-header treecell-header-image treecell-inset-header readColumnHeader" display="Read" onclick="return top.MsgSortByRead();"/>
<treecell class="treecell-header treecell-inset-header" value="&dateColumn.label;" onclick="return top.MsgSortByDate();"/>
<treecell class="treecell-header treecell-inset-header" value="&priorityColumn.label;" onclick="return top.MsgSortByPriority();"/>
<treecell class="treecell-header treecell-header-image treecell-inset-header flagColumnHeader" display="Flag" onclick="return top.MsgSortByFlagged();" />
<treecell class="treecell-header treecell-inset-header" value="&statusColumn.label;" onclick="return top.MsgSortByStatus();"/>
<treecell class="treecell-header treecell-inset-header" value="&sizeColumn.label;" onclick="return top.MsgSortBySize();"/>
<treecell class="treecell-header treecell-inset-header" value="&unreadColumn.label;" onclick="return top.MsgSortByUnread();"/>
<treecell class="treecell-header treecell-inset-header" value="&totalColumn.label;" onclick="return top.MsgSortByTotal();"/>
<treecell class="treecell-header treecell-inset-header" value="&orderReceivedColumn.label;" onclick="return top.MsgSortByOrderReceived();"/>
<treecell class="treecell-header treecell-inset-header sortDirectionIndicator" value="&subjectColumn.label;" onclick="return top.MsgSortBySubject();" id="SubjectColumnHeader"/>
<treecell class="treecell-header treecell-inset-header sortDirectionIndicator" onclick="return top.MsgSortBySender();" value="&senderColumn.label;" id="SenderColumnHeader"/>
<treecell class="treecell-header treecell-header-image treecell-inset-header readColumnHeader sortDirectionIndicator" display="Read" onclick="return top.MsgSortByRead();" id="UnreadButtonColumnHeader"/>
<treecell class="treecell-header treecell-inset-header sortDirectionIndicator" value="&dateColumn.label;" onclick="return top.MsgSortByDate();" id="DateColumnHeader"/>
<treecell class="treecell-header treecell-inset-header sortDirectionIndicator" value="&priorityColumn.label;" onclick="return top.MsgSortByPriority();" id="PriorityColumnHeader"/>
<treecell class="treecell-header treecell-header-image treecell-inset-header flagColumnHeader sortDirectionIndicator" display="Flag" onclick="return top.MsgSortByFlagged();" id="FlaggedButtonColumnHeader"/>
<treecell class="treecell-header treecell-inset-header sortDirectionIndicator" value="&statusColumn.label;" onclick="return top.MsgSortByStatus();" id="StatusColumnHeader"/>
<treecell class="treecell-header treecell-inset-header sortDirectionIndicator" value="&sizeColumn.label;" onclick="return top.MsgSortBySize();" id="SizeColumnHeader"/>
<treecell class="treecell-header treecell-inset-header sortDirectionIndicator" value="&unreadColumn.label;" onclick="return top.MsgSortByUnread();" id="UnreadColumnHeader"/>
<treecell class="treecell-header treecell-inset-header sortDirectionIndicator" value="&totalColumn.label;" onclick="return top.MsgSortByTotal();" id="TotalColumnHeader"/>
<treecell class="treecell-header treecell-inset-header sortDirectionIndicator" value="&orderReceivedColumn.label;" onclick="return top.MsgSortByOrderReceived();" id="OrderReceivedColumnHeader"/>
<treecell class="treecell-header treecell-header-image treecell-inset-header" allowevents="true" id="popupCell" tooltip="aTooltip" tooltiptext="&columnChooser.tooltip;" autostretch="never">
<menu>
<image class="treecell-popup-icon"/>