pjs/rdf/resources/sidebar.xul

111 строки
3.7 KiB
XML

<?xml version="1.0"?>
<?xml-stylesheet href="sidebar.css" type="text/css"?>
<xul:window
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:html="http://www.w3.org/TR/REC-html40"
xmlns:rdf="http://www.w3.org/TR/WD-rdf-syntax#">
<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");
XPAppCoresManager.Add(rdfCore);
dump("RDFCore added into XPAppCoresManager\n");
}
// sort!!!
dump("About to sort...\n");
rdfCore.doSort(node, sortResource, sortDirection);
dump("Sort done.\n");
return(false);
}
</html:script>
<xul:tree datasources="rdf:find rdf:files rdf:bookmarks rdf:history">
<xul:treecol id="NameColumn" rdf:resource="http://home.netscape.com/NC-rdf#Name"/>
<xul:treecol id="URLColumn" rdf:resource="http://home.netscape.com/NC-rdf#URL"/>
<xul:treecol id="LastModColumn" rdf:resource="http://home.netscape.com/WEB-rdf#LastModifiedDate"/>
<xul:treehead>
<xul:treeitem>
<xul:treecell resource='http://home.netscape.com/NC-rdf#Name' onclick="return doSort('NameColumn');">
<xul:observes element="NameColumn" attribute="sortActive"/>
<xul:observes element="NameColumn" attribute="sortDirection"/>
Name</xul:treecell>
<xul:treecell resource='http://home.netscape.com/NC-rdf#URL' onclick="return doSort('URLColumn');">
<xul:observes element="URLColumn" attribute="sortActive"/>
<xul:observes element="URLColumn" attribute="sortDirection"/>
URL</xul:treecell>
<xul:treecell resource='http://home.netscape.com/WEB-rdf#LastModifiedDate' onclick="return doSort('LastModColumn');">
<xul:observes element="LastModColumn" attribute="sortActive"/>
<xul:observes element="LastModColumn" attribute="sortDirection"/>
Last Modified</xul:treecell>
</xul:treeitem>
</xul:treehead>
<xul:treebody>
<xul:treeitem id="NC:BookmarksRoot" open="true">
<xul:treecell>Bookmarks</xul:treecell>
<xul:treecell></xul:treecell>
<xul:treecell></xul:treecell>
</xul:treeitem>
<xul:treeitem id="NC:FilesRoot">
<xul:treecell>File System</xul:treecell>
<xul:treecell></xul:treecell>
<xul:treecell></xul:treecell>
</xul:treeitem>
<xul:treeitem id="NC:HistoryBySite">
<xul:treecell>History By Site</xul:treecell>
<xul:treecell></xul:treecell>
<xul:treecell></xul:treecell>
</xul:treeitem>
<xul:treeitem id="NC:HistoryByDate">
<xul:treecell>History By Date</xul:treecell>
<xul:treecell></xul:treecell>
<xul:treecell></xul:treecell>
</xul:treeitem>
</xul:treebody>
</xul:tree>
</xul:window>