mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 22:01:30 +00:00
Fix history window.
This commit is contained in:
parent
cf191de831
commit
fe7e7976fe
36
suite/common/history/history.js
Normal file
36
suite/common/history/history.js
Normal file
@ -0,0 +1,36 @@
|
||||
// -*- Mode: Java -*-
|
||||
|
||||
function doSort(sortColName)
|
||||
{
|
||||
var node = document.getElementById(sortColName);
|
||||
// determine column resource to sort on
|
||||
var sortResource = node.getAttribute('resource');
|
||||
if (!node) return(false);
|
||||
|
||||
var sortDirection="ascending";
|
||||
var isSortActive = node.getAttribute('sortActive');
|
||||
if (isSortActive == "true")
|
||||
{
|
||||
var currentDirection = node.getAttribute('sortDirection');
|
||||
if (currentDirection == "ascending")
|
||||
sortDirection = "descending";
|
||||
else if (currentDirection == "descending")
|
||||
sortDirection = "natural";
|
||||
else sortDirection = "ascending";
|
||||
}
|
||||
|
||||
// get RDF Core service
|
||||
var rdfCore = XPAppCoresManager.Find("RDFCore");
|
||||
if (!rdfCore)
|
||||
{
|
||||
rdfCore = new RDFCore();
|
||||
if (!rdfCore)
|
||||
{
|
||||
return(false);
|
||||
}
|
||||
rdfCore.Init("RDFCore");
|
||||
}
|
||||
// sort!!!
|
||||
rdfCore.doSort(node, sortResource, sortDirection);
|
||||
return(false);
|
||||
}
|
@ -40,93 +40,20 @@
|
||||
<!ENTITY historyBySite.label "History By Site">
|
||||
<!ENTITY historyByDate.label "History By Date">
|
||||
<!ENTITY historyWindowTitle.label "History">
|
||||
<!ENTITY name.column.label "Title">
|
||||
<!ENTITY url.column.label "URL">
|
||||
<!ENTITY lastvisited.column.label "Last Visited">
|
||||
]>
|
||||
|
||||
<window title="&historyWindowTitle.label;"
|
||||
xmlns:html="http://www.w3.org/TR/REC-html40"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
align="vertical"
|
||||
width="400"
|
||||
height="300">
|
||||
|
||||
<html:script>
|
||||
|
||||
function HistoryNewWindow()
|
||||
{
|
||||
var toolkitCore = XPAppCoresManager.Find("ToolkitCore");
|
||||
if (!toolkitCore) {
|
||||
toolkitCore = new ToolkitCore();
|
||||
if (toolkitCore) {
|
||||
toolkitCore.Init("ToolkitCore");
|
||||
}
|
||||
}
|
||||
if (toolkitCore) {
|
||||
toolkitCore.ShowWindow("resource:/res/rdf/history.xul",
|
||||
window);
|
||||
}
|
||||
}
|
||||
|
||||
function OpenURL(event,node)
|
||||
{
|
||||
|
||||
url = node.getAttribute('id');
|
||||
|
||||
// Ignore "NC:" urls.
|
||||
if (url.substring(0, 3) == "NC:") {
|
||||
return false;
|
||||
}
|
||||
|
||||
/*window.open(url,'bookmarks');*/
|
||||
var toolkitCore = XPAppCoresManager.Find("ToolkitCore");
|
||||
if (!toolkitCore) {
|
||||
toolkitCore = new ToolkitCore();
|
||||
if (toolkitCore) {
|
||||
toolkitCore.Init("ToolkitCore");
|
||||
}
|
||||
}
|
||||
if (toolkitCore) {
|
||||
toolkitCore.ShowWindow(url,window);
|
||||
}
|
||||
|
||||
dump("OpenURL(" + url + ")\n");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function doSort(sortColName)
|
||||
{
|
||||
var node = document.getElementById(sortColName);
|
||||
// determine column resource to sort on
|
||||
var sortResource = node.getAttribute('resource');
|
||||
if (!node) return(false);
|
||||
|
||||
var sortDirection="ascending";
|
||||
var isSortActive = node.getAttribute('sortActive');
|
||||
if (isSortActive == "true")
|
||||
{
|
||||
var currentDirection = node.getAttribute('sortDirection');
|
||||
if (currentDirection == "ascending")
|
||||
sortDirection = "descending";
|
||||
else if (currentDirection == "descending")
|
||||
sortDirection = "natural";
|
||||
else sortDirection = "ascending";
|
||||
}
|
||||
|
||||
// get RDF Core service
|
||||
var rdfCore = XPAppCoresManager.Find("RDFCore");
|
||||
if (!rdfCore)
|
||||
{
|
||||
rdfCore = new RDFCore();
|
||||
if (!rdfCore)
|
||||
{
|
||||
return(false);
|
||||
}
|
||||
rdfCore.Init("RDFCore");
|
||||
}
|
||||
// sort!!!
|
||||
rdfCore.doSort(node, sortResource, sortDirection);
|
||||
return(false);
|
||||
}
|
||||
|
||||
</html:script>
|
||||
<html:script src="history.js" />
|
||||
|
||||
<menubar>
|
||||
<menu value="&fileMenu.label;">
|
||||
@ -153,86 +80,56 @@ function doSort(sortColName)
|
||||
</menu>
|
||||
</menubar>
|
||||
|
||||
<tree rdf:datasources="rdf:history"
|
||||
ondblclick="return OpenURL(event,event.target.parentNode.parentNode);">
|
||||
<tree rdf:datasources="rdf:history rdf:find"
|
||||
ondblclick="OpenURL(event.target.parentNode.parentNode);"
|
||||
ref="NC:HistoryRoot"
|
||||
style="height:100%;">
|
||||
|
||||
<template>
|
||||
<rule rdf:type="http://home.netscape.com/NC-rdf#BookmarkSeparator">
|
||||
<treechildren>
|
||||
<treeitem uri="...">
|
||||
<treerow>
|
||||
<treecell>
|
||||
<html:hr width="75%" align="center" size="1" />
|
||||
</treecell>
|
||||
<treecell></treecell>
|
||||
<treecell></treecell>
|
||||
</treerow>
|
||||
</treeitem>
|
||||
</treechildren>
|
||||
</rule>
|
||||
|
||||
<rule>
|
||||
<treechildren>
|
||||
<treeitem uri="...">
|
||||
<treerow>
|
||||
<treecell>
|
||||
<treeindentation />
|
||||
<titledbutton value="rdf:http://home.netscape.com/NC-rdf#Name" align="right" />
|
||||
</treecell>
|
||||
|
||||
<treecell>
|
||||
<titledbutton value="rdf:http://home.netscape.com/NC-rdf#URL" align="right"
|
||||
<titledbutton value="rdf:http://home.netscape.com/NC-rdf#Name" align="left"
|
||||
style="list-style-image: none;" />
|
||||
</treecell>
|
||||
|
||||
<treecell>
|
||||
<titledbutton value="rdf:http://home.netscape.com/NC-rdf#ShortcutURL" align="right"
|
||||
<titledbutton value="rdf:http://home.netscape.com/NC-rdf#URL" align="left"
|
||||
style="list-style-image: none;" />
|
||||
</treecell>
|
||||
|
||||
<treecell>
|
||||
<titledbutton value="rdf:http://home.netscape.com/NC-rdf#Date" align="left"
|
||||
style="list-style-image: none;" />
|
||||
</treecell>
|
||||
</treerow>
|
||||
</treeitem>
|
||||
</treechildren>
|
||||
</rule>
|
||||
</template>
|
||||
|
||||
<treecol id="NameColumn" rdf:resource="http://home.netscape.com/NC-rdf#Name"/>
|
||||
<treecol id="URLColumn" rdf:resource="http://home.netscape.com/NC-rdf#URL"/>
|
||||
<treecol id="ShortcutURLColumn" rdf:resource="http://home.netscape.com/NC-rdf#ShortcutURL"/>
|
||||
<treecol id="DateColumn" rdf:resource="http://home.netscape.com/NC-rdf#Date"/>
|
||||
|
||||
<treehead>
|
||||
<treerow>
|
||||
<treecell onclick="return doSort('NameColumn');">
|
||||
<xul:observes element="NameColumn" attribute="sortActive"/>
|
||||
<xul:observes element="NameColumn" attribute="sortDirection"/>
|
||||
Name</treecell>
|
||||
&name.column.label;</treecell>
|
||||
<treecell onclick="return doSort('URLColumn');">
|
||||
<xul:observes element="URLColumn" attribute="sortActive"/>
|
||||
<xul:observes element="URLColumn" attribute="sortDirection"/>
|
||||
URL</treecell>
|
||||
<treecell onclick="return doSort('ShortcutURLColumn');">
|
||||
<xul:observes element="ShortcutURLColumn" attribute="sortActive"/>
|
||||
<xul:observes element="ShortcutURLColumn" attribute="sortDirection"/>
|
||||
Shortcut URL</treecell>
|
||||
&url.column.label;</treecell>
|
||||
<treecell onclick="return doSort('DateColumn');">
|
||||
<xul:observes element="DateColumn" attribute="sortActive"/>
|
||||
<xul:observes element="DateColumn" attribute="sortDirection"/>
|
||||
&lastvisited.column.label;</treecell>
|
||||
</treerow>
|
||||
</treehead>
|
||||
|
||||
<treechildren>
|
||||
<treeitem ref="NC:HistoryBySite" open="true">
|
||||
<treerow>
|
||||
<treecell>&historyBySite.label;</treecell>
|
||||
<treecell></treecell>
|
||||
<treecell></treecell>
|
||||
</treerow>
|
||||
</treeitem>
|
||||
|
||||
<treeitem ref="NC:HistoryByDate" open="true">
|
||||
<treerow>
|
||||
<treecell>&historyByDate.label;</treecell>
|
||||
<treecell></treecell>
|
||||
<treecell></treecell>
|
||||
</treerow>
|
||||
</treeitem>
|
||||
</treechildren>
|
||||
</tree>
|
||||
|
||||
<!-- TREECHILDREN are built *here* -->
|
||||
</tree>
|
||||
</window>
|
||||
|
@ -1,4 +1,5 @@
|
||||
history.xul
|
||||
history.css
|
||||
history.js
|
||||
history-test.xul
|
||||
history-test.js
|
||||
|
@ -27,6 +27,7 @@ include $(topsrcdir)/config/rules.mk
|
||||
FILES = \
|
||||
history.xul \
|
||||
history.css \
|
||||
history.js \
|
||||
history-test.xul \
|
||||
history-test.js \
|
||||
$(NULL)
|
||||
|
@ -32,17 +32,13 @@ treeitem[type="http://home.netscape.com/NC-rdf#Folder"][open="true"] > treerow >
|
||||
list-style-image: url("resource:/res/rdf/bookmark-folder-open.gif");
|
||||
}
|
||||
|
||||
treeitem[type="http://home.netscape.com/NC-rdf#Folder"][id="NC:PersonalToolbarFolder"] > treerow > treecell > titledbutton
|
||||
treeitem > treerow > treecell > titledbutton
|
||||
{
|
||||
list-style-image: url("resource:/res/rdf/personal-folder-closed.gif");
|
||||
}
|
||||
|
||||
treeitem[type="http://home.netscape.com/NC-rdf#Folder"][id="NC:PersonalToolbarFolder"][open="true"] > treerow > treecell > titledbutton
|
||||
{
|
||||
list-style-image: url("resource:/res/rdf/personal-folder-open.gif");
|
||||
}
|
||||
|
||||
treeitem[type="http://home.netscape.com/NC-rdf#Bookmark"] > treerow > treecell > titledbutton
|
||||
{
|
||||
list-style-image: url("resource:/res/rdf/bookmark-item.gif");
|
||||
height: 16px;
|
||||
width: 16px;
|
||||
color: inherit;
|
||||
border: none;
|
||||
padding: 0px;
|
||||
margin: 0px;
|
||||
font: inherit;
|
||||
}
|
||||
|
36
xpfe/components/history/resources/history.js
Normal file
36
xpfe/components/history/resources/history.js
Normal file
@ -0,0 +1,36 @@
|
||||
// -*- Mode: Java -*-
|
||||
|
||||
function doSort(sortColName)
|
||||
{
|
||||
var node = document.getElementById(sortColName);
|
||||
// determine column resource to sort on
|
||||
var sortResource = node.getAttribute('resource');
|
||||
if (!node) return(false);
|
||||
|
||||
var sortDirection="ascending";
|
||||
var isSortActive = node.getAttribute('sortActive');
|
||||
if (isSortActive == "true")
|
||||
{
|
||||
var currentDirection = node.getAttribute('sortDirection');
|
||||
if (currentDirection == "ascending")
|
||||
sortDirection = "descending";
|
||||
else if (currentDirection == "descending")
|
||||
sortDirection = "natural";
|
||||
else sortDirection = "ascending";
|
||||
}
|
||||
|
||||
// get RDF Core service
|
||||
var rdfCore = XPAppCoresManager.Find("RDFCore");
|
||||
if (!rdfCore)
|
||||
{
|
||||
rdfCore = new RDFCore();
|
||||
if (!rdfCore)
|
||||
{
|
||||
return(false);
|
||||
}
|
||||
rdfCore.Init("RDFCore");
|
||||
}
|
||||
// sort!!!
|
||||
rdfCore.doSort(node, sortResource, sortDirection);
|
||||
return(false);
|
||||
}
|
@ -40,93 +40,20 @@
|
||||
<!ENTITY historyBySite.label "History By Site">
|
||||
<!ENTITY historyByDate.label "History By Date">
|
||||
<!ENTITY historyWindowTitle.label "History">
|
||||
<!ENTITY name.column.label "Title">
|
||||
<!ENTITY url.column.label "URL">
|
||||
<!ENTITY lastvisited.column.label "Last Visited">
|
||||
]>
|
||||
|
||||
<window title="&historyWindowTitle.label;"
|
||||
xmlns:html="http://www.w3.org/TR/REC-html40"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
align="vertical"
|
||||
width="400"
|
||||
height="300">
|
||||
|
||||
<html:script>
|
||||
|
||||
function HistoryNewWindow()
|
||||
{
|
||||
var toolkitCore = XPAppCoresManager.Find("ToolkitCore");
|
||||
if (!toolkitCore) {
|
||||
toolkitCore = new ToolkitCore();
|
||||
if (toolkitCore) {
|
||||
toolkitCore.Init("ToolkitCore");
|
||||
}
|
||||
}
|
||||
if (toolkitCore) {
|
||||
toolkitCore.ShowWindow("resource:/res/rdf/history.xul",
|
||||
window);
|
||||
}
|
||||
}
|
||||
|
||||
function OpenURL(event,node)
|
||||
{
|
||||
|
||||
url = node.getAttribute('id');
|
||||
|
||||
// Ignore "NC:" urls.
|
||||
if (url.substring(0, 3) == "NC:") {
|
||||
return false;
|
||||
}
|
||||
|
||||
/*window.open(url,'bookmarks');*/
|
||||
var toolkitCore = XPAppCoresManager.Find("ToolkitCore");
|
||||
if (!toolkitCore) {
|
||||
toolkitCore = new ToolkitCore();
|
||||
if (toolkitCore) {
|
||||
toolkitCore.Init("ToolkitCore");
|
||||
}
|
||||
}
|
||||
if (toolkitCore) {
|
||||
toolkitCore.ShowWindow(url,window);
|
||||
}
|
||||
|
||||
dump("OpenURL(" + url + ")\n");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function doSort(sortColName)
|
||||
{
|
||||
var node = document.getElementById(sortColName);
|
||||
// determine column resource to sort on
|
||||
var sortResource = node.getAttribute('resource');
|
||||
if (!node) return(false);
|
||||
|
||||
var sortDirection="ascending";
|
||||
var isSortActive = node.getAttribute('sortActive');
|
||||
if (isSortActive == "true")
|
||||
{
|
||||
var currentDirection = node.getAttribute('sortDirection');
|
||||
if (currentDirection == "ascending")
|
||||
sortDirection = "descending";
|
||||
else if (currentDirection == "descending")
|
||||
sortDirection = "natural";
|
||||
else sortDirection = "ascending";
|
||||
}
|
||||
|
||||
// get RDF Core service
|
||||
var rdfCore = XPAppCoresManager.Find("RDFCore");
|
||||
if (!rdfCore)
|
||||
{
|
||||
rdfCore = new RDFCore();
|
||||
if (!rdfCore)
|
||||
{
|
||||
return(false);
|
||||
}
|
||||
rdfCore.Init("RDFCore");
|
||||
}
|
||||
// sort!!!
|
||||
rdfCore.doSort(node, sortResource, sortDirection);
|
||||
return(false);
|
||||
}
|
||||
|
||||
</html:script>
|
||||
<html:script src="history.js" />
|
||||
|
||||
<menubar>
|
||||
<menu value="&fileMenu.label;">
|
||||
@ -153,86 +80,56 @@ function doSort(sortColName)
|
||||
</menu>
|
||||
</menubar>
|
||||
|
||||
<tree rdf:datasources="rdf:history"
|
||||
ondblclick="return OpenURL(event,event.target.parentNode.parentNode);">
|
||||
<tree rdf:datasources="rdf:history rdf:find"
|
||||
ondblclick="OpenURL(event.target.parentNode.parentNode);"
|
||||
ref="NC:HistoryRoot"
|
||||
style="height:100%;">
|
||||
|
||||
<template>
|
||||
<rule rdf:type="http://home.netscape.com/NC-rdf#BookmarkSeparator">
|
||||
<treechildren>
|
||||
<treeitem uri="...">
|
||||
<treerow>
|
||||
<treecell>
|
||||
<html:hr width="75%" align="center" size="1" />
|
||||
</treecell>
|
||||
<treecell></treecell>
|
||||
<treecell></treecell>
|
||||
</treerow>
|
||||
</treeitem>
|
||||
</treechildren>
|
||||
</rule>
|
||||
|
||||
<rule>
|
||||
<treechildren>
|
||||
<treeitem uri="...">
|
||||
<treerow>
|
||||
<treecell>
|
||||
<treeindentation />
|
||||
<titledbutton value="rdf:http://home.netscape.com/NC-rdf#Name" align="right" />
|
||||
</treecell>
|
||||
|
||||
<treecell>
|
||||
<titledbutton value="rdf:http://home.netscape.com/NC-rdf#URL" align="right"
|
||||
<titledbutton value="rdf:http://home.netscape.com/NC-rdf#Name" align="left"
|
||||
style="list-style-image: none;" />
|
||||
</treecell>
|
||||
|
||||
<treecell>
|
||||
<titledbutton value="rdf:http://home.netscape.com/NC-rdf#ShortcutURL" align="right"
|
||||
<titledbutton value="rdf:http://home.netscape.com/NC-rdf#URL" align="left"
|
||||
style="list-style-image: none;" />
|
||||
</treecell>
|
||||
|
||||
<treecell>
|
||||
<titledbutton value="rdf:http://home.netscape.com/NC-rdf#Date" align="left"
|
||||
style="list-style-image: none;" />
|
||||
</treecell>
|
||||
</treerow>
|
||||
</treeitem>
|
||||
</treechildren>
|
||||
</rule>
|
||||
</template>
|
||||
|
||||
<treecol id="NameColumn" rdf:resource="http://home.netscape.com/NC-rdf#Name"/>
|
||||
<treecol id="URLColumn" rdf:resource="http://home.netscape.com/NC-rdf#URL"/>
|
||||
<treecol id="ShortcutURLColumn" rdf:resource="http://home.netscape.com/NC-rdf#ShortcutURL"/>
|
||||
<treecol id="DateColumn" rdf:resource="http://home.netscape.com/NC-rdf#Date"/>
|
||||
|
||||
<treehead>
|
||||
<treerow>
|
||||
<treecell onclick="return doSort('NameColumn');">
|
||||
<xul:observes element="NameColumn" attribute="sortActive"/>
|
||||
<xul:observes element="NameColumn" attribute="sortDirection"/>
|
||||
Name</treecell>
|
||||
&name.column.label;</treecell>
|
||||
<treecell onclick="return doSort('URLColumn');">
|
||||
<xul:observes element="URLColumn" attribute="sortActive"/>
|
||||
<xul:observes element="URLColumn" attribute="sortDirection"/>
|
||||
URL</treecell>
|
||||
<treecell onclick="return doSort('ShortcutURLColumn');">
|
||||
<xul:observes element="ShortcutURLColumn" attribute="sortActive"/>
|
||||
<xul:observes element="ShortcutURLColumn" attribute="sortDirection"/>
|
||||
Shortcut URL</treecell>
|
||||
&url.column.label;</treecell>
|
||||
<treecell onclick="return doSort('DateColumn');">
|
||||
<xul:observes element="DateColumn" attribute="sortActive"/>
|
||||
<xul:observes element="DateColumn" attribute="sortDirection"/>
|
||||
&lastvisited.column.label;</treecell>
|
||||
</treerow>
|
||||
</treehead>
|
||||
|
||||
<treechildren>
|
||||
<treeitem ref="NC:HistoryBySite" open="true">
|
||||
<treerow>
|
||||
<treecell>&historyBySite.label;</treecell>
|
||||
<treecell></treecell>
|
||||
<treecell></treecell>
|
||||
</treerow>
|
||||
</treeitem>
|
||||
|
||||
<treeitem ref="NC:HistoryByDate" open="true">
|
||||
<treerow>
|
||||
<treecell>&historyByDate.label;</treecell>
|
||||
<treecell></treecell>
|
||||
<treecell></treecell>
|
||||
</treerow>
|
||||
</treeitem>
|
||||
</treechildren>
|
||||
</tree>
|
||||
|
||||
<!-- TREECHILDREN are built *here* -->
|
||||
</tree>
|
||||
</window>
|
||||
|
@ -22,6 +22,7 @@ DEPTH=..\..\..\..
|
||||
FILES=\
|
||||
history.xul \
|
||||
history.css \
|
||||
history.js \
|
||||
history-test.xul \
|
||||
history-test.js \
|
||||
$(NULL)
|
||||
|
Loading…
Reference in New Issue
Block a user