fix for 64218 - implement history sidebar panel

a=ben@netscape.com
This commit is contained in:
alecf%netscape.com 2001-01-17 06:06:50 +00:00
parent 74fe5e6f9f
commit e839941b69
10 changed files with 225 additions and 153 deletions

View File

@ -0,0 +1,39 @@
<?xml version="1.0"?> <!-- -*- Mode: xml; indent-tabs-mode: nil; -*- -->
<!--
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):
-->
<?xml-stylesheet href="chrome://communicator/skin/" type="text/css"?>
<?xul-overlay href="chrome://communicator/content/history/historyTreeOverlay.xul"?>
<?xul-overlay href="chrome://communicator/content/utilityOverlay.xul"?>
<!DOCTYPE window SYSTEM "chrome://communicator/locale/history/history.dtd" >
<window id="history-panel"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
>
<script src="chrome://communicator/content/history/history.js"/>
<tree id="historyTree"/>
</window>

View File

@ -24,7 +24,7 @@
// The history window uses JavaScript in bookmarks.js too.
function HistoryInit() {
var tree = document.getElementById("bookmarksTree");
var tree = document.getElementById("historyTree");
var historyController = new nsTreeController(tree);
var children = document.getElementById('treechildren-bookmarks');

View File

@ -1,4 +1,4 @@
<?xml version="1.0"?> <!-- -*- Mode: HTML; indent-tabs-mode: nil; -*- -->
<?xml version="1.0"?> <!-- -*- Mode: xml; indent-tabs-mode: nil; -*- -->
<!--
The contents of this file are subject to the Netscape Public
@ -25,6 +25,8 @@
<?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"?>
<?xul-overlay href="chrome://communicator/content/utilityOverlay.xul"?>
<?xul-overlay href="chrome://communicator/content/tasksOverlay.xul"?>
@ -33,26 +35,16 @@
<!DOCTYPE window SYSTEM "chrome://communicator/locale/history/history.dtd" >
<window title="&historyWindowTitle.label;" id="bookmark-window"
onload="HistoryInit();"
xmlns:html="http://www.w3.org/1999/xhtml"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:web="http://home.netscape.com/WEB-rdf#"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
width="500" height="400"
persist="width height screenX screenY sizemode"
orient="vertical"
windowtype="history:manager">
onload="HistoryInit();"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
width="500" height="400"
persist="width height screenX screenY sizemode"
orient="vertical"
windowtype="history:manager">
<script src="chrome://communicator/content/history/history.js"/>
<script src="chrome://global/content/nsTreeController.js"/>
<script src="chrome://global/content/nsTreeUtils.js"/>
<script src="chrome://global/content/treePopups.js"/>
<script src="chrome://global/content/strres.js"/>
<script src="chrome://global/content/globalOverlay.js"/>
<script src="chrome://global/content/nsJSComponentManager.js"/>
<script src="chrome://global/content/nsDragAndDrop.js"/>
<script src="chrome://global/content/nsTransferable.js"/>
<script src="chrome://global/content/nsJSSupportsUtils.js"/>
<commands id="commands">
<commandset id="selectEditMenuItems"/>
@ -68,6 +60,7 @@
<broadcaster id="bm_cmd_saveas"/>
<!-- Edit Menu -->
<broadcaster id="cmd_undo"/>
<broadcaster id="cmd_cut"/>
<broadcaster id="cmd_copy"/>
<broadcaster id="cmd_delete"/>
<broadcaster id="cmd_selectAll"/>
@ -82,7 +75,6 @@
<key id="key_undo"/>
<key id="key_cut"/>
<key id="key_copy"/>
<key id="key_paste"/>
<key id="key_delete"/>
<key id="key_selectAll"/>
</keyset>
@ -106,9 +98,8 @@
<menupopup>
<menuitem id="menu_undo" disabled="true" />
<menuseparator/>
<menuitem id="menu_cut" disabled="true"/>
<menuitem id="menu_cut"/>
<menuitem id="menu_copy"/>
<menuitem id="menu_paste" disabled="true"/>
<menuitem id="menu_delete"/>
<menuseparator/>
<menuitem id="menu_selectAll"/>
@ -148,125 +139,12 @@
</toolbox>
<popupset>
<popup id="contextual" oncreate="return fillContextMenu('contextual');" >
<popup id="contextual" oncreate="return fillContextMenu('contextual', 'historyTree');" >
<menu />
</popup>
</popupset>
<tree id="bookmarksTree" ref="NC:HistoryRoot" context="contextual"
datasources="rdf:history rdf:localsearch"
flex="1"
multiple="true"
ondraggesture="dump('*** starting drag\n'); nsDragAndDrop.startDrag(event, historyDNDObserver);">
<template>
<rule>
<treechildren>
<treeitem uri="rdf:*" persist="open"
web:status="rdf:http://home.netscape.com/WEB-rdf#status"
rdf:type="rdf:http://www.w3.org/1999/02/22-rdf-syntax-ns#type"
loading="rdf:http://home.netscape.com/NC-rdf#loading">
<treerow>
<treecell value="rdf:http://home.netscape.com/NC-rdf#Name"
class="treecell-indent treecell-bookmark"/>
<treecell value="rdf:http://home.netscape.com/NC-rdf#URL" />
<treecell value="rdf:http://home.netscape.com/NC-rdf#Date" />
<treecell value="rdf:http://home.netscape.com/NC-rdf#FirstVisitDate" />
<treecell value="rdf:http://home.netscape.com/NC-rdf#Referrer" />
<treecell value="rdf:http://home.netscape.com/NC-rdf#VisitCount" />
</treerow>
</treeitem>
</treechildren>
</rule>
</template>
<treecolgroup id="theColumns">
<treecol flex="4" id="Name"
sortSeparators="true" persist="hidden width"
resource="http://home.netscape.com/NC-rdf#Name"/>
<splitter class="tree-splitter"/>
<treecol flex="4" id="URL"
sortSeparators="true" persist="hidden width"
resource="http://home.netscape.com/NC-rdf#URL"
resource2="http://home.netscape.com/NC-rdf#Name"/>
<splitter class="tree-splitter"/>
<treecol flex="1" id="Date"
sortSeparators="true" persist="hidden width"
resource="http://home.netscape.com/NC-rdf#Date"
resource2="http://home.netscape.com/NC-rdf#Name"/>
<splitter class="tree-splitter"/>
<treecol flex="1" id="FirstVisitDate"
sortSeparators="true" persist="hidden width"
resource="http://home.netscape.com/NC-rdf#FirstVisitDate"
resource2="http://home.netscape.com/NC-rdf#Name"/>
<splitter class="tree-splitter"/>
<treecol flex="1" id="Referrer"
sortSeparators="true" persist="hidden width"
resource="http://home.netscape.com/NC-rdf#Referrer"
resource2="http://home.netscape.com/NC-rdf#Name"/>
<splitter class="tree-splitter"/>
<treecol flex="1" id="VisitCount"
sortSeparators="true" persist="hidden width"
resource="http://home.netscape.com/NC-rdf#VisitCount"
resource2="http://home.netscape.com/NC-rdf#Name"/>
<splitter class="tree-splitter"/>
<treecol persist="width" fixed="true" width="14" id="PopupColumn"/>
</treecolgroup>
<treehead>
<treerow id="headRow">
<treecell class="treecell-header sortDirectionIndicator"
value="&tree.header.name.label;"
onclick="return TriStateColumnSort('Name');"
observes="Name" />
<treecell class="treecell-header sortDirectionIndicator"
value="&tree.header.url.label;"
onclick="return TriStateColumnSort('URL');"
observes="URL" />
<treecell class="treecell-header sortDirectionIndicator"
value="&tree.header.date.label;"
onclick="return TriStateColumnSort('Date');"
observes="Date"/>
<treecell class="treecell-header sortDirectionIndicator"
value="&tree.header.firstvisitdate.label;"
onclick="return TriStateColumnSort('FirstVisitDate');"
observes="FirstVisitDate"/>
<treecell class="treecell-header sortDirectionIndicator"
value="&tree.header.referrer.label;"
onclick="return TriStateColumnSort('Referrer');"
observes="Referrer"/>
<treecell class="treecell-header sortDirectionIndicator"
value="&tree.header.visitcount.label;"
onclick="return TriStateColumnSort('VisitCount');"
observes="VisitCount"/>
<treecell class="treecell-header" allowevents="true" id="popupCell">
<menu>
<image class="treecell-popup-icon"/>
<menupopup popupanchor="bottomright"
popupalign="topright"
oncreate="BuildTreePopup(document.getElementById('theColumns'), document.getElementById('headRow'), this,
document.getElementById('popupCell'))"/>
</menu>
</treecell>
</treerow>
</treehead>
<treechildren flex="1" id="treechildren-bookmarks"
onclick="return OpenURL(event, event.target.parentNode.parentNode,
'bookmarksTree');"/>
</tree>
<tree id="historyTree"/>
<statusbar id="status-bar">
<statusbarpanel class="statusbarpanel-icononly" id="offline-status"/>
<statusbarpanel id="statusbar-display" crop="right" flex="1"/>

