gecko-dev/rdf/resources/sidebar.xul

165 строки
5.3 KiB
XML

<?xml version="1.0"?>
<?xml-stylesheet href="sidebar.css" type="text/css"?>
<xul:window
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">
<html:script>
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";
}
dump("Sort on '" + sortResource + "' column in '" + sortDirection + "' order.\n");
// get RDF Core service
var rdfCore = XPAppCoresManager.Find("RDFCore");
if (!rdfCore)
{
rdfCore = new RDFCore();
if (!rdfCore)
{
dump(" *** error: Unable to create new RDFCore.\n");
return(false);
}
dump("RDFCore created\n");
rdfCore.Init("RDFCore");
dump("RDFCore inited\n");
}
// sort!!!
dump("About to sort...\n");
rdfCore.doSort(node, sortResource, sortDirection);
dump("Sort done.\n");
return(false);
}
function OpenURL(event,node)
{
if (node.getAttribute('container') == "true")
{
return false;
}
url = node.getAttribute('id');
// Ignore "NC:" urls.
if (url.substring(0, 3) == "NC:")
{
return false;
}
dump(url);
parent.parent.frames[1].location.href = url;
RefreshUrlbar();
return true;
}
</html:script>
<tree flex="100%" datasources="rdf:find rdf:files rdf:ftp rdf:relatedlinks rdf:bookmarks rdf:history" ondblclick="return OpenURL(event,event.target.parentNode);">
<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="LastModColumn" rdf:resource="http://home.netscape.com/WEB-rdf#LastModifiedDate"/>
<popup id="popupmenu">
<menu>
<menuitem name="Cut" />
<menuitem name="Copy" />
<menuitem name="Paste" />
</menu>
</popup>
<template>
<rule rdf:type="http://home.netscape.com/NC-rdf#BookmarkSeparator" rootcontainment="treebody" subcontainment="treechildren">
<treeitem uri="...">
<treecell>
<html:hr width="75%" align="center" size="1" />
</treecell>
</treeitem>
</rule>
<rule rootcontainment="treebody" subcontainment="treechildren">
<treeitem uri="...">
<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" style="list-style-image: none;" />
</treecell>
<treecell>
<titledbutton value="rdf:http://home.netscape.com/NC-rdf#ShortcutURL" align="right" style="list-style-image: none;" />
</treecell>
<treecell context="popupmenu">
<titledbutton value="rdf:http://home.netscape.com/WEB-rdf#LastModifiedDate" align="right" style="list-style-image: none;" />
</treecell>
</treeitem>
</rule>
</template>
<treehead>
<treeitem>
<treecell resource='http://home.netscape.com/NC-rdf#Name' onclick="return doSort('NameColumn');">
<observes element="NameColumn" attribute="sortActive"/>
<observes element="NameColumn" attribute="sortDirection"/>
Name</treecell>
<treecell resource='http://home.netscape.com/NC-rdf#URL' onclick="return doSort('URLColumn');">
<observes element="URLColumn" attribute="sortActive"/>
<observes element="URLColumn" attribute="sortDirection"/>
URL</treecell>
<treecell resource='http://home.netscape.com/NC-rdf#ShortcutURL' onclick="return doSort('ShortcutURLColumn');">
<observes element="ShortcutURLColumn" attribute="sortActive"/>
<observes element="ShortcutURLColumn" attribute="sortDirection"/>
Shortcut URL</treecell>
<treecell resource='http://home.netscape.com/WEB-rdf#LastModifiedDate' onclick="return doSort('LastModColumn');">
<observes element="LastModColumn" attribute="sortActive"/>
<observes element="LastModColumn" attribute="sortDirection"/>
Last Modified</treecell>
</treeitem>
</treehead>
<treebody>
<treeitem id="NC:BookmarksRoot" open="true">
<treecell><treeindentation /><titledbutton />Bookmarks</treecell>
</treeitem>
<treeitem id="NC:FilesRoot">
<treecell><treeindentation /><titledbutton />File System</treecell>
</treeitem>
<treeitem id="NC:HistoryBySite">
<treecell><treeindentation /><titledbutton />History By Site</treecell>
</treeitem>
<treeitem id="NC:HistoryByDate">
<treecell><treeindentation /><titledbutton />History By Date</treecell>
</treeitem>
<treeitem id="NC:RelatedLinks" pulse="5">
<treecell><treeindentation /><titledbutton />Related Links</treecell>
</treeitem>
</treebody>
</tree>
</xul:window>