History should use outliner, provide a way to sort/view history the old way, win32 classic should use +/- twisties (73857, 71947, 80846, also fixes 66907, 59814, 71029, 48864, 69260, others). r=alecf sr=ben
@ -677,14 +677,37 @@ nsXULOutlinerBuilder::CycleHeader(const PRUnichar* aColID, nsIDOMElement* aEleme
|
||||
mSortDirection = eDirection_Ascending;
|
||||
}
|
||||
|
||||
header->SetAttribute(kNameSpaceID_None, nsXULAtoms::sortDirection, dir, PR_FALSE);
|
||||
|
||||
// Sort it
|
||||
SortSubtree(mRows.GetRoot());
|
||||
mRows.InvalidateCachedRow();
|
||||
mBoxObject->Invalidate();
|
||||
}
|
||||
|
||||
header->SetAttribute(kNameSpaceID_None, nsXULAtoms::sortDirection, dir, PR_FALSE);
|
||||
|
||||
// Unset sort attribute(s) on the other columns
|
||||
nsCOMPtr<nsIContent> parentContent;
|
||||
header->GetParent(*getter_AddRefs(parentContent));
|
||||
if (parentContent) {
|
||||
nsCOMPtr<nsIAtom> parentTag;
|
||||
parentContent->GetTag(*getter_AddRefs(parentTag));
|
||||
if (parentTag.get() == nsXULAtoms::outliner) {
|
||||
PRInt32 numChildren;
|
||||
parentContent->ChildCount(numChildren);
|
||||
for (int i = 0; i < numChildren; ++i) {
|
||||
nsCOMPtr<nsIContent> childContent;
|
||||
nsCOMPtr<nsIAtom> childTag;
|
||||
parentContent->ChildAt(i, *getter_AddRefs(childContent));
|
||||
if (childContent) {
|
||||
childContent->GetTag(*getter_AddRefs(childTag));
|
||||
if (childTag.get() == nsXULAtoms::outlinercol && childContent != header) {
|
||||
childContent->UnsetAttribute(kNameSpaceID_None,
|
||||
nsXULAtoms::sortDirection, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -677,14 +677,37 @@ nsXULOutlinerBuilder::CycleHeader(const PRUnichar* aColID, nsIDOMElement* aEleme
|
||||
mSortDirection = eDirection_Ascending;
|
||||
}
|
||||
|
||||
header->SetAttribute(kNameSpaceID_None, nsXULAtoms::sortDirection, dir, PR_FALSE);
|
||||
|
||||
// Sort it
|
||||
SortSubtree(mRows.GetRoot());
|
||||
mRows.InvalidateCachedRow();
|
||||
mBoxObject->Invalidate();
|
||||
}
|
||||
|
||||
header->SetAttribute(kNameSpaceID_None, nsXULAtoms::sortDirection, dir, PR_FALSE);
|
||||
|
||||
// Unset sort attribute(s) on the other columns
|
||||
nsCOMPtr<nsIContent> parentContent;
|
||||
header->GetParent(*getter_AddRefs(parentContent));
|
||||
if (parentContent) {
|
||||
nsCOMPtr<nsIAtom> parentTag;
|
||||
parentContent->GetTag(*getter_AddRefs(parentTag));
|
||||
if (parentTag.get() == nsXULAtoms::outliner) {
|
||||
PRInt32 numChildren;
|
||||
parentContent->ChildCount(numChildren);
|
||||
for (int i = 0; i < numChildren; ++i) {
|
||||
nsCOMPtr<nsIContent> childContent;
|
||||
nsCOMPtr<nsIAtom> childTag;
|
||||
parentContent->ChildAt(i, *getter_AddRefs(childContent));
|
||||
if (childContent) {
|
||||
childContent->GetTag(*getter_AddRefs(childTag));
|
||||
if (childTag.get() == nsXULAtoms::outlinercol && childContent != header) {
|
||||
childContent->UnsetAttribute(kNameSpaceID_None,
|
||||
nsXULAtoms::sortDirection, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -25,17 +25,19 @@
|
||||
/**
|
||||
* Style rules for generic bookmarks items.
|
||||
*/
|
||||
.bookmark-item
|
||||
.bookmark-item, outlinerbody:-moz-outliner-image(Name)
|
||||
{
|
||||
padding-right: 2px;
|
||||
list-style-image : url("chrome://communicator/skin/bookmarks/bookmark-item.gif");
|
||||
}
|
||||
|
||||
.bookmark-item[container="true"]
|
||||
|
||||
.bookmark-item[container="true"], outlinerbody:-moz-outliner-image(Name, container)
|
||||
{
|
||||
padding-right: 2px;
|
||||
list-style-image : url("chrome://communicator/skin/bookmarks/bookmark-folder-closed.gif");
|
||||
}
|
||||
|
||||
.bookmark-item[container="true"][open="true"]
|
||||
.bookmark-item[container="true"][open="true"], outlinerbody:-moz-outliner-image(Name, open)
|
||||
{
|
||||
list-style-image : url("chrome://communicator/skin/bookmarks/bookmark-folder-open.gif");
|
||||
}
|
||||
|
@ -2,13 +2,13 @@
|
||||
#sidebar-splitter
|
||||
{
|
||||
border-top : 1px solid ThreeDHighlight;
|
||||
border-bottom : 1px solid ThreeDShadow;
|
||||
}
|
||||
|
||||
#sidebar-box
|
||||
{
|
||||
border-left : 1px solid ThreeDShadow;
|
||||
border-right : 1px solid ThreeDHighlight;
|
||||
border-bottom : 1px solid ThreeDHighlight;
|
||||
background-color : AppWorkspace;
|
||||
}
|
||||
|
||||
|
@ -223,4 +223,10 @@ classic.jar:
|
||||
skin/classic/global/error-icon.gif (::error-icon.gif)
|
||||
skin/classic/global/alert-icon.gif (::alert-icon.gif)
|
||||
skin/classic/global/question-icon.gif (::question-icon.gif)
|
||||
skin/classic/global/twisty-open.gif
|
||||
skin/classic/global/twisty-open-active.gif
|
||||
skin/classic/global/twisty-open-selected.gif
|
||||
skin/classic/global/twisty-closed.gif
|
||||
skin/classic/global/twisty-closed-active.gif
|
||||
skin/classic/global/twisty-closed-selected.gif
|
||||
|
||||
|
BIN
themes/classic/global/mac/twisty-closed-active.gif
Normal file
After Width: | Height: | Size: 44 B |
Before Width: | Height: | Size: 94 B After Width: | Height: | Size: 94 B |
Before Width: | Height: | Size: 94 B After Width: | Height: | Size: 94 B |
Before Width: | Height: | Size: 70 B After Width: | Height: | Size: 70 B |
Before Width: | Height: | Size: 91 B After Width: | Height: | Size: 91 B |
Before Width: | Height: | Size: 91 B After Width: | Height: | Size: 91 B |
Before Width: | Height: | Size: 73 B |
@ -38,5 +38,7 @@ classic.jar:
|
||||
skin/classic/global/alert-icon.gif
|
||||
skin/classic/global/dialogOverlay.css
|
||||
skin/classic/global/linkTree.css
|
||||
skin/classic/global/twisty-open.gif
|
||||
skin/classic/global/twisty-closed.gif
|
||||
|
||||
|
||||
|
@ -7,8 +7,13 @@
|
||||
**/
|
||||
|
||||
outliner {
|
||||
background-color: -moz-Field;
|
||||
color: -moz-FieldText;
|
||||
border-spacing : 0px;
|
||||
border-top : 1px solid ThreeDShadow;
|
||||
border-right : 1px solid ThreeDHighlight;
|
||||
border-bottom : 1px solid ThreeDShadow;
|
||||
border-left : 1px solid ThreeDShadow;
|
||||
background-color : -moz-Field;
|
||||
color : -moz-FieldText;
|
||||
}
|
||||
|
||||
outliner.inset {
|
||||
|
@ -1,5 +1,5 @@
|
||||
|
||||
/******** Tree widget **********/
|
||||
/******** Tree widget **********/
|
||||
|
||||
/** basic tree ****************************************************
|
||||
* basic tree widget for use in main windows where no decoration
|
||||
@ -211,11 +211,6 @@ treeitem[container="true"] > treerow > .treecell-indent > .tree-cell-primary-ico
|
||||
padding-left : 0px;
|
||||
}
|
||||
|
||||
treeitem[selected="true"] > treerow > treecell > .tree-cell-twisty
|
||||
{
|
||||
list-style-image : url("chrome://global/skin/twisty-closed-selected.gif");
|
||||
}
|
||||
|
||||
.tree-cell-twisty[disabled="true"]
|
||||
{
|
||||
list-style-image : none;
|
||||
@ -226,11 +221,6 @@ treeitem[container="true"][open="true"] > treerow > treecell > .tree-cell-twisty
|
||||
list-style-image : url("chrome://global/skin/twisty-open.gif");
|
||||
}
|
||||
|
||||
treeitem[selected="true"][container="true"][open="true"] > treerow > treecell > .tree-cell-twisty
|
||||
{
|
||||
list-style-image : url("chrome://global/skin/twisty-open-selected.gif");
|
||||
}
|
||||
|
||||
/* tree header with sort direction indicators */
|
||||
|
||||
.tree-header-sortdirection
|
||||
|
BIN
themes/classic/global/win/twisty-closed.gif
Normal file
After Width: | Height: | Size: 841 B |
BIN
themes/classic/global/win/twisty-open.gif
Normal file
After Width: | Height: | Size: 835 B |
@ -31,15 +31,17 @@
|
||||
|
||||
/* ::::: bookmark items ::::: */
|
||||
|
||||
.bookmark-item {
|
||||
.bookmark-item, outlinerbody:-moz-outliner-image(Name) {
|
||||
padding-right: 2px;
|
||||
list-style-image: url("chrome://communicator/skin/bookmarks/bookmark-item.gif");
|
||||
}
|
||||
|
||||
.bookmark-item[container="true"] {
|
||||
.bookmark-item[container="true"], outlinerbody:-moz-outliner-image(Name, container) {
|
||||
padding-right: 2px;
|
||||
list-style-image: url("chrome://communicator/skin/bookmarks/bookmark-folder-closed.gif");
|
||||
}
|
||||
|
||||
.bookmark-item[container="true"][open="true"] {
|
||||
.bookmark-item[container="true"][open="true"], outlinerbody:-moz-outliner-image(Name, open) {
|
||||
list-style-image: url("chrome://communicator/skin/bookmarks/bookmark-folder-open.gif");
|
||||
}
|
||||
|
||||
|
@ -22,7 +22,6 @@
|
||||
-->
|
||||
|
||||
<?xml-stylesheet href="chrome://communicator/skin/" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://communicator/skin/bookmarks/bookmarks.css" type="text/css"?>
|
||||
<?xul-overlay href="chrome://communicator/content/history/historyTreeOverlay.xul"?>
|
||||
<?xul-overlay href="chrome://communicator/content/utilityOverlay.xul"?>
|
||||
|
||||
@ -31,31 +30,23 @@
|
||||
<window id="history-panel"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
onload="HistoryInit();">
|
||||
<script type="application/x-javascript" src="chrome://communicator/content/history/history.js"/>
|
||||
|
||||
<!-- use deep merging to hide certain columns by default -->
|
||||
<tree id="historyTree">
|
||||
<treecolgroup id="theColumns">
|
||||
<treecol id="Name"/>
|
||||
<splitter id="pre-URL-splitter"/>
|
||||
<treecol id="URL" hidden="true"/>
|
||||
|
||||
<splitter id="pre-Date-splitter"/>
|
||||
<treecol id="Date" hidden="true"/>
|
||||
|
||||
<splitter id="pre-FirstVisitDate-splitter"/>
|
||||
<treecol id="FirstVisitDate" hidden="true"/>
|
||||
|
||||
<splitter id="pre-Hostname-splitter"/>
|
||||
<treecol id="Hostname" hidden="true"/>
|
||||
|
||||
<splitter id="pre-Referrer-splitter"/>
|
||||
<treecol id="Referrer" hidden="true"/>
|
||||
|
||||
<splitter id="pre-VisitCount-splitter"/>
|
||||
<treecol id="VisitCount" hidden="true"/>
|
||||
</treecolgroup>
|
||||
</tree>
|
||||
<outliner id="historyOutliner">
|
||||
<outlinercol id="Name"/>
|
||||
<splitter id="pre-URL-splitter"/>
|
||||
<outlinercol id="URL" hidden="true"/>
|
||||
<splitter id="pre-Date-splitter"/>
|
||||
<outlinercol id="Date" hidden="true"/>
|
||||
<splitter id="pre-FirstVisitDate-splitter"/>
|
||||
<outlinercol id="FirstVisitDate" hidden="true"/>
|
||||
<splitter id="pre-Hostname-splitter"/>
|
||||
<outlinercol id="Hostname" hidden="true"/>
|
||||
<splitter id="pre-Referrer-splitter"/>
|
||||
<outlinercol id="Referrer" hidden="true"/>
|
||||
<splitter id="pre-VisitCount-splitter"/>
|
||||
<outlinercol id="VisitCount" hidden="true"/>
|
||||
</outliner>
|
||||
|
||||
|
||||
</window>
|
||||
|
@ -20,58 +20,67 @@
|
||||
* Contributor(s):
|
||||
* Alec Flett <alecf@netscape.com>
|
||||
*/
|
||||
|
||||
// The history window uses JavaScript in bookmarks.js too.
|
||||
|
||||
function debug(msg)
|
||||
{
|
||||
// Uncomment for noise
|
||||
//dump(msg+"\n");
|
||||
}
|
||||
|
||||
var gHistoryTree;
|
||||
var gHistoryOutliner;
|
||||
var gLastHostname;
|
||||
var gLastDomain;
|
||||
var gGlobalHistory;
|
||||
|
||||
var gPrefService;
|
||||
var gDeleteByHostname;
|
||||
var gDeleteByDomain;
|
||||
var gHistoryBundle;
|
||||
var gHistoryStatus;
|
||||
|
||||
function HistoryInit() {
|
||||
|
||||
gHistoryTree = document.getElementById("historyTree");
|
||||
function HistoryInit()
|
||||
{
|
||||
gHistoryOutliner = document.getElementById("historyOutliner");
|
||||
gDeleteByHostname = document.getElementById("menu_deleteByHostname");
|
||||
gDeleteByDomain = document.getElementById("menu_deleteByDomain");
|
||||
gHistoryBundle = document.getElementById("historyBundle");
|
||||
gHistoryStatus = document.getElementById("statusbar-display");
|
||||
|
||||
var treeController = new nsTreeController(gHistoryTree);
|
||||
var outlinerController = new nsOutlinerController(gHistoryOutliner, document.getElementById('historyOutlinerBody'));
|
||||
var historyController = new nsHistoryController;
|
||||
gHistoryTree.controllers.appendController(historyController);
|
||||
|
||||
gGlobalHistory = Components.classes["@mozilla.org/browser/global-history;1"].getService(Components.interfaces.nsIBrowserHistory);
|
||||
gHistoryOutliner.controllers.appendController(historyController);
|
||||
|
||||
if ("arguments" in window && window.arguments[0] && window.arguments.length >= 1) {
|
||||
// We have been supplied a resource URI to root the tree on
|
||||
var uri = window.arguments[0];
|
||||
setRoot(uri);
|
||||
if (uri.substring(0,5) == "find:") {
|
||||
// Update the windowtype so that future searches are directed
|
||||
// there and the window is not re-used for bookmarks.
|
||||
var windowNode = document.getElementById("history-window");
|
||||
windowNode.setAttribute("windowtype", "history:searchresults");
|
||||
}
|
||||
// We have been supplied a resource URI to root the tree on
|
||||
var uri = window.arguments[0];
|
||||
setRoot(uri);
|
||||
if (uri.substring(0,5) == "find:") {
|
||||
// Update the windowtype so that future searches are directed
|
||||
// there and the window is not re-used for bookmarks.
|
||||
var windowNode = document.getElementById("history-window");
|
||||
windowNode.setAttribute("windowtype", "history:searchresults");
|
||||
}
|
||||
}
|
||||
|
||||
gPrefService = Components.classes["@mozilla.org/preferences;1"]
|
||||
.getService(Components.interfaces.nsIPref);
|
||||
try {
|
||||
var grouping = gPrefService.GetCharPref("browser.history.grouping");
|
||||
}
|
||||
catch(e) {
|
||||
grouping = "";
|
||||
}
|
||||
GroupBy(grouping);
|
||||
if (gHistoryStatus) { // must be the window
|
||||
switch(grouping) {
|
||||
case "site":
|
||||
document.getElementById("groupBySite").setAttribute("checked", "true");
|
||||
break;
|
||||
case "none":
|
||||
document.getElementById("groupByNone").setAttribute("checked", "true");
|
||||
break;
|
||||
case "day":
|
||||
default:
|
||||
document.getElementById("groupByDay").setAttribute("checked", "true");
|
||||
}
|
||||
}
|
||||
|
||||
var children = document.getElementById('treechildren-bookmarks');
|
||||
if (children.firstChild)
|
||||
gHistoryTree.selectItem(children.firstChild);
|
||||
gHistoryTree.focus();
|
||||
|
||||
// do a sort
|
||||
RefreshSort();
|
||||
gHistoryOutliner.focus();
|
||||
gHistoryOutliner.outlinerBoxObject.view.selection.select(0);
|
||||
}
|
||||
|
||||
function updateHistoryCommands()
|
||||
@ -80,24 +89,27 @@ function updateHistoryCommands()
|
||||
goUpdateCommand("cmd_deleteByDomain");
|
||||
}
|
||||
|
||||
function historyOnSelect(event)
|
||||
function historyOnSelect()
|
||||
{
|
||||
// every time selection changes, save the last hostname
|
||||
gLastHostname = "";
|
||||
gLastDomain = "";
|
||||
var match;
|
||||
var selection = gHistoryTree.selectedItems;
|
||||
if (selection && selection.length > 0) {
|
||||
var url = selection[0].id;
|
||||
var currentIndex = gHistoryOutliner.currentIndex;
|
||||
var rowIsContainer = isContainer(gHistoryOutliner, currentIndex);
|
||||
var url = gHistoryOutliner.outlinerBoxObject.view.getCellText(currentIndex, "URL");
|
||||
|
||||
if (url && !rowIsContainer) {
|
||||
// matches scheme://(hostname)...
|
||||
match = url.match(/.*:\/\/([^\/:]*)/);
|
||||
|
||||
if (match && match.length>1)
|
||||
gLastHostname = match[1];
|
||||
|
||||
|
||||
if (gHistoryStatus)
|
||||
gHistoryStatus.label = url;
|
||||
} else {
|
||||
gHistoryStatus.label = url;
|
||||
}
|
||||
else {
|
||||
if (gHistoryStatus)
|
||||
gHistoryStatus.label = "";
|
||||
}
|
||||
@ -108,14 +120,11 @@ function historyOnSelect(event)
|
||||
if (match)
|
||||
gLastDomain = match[1];
|
||||
}
|
||||
|
||||
|
||||
document.commandDispatcher.updateCommands("select");
|
||||
}
|
||||
|
||||
function nsHistoryController()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
nsHistoryController.prototype =
|
||||
@ -144,11 +153,9 @@ nsHistoryController.prototype =
|
||||
} else {
|
||||
stringId = "deleteHostNoSelection";
|
||||
}
|
||||
text =
|
||||
gHistoryBundle.stringBundle.formatStringFromName(stringId,
|
||||
[ gLastHostname ], 1);
|
||||
text = gHistoryBundle.stringBundle.formatStringFromName(stringId,
|
||||
[ gLastHostname ], 1);
|
||||
gDeleteByHostname.setAttribute("label", text);
|
||||
|
||||
break;
|
||||
case "cmd_deleteByDomain":
|
||||
if (gLastDomain) {
|
||||
@ -168,50 +175,50 @@ nsHistoryController.prototype =
|
||||
{
|
||||
switch(command) {
|
||||
case "cmd_deleteByHostname":
|
||||
if (!gGlobalHistory)
|
||||
gGlobalHistory = Components.classes["@mozilla.org/browser/global-history;1"].getService(Components.interfaces.nsIBrowserHistory);
|
||||
gGlobalHistory.removePagesFromHost(gLastHostname, false)
|
||||
return true;
|
||||
|
||||
case "cmd_deleteByDomain":
|
||||
if (!gGlobalHistory)
|
||||
gGlobalHistory = Components.classes["@mozilla.org/browser/global-history;1"].getService(Components.interfaces.nsIBrowserHistory);
|
||||
gGlobalHistory.removePagesFromHost(gLastDomain, true)
|
||||
return true;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
var historyDNDObserver = {
|
||||
onDragStart: function (aEvent, aXferData, aDragAction)
|
||||
{
|
||||
var title = aEvent.target.getAttribute("label");
|
||||
var uri = aEvent.target.parentNode.parentNode.id;
|
||||
if (aEvent.target.localName != "treecell") // make sure we have something to drag
|
||||
return null;
|
||||
onDragStart: function (aEvent, aXferData, aDragAction)
|
||||
{
|
||||
var currentIndex = gHistoryOutliner.currentIndex;
|
||||
if (isContainer(gHistoryOutliner, currentIndex))
|
||||
return false;
|
||||
var url = gHistoryOutliner.outlinerBoxObject.view.getCellText(currentIndex, "URL");
|
||||
var title = gHistoryOutliner.outlinerBoxObject.view.getCellText(currentIndex, "Name");
|
||||
|
||||
var htmlString = "<A HREF='" + uri + "'>" + title + "</A>";
|
||||
aXferData.data = new TransferData();
|
||||
aXferData.data.addDataForFlavour("text/unicode", uri);
|
||||
aXferData.data.addDataForFlavour("text/html", htmlString);
|
||||
aXferData.data.addDataForFlavour("text/x-moz-url", uri + "\n" + title);
|
||||
}
|
||||
var htmlString = "<A HREF='" + url + "'>" + title + "</A>";
|
||||
aXferData.data = new TransferData();
|
||||
aXferData.data.addDataForFlavour("text/unicode", url);
|
||||
aXferData.data.addDataForFlavour("text/html", htmlString);
|
||||
aXferData.data.addDataForFlavour("text/x-moz-url", url + "\n" + title);
|
||||
}
|
||||
};
|
||||
|
||||
function OpenURL(event, node, root)
|
||||
function OpenURL(aInNewWindow)
|
||||
{
|
||||
if ((event.button != 0) || (event.detail != 2)
|
||||
|| (node.nodeName != "treeitem"))
|
||||
var currentIndex = gHistoryOutliner.currentIndex;
|
||||
if (isContainer(gHistoryOutliner, currentIndex))
|
||||
return false;
|
||||
|
||||
var url = gHistoryOutliner.outlinerBoxObject.view.getCellText(currentIndex, "URL");
|
||||
|
||||
if (node.getAttribute("container") == "true")
|
||||
return false;
|
||||
|
||||
var url = node.id;
|
||||
if (event.ctrlKey)
|
||||
// if metaKey is down, open in a new browser window
|
||||
window.openDialog( getBrowserURL(), "_blank", "chrome,all,dialog=no", id );
|
||||
if (aInNewWindow)
|
||||
window.openDialog( getBrowserURL(), "_blank", "chrome,all,dialog=no", url );
|
||||
else
|
||||
openTopWin(url);
|
||||
return true;
|
||||
@ -222,8 +229,24 @@ function OpenURL(event, node, root)
|
||||
*/
|
||||
function setRoot(root)
|
||||
{
|
||||
var windowNode = document.getElementById("history-window");
|
||||
windowNode.setAttribute("title", gHistoryBundle.getString("search_results_title"));
|
||||
gHistoryTree.setAttribute("ref", root);
|
||||
var windowNode = document.getElementById("history-window");
|
||||
windowNode.setAttribute("title", gHistoryBundle.getString("search_results_title"));
|
||||
document.getElementById("historyOutlinerBody").setAttribute("ref", root);
|
||||
}
|
||||
|
||||
function GroupBy(groupingType)
|
||||
{
|
||||
var outlinerBody = document.getElementById("historyOutlinerBody");
|
||||
switch(groupingType) {
|
||||
case "day":
|
||||
outlinerBody.setAttribute("ref", "NC:HistoryByDate");
|
||||
break;
|
||||
case "site":
|
||||
outlinerBody.setAttribute("ref", "find:groupby=hostname");
|
||||
break;
|
||||
case "none":
|
||||
outlinerBody.setAttribute("ref", "NC:HistoryRoot");
|
||||
break;
|
||||
}
|
||||
gPrefService.SetCharPref("browser.history.grouping", groupingType);
|
||||
}
|
||||
|
@ -24,7 +24,6 @@
|
||||
-->
|
||||
|
||||
<?xml-stylesheet href="chrome://communicator/skin/" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://communicator/skin/bookmarks/bookmarks.css" type="text/css"?>
|
||||
|
||||
<?xul-overlay href="chrome://communicator/content/history/historyTreeOverlay.xul"?>
|
||||
<?xul-overlay href="chrome://global/content/globalOverlay.xul"?>
|
||||
@ -42,12 +41,11 @@
|
||||
orient="vertical"
|
||||
windowtype="history:manager">
|
||||
|
||||
<script type="application/x-javascript" src="chrome://communicator/content/history/history.js"/>
|
||||
<script type="application/x-javascript" src="chrome://global/content/strres.js"/>
|
||||
<script type="application/x-javascript" src="chrome://global/content/globalOverlay.js"/>
|
||||
|
||||
<stringbundle id="historyBundle"
|
||||
src="chrome://communicator/locale/history/history.properties"/>
|
||||
<stringbundle id="sortBundle" src="chrome://global/locale/nsOutlinerSorting.properties"/>
|
||||
|
||||
<commandset id="tasksCommands">
|
||||
<commandset id="selectEditMenuItems"/>
|
||||
@ -65,7 +63,6 @@
|
||||
<command id="cmd_quit"/>
|
||||
<command id="bm_cmd_saveas"/>
|
||||
<!-- Edit Menu -->
|
||||
<command id="cmd_undo"/>
|
||||
<command id="cmd_cut"/>
|
||||
<command id="cmd_copy"/>
|
||||
<command id="cmd_delete"/>
|
||||
@ -82,7 +79,6 @@
|
||||
<key id="key_close"/>
|
||||
<key id="key_quit"/>
|
||||
<!-- Edit Menu -->
|
||||
<key id="key_undo"/>
|
||||
<key id="key_cut"/>
|
||||
<key id="key_copy"/>
|
||||
<key id="key_delete"/>
|
||||
@ -107,8 +103,6 @@
|
||||
|
||||
<menu id="menu_Edit">
|
||||
<menupopup>
|
||||
<menuitem id="menu_undo" disabled="true" />
|
||||
<menuseparator/>
|
||||
<menuitem id="menu_cut"/>
|
||||
<menuitem id="menu_copy"/>
|
||||
<menuitem id="menu_delete"/>
|
||||
@ -122,28 +116,27 @@
|
||||
</menu>
|
||||
<menu id="menu_View">
|
||||
<menupopup oncreate="fillViewMenu(this)">
|
||||
<menu label="&groupBy.label;" accesskey="&groupBy.accesskey;">
|
||||
<menupopup>
|
||||
<menuitem id="groupByDay" label="&groupByDay.label;" accesskey="&groupByDay.accesskey;" type="radio" oncommand="GroupBy('day');"/>
|
||||
<menuitem id="groupBySite" label="&groupBySite.label;" accesskey="&groupBySite.accesskey;" type="radio" oncommand="GroupBy('site');"/>
|
||||
<menuitem id="groupByNone" label="&groupByNone.label;" accesskey="&groupByNone.accesskey;" type="radio" oncommand="GroupBy('none');"/>
|
||||
</menupopup>
|
||||
</menu>
|
||||
<menuitem type="radio" name="sort_column" id="unsorted_menuitem"
|
||||
label="&menuitem.view.unsorted.label;"
|
||||
accesskey="&menuitem.view.unsorted.accesskey;"
|
||||
oncommand="return SetSortDirection('natural');"/>
|
||||
oncommand="return SortInNewDirection('natural');"/>
|
||||
<menuseparator id="fill_after_this_node"/>
|
||||
<menuseparator id="fill_before_this_node"/>
|
||||
<menuitem type="radio" name="sort_direction" id="sort_ascending"
|
||||
label="&menuitem.view.ascending.label;"
|
||||
accesskey="&menuitem.view.ascending.accesskey;"
|
||||
oncommand="return SetSortDirection('ascending');"/>
|
||||
oncommand="return SortInNewDirection('ascending');"/>
|
||||
<menuitem type="radio" name="sort_direction" id="sort_descending"
|
||||
label="&menuitem.view.descending.label;"
|
||||
accesskey="&menuitem.view.descending.accesskey;"
|
||||
oncommand="return SetSortDirection('descending');"/>
|
||||
<menuseparator/>
|
||||
<menu label="&menuitem.view.show_columns.label;"
|
||||
accesskey="&menuitem.view.show_columns.accesskey;">
|
||||
<menupopup
|
||||
oncreate="BuildTreePopup(document.getElementById('theColumns'),
|
||||
document.getElementById('headRow'), this,
|
||||
document.getElementById('popupCell'))"/>
|
||||
</menu>
|
||||
oncommand="return SortInNewDirection('descending');"/>
|
||||
</menupopup>
|
||||
</menu>
|
||||
<menu id="tasksMenu" accesskey="t" />
|
||||
@ -151,16 +144,10 @@
|
||||
</menubar>
|
||||
</toolbox>
|
||||
|
||||
<popupset>
|
||||
<popup id="contextual" oncreate="return fillContextMenu('contextual', 'historyTree');" >
|
||||
<menu />
|
||||
</popup>
|
||||
</popupset>
|
||||
|
||||
<tree id="historyTree"/>
|
||||
<outliner id="historyOutliner"/>
|
||||
<statusbar id="status-bar">
|
||||
<statusbarpanel class="statusbarpanel-icononly" id="offline-status"/>
|
||||
<statusbarpanel id="statusbar-display" crop="right" flex="1"/>
|
||||
<statusbarpanel class="statusbarpanel-icononly" id="offline-status"/>
|
||||
</statusbar>
|
||||
|
||||
</window>
|
||||
|
@ -20,11 +20,13 @@
|
||||
|
||||
Contributor(s):
|
||||
Ben Goodger <ben@netscape.com>
|
||||
Blake Ross <BlakeR1234@aol.com>
|
||||
Blake Ross <blakeross@telocity.com>
|
||||
Alec Flett <alecf@netscape.com>
|
||||
-->
|
||||
|
||||
<!DOCTYPE overlay SYSTEM "chrome://communicator/locale/history/historyTreeOverlay.dtd" >
|
||||
<?xml-stylesheet href="chrome://global/skin/outliner.css" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://communicator/skin/bookmarks/bookmarks.css" type="text/css"?>
|
||||
|
||||
<overlay id="historyTreeOverlay"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
@ -33,129 +35,88 @@
|
||||
|
||||
<script type="application/x-javascript" src="chrome://global/content/nsDragAndDrop.js"/>
|
||||
<script type="application/x-javascript" src="chrome://global/content/nsTransferable.js"/>
|
||||
<script type="application/x-javascript" src="chrome://global/content/nsJSComponentManager.js"/>
|
||||
<script type="application/x-javascript" src="chrome://global/content/nsJSSupportsUtils.js"/>
|
||||
<script type="application/x-javascript" src="chrome://global/content/nsTreeController.js"/>
|
||||
<script type="application/x-javascript" src="chrome://global/content/nsTreeUtils.js"/>
|
||||
<script type="application/x-javascript" src="chrome://global/content/treePopups.js"/>
|
||||
<script type="application/x-javascript" src="chrome://global/content/nsOutlinerController.js"/>
|
||||
<script type="application/x-javascript" src="chrome://global/content/nsOutlinerSorting.js"/>
|
||||
<script type="application/x-javascript" src="chrome://communicator/content/history/history.js"/>
|
||||
|
||||
<tree id="historyTree" ref="NC:HistoryByDate" context="contextual"
|
||||
datasources="rdf:history"
|
||||
flex="1"
|
||||
multiple="true"
|
||||
onselect="historyOnSelect(event)"
|
||||
ondraggesture="nsDragAndDrop.startDrag(event, historyDNDObserver);">
|
||||
<outliner id="historyOutliner" flex="1"
|
||||
onkeypress="if (event.keyCode == 13) OpenURL(event.ctrlKey || event.metaKey);">
|
||||
|
||||
<outlinerbody id="historyOutlinerBody" flex="1" datasources="rdf:history"
|
||||
ref="NC:HistoryByDate" multiple="true" context="contextual"
|
||||
onselect="this.parentNode.outlinerBoxObject.view.selectionChanged();
|
||||
historyOnSelect();"
|
||||
ondraggesture="nsDragAndDrop.startDrag(event, historyDNDObserver);"
|
||||
ondblclick="if (event.button == 0) OpenURL(event.ctrlKey || event.metaKey);">
|
||||
|
||||
<template>
|
||||
<rule>
|
||||
<outlinerrow uri="rdf:*" rdf:type="rdf:http://www.w3.org/1999/02/22-rdf-syntax-ns#type">
|
||||
<outlinercell label="rdf:http://home.netscape.com/NC-rdf#Name"
|
||||
ref="Name"/>
|
||||
<outlinercell label="rdf:http://home.netscape.com/NC-rdf#URL"
|
||||
ref="URL"/>
|
||||
<outlinercell label="rdf:http://home.netscape.com/NC-rdf#Date"
|
||||
ref="Date"/>
|
||||
<outlinercell label="rdf:http://home.netscape.com/NC-rdf#FirstVisitDate"
|
||||
ref="FirstVisitDate"/>
|
||||
<outlinercell label="rdf:http://home.netscape.com/NC-rdf#Hostname"
|
||||
ref="Hostname"/>
|
||||
<outlinercell label="rdf:http://home.netscape.com/NC-rdf#Referrer"
|
||||
ref="Referrer"/>
|
||||
<outlinercell label="rdf:http://home.netscape.com/NC-rdf#VisitCount"
|
||||
ref="VisitCount"/>
|
||||
</outlinerrow>
|
||||
</rule>
|
||||
</template>
|
||||
</outlinerbody>
|
||||
|
||||
<treecolgroup id="theColumns">
|
||||
<treecol flex="4" id="Name"
|
||||
sortSeparators="true" persist="hidden width sortActive sortDirection"
|
||||
resource="http://home.netscape.com/NC-rdf#Name"/>
|
||||
<outlinercol flex="4" id="Name" persist="hidden width sortActive sortDirection"
|
||||
label="&tree.header.name.label;" primary="true"
|
||||
sort="rdf:http://home.netscape.com/NC-rdf#Name"
|
||||
class="sortDirectionIndicator"/>
|
||||
|
||||
<splitter class="tree-splitter" id="pre-URL-splitter"/>
|
||||
|
||||
<treecol flex="4" id="URL"
|
||||
sortSeparators="true" persist="hidden width sortActive sortDirection"
|
||||
resource="http://home.netscape.com/NC-rdf#URL"
|
||||
resource2="http://home.netscape.com/NC-rdf#Name"/>
|
||||
<outlinercol flex="4" id="URL"
|
||||
persist="hidden width sortActive sortDirection"
|
||||
label="&tree.header.url.label;" class="sortDirectionIndicator"
|
||||
sort="rdf:http://home.netscape.com/NC-rdf#URL"/>
|
||||
|
||||
<splitter class="tree-splitter" id="pre-Date-splitter"/>
|
||||
|
||||
<treecol flex="1" id="Date" sortActive="true" sortDirection="descending"
|
||||
sortSeparators="true" persist="hidden width sortActive sortDirection"
|
||||
resource="http://home.netscape.com/NC-rdf#Date"
|
||||
resource2="http://home.netscape.com/NC-rdf#Name"/>
|
||||
<outlinercol flex="1" id="Date" sortActive="true" sortDirection="descending"
|
||||
persist="hidden width sortActive sortDirection"
|
||||
label="&tree.header.date.label;" class="sortDirectionIndicator"
|
||||
sort="rdf:http://home.netscape.com/NC-rdf#Date"/>
|
||||
|
||||
<splitter class="tree-splitter" id="pre-FirstVisitDate-splitter"/>
|
||||
|
||||
<treecol flex="1" id="FirstVisitDate"
|
||||
hidden="true"
|
||||
sortSeparators="true" persist="hidden width sortActive sortDirection"
|
||||
resource="http://home.netscape.com/NC-rdf#FirstVisitDate"
|
||||
resource2="http://home.netscape.com/NC-rdf#Name"/>
|
||||
<outlinercol flex="1" id="FirstVisitDate"
|
||||
hidden="true" persist="hidden width sortActive sortDirection"
|
||||
label="&tree.header.firstvisitdate.label;" class="sortDirectionIndicator"
|
||||
sort="rdf:http://home.netscape.com/NC-rdf#FirstVisitDate"/>
|
||||
|
||||
<splitter class="tree-splitter" id="pre-Hostname-splitter"/>
|
||||
|
||||
<treecol flex="1" id="Hostname" hidden="true"
|
||||
sortSeparators="true" persist="hidden width sortActive sortDirection"
|
||||
resource="http://home.netscape.com/NC-rdf#Hostname"
|
||||
resource2="http://home.netscape.com/NC-rdf#Name"/>
|
||||
<outlinercol flex="1" id="Hostname" hidden="true"
|
||||
persist="hidden width sortActive sortDirection"
|
||||
label="&tree.header.hostname.label;" class="sortDirectionIndicator"
|
||||
sort="rdf:http://home.netscape.com/NC-rdf#Hostname"/>
|
||||
|
||||
<splitter class="tree-splitter" id="pre-Referrer-splitter"/>
|
||||
|
||||
<treecol flex="1" id="Referrer" hidden="true"
|
||||
sortSeparators="true" persist="hidden width sortActive sortDirection"
|
||||
resource="http://home.netscape.com/NC-rdf#Referrer"
|
||||
resource2="http://home.netscape.com/NC-rdf#Name"/>
|
||||
<outlinercol flex="1" id="Referrer" hidden="true"
|
||||
persist="hidden width sortActive sortDirection"
|
||||
label="&tree.header.referrer.label;" class="sortDirectionIndicator"
|
||||
sort="rdf:http://home.netscape.com/NC-rdf#Referrer"/>
|
||||
|
||||
<splitter class="tree-splitter" id="pre-VisitCount-splitter"/>
|
||||
|
||||
<treecol flex="1" id="VisitCount"
|
||||
hidden="true"
|
||||
sortSeparators="true" persist="hidden width sortActive sortDirection"
|
||||
resource="http://home.netscape.com/NC-rdf#VisitCount"
|
||||
resource2="http://home.netscape.com/NC-rdf#Name"/>
|
||||
<outlinercol flex="1" id="VisitCount"
|
||||
hidden="true" persist="hidden width sortActive sortDirection"
|
||||
label="&tree.header.visitcount.label;" class="sortDirectionIndicator"
|
||||
sort="rdf:http://home.netscape.com/NC-rdf#VisitCount"/>
|
||||
|
||||
<splitter class="tree-splitter" id="pre-Popup-splitter"/>
|
||||
|
||||
<treecol persist="width" fixed="true" width="14" id="PopupColumn"/>
|
||||
</treecolgroup>
|
||||
|
||||
<treehead>
|
||||
<treerow id="headRow" onclick="if (event.target.getAttribute('observes')) TriStateColumnSort(event.target.getAttribute('observes'));">
|
||||
<treecell class="treecell-header sortDirectionIndicator"
|
||||
label="&tree.header.name.label;"
|
||||
observes="Name" />
|
||||
<treecell class="treecell-header sortDirectionIndicator"
|
||||
label="&tree.header.url.label;"
|
||||
observes="URL" />
|
||||
<treecell class="treecell-header sortDirectionIndicator"
|
||||
label="&tree.header.date.label;"
|
||||
observes="Date"/>
|
||||
<treecell class="treecell-header sortDirectionIndicator"
|
||||
label="&tree.header.firstvisitdate.label;"
|
||||
observes="FirstVisitDate"/>
|
||||
<treecell class="treecell-header sortDirectionIndicator"
|
||||
label="&tree.header.hostname.label;"
|
||||
observes="Hostname"/>
|
||||
<treecell class="treecell-header sortDirectionIndicator"
|
||||
label="&tree.header.referrer.label;"
|
||||
observes="Referrer"/>
|
||||
<treecell class="treecell-header sortDirectionIndicator"
|
||||
label="&tree.header.visitcount.label;"
|
||||
observes="VisitCount"/>
|
||||
<treecell class="treecell-header" allowevents="true" id="popupCell">
|
||||
<menu class="treecell-popupcell-menu">
|
||||
<menupopup popupanchor="bottomright"
|
||||
popupalign="topright"
|
||||
oncreate="BuildTreePopup(document.getElementById('theColumns'), document.getElementById('headRow'), this,
|
||||
document.getElementById('popupCell'))"/>
|
||||
</menu>
|
||||
</treecell>
|
||||
</treerow>
|
||||
</treehead>
|
||||
|
||||
<template>
|
||||
<rule>
|
||||
<treechildren>
|
||||
<treeitem uri="rdf:*" class="bookmark-item"
|
||||
rdf:type="rdf:http://www.w3.org/1999/02/22-rdf-syntax-ns#type">
|
||||
<treerow>
|
||||
<treecell label="rdf:http://home.netscape.com/NC-rdf#Name"
|
||||
class="treecell-indent treecell-bookmark"/>
|
||||
<treecell label="rdf:http://home.netscape.com/NC-rdf#URL" />
|
||||
<treecell label="rdf:http://home.netscape.com/NC-rdf#Date" />
|
||||
<treecell label="rdf:http://home.netscape.com/NC-rdf#FirstVisitDate" />
|
||||
<treecell label="rdf:http://home.netscape.com/NC-rdf#Hostname" />
|
||||
<treecell label="rdf:http://home.netscape.com/NC-rdf#Referrer" />
|
||||
<treecell label="rdf:http://home.netscape.com/NC-rdf#VisitCount" />
|
||||
</treerow>
|
||||
</treeitem>
|
||||
</treechildren>
|
||||
</rule>
|
||||
</template>
|
||||
|
||||
<treechildren flex="1" id="treechildren-bookmarks"
|
||||
onclick="return OpenURL(event, event.target.parentNode.parentNode,
|
||||
'historyTree');"/>
|
||||
</tree>
|
||||
</outliner>
|
||||
</overlay>
|
||||
|
@ -13,6 +13,14 @@
|
||||
<!ENTITY findHisCmd.label "Search History...">
|
||||
<!ENTITY findHisCmd.commandkey "f">
|
||||
<!ENTITY findHisCmd.accesskey "s">
|
||||
<!ENTITY groupBy.label "Group By">
|
||||
<!ENTITY groupBy.accesskey "G">
|
||||
<!ENTITY groupByDay.label "Day">
|
||||
<!ENTITY groupByDay.accesskey "D">
|
||||
<!ENTITY groupBySite.label "Site">
|
||||
<!ENTITY groupBySite.accesskey "S">
|
||||
<!ENTITY groupByNone.label "None">
|
||||
<!ENTITY groupByNone.accesskey "N">
|
||||
<!ENTITY historyWindowTitle.label "History">
|
||||
<!ENTITY menuitem.view.unsorted.label "Unsorted">
|
||||
<!ENTITY menuitem.view.unsorted.accesskey "u">
|
||||
|
@ -1680,7 +1680,7 @@ nsGlobalHistory::Unassert(nsIRDFResource* aSource,
|
||||
{
|
||||
// translate into an appropriate removehistory call
|
||||
nsresult rv;
|
||||
if ((aSource == kNC_HistoryRoot || IsFindResource(aSource)) &&
|
||||
if ((aSource == kNC_HistoryRoot || aSource == kNC_HistoryByDate || IsFindResource(aSource)) &&
|
||||
aProperty == kNC_child) {
|
||||
|
||||
nsCOMPtr<nsIRDFResource> resource = do_QueryInterface(aTarget, &rv);
|
||||
|
@ -28,7 +28,9 @@ toolkit.jar:
|
||||
content/global/wizardOverlay.xul (resources/content/wizardOverlay.xul)
|
||||
content/global/treePopups.js (resources/content/treePopups.js)
|
||||
content/global/nsTreeController.js (resources/content/nsTreeController.js)
|
||||
content/global/nsOutlinerController.js (resources/content/nsOutlinerController.js)
|
||||
content/global/nsTreeUtils.js (resources/content/nsTreeUtils.js)
|
||||
content/global/nsOutlinerSorting.js (resources/content/nsOutlinerSorting.js)
|
||||
content/global/nsClipboard.js (resources/content/nsClipboard.js)
|
||||
content/global/nsDragAndDrop.js (resources/content/nsDragAndDrop.js)
|
||||
content/global/nsJSSupportsUtils.js (resources/content/nsJSSupportsUtils.js)
|
||||
@ -83,6 +85,8 @@ en-US.jar:
|
||||
locale/en-US/global/regionNames.properties (resources/locale/en-US/regionNames.properties)
|
||||
locale/en-US/global/about.html (resources/locale/en-US/about.html)
|
||||
locale/en-US/global/commonDialogs.properties (resources/locale/en-US/commonDialogs.properties)
|
||||
locale/en-US/global/nsOutlinerSorting.properties (resources/locale/en-US/nsOutlinerSorting.properties)
|
||||
locale/en-US/global/platformKeys.properties (resources/locale/en-US/platformKeys.properties)
|
||||
US.jar:
|
||||
locale/US/global-region/contents.rdf (resources/locale/en-US/contents-region.rdf)
|
||||
locale/US/global-region/region.dtd (resources/locale/en-US/region.dtd)
|
||||
|
@ -524,7 +524,7 @@
|
||||
</xul:box>
|
||||
</content>
|
||||
<handlers>
|
||||
<handler event="click" action="if (event.originalTarget == this) { this.parentNode.outlinerBoxObject.view.cycleHeader(this.id, this); }"/>
|
||||
<handler event="click" button="0" action="if (event.originalTarget == this) { this.parentNode.outlinerBoxObject.view.cycleHeader(this.id, this); }"/>
|
||||
</handlers>
|
||||
</binding>
|
||||
|
||||
@ -535,7 +535,7 @@
|
||||
</xul:box>
|
||||
</content>
|
||||
<handlers>
|
||||
<handler event="click" action="this.parentNode.outlinerBoxObject.view.cycleHeader(this.id, this)"/>
|
||||
<handler event="click" button="0" action="this.parentNode.outlinerBoxObject.view.cycleHeader(this.id, this)"/>
|
||||
</handlers>
|
||||
</binding>
|
||||
|
||||
|
@ -30,7 +30,6 @@
|
||||
/**
|
||||
* XXX - until load is supported in chrome, you also need to include
|
||||
* these files:
|
||||
* chrome://global/content/nsJSSupportsUtils.js
|
||||
* chrome://global/content/nsTransferable.js
|
||||
**/
|
||||
|
||||
@ -90,7 +89,9 @@ var nsDragAndDrop = {
|
||||
if (!transferData.data) return;
|
||||
transferData = transferData.data;
|
||||
|
||||
var transArray = nsJSSupportsUtils.createSupportsArray();
|
||||
var transArray = Components.classes["@mozilla.org/supports-array;1"]
|
||||
.createInstance(Components.interfaces.nsISupportsArray);
|
||||
|
||||
var count = 0;
|
||||
do
|
||||
{
|
||||
@ -190,7 +191,9 @@ var nsDragAndDrop = {
|
||||
**/
|
||||
getDragData: function (aFlavourSet)
|
||||
{
|
||||
var supportsArray = nsJSSupportsUtils.createSupportsArray();
|
||||
var supportsArray = Components.classes["@mozilla.org/supports-array;1"]
|
||||
.createInstance(Components.interfaces.nsISupportsArray);
|
||||
|
||||
for (var i = 0; i < nsDragAndDrop.mDragSession.numDropItems; ++i)
|
||||
{
|
||||
var trans = nsTransferable.createTransferable();
|
||||
|
@ -0,0 +1,292 @@
|
||||
/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape 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/NPL/
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Blake Ross <blakeross@telocity.com> (Original Author)
|
||||
*/
|
||||
|
||||
// helper routines, for doing rdf-based cut/copy/paste/etc
|
||||
// this needs to be more generic!
|
||||
|
||||
const nsTransferable_contractid = "@mozilla.org/widget/transferable;1";
|
||||
const clipboard_contractid = "@mozilla.org/widget/clipboard;1";
|
||||
const rdf_contractid = "@mozilla.org/rdf/rdf-service;1";
|
||||
const supportswstring_contractid = "@mozilla.org/supports-wstring;1";
|
||||
const rdfc_contractid = "@mozilla.org/rdf/container;1";
|
||||
|
||||
const nsISupportsWString = Components.interfaces.nsISupportsWString;
|
||||
const nsIClipboard = Components.interfaces.nsIClipboard;
|
||||
const nsITransferable = Components.interfaces.nsITransferable;
|
||||
const nsIRDFLiteral = Components.interfaces.nsIRDFLiteral;
|
||||
const nsIRDFContainer = Components.interfaces.nsIRDFContainer;
|
||||
|
||||
var gClipboard;
|
||||
var gOutliner;
|
||||
var gOutlinerBody;
|
||||
var gRDFC;
|
||||
var gRDF;
|
||||
|
||||
function isContainer(outliner, index)
|
||||
{
|
||||
return outliner.outlinerBoxObject.view.isContainer(index);
|
||||
}
|
||||
|
||||
function nsOutlinerController_SetTransferData(transferable, flavor, text)
|
||||
{
|
||||
if (!text)
|
||||
return;
|
||||
var textData = Components.classes[supportswstring_contractid].createInstance(nsISupportsWString);
|
||||
textData.data = text;
|
||||
|
||||
transferable.addDataFlavor(flavor);
|
||||
transferable.setTransferData(flavor, textData, text.length*2);
|
||||
}
|
||||
|
||||
function nsOutlinerController_copy()
|
||||
{
|
||||
var rangeCount = this.getOutlinerSelection().getRangeCount();
|
||||
if (rangeCount < 1)
|
||||
return false;
|
||||
|
||||
// Build a url that encodes all the select nodes
|
||||
// as well as their parent nodes
|
||||
var url = "";
|
||||
var text = "";
|
||||
var html = "";
|
||||
var min = new Object();
|
||||
var max = new Object();
|
||||
|
||||
for (var i = 0; i < rangeCount; ++i) {
|
||||
this.getOutlinerSelection().getRangeAt(i, min, max);
|
||||
for (var k = min.value; k <= max.value; ++k) {
|
||||
// If one of the selected items is
|
||||
// a container, ignore it.
|
||||
if (isContainer(this.getOutliner(), k))
|
||||
continue;
|
||||
var pageUrl = this.getOutlinerView().getCellText(k, "URL");
|
||||
var pageName = this.getOutlinerView().getCellText(k, "Name");
|
||||
|
||||
url += "ID:{" + pageUrl + "};";
|
||||
url += "NAME:{" + pageName + "};";
|
||||
|
||||
text += pageUrl + "\r";
|
||||
html += "<a href='" + pageUrl + "'>";
|
||||
if (pageName) html += pageName;
|
||||
html += "</a><p>";
|
||||
}
|
||||
}
|
||||
|
||||
if (!url)
|
||||
return false;
|
||||
|
||||
// get some useful components
|
||||
var trans = Components.classes[nsTransferable_contractid].createInstance(nsITransferable);
|
||||
|
||||
if (!gClipboard)
|
||||
gClipboard = Components.classes[clipboard_contractid].getService(Components.interfaces.nsIClipboard);
|
||||
|
||||
gClipboard.emptyClipboard(nsIClipboard.kGlobalClipboard);
|
||||
|
||||
this.SetTransferData(trans, "text/unicode", text);
|
||||
this.SetTransferData(trans, "moz/bookmarkclipboarditem", url);
|
||||
this.SetTransferData(trans, "text/html", html);
|
||||
|
||||
gClipboard.setData(trans, null, nsIClipboard.kGlobalClipboard);
|
||||
return true;
|
||||
}
|
||||
|
||||
function nsOutlinerController_cut()
|
||||
{
|
||||
if (this.copy()) {
|
||||
this.doDelete();
|
||||
return true; // copy succeeded, don't care if delete failed
|
||||
}
|
||||
return false; // copy failed, so did cut
|
||||
}
|
||||
|
||||
function nsOutlinerController_selectAll()
|
||||
{
|
||||
this.getOutlinerSelection().selectAll();
|
||||
}
|
||||
|
||||
function nsOutlinerController_delete()
|
||||
{
|
||||
var rangeCount = this.getOutlinerSelection().getRangeCount();
|
||||
if (rangeCount < 1)
|
||||
return false;
|
||||
|
||||
if (!gRDFC)
|
||||
gRDFC = Components.classes[rdfc_contractid].getService(nsIRDFContainer);
|
||||
|
||||
var datasource = this.getOutlinerBody().database;
|
||||
var min = new Object();
|
||||
var max = new Object();
|
||||
var dirty = false;
|
||||
|
||||
for (var i = 0; i < rangeCount; ++i) {
|
||||
this.getOutlinerSelection().getRangeAt(i, min, max);
|
||||
for (var k = max.value; k >= min.value; --k) {
|
||||
var url = this.getOutlinerView().getCellText(k, "URL");
|
||||
if (!url)
|
||||
continue;
|
||||
|
||||
if (!gRDF)
|
||||
gRDF = Components.classes[rdf_contractid].getService(Components.interfaces.nsIRDFService);
|
||||
|
||||
var IDRes = gRDF.GetResource(url);
|
||||
if (!IDRes)
|
||||
continue;
|
||||
|
||||
var root = this.getOutlinerBody().getAttribute('ref');
|
||||
var parentIDRes = gRDF.GetResource(root);
|
||||
if (!parentIDRes)
|
||||
continue;
|
||||
|
||||
// XXX - This should not be necessary
|
||||
// Why doesn't the unassertion fan out to all of the datasources in
|
||||
// the nsIRDFCompositeDataSource so they can handle it?
|
||||
var dsEnum = datasource.GetDataSources();
|
||||
while (dsEnum.hasMoreElements()) {
|
||||
var ds = dsEnum.getNext().QueryInterface(Components.interfaces.nsIRDFDataSource);
|
||||
|
||||
try {
|
||||
// try a container-based approach
|
||||
gRDFC.Init(ds, parentIDRes);
|
||||
gRDFC.RemoveElement(IDRes, true);
|
||||
} catch (ex) {
|
||||
// otherwise remove the parent/child assertion then
|
||||
var containment = gRDF.GetResource("http://home.netscape.com/NC-rdf#child");
|
||||
ds.Unassert(parentIDRes, containment, IDRes);
|
||||
}
|
||||
dirty = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (dirty) {
|
||||
try {
|
||||
var remote = datasource.QueryInterface(Components.interfaces.nsIRDFRemoteDataSource);
|
||||
remote.Flush();
|
||||
} catch (ex) {
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
function nsOutlinerController(outliner, outlinerBody)
|
||||
{
|
||||
this.outlinerId = outliner.id;
|
||||
this.outlinerBodyId = outlinerBody.id;
|
||||
outliner.controllers.appendController(this);
|
||||
}
|
||||
|
||||
nsOutlinerController.prototype =
|
||||
{
|
||||
// store the outliner's ID, rather than the outliner,
|
||||
// to avoid holding a strong ref
|
||||
outlinerId: null,
|
||||
outlinerBodyId: null,
|
||||
getOutliner : function()
|
||||
{
|
||||
if (!gOutliner)
|
||||
gOutliner = document.getElementById(this.outlinerId);
|
||||
return gOutliner;
|
||||
},
|
||||
getOutlinerBoxObject : function()
|
||||
{
|
||||
return this.getOutliner().outlinerBoxObject;
|
||||
},
|
||||
getOutlinerView : function()
|
||||
{
|
||||
return this.getOutliner().outlinerBoxObject.view;
|
||||
},
|
||||
getOutlinerSelection : function()
|
||||
{
|
||||
return this.getOutliner().outlinerBoxObject.view.selection;
|
||||
},
|
||||
getOutlinerBody : function()
|
||||
{
|
||||
if (!gOutlinerBody)
|
||||
gOutlinerBody = document.getElementById(this.outlinerBodyId);
|
||||
return gOutlinerBody;
|
||||
},
|
||||
SetTransferData : nsOutlinerController_SetTransferData,
|
||||
|
||||
supportsCommand: function(command)
|
||||
{
|
||||
switch(command)
|
||||
{
|
||||
case "cmd_cut":
|
||||
case "cmd_copy":
|
||||
case "cmd_delete":
|
||||
case "cmd_selectAll":
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
},
|
||||
|
||||
isCommandEnabled: function(command)
|
||||
{
|
||||
var haveCommand;
|
||||
switch (command)
|
||||
{
|
||||
// commands which do not require selection
|
||||
case "cmd_selectAll":
|
||||
var outlinerView = this.getOutlinerView();
|
||||
return (outlinerView.rowCount != outlinerView.selection.count);
|
||||
|
||||
// these commands require selection
|
||||
case "cmd_cut":
|
||||
haveCommand = (this.cut != undefined);
|
||||
break;
|
||||
case "cmd_copy":
|
||||
haveCommand = (this.copy != undefined);
|
||||
break;
|
||||
case "cmd_delete":
|
||||
haveCommand = (this.doDelete != undefined);
|
||||
break;
|
||||
}
|
||||
|
||||
// if we get here, then we have a command that requires selection
|
||||
var haveSelection = (this.getOutlinerSelection().count);
|
||||
return (haveCommand && haveSelection);
|
||||
},
|
||||
|
||||
doCommand: function(command)
|
||||
{
|
||||
switch(command)
|
||||
{
|
||||
case "cmd_cut":
|
||||
return this.cut();
|
||||
case "cmd_copy":
|
||||
return this.copy();
|
||||
case "cmd_delete":
|
||||
return this.doDelete();
|
||||
case "cmd_selectAll":
|
||||
return this.selectAll();
|
||||
}
|
||||
return false;
|
||||
},
|
||||
copy: nsOutlinerController_copy,
|
||||
cut: nsOutlinerController_cut,
|
||||
doDelete: nsOutlinerController_delete,
|
||||
selectAll: nsOutlinerController_selectAll
|
||||
}
|
||||
|
182
xpfe/global/resources/content/nsOutlinerSorting.js
Normal file
@ -0,0 +1,182 @@
|
||||
/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape 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/NPL/
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Peter Annema <disttsc@bart.nl>
|
||||
* Blake Ross <blakeross@telocity.com>
|
||||
* Alec Flett <alecf@netscape.com>
|
||||
*/
|
||||
|
||||
|
||||
// utility routines for sorting
|
||||
|
||||
// re-does a sort based on the current state
|
||||
function RefreshSort()
|
||||
{
|
||||
var current_column = find_sort_column();
|
||||
SortColumn(current_column.id);
|
||||
}
|
||||
|
||||
// set the sort direction on the currently sorted column
|
||||
function SortInNewDirection(direction)
|
||||
{
|
||||
var current_column = find_sort_column();
|
||||
if (direction == "ascending")
|
||||
direction = "natural";
|
||||
else if (direction == "descending")
|
||||
direction = "ascending";
|
||||
else if (direction == "natural")
|
||||
direction = "descending";
|
||||
current_column.setAttribute("sortDirection", direction);
|
||||
SortColumn(current_column.id);
|
||||
}
|
||||
|
||||
function SortColumn(columnID)
|
||||
{
|
||||
var column = document.getElementById(columnID);
|
||||
column.parentNode.outlinerBoxObject.view.cycleHeader(columnID, column);
|
||||
}
|
||||
|
||||
// search over the columns to find the first one with an active sort
|
||||
function find_sort_column()
|
||||
{
|
||||
var columns = document.getElementsByTagName('outlinercol');
|
||||
for (var i = 0; i < columns.length; ++i) {
|
||||
if (columns[i].getAttribute('sortDirection'))
|
||||
return columns[i];
|
||||
}
|
||||
return columns[0];
|
||||
}
|
||||
|
||||
// get the sort direction for the given column
|
||||
function find_sort_direction(column)
|
||||
{
|
||||
var sortDirection = column.getAttribute('sortDirection');
|
||||
return (sortDirection ? sortDirection : "natural");
|
||||
}
|
||||
|
||||
// set up the menu items to reflect the specified sort column
|
||||
// and direction - put check marks next to the active ones, and clear
|
||||
// out the old ones
|
||||
// - disable ascending/descending direction if the tree isn't sorted
|
||||
// - disable columns that are not visible
|
||||
function update_sort_menuitems(column, direction)
|
||||
{
|
||||
var unsorted_menuitem = document.getElementById("unsorted_menuitem");
|
||||
var sort_ascending = document.getElementById('sort_ascending');
|
||||
var sort_descending = document.getElementById('sort_descending');
|
||||
|
||||
// as this function may be called from various places, including the
|
||||
// bookmarks sidebar panel (which doesn't have any menu items)
|
||||
// ensure that the document contains the elements
|
||||
if ((!unsorted_menuitem) || (!sort_ascending) || (!sort_descending))
|
||||
return;
|
||||
|
||||
if (direction == "natural") {
|
||||
unsorted_menuitem.setAttribute('checked','true');
|
||||
sort_ascending.setAttribute('disabled','true');
|
||||
sort_descending.setAttribute('disabled','true');
|
||||
sort_ascending.removeAttribute('checked');
|
||||
sort_descending.removeAttribute('checked');
|
||||
} else {
|
||||
sort_ascending.removeAttribute('disabled');
|
||||
sort_descending.removeAttribute('disabled');
|
||||
if (direction == "ascending") {
|
||||
sort_ascending.setAttribute('checked','true');
|
||||
} else {
|
||||
sort_descending.setAttribute('checked','true');
|
||||
}
|
||||
|
||||
var columns = document.getElementsByTagName('outlinercol');
|
||||
var i = 0;
|
||||
var column_node = columns[i];
|
||||
var column_name = column.id;
|
||||
var menuitem = document.getElementById('fill_after_this_node');
|
||||
menuitem = menuitem.nextSibling
|
||||
while (1) {
|
||||
var name = menuitem.getAttribute('column_id');
|
||||
if (!name) break;
|
||||
if (column_name == name) {
|
||||
menuitem.setAttribute('checked', 'true');
|
||||
break;
|
||||
}
|
||||
menuitem = menuitem.nextSibling;
|
||||
column_node = columns[++i];
|
||||
if (column_node && column_node.tagName == "splitter") {
|
||||
column_node = columns[++i];
|
||||
}
|
||||
}
|
||||
}
|
||||
enable_sort_menuitems();
|
||||
}
|
||||
|
||||
function enable_sort_menuitems()
|
||||
{
|
||||
var columns = document.getElementsByTagName('outlinercol');
|
||||
var i = 0;
|
||||
var column_node = columns[i];
|
||||
var menuitem = document.getElementById('fill_after_this_node');
|
||||
menuitem = menuitem.nextSibling
|
||||
while (column_node && menuitem) {
|
||||
if (column_node.getAttribute("hidden") == "true")
|
||||
menuitem.setAttribute("disabled", "true");
|
||||
else
|
||||
menuitem.removeAttribute("disabled");
|
||||
menuitem = menuitem.nextSibling;
|
||||
column_node = columns[++i];
|
||||
}
|
||||
}
|
||||
|
||||
function fillViewMenu(popup)
|
||||
{
|
||||
var fill_after = document.getElementById('fill_after_this_node');
|
||||
var fill_before = document.getElementById('fill_before_this_node');
|
||||
var columns = document.getElementsByTagName('outlinercol');
|
||||
var strBundle = document.getElementById('sortBundle');
|
||||
var sortString;
|
||||
if (strBundle)
|
||||
sortString = strBundle.getString('SortMenuItems');
|
||||
if (!sortString)
|
||||
sortString = "Sorted by %COLNAME%";
|
||||
|
||||
var i = 0;
|
||||
var column = columns[i];
|
||||
var popupChild = popup.firstChild.nextSibling.nextSibling;
|
||||
var firstTime = (fill_after.nextSibling == fill_before);
|
||||
while (column) {
|
||||
if (firstTime) {
|
||||
// Construct an entry for each cell in the row.
|
||||
var column_name = column.getAttribute("label");
|
||||
var item = document.createElement("menuitem");
|
||||
item.setAttribute("type", "radio");
|
||||
item.setAttribute("name", "sort_column");
|
||||
if (column_name == "")
|
||||
column_name = column.getAttribute("display");
|
||||
var name = sortString.replace(/%COLNAME%/g, column_name);
|
||||
item.setAttribute("label", name);
|
||||
item.setAttribute("oncommand", "SortColumn('" + column.id + "');");
|
||||
item.setAttribute("column_id", column.id);
|
||||
popup.insertBefore(item, fill_before);
|
||||
}
|
||||
column = columns[++i];
|
||||
}
|
||||
var sort_column = find_sort_column();
|
||||
var sort_direction = find_sort_direction(sort_column);
|
||||
update_sort_menuitems(sort_column, sort_direction);
|
||||
}
|
@ -55,7 +55,9 @@ var nsTransferable = {
|
||||
var length = 0;
|
||||
if (currData.flavour.dataIIDKey == "nsISupportsWString")
|
||||
{
|
||||
supports = nsJSSupportsUtils.createSupportsWString();
|
||||
supports = Components.classes["@mozilla.org/supports-wstring;1"]
|
||||
.createInstance(Components.interfaces.nsISupportsWString);
|
||||
|
||||
supports.data = currData.supports;
|
||||
length = supports.data.length;
|
||||
}
|
||||
|
182
xpfe/global/resources/content/nsTreeSorting.js
Normal file
@ -0,0 +1,182 @@
|
||||
/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* The contents of this file are subject to the Netscape 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/NPL/
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Netscape
|
||||
* Communications Corporation. Portions created by Netscape are
|
||||
* Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
* Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Peter Annema <disttsc@bart.nl>
|
||||
* Blake Ross <blakeross@telocity.com>
|
||||
* Alec Flett <alecf@netscape.com>
|
||||
*/
|
||||
|
||||
|
||||
// utility routines for sorting
|
||||
|
||||
// re-does a sort based on the current state
|
||||
function RefreshSort()
|
||||
{
|
||||
var current_column = find_sort_column();
|
||||
SortColumn(current_column.id);
|
||||
}
|
||||
|
||||
// set the sort direction on the currently sorted column
|
||||
function SortInNewDirection(direction)
|
||||
{
|
||||
var current_column = find_sort_column();
|
||||
if (direction == "ascending")
|
||||
direction = "natural";
|
||||
else if (direction == "descending")
|
||||
direction = "ascending";
|
||||
else if (direction == "natural")
|
||||
direction = "descending";
|
||||
current_column.setAttribute("sortDirection", direction);
|
||||
SortColumn(current_column.id);
|
||||
}
|
||||
|
||||
function SortColumn(columnID)
|
||||
{
|
||||
var column = document.getElementById(columnID);
|
||||
column.parentNode.outlinerBoxObject.view.cycleHeader(columnID, column);
|
||||
}
|
||||
|
||||
// search over the columns to find the first one with an active sort
|
||||
function find_sort_column()
|
||||
{
|
||||
var columns = document.getElementsByTagName('outlinercol');
|
||||
for (var i = 0; i < columns.length; ++i) {
|
||||
if (columns[i].getAttribute('sortDirection'))
|
||||
return columns[i];
|
||||
}
|
||||
return columns[0];
|
||||
}
|
||||
|
||||
// get the sort direction for the given column
|
||||
function find_sort_direction(column)
|
||||
{
|
||||
var sortDirection = column.getAttribute('sortDirection');
|
||||
return (sortDirection ? sortDirection : "natural");
|
||||
}
|
||||
|
||||
// set up the menu items to reflect the specified sort column
|
||||
// and direction - put check marks next to the active ones, and clear
|
||||
// out the old ones
|
||||
// - disable ascending/descending direction if the tree isn't sorted
|
||||
// - disable columns that are not visible
|
||||
function update_sort_menuitems(column, direction)
|
||||
{
|
||||
var unsorted_menuitem = document.getElementById("unsorted_menuitem");
|
||||
var sort_ascending = document.getElementById('sort_ascending');
|
||||
var sort_descending = document.getElementById('sort_descending');
|
||||
|
||||
// as this function may be called from various places, including the
|
||||
// bookmarks sidebar panel (which doesn't have any menu items)
|
||||
// ensure that the document contains the elements
|
||||
if ((!unsorted_menuitem) || (!sort_ascending) || (!sort_descending))
|
||||
return;
|
||||
|
||||
if (direction == "natural") {
|
||||
unsorted_menuitem.setAttribute('checked','true');
|
||||
sort_ascending.setAttribute('disabled','true');
|
||||
sort_descending.setAttribute('disabled','true');
|
||||
sort_ascending.removeAttribute('checked');
|
||||
sort_descending.removeAttribute('checked');
|
||||
} else {
|
||||
sort_ascending.removeAttribute('disabled');
|
||||
sort_descending.removeAttribute('disabled');
|
||||
if (direction == "ascending") {
|
||||
sort_ascending.setAttribute('checked','true');
|
||||
} else {
|
||||
sort_descending.setAttribute('checked','true');
|
||||
}
|
||||
|
||||
var columns = document.getElementsByTagName('outlinercol');
|
||||
var i = 0;
|
||||
var column_node = columns[i];
|
||||
var column_name = column.id;
|
||||
var menuitem = document.getElementById('fill_after_this_node');
|
||||
menuitem = menuitem.nextSibling
|
||||
while (1) {
|
||||
var name = menuitem.getAttribute('column_id');
|
||||
if (!name) break;
|
||||
if (column_name == name) {
|
||||
menuitem.setAttribute('checked', 'true');
|
||||
break;
|
||||
}
|
||||
menuitem = menuitem.nextSibling;
|
||||
column_node = columns[++i];
|
||||
if (column_node && column_node.tagName == "splitter") {
|
||||
column_node = columns[++i];
|
||||
}
|
||||
}
|
||||
}
|
||||
enable_sort_menuitems();
|
||||
}
|
||||
|
||||
function enable_sort_menuitems()
|
||||
{
|
||||
var columns = document.getElementsByTagName('outlinercol');
|
||||
var i = 0;
|
||||
var column_node = columns[i];
|
||||
var menuitem = document.getElementById('fill_after_this_node');
|
||||
menuitem = menuitem.nextSibling
|
||||
while (column_node && menuitem) {
|
||||
if (column_node.getAttribute("hidden") == "true")
|
||||
menuitem.setAttribute("disabled", "true");
|
||||
else
|
||||
menuitem.removeAttribute("disabled");
|
||||
menuitem = menuitem.nextSibling;
|
||||
column_node = columns[++i];
|
||||
}
|
||||
}
|
||||
|
||||
function fillViewMenu(popup)
|
||||
{
|
||||
var fill_after = document.getElementById('fill_after_this_node');
|
||||
var fill_before = document.getElementById('fill_before_this_node');
|
||||
var columns = document.getElementsByTagName('outlinercol');
|
||||
var strBundle = document.getElementById('sortBundle');
|
||||
var sortString;
|
||||
if (strBundle)
|
||||
sortString = strBundle.getString('SortMenuItems');
|
||||
if (!sortString)
|
||||
sortString = "Sorted by %COLNAME%";
|
||||
|
||||
var i = 0;
|
||||
var column = columns[i];
|
||||
var popupChild = popup.firstChild.nextSibling.nextSibling;
|
||||
var firstTime = (fill_after.nextSibling == fill_before);
|
||||
while (column) {
|
||||
if (firstTime) {
|
||||
// Construct an entry for each cell in the row.
|
||||
var column_name = column.getAttribute("label");
|
||||
var item = document.createElement("menuitem");
|
||||
item.setAttribute("type", "radio");
|
||||
item.setAttribute("name", "sort_column");
|
||||
if (column_name == "")
|
||||
column_name = column.getAttribute("display");
|
||||
var name = sortString.replace(/%COLNAME%/g, column_name);
|
||||
item.setAttribute("label", name);
|
||||
item.setAttribute("oncommand", "SortColumn('" + column.id + "');");
|
||||
item.setAttribute("column_id", column.id);
|
||||
popup.insertBefore(item, fill_before);
|
||||
}
|
||||
column = columns[++i];
|
||||
}
|
||||
var sort_column = find_sort_column();
|
||||
var sort_direction = find_sort_direction(sort_column);
|
||||
update_sort_menuitems(sort_column, sort_direction);
|
||||
}
|
@ -0,0 +1 @@
|
||||
SortMenuItems=Sorted by %COLNAME%
|
@ -0,0 +1 @@
|
||||
SortMenuItems=Sorted by %COLNAME%
|