View File

@ -0,0 +1,155 @@
<?xml version="1.0"?>
<!--
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):
Ben Goodger <ben@netscape.com>
Blake Ross <BlakeR1234@aol.com>
Alec Flett <alecf@netscape.com>
-->
<!DOCTYPE overlay SYSTEM "chrome://communicator/locale/history/historyTreeOverlay.dtd" >
<overlay id="historyTreeOverlay"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:web="http://home.netscape.com/WEB-rdf#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
<script src="chrome://global/content/nsDragAndDrop.js"/>
<script src="chrome://global/content/nsTransferable.js"/>
<script src="chrome://global/content/nsJSComponentManager.js"/>
<script src="chrome://global/content/nsJSSupportsUtils.js"/>
<script src="chrome://global/content/nsTreeController.js"/>
<script src="chrome://global/content/nsTreeUtils.js"/>
<script src="chrome://global/content/treePopups.js"/>
<tree id="historyTree" ref="NC:HistoryRoot" context="contextual"
datasources="rdf:history rdf:localsearch"
flex="1"
multiple="true"
ondraggesture="nsDragAndDrop.startDrag(event, historyDNDObserver);">
<template>
<rule>
<treechildren>
<treeitem uri="rdf:*" persist="open"
web:status="rdf:http://home.netscape.com/WEB-rdf#status"
rdf:type="rdf:http://www.w3.org/1999/02/22-rdf-syntax-ns#type"
loading="rdf:http://home.netscape.com/NC-rdf#loading">
<treerow>
<treecell value="rdf:http://home.netscape.com/NC-rdf#Name"
class="treecell-indent treecell-bookmark"/>
<treecell value="rdf:http://home.netscape.com/NC-rdf#URL" />
<treecell value="rdf:http://home.netscape.com/NC-rdf#Date" />
<treecell value="rdf:http://home.netscape.com/NC-rdf#FirstVisitDate" />
<treecell value="rdf:http://home.netscape.com/NC-rdf#Referrer" />
<treecell value="rdf:http://home.netscape.com/NC-rdf#VisitCount" />
</treerow>
</treeitem>
</treechildren>
</rule>
</template>
<treecolgroup id="theColumns">
<treecol flex="4" id="Name"
sortSeparators="true" persist="hidden width"
resource="http://home.netscape.com/NC-rdf#Name"/>
<splitter class="tree-splitter"/>
<treecol flex="4" id="URL"
sortSeparators="true" persist="hidden width"
resource="http://home.netscape.com/NC-rdf#URL"
resource2="http://home.netscape.com/NC-rdf#Name"/>
<splitter class="tree-splitter"/>
<treecol flex="1" id="Date"
sortSeparators="true" persist="hidden width"
resource="http://home.netscape.com/NC-rdf#Date"
resource2="http://home.netscape.com/NC-rdf#Name"/>
<splitter class="tree-splitter"/>
<treecol flex="1" id="FirstVisitDate"
sortSeparators="true" persist="hidden width"
resource="http://home.netscape.com/NC-rdf#FirstVisitDate"
resource2="http://home.netscape.com/NC-rdf#Name"/>
<splitter class="tree-splitter"/>
<treecol flex="1" id="Referrer"
sortSeparators="true" persist="hidden width"
resource="http://home.netscape.com/NC-rdf#Referrer"
resource2="http://home.netscape.com/NC-rdf#Name"/>
<splitter class="tree-splitter"/>
<treecol flex="1" id="VisitCount"
sortSeparators="true" persist="hidden width"
resource="http://home.netscape.com/NC-rdf#VisitCount"
resource2="http://home.netscape.com/NC-rdf#Name"/>
<splitter class="tree-splitter"/>
<treecol persist="width" fixed="true" width="14" id="PopupColumn"/>
</treecolgroup>
<treehead>
<treerow id="headRow">
<treecell class="treecell-header sortDirectionIndicator"
value="&tree.header.name.label;"
onclick="return TriStateColumnSort('Name');"
observes="Name" />
<treecell class="treecell-header sortDirectionIndicator"
value="&tree.header.url.label;"
onclick="return TriStateColumnSort('URL');"
observes="URL" />
<treecell class="treecell-header sortDirectionIndicator"
value="&tree.header.date.label;"
onclick="return TriStateColumnSort('Date');"
observes="Date"/>
<treecell class="treecell-header sortDirectionIndicator"
value="&tree.header.firstvisitdate.label;"
onclick="return TriStateColumnSort('FirstVisitDate');"
observes="FirstVisitDate"/>
<treecell class="treecell-header sortDirectionIndicator"
value="&tree.header.referrer.label;"
onclick="return TriStateColumnSort('Referrer');"
observes="Referrer"/>
<treecell class="treecell-header sortDirectionIndicator"
value="&tree.header.visitcount.label;"
onclick="return TriStateColumnSort('VisitCount');"
observes="VisitCount"/>
<treecell class="treecell-header" allowevents="true" id="popupCell">
<menu>
<image class="treecell-popup-icon"/>
<menupopup popupanchor="bottomright"
popupalign="topright"
oncreate="BuildTreePopup(document.getElementById('theColumns'), document.getElementById('headRow'), this,
document.getElementById('popupCell'))"/>
</menu>
</treecell>
</treerow>
</treehead>
<treechildren flex="1" id="treechildren-bookmarks"
onclick="return OpenURL(event, event.target.parentNode.parentNode,
'historyTree');"/>
</tree>
</overlay>

