gecko-dev/rdf/resources/sidebar.xul

153 строки
4.9 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/1999/02/22-rdf-syntax-ns#">
<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);
}
function OpenURL(event,node)
{
/*
if (node.getAttribute('type') != "http://home.netscape.com/NC-rdf#Bookmark")
{
return false;
}
*/
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.frames[1].location.href = url;
RefreshUrlbar();
return true;
}
</html:script>
<xul:tree flex="100%" datasources="rdf:find rdf:files rdf:ftp rdf:relatedlinks rdf:bookmarks rdf:history" onclick="return OpenURL(event,event.target.parentNode);">
<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="ShortcutURLColumn" rdf:resource="http://home.netscape.com/NC-rdf#ShortcutURL"/>
<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/NC-rdf#ShortcutURL' onclick="return doSort('ShortcutURLColumn');">
<xul:observes element="ShortcutURLColumn" attribute="sortActive"/>
<xul:observes element="ShortcutURLColumn" attribute="sortDirection"/>
Shortcut 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: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: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: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:treecell></xul:treecell>
</xul:treeitem>
<xul:treeitem id="NC:RelatedLinks" pulse="5">
<xul:treecell>Related Links</xul:treecell>
<xul:treecell></xul:treecell>
<xul:treecell></xul:treecell>
<xul:treecell></xul:treecell>
</xul:treeitem>
</xul:treebody>
</xul:tree>
</xul:window>