Landng boomar groups. 119599 r ben sr jag a asa

This commit is contained in:
hyatt%netscape.com 2006-09-14 06:03:34 +00:00
Родитель 15a8becb5e
Коммит 6299732614
3 изменённых файлов: 67 добавлений и 4 удалений

Просмотреть файл

@ -620,8 +620,56 @@ function BrowserHome()
loadURI(homePage);
}
function OpenBookmarkGroup(element, datasource)
{
if (!datasource)
return;
var id = element.getAttribute("id");
var rdf = Components.classes["@mozilla.org/rdf/rdf-service;1"]
.getService(Components.interfaces.nsIRDFService);
var resource = rdf.GetResource(id, true);
return OpenBookmarkGroupFromResource(resource, datasource, rdf);
}
function OpenBookmarkGroupFromResource(resource, datasource, rdf) {
var urlResource = rdf.GetResource("http://home.netscape.com/NC-rdf#URL");
var rdfContainer = Components.classes["@mozilla.org/rdf/container;1"].getService(Components.interfaces.nsIRDFContainer);
rdfContainer.Init(datasource, resource);
var containerChildren = rdfContainer.GetElements();
var tabPanels = gBrowser.mPanelContainer.childNodes;
var tabCount = tabPanels.length;
var index = 0;
while (containerChildren.hasMoreElements()) {
var resource = containerChildren.getNext().QueryInterface(Components.interfaces.nsIRDFResource);
var target = datasource.GetTarget(resource, urlResource, true);
if (target) {
var uri = target.QueryInterface(Components.interfaces.nsIRDFLiteral).Value;
if (index < tabCount)
tabPanels[index].loadURI(uri, null, nsIWebNavigation.LOAD_FLAGS_NONE);
else
gBrowser.addTab(uri);
index++;
}
}
if (index == 0)
return; // If the bookmark group was completely invalid, just bail.
// Select the first tab in the group.
var tabs = gBrowser.mTabContainer.childNodes;
gBrowser.selectedTab = tabs[0];
// Close any remaining open tabs that are left over.
for (var i = tabCount-1; i >= index; i--)
gBrowser.removeTab(tabs[i]);
}
function OpenBookmarkURL(node, datasources)
{
if (node.getAttribute("group") == "true")
OpenBookmarkGroup(node, datasources);
if (node.getAttribute("container") == "true")
return;

Просмотреть файл

@ -281,15 +281,13 @@ Contributor(s): ______________________________________. -->
ref="NC:PersonalToolbarFolder" flags="dont-test-empty"
rdf:type="http://home.netscape.com/NC-rdf#Folder"
oncommand="OpenBookmarkURL(event.target, document.getElementById('innermostBox').database)">
<tooltip id="ptTooltip" noautohide="true" onpopupshowing="return FillInPTTooltip(document.tooltipNode)">
<vbox id="ptTooltipTextBox" flex="1">
<label id="ptTitleText" />
<label id="ptUrlText" />
</vbox>
</tooltip>
<template>
<template xmlns:nc="http://home.netscape.com/NC-rdf#">
<rule parent="hbox" rdf:type="http://home.netscape.com/NC-rdf#BookmarkSeparator">
<toolbarseparator uri="rdf:*"
rdf:type="rdf:http://www.w3.org/1999/02/22-rdf-syntax-ns#type"/>
@ -297,6 +295,14 @@ Contributor(s): ______________________________________. -->
<!-- yes, the type attribute is necessary otherwise all leaves are
treated as containers for some reason -->
<rule parent="hbox" iscontainer="true"
nc:FolderGroup="true">
<toolbarbutton class="bookmark-item bookmark-group" uri="rdf:*" xulcontentsgenerated="true"
group="true"
container="false"
rdf:type="http://home.netscape.com/NC-rdf#Folder"
label="rdf:http://home.netscape.com/NC-rdf#Name"/>
</rule>
<rule parent="hbox" iscontainer="true" isempty="true"
rdf:type="http://home.netscape.com/NC-rdf#Folder">
<toolbarbutton type="menu" editable="true" class="bookmark-item"

Просмотреть файл

@ -296,7 +296,16 @@
datasources="rdf:bookmarks rdf:files rdf:localsearch rdf:internetsearch"
ref="NC:BookmarksRoot" flags="dont-test-empty" template="bookmarksMenuTemplate"
oncommand="OpenBookmarkURL(event.target, document.getElementById('BookmarksMenu').database)">
<template id="bookmarksMenuTemplate">
<template id="bookmarksMenuTemplate" xmlns:nc="http://home.netscape.com/NC-rdf#">
<rule nc:FolderGroup="true" iscontainer="true">
<menupopup>
<menuitem class="menuitem-iconic bookmark-group"
label="rdf:http://home.netscape.com/NC-rdf#Name"
group="true"
uri="rdf:*"
xulcontentsgenerated="true"/>
</menupopup>
</rule>
<rule iscontainer="true" isempty="true"
rdf:type="http://home.netscape.com/NC-rdf#Folder">
<menupopup>