View File

@ -14,12 +14,6 @@
<!ENTITY findHisCmd.label "Find in History...">
<!ENTITY findHisCmd.accesskey "f">
<!ENTITY historyWindowTitle.label "History">
<!ENTITY tree.header.name.label "Title">
<!ENTITY tree.header.url.label "URL">
<!ENTITY tree.header.date.label "Last Visited">
<!ENTITY tree.header.firstvisitdate.label "First Visited">
<!ENTITY tree.header.referrer.label "Referrer">
<!ENTITY tree.header.visitcount.label "Visit Count">
<!ENTITY menuitem.view.unsorted.label "Unsorted">
<!ENTITY menuitem.view.unsorted.accesskey "u">
<!ENTITY menuitem.view.ascending.label "A > Z Sort Order">

View File

@ -0,0 +1,6 @@
<!ENTITY tree.header.name.label "Title">
<!ENTITY tree.header.url.label "URL">
<!ENTITY tree.header.date.label "Last Visited">
<!ENTITY tree.header.firstvisitdate.label "First Visited">
<!ENTITY tree.header.referrer.label "Referrer">
<!ENTITY tree.header.visitcount.label "Visit Count">

View File

@ -11,6 +11,8 @@ comm.jar:
content/communicator/directory/directory.xul (directory/directory.xul)
content/communicator/directory/directory.js (directory/directory.js)
content/communicator/history/history.xul (history/resources/history.xul)
content/communicator/history/historyTreeOverlay.xul (history/resources/historyTreeOverlay.xul)
content/communicator/history/history-panel.xul (history/resources/history-panel.xul)
content/communicator/history/history.js (history/resources/history.js)
content/communicator/history/history-test.xul (history/resources/history-test.xul)
content/communicator/history/history-test.js (history/resources/history-test.js)
@ -101,6 +103,7 @@ en-US.jar:
locale/en-US/communicator/bookmarks/bookmark.properties (bookmarks/resources/locale/en-US/bookmark.properties)
locale/en-US/communicator/directory/directory.dtd (directory/locale/en-US/directory.dtd)
locale/en-US/communicator/history/history.dtd (history/resources/locale/en-US/history.dtd)
locale/en-US/communicator/history/historyTreeOverlay.dtd (history/resources/locale/en-US/historyTreeOverlay.dtd)
locale/en-US/communicator/pref/pref-advanced.dtd (prefwindow/resources/locale/en-US/pref-advanced.dtd)
locale/en-US/communicator/pref/pref-appearance.dtd (prefwindow/resources/locale/en-US/pref-appearance.dtd)
locale/en-US/communicator/pref/pref-applications.dtd (prefwindow/resources/locale/en-US/pref-applications.dtd)

