gecko-dev/rdf/resources/sidebar.xul

173 lines
5.8 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.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:template xul:containment="treeitem" xul:subcontainment="treechildren">
<xul:treeitem>
<xul:treecell>
<xul:treeindentation />
<xul:titledbutton>
</xul:titledbutton>
<xul:text rdf:resource="http://home.netscape.com/NC-rdf#Name" />
</xul:treecell>
<xul:treecell>
<xul:text rdf:resource="http://home.netscape.com/NC-rdf#URL" />
</xul:treecell>
<xul:treecell>
<xul:text rdf:resource="http://home.netscape.com/NC-rdf#ShortcutURL" />
</xul:treecell>
<xul:treecell>
<xul:text rdf:resource="http://home.netscape.com/WEB-rdf#LastModifiedDate" />
</xul:treecell>
</xul:treeitem>
</xul:template>
<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><xul:treeindentation /><xul:titledbutton />Bookmarks</xul:treecell>
<xul:treecell></xul:treecell>
<xul:treecell></xul:treecell>
<xul:treecell></xul:treecell>
</xul:treeitem>
<xul:treeitem id="NC:FilesRoot">
<xul:treecell><xul:treeindentation /><xul:titledbutton />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><xul:treeindentation /><xul:titledbutton />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><xul:treeindentation /><xul:titledbutton />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><xul:treeindentation /><xul:titledbutton />Related Links</xul:treecell>
<xul:treecell></xul:treecell>
<xul:treecell></xul:treecell>
<xul:treecell></xul:treecell>
</xul:treeitem>
</xul:treebody>
</xul:tree>
</xul:window>