diff --git a/mozilla/suite/common/related/related-panel.js b/mozilla/suite/common/related/related-panel.js
index 07159c675f3..f89a5d3fed4 100644
--- a/mozilla/suite/common/related/related-panel.js
+++ b/mozilla/suite/common/related/related-panel.js
@@ -42,18 +42,14 @@ Handler = Handler.QueryInterface(Components.interfaces.nsIRelatedLinksHandler);
// Our observer object
var Observer = {
Observe: function(subject, topic, data) {
- // debug("Observer.Observe(" + subject + ", " + topic + ", " + data + ")\n");
+ debug("Observer.Observe(" + subject + ", " + topic + ", " + data + ")\n");
+
if (subject != ContentWindow)
- return;
-
- // Okay, it's a hit. Before we go out and fetch RL data, make sure that
- // the RelatedLinks folder is open.
- var root = document.getElementById('NC:RelatedLinks');
-
- if (root.getAttribute('open') == 'true')
{
- refetchRelatedLinks(Handler, data);
+ debug("subject was not content window, ignoring\n");
+ return;
}
+ refetchRelatedLinks(Handler, data);
}
}
@@ -184,65 +180,45 @@ function refetchRelatedLinks(Handler, data)
function Init()
{
- // Initialize the Related Links panel
+ // Initialize the Related Links panel
- // Create a Related Links handler, and install it in the tree
- var Tree = document.getElementById("Tree");
- Tree.database.AddDataSource(Handler.QueryInterface(Components.interfaces.nsIRDFDataSource));
+ // Create a Related Links handler, and install it in the tree
+ var Tree = document.getElementById("Tree");
+ Tree.database.AddDataSource(Handler.QueryInterface(Components.interfaces.nsIRDFDataSource));
- // Install the observer so we'll be notified when new content is loaded.
- var ObserverService = Components.classes["component://netscape/observer-service"].getService();
- ObserverService = ObserverService.QueryInterface(Components.interfaces.nsIObserverService);
- debug("got observer service\n");
+ // Install the observer so we'll be notified when new content is loaded.
+ var ObserverService = Components.classes["component://netscape/observer-service"].getService();
+ ObserverService = ObserverService.QueryInterface(Components.interfaces.nsIObserverService);
+ if (ObserverService)
+ {
+ ObserverService.AddObserver(Observer, "StartDocumentLoad");
+ ObserverService.AddObserver(Observer, "EndDocumentLoad");
+ ObserverService.AddObserver(Observer, "FailDocumentLoad");
+ debug("added observer\n");
+ }
+ else
+ {
+ debug("FAILURE to get observer service\n");
+ }
- ObserverService.AddObserver(Observer, "EndDocumentLoad");
- debug("added observer\n");
-}
-
-function clicked(event, target) {
- if (target.getAttribute('container') == 'true') {
- if (target.getAttribute('open') == 'true') {
- target.removeAttribute('open');
- } else {
- target.setAttribute('open','true');
- // First, see if they're opening the related links node. If so,
- // we'll need to go out and fetch related links _now_.
- if (target.getAttribute('id') == 'NC:RelatedLinks') {
- refetchRelatedLinks(Handler, ContentWindow.location);
- return;
- }
- }
- } else {
- if (event.clickCount == 2) {
- openURL(target, 'Tree');
- }
- }
+ refetchRelatedLinks(Handler, ContentWindow.location);
}
-function openURL(treeitem, root)
+
+function openURL(event, treeitem, root)
{
+ if ((event.button != 1) || (event.clickCount != 2))
+ return(false);
- // Next, check to see if it's a container. If so, then just let
- // the tree do its open and close stuff.
- if (treeitem.getAttribute('container') == 'true') {
+ if (treeitem.getAttribute('container') == 'true')
+ return(false);
- // if (treeitem.getAttribute('open') == 'true') {
- // treeitem.setAttribute('open','')
- // } else {
- // treeitem.setAttribute('open','true')
- // }
+ if (treeitem.getAttribute("type") == "http://home.netscape.com/NC-rdf#BookmarkSeparator")
+ return(false);
- return;
- }
-
- if (treeitem.getAttribute('type') == 'http://home.netscape.com/NC-rdf#BookmarkSeparator') {
- return;
- }
-
- // Okay, it's not a container. See if it has a URL, and if so, open it.
- var id = treeitem.getAttribute('id');
- if (!id) return(false);
+ var id = treeitem.getAttribute('id');
+ if (!id) return(false);
// rjc: add support for anonymous resources; if the node has
// a "#URL" property, use it, otherwise default to using the id
@@ -272,5 +248,6 @@ function openURL(treeitem, root)
catch(ex)
{
}
- ContentWindow.location = id;
+
+ ContentWindow.location = id;
}
diff --git a/mozilla/suite/common/related/related-panel.xul b/mozilla/suite/common/related/related-panel.xul
index b823d7bc206..f8353f511d1 100644
--- a/mozilla/suite/common/related/related-panel.xul
+++ b/mozilla/suite/common/related/related-panel.xul
@@ -40,11 +40,11 @@
though there is no datasource from which to build content yet.
-->
-
-
+
+ datasources="rdf:null"
+ onclick="openURL(event, event.target.parentNode.parentNode, 'Tree')">
@@ -52,7 +52,7 @@
-
+
@@ -61,7 +61,7 @@
-
@@ -75,26 +75,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/mozilla/suite/common/search/search-panel.js b/mozilla/suite/common/search/search-panel.js
new file mode 100644
index 00000000000..0329bd8423f
--- /dev/null
+++ b/mozilla/suite/common/search/search-panel.js
@@ -0,0 +1,89 @@
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is mozilla.org code.
+ *
+ * The Initial Developer of the Original Code is Netscape
+ * Communications Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ */
+
+/*
+
+ Code for the Search Sidebar Panel
+
+ */
+
+function debug(msg)
+{
+ // uncomment for noise
+ // dump(msg);
+}
+
+
+
+function Init()
+{
+ // Initialize the Search panel
+}
+
+
+
+function openURL(event, treeitem, root)
+{
+ if ((event.button != 1) || (event.clickCount != 2))
+ return(false);
+
+ if (treeitem.getAttribute("container") == "true")
+ return(false);
+
+ if (treeitem.getAttribute("type") == "http://home.netscape.com/NC-rdf#BookmarkSeparator")
+ return(false);
+
+ var id = treeitem.getAttribute('id');
+ if (!id)
+ return(false);
+
+ // rjc: add support for anonymous resources; if the node has
+ // a "#URL" property, use it, otherwise default to using the id
+ try
+ {
+ var rootNode = document.getElementById(root);
+ var ds = null;
+ if (rootNode)
+ {
+ ds = rootNode.database;
+ }
+ var rdf = Components.classes["component://netscape/rdf/rdf-service"].getService();
+ if (rdf) rdf = rdf.QueryInterface(Components.interfaces.nsIRDFService);
+ if (rdf)
+ {
+ if (ds)
+ {
+ var src = rdf.GetResource(id, true);
+ var prop = rdf.GetResource("http://home.netscape.com/NC-rdf#URL", true);
+ var target = ds.GetTarget(src, prop, true);
+ if (target) target = target.QueryInterface(Components.interfaces.nsIRDFLiteral);
+ if (target) target = target.Value;
+ if (target) id = target;
+ }
+ }
+ }
+ catch(ex)
+ {
+ }
+
+ window.content.location = id;
+}
diff --git a/mozilla/suite/common/search/search-panel.xul b/mozilla/suite/common/search/search-panel.xul
new file mode 100644
index 00000000000..7da820c4353
--- /dev/null
+++ b/mozilla/suite/common/search/search-panel.xul
@@ -0,0 +1,74 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/mozilla/suite/common/sidebar/local-panels.rdf b/mozilla/suite/common/sidebar/local-panels.rdf
index bdffd519d20..7b1d0cdfe10 100644
--- a/mozilla/suite/common/sidebar/local-panels.rdf
+++ b/mozilla/suite/common/sidebar/local-panels.rdf
@@ -32,6 +32,12 @@
chrome://related/content/related-panel.xul
+
+
+ &sidebar.search.label;
+ chrome://search/content/search-panel.xul
+
+
&sidebar.bookmarks.label;
diff --git a/mozilla/suite/locales/en-US/chrome/common/search/search-panel.dtd b/mozilla/suite/locales/en-US/chrome/common/search/search-panel.dtd
new file mode 100755
index 00000000000..d835dc02e29
--- /dev/null
+++ b/mozilla/suite/locales/en-US/chrome/common/search/search-panel.dtd
@@ -0,0 +1,21 @@
+
+
diff --git a/mozilla/xpfe/components/related/resources/related-panel.js b/mozilla/xpfe/components/related/resources/related-panel.js
index 07159c675f3..f89a5d3fed4 100644
--- a/mozilla/xpfe/components/related/resources/related-panel.js
+++ b/mozilla/xpfe/components/related/resources/related-panel.js
@@ -42,18 +42,14 @@ Handler = Handler.QueryInterface(Components.interfaces.nsIRelatedLinksHandler);
// Our observer object
var Observer = {
Observe: function(subject, topic, data) {
- // debug("Observer.Observe(" + subject + ", " + topic + ", " + data + ")\n");
+ debug("Observer.Observe(" + subject + ", " + topic + ", " + data + ")\n");
+
if (subject != ContentWindow)
- return;
-
- // Okay, it's a hit. Before we go out and fetch RL data, make sure that
- // the RelatedLinks folder is open.
- var root = document.getElementById('NC:RelatedLinks');
-
- if (root.getAttribute('open') == 'true')
{
- refetchRelatedLinks(Handler, data);
+ debug("subject was not content window, ignoring\n");
+ return;
}
+ refetchRelatedLinks(Handler, data);
}
}
@@ -184,65 +180,45 @@ function refetchRelatedLinks(Handler, data)
function Init()
{
- // Initialize the Related Links panel
+ // Initialize the Related Links panel
- // Create a Related Links handler, and install it in the tree
- var Tree = document.getElementById("Tree");
- Tree.database.AddDataSource(Handler.QueryInterface(Components.interfaces.nsIRDFDataSource));
+ // Create a Related Links handler, and install it in the tree
+ var Tree = document.getElementById("Tree");
+ Tree.database.AddDataSource(Handler.QueryInterface(Components.interfaces.nsIRDFDataSource));
- // Install the observer so we'll be notified when new content is loaded.
- var ObserverService = Components.classes["component://netscape/observer-service"].getService();
- ObserverService = ObserverService.QueryInterface(Components.interfaces.nsIObserverService);
- debug("got observer service\n");
+ // Install the observer so we'll be notified when new content is loaded.
+ var ObserverService = Components.classes["component://netscape/observer-service"].getService();
+ ObserverService = ObserverService.QueryInterface(Components.interfaces.nsIObserverService);
+ if (ObserverService)
+ {
+ ObserverService.AddObserver(Observer, "StartDocumentLoad");
+ ObserverService.AddObserver(Observer, "EndDocumentLoad");
+ ObserverService.AddObserver(Observer, "FailDocumentLoad");
+ debug("added observer\n");
+ }
+ else
+ {
+ debug("FAILURE to get observer service\n");
+ }
- ObserverService.AddObserver(Observer, "EndDocumentLoad");
- debug("added observer\n");
-}
-
-function clicked(event, target) {
- if (target.getAttribute('container') == 'true') {
- if (target.getAttribute('open') == 'true') {
- target.removeAttribute('open');
- } else {
- target.setAttribute('open','true');
- // First, see if they're opening the related links node. If so,
- // we'll need to go out and fetch related links _now_.
- if (target.getAttribute('id') == 'NC:RelatedLinks') {
- refetchRelatedLinks(Handler, ContentWindow.location);
- return;
- }
- }
- } else {
- if (event.clickCount == 2) {
- openURL(target, 'Tree');
- }
- }
+ refetchRelatedLinks(Handler, ContentWindow.location);
}
-function openURL(treeitem, root)
+
+function openURL(event, treeitem, root)
{
+ if ((event.button != 1) || (event.clickCount != 2))
+ return(false);
- // Next, check to see if it's a container. If so, then just let
- // the tree do its open and close stuff.
- if (treeitem.getAttribute('container') == 'true') {
+ if (treeitem.getAttribute('container') == 'true')
+ return(false);
- // if (treeitem.getAttribute('open') == 'true') {
- // treeitem.setAttribute('open','')
- // } else {
- // treeitem.setAttribute('open','true')
- // }
+ if (treeitem.getAttribute("type") == "http://home.netscape.com/NC-rdf#BookmarkSeparator")
+ return(false);
- return;
- }
-
- if (treeitem.getAttribute('type') == 'http://home.netscape.com/NC-rdf#BookmarkSeparator') {
- return;
- }
-
- // Okay, it's not a container. See if it has a URL, and if so, open it.
- var id = treeitem.getAttribute('id');
- if (!id) return(false);
+ var id = treeitem.getAttribute('id');
+ if (!id) return(false);
// rjc: add support for anonymous resources; if the node has
// a "#URL" property, use it, otherwise default to using the id
@@ -272,5 +248,6 @@ function openURL(treeitem, root)
catch(ex)
{
}
- ContentWindow.location = id;
+
+ ContentWindow.location = id;
}
diff --git a/mozilla/xpfe/components/related/resources/related-panel.xul b/mozilla/xpfe/components/related/resources/related-panel.xul
index b823d7bc206..f8353f511d1 100644
--- a/mozilla/xpfe/components/related/resources/related-panel.xul
+++ b/mozilla/xpfe/components/related/resources/related-panel.xul
@@ -40,11 +40,11 @@
though there is no datasource from which to build content yet.
-->
-
-
+
+ datasources="rdf:null"
+ onclick="openURL(event, event.target.parentNode.parentNode, 'Tree')">
@@ -52,7 +52,7 @@
-
+
@@ -61,7 +61,7 @@
-
@@ -75,26 +75,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/mozilla/xpfe/components/search/resources/MANIFEST b/mozilla/xpfe/components/search/resources/MANIFEST
index d57396a45dd..627bd7458fb 100644
--- a/mozilla/xpfe/components/search/resources/MANIFEST
+++ b/mozilla/xpfe/components/search/resources/MANIFEST
@@ -2,6 +2,8 @@ default.htm
search.css
search.js
search.xul
+search-panel.js
+search-panel.xul
shared.js
find.js
find.xul
diff --git a/mozilla/xpfe/components/search/resources/MANIFEST-content b/mozilla/xpfe/components/search/resources/MANIFEST-content
index 482afa57299..3fe2369d51d 100644
--- a/mozilla/xpfe/components/search/resources/MANIFEST-content
+++ b/mozilla/xpfe/components/search/resources/MANIFEST-content
@@ -8,4 +8,6 @@ internetresults.js
internetresults.xul
search.js
search.xul
+search-panel.js
+search-panel.xul
shared.js
diff --git a/mozilla/xpfe/components/search/resources/Makefile.in b/mozilla/xpfe/components/search/resources/Makefile.in
index 75dd55472bd..027e7a776c8 100755
--- a/mozilla/xpfe/components/search/resources/Makefile.in
+++ b/mozilla/xpfe/components/search/resources/Makefile.in
@@ -35,6 +35,8 @@ CHROME_CONTENT = \
default.htm \
search.js \
search.xul \
+ search-panel.js \
+ search-panel.xul \
shared.js \
find.js \
find.xul \
@@ -59,6 +61,7 @@ CHROME_L10N = \
locale/en-US/internet.dtd \
locale/en-US/internetresults.dtd \
locale/en-US/search.dtd \
+ locale/en-US/search-panel.dtd \
$(NULL)
include $(topsrcdir)/config/rules.mk
diff --git a/mozilla/xpfe/components/search/resources/locale/MANIFEST b/mozilla/xpfe/components/search/resources/locale/MANIFEST
index fdf3cb87f33..9b3fcf3c6c2 100755
--- a/mozilla/xpfe/components/search/resources/locale/MANIFEST
+++ b/mozilla/xpfe/components/search/resources/locale/MANIFEST
@@ -1,4 +1,5 @@
en-US:search.dtd
+en-US:search-panel.dtd
en-US:find.dtd
en-US:findresults.dtd
en-US:internet.dtd
diff --git a/mozilla/xpfe/components/search/resources/locale/en-US/search-panel.dtd b/mozilla/xpfe/components/search/resources/locale/en-US/search-panel.dtd
new file mode 100755
index 00000000000..d835dc02e29
--- /dev/null
+++ b/mozilla/xpfe/components/search/resources/locale/en-US/search-panel.dtd
@@ -0,0 +1,21 @@
+
+
diff --git a/mozilla/xpfe/components/search/resources/makefile.win b/mozilla/xpfe/components/search/resources/makefile.win
index cd75dc0fed3..4e7882a3bab 100644
--- a/mozilla/xpfe/components/search/resources/makefile.win
+++ b/mozilla/xpfe/components/search/resources/makefile.win
@@ -32,6 +32,8 @@ CHROME_CONTENT = \
.\default.htm \
.\search.js \
.\search.xul \
+ .\search-panel.js \
+ .\search-panel.xul \
.\shared.js \
.\find.js \
.\find.xul \
@@ -56,6 +58,7 @@ CHROME_L10N = \
.\locale\en-US\internet.dtd \
.\locale\en-US\internetresults.dtd \
.\locale\en-US\search.dtd \
+ .\locale\en-US\search-panel.dtd \
$(NULL)
include <$(DEPTH)\config\rules.mak>
diff --git a/mozilla/xpfe/components/search/resources/search-panel.js b/mozilla/xpfe/components/search/resources/search-panel.js
new file mode 100644
index 00000000000..0329bd8423f
--- /dev/null
+++ b/mozilla/xpfe/components/search/resources/search-panel.js
@@ -0,0 +1,89 @@
+/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
+ *
+ * The contents of this file are subject to the Netscape Public
+ * License Version 1.1 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.mozilla.org/NPL/
+ *
+ * Software distributed under the License is distributed on an "AS
+ * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
+ * implied. See the License for the specific language governing
+ * rights and limitations under the License.
+ *
+ * The Original Code is mozilla.org code.
+ *
+ * The Initial Developer of the Original Code is Netscape
+ * Communications Corporation. Portions created by Netscape are
+ * Copyright (C) 1998 Netscape Communications Corporation. All
+ * Rights Reserved.
+ *
+ * Contributor(s):
+ */
+
+/*
+
+ Code for the Search Sidebar Panel
+
+ */
+
+function debug(msg)
+{
+ // uncomment for noise
+ // dump(msg);
+}
+
+
+
+function Init()
+{
+ // Initialize the Search panel
+}
+
+
+
+function openURL(event, treeitem, root)
+{
+ if ((event.button != 1) || (event.clickCount != 2))
+ return(false);
+
+ if (treeitem.getAttribute("container") == "true")
+ return(false);
+
+ if (treeitem.getAttribute("type") == "http://home.netscape.com/NC-rdf#BookmarkSeparator")
+ return(false);
+
+ var id = treeitem.getAttribute('id');
+ if (!id)
+ return(false);
+
+ // rjc: add support for anonymous resources; if the node has
+ // a "#URL" property, use it, otherwise default to using the id
+ try
+ {
+ var rootNode = document.getElementById(root);
+ var ds = null;
+ if (rootNode)
+ {
+ ds = rootNode.database;
+ }
+ var rdf = Components.classes["component://netscape/rdf/rdf-service"].getService();
+ if (rdf) rdf = rdf.QueryInterface(Components.interfaces.nsIRDFService);
+ if (rdf)
+ {
+ if (ds)
+ {
+ var src = rdf.GetResource(id, true);
+ var prop = rdf.GetResource("http://home.netscape.com/NC-rdf#URL", true);
+ var target = ds.GetTarget(src, prop, true);
+ if (target) target = target.QueryInterface(Components.interfaces.nsIRDFLiteral);
+ if (target) target = target.Value;
+ if (target) id = target;
+ }
+ }
+ }
+ catch(ex)
+ {
+ }
+
+ window.content.location = id;
+}
diff --git a/mozilla/xpfe/components/search/resources/search-panel.xul b/mozilla/xpfe/components/search/resources/search-panel.xul
new file mode 100644
index 00000000000..7da820c4353
--- /dev/null
+++ b/mozilla/xpfe/components/search/resources/search-panel.xul
@@ -0,0 +1,74 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/mozilla/xpfe/components/sidebar/resources/local-panels.rdf b/mozilla/xpfe/components/sidebar/resources/local-panels.rdf
index bdffd519d20..7b1d0cdfe10 100644
--- a/mozilla/xpfe/components/sidebar/resources/local-panels.rdf
+++ b/mozilla/xpfe/components/sidebar/resources/local-panels.rdf
@@ -32,6 +32,12 @@
chrome://related/content/related-panel.xul
+
+
+ &sidebar.search.label;
+ chrome://search/content/search-panel.xul
+
+
&sidebar.bookmarks.label;
diff --git a/mozilla/xpfe/components/sidebar/resources/locale/en-US/sidebar-rdf.dtd b/mozilla/xpfe/components/sidebar/resources/locale/en-US/sidebar-rdf.dtd
index ca2b7649684..861aaaf7830 100644
--- a/mozilla/xpfe/components/sidebar/resources/locale/en-US/sidebar-rdf.dtd
+++ b/mozilla/xpfe/components/sidebar/resources/locale/en-US/sidebar-rdf.dtd
@@ -22,6 +22,7 @@
+