View File

@ -46,4 +46,8 @@
<nc:title>&sidebar.bookmarks.label;</nc:title>
<nc:content>chrome://communicator/content/bookmarks/bm-panel.xul</nc:content>
</rdf:Description>
<rdf:Description about="urn:sidebar:panel:history">
<nc:title>&sidebar.history.label;</nc:title>
<nc:content>chrome://communicator/content/history/history-panel.xul</nc:content>
</rdf:Description>
</rdf:RDF>

View File

@ -26,3 +26,4 @@
<!-- LOCALIZATION NOTE sidebar.tinderbox.label: DONT_TRANSLATE -->
<!ENTITY sidebar.tinderbox.label "Tinderbox">
<!ENTITY sidebar.bookmarks.label "Bookmarks">
<!ENTITY sidebar.history.label "History">

View File

@ -29,7 +29,6 @@
function TriStateColumnSort(column_name)
{
debug("TriStateColumnSort("+column_name+")");
var current_column = find_sort_column();
var current_direction = find_sort_direction(current_column);
var column = document.getElementById(column_name);
@ -48,7 +47,6 @@ function TriStateColumnSort(column_name)
function SetSortDirection(direction)
{
debug("SetSortDirection("+direction+")");
var current_column = find_sort_column();
var current_direction = find_sort_direction(current_column);
if (current_direction != direction) {
@ -58,7 +56,6 @@ function SetSortDirection(direction)
function SetSortColumn(column_name)
{
debug("SetSortColumn("+column_name+")");
var current_column = find_sort_column();
var current_direction = find_sort_direction(current_column);
var column = document.getElementById(column_name);
@ -82,7 +79,7 @@ function sort_column(column, direction)
}
catch(ex)
{
debug("Exception calling xulSortService.Sort()");
dump("sort exception: " + ex + "\n");
}
update_sort_menuitems(column, direction);
return false;
@ -143,7 +140,6 @@ function update_sort_menuitems(column, direction)
menuitem = menuitem.nextSibling
while (1) {
var name = menuitem.getAttribute('column_id');
debug("update: "+name)
if (!name) break;
if (column_name == name) {
menuitem.setAttribute('checked', 'true');
@ -226,7 +222,7 @@ function fillViewMenu(popup)
update_sort_menuitems(sort_column, sort_direction);
}
function fillContextMenu(name)
function fillContextMenu(name, treeName)
{
if (!name) return false;
var popupNode = document.getElementById(name);
@ -238,7 +234,7 @@ function fillContextMenu(name)
popupNode.removeChild(popupNode.childNodes[0]);
}
var treeNode = document.getElementById("bookmarksTree");
var treeNode = document.getElementById(treeName);
if (!treeNode) return false;
var db = treeNode.database;
if (!db) return false;
@ -261,7 +257,6 @@ function fillContextMenu(name)
}
var select_list = treeNode.selectedItems;
debug("# of Nodes selected: " + treeNode.selectedItems.length + "\n");
var separatorResource =
rdf.GetResource(NC_NS + "BookmarkSeparator");
@ -376,9 +371,6 @@ function fillContextMenu(name)
var cmdName = cmdNameLiteral.Value;
if (!cmdName) break;
debug("Command #" + cmdIndex + ": id='" + cmdResource.Value +
"' name='" + cmdName + "'");
var newMenuItem = document.createElement("menuitem");
newMenuItem.setAttribute("value", cmdName);
popupNode.appendChild(newMenuItem);