From 7a1ee8255d8e7a5dc64436d56407d77b54745ee7 Mon Sep 17 00:00:00 2001 From: "rjc%netscape.com" Date: Sat, 21 Aug 1999 09:26:10 +0000 Subject: [PATCH] Add HTML banners if available. --- suite/common/search/internetresults.js | 28 +++++++++++-------- suite/common/search/internetresults.xul | 7 ++--- xpfe/components/search/resources/internet.xul | 3 +- .../search/resources/internetresults.js | 28 +++++++++++-------- .../search/resources/internetresults.xul | 7 ++--- 5 files changed, 39 insertions(+), 34 deletions(-) diff --git a/suite/common/search/internetresults.js b/suite/common/search/internetresults.js index d69e11242d2e..1ced2e4e036b 100644 --- a/suite/common/search/internetresults.js +++ b/suite/common/search/internetresults.js @@ -3,8 +3,6 @@ var gEditorShell = null; function doLoad() { - dump("doLoad() entered.\n"); - var editorShell = Components.classes["component://netscape/editor/editorshell"].createInstance(); if (editorShell) editorShell = editorShell.QueryInterface(Components.interfaces.nsIEditorShell); if (editorShell) @@ -12,23 +10,20 @@ function doLoad() window.editorShell = editorShell; editorShell.Init(); - dump("init\n"); + // editorShell.SetWebShellWindow(window); // dump("SetWebShellWindow\n"); // editorShell.SetToolbarWindow(window) // dump("SetToolbarWindow\n"); + editorShell.SetEditorType("html"); - dump("SetEditorType\n"); editorShell.SetContentWindow(window.content); - // Get url for editor content and load it. - // the editor gets instantiated by the editor shell when the URL has finished loading. + // The editor gets instantiated by the editor shell when the URL has finished loading. editorShell.LoadUrl("about:blank"); gEditorShell = editorShell; - dump("doLoad() succeeded.\n"); } - else dump("doLoad(): problem loading component://netscape/editor/editorshell \n"); } function doClick(node) @@ -46,7 +41,13 @@ function doClick(node) if (internetSearchStore) { var src = rdf.GetResource(theID, true); + var bannerProperty = rdf.GetResource("http://home.netscape.com/NC-rdf#Banner", true); var htmlProperty = rdf.GetResource("http://home.netscape.com/NC-rdf#HTML", true); + + var banner = internetSearchStore.GetTarget(src, bannerProperty, true); + if (banner) banner = banner.QueryInterface(Components.interfaces.nsIRDFLiteral); + if (banner) banner = banner.Value; + var target = internetSearchStore.GetTarget(src, htmlProperty, true); if (target) target = target.QueryInterface(Components.interfaces.nsIRDFLiteral); if (target) target = target.Value; @@ -58,14 +59,17 @@ function doClick(node) } if (gEditorShell) { - var text = target; + var text = ""; + if (banner) + { + // add a and a
just in case + text += banner + "
"; + } + text += target; gEditorShell.SelectAll(); gEditorShell.DeleteSelection(2); -// gEditorShell.SetTextProperty("font", "size", "-2"); gEditorShell.InsertSource(text); -// gEditorShell.SelectAll(); -// gEditorShell.SetTextProperty("font", "size", "-2"); } } } diff --git a/suite/common/search/internetresults.xul b/suite/common/search/internetresults.xul index e884156e6759..879ec76852e4 100644 --- a/suite/common/search/internetresults.xul +++ b/suite/common/search/internetresults.xul @@ -6,7 +6,6 @@ @@ -18,7 +17,7 @@ ]> - @@ -67,7 +66,7 @@ - + @@ -136,5 +135,5 @@ - + diff --git a/xpfe/components/search/resources/internet.xul b/xpfe/components/search/resources/internet.xul index 8b64c54d853f..dbb89802df91 100644 --- a/xpfe/components/search/resources/internet.xul +++ b/xpfe/components/search/resources/internet.xul @@ -5,7 +5,6 @@ @@ -17,7 +16,7 @@ ]> - diff --git a/xpfe/components/search/resources/internetresults.js b/xpfe/components/search/resources/internetresults.js index d69e11242d2e..1ced2e4e036b 100644 --- a/xpfe/components/search/resources/internetresults.js +++ b/xpfe/components/search/resources/internetresults.js @@ -3,8 +3,6 @@ var gEditorShell = null; function doLoad() { - dump("doLoad() entered.\n"); - var editorShell = Components.classes["component://netscape/editor/editorshell"].createInstance(); if (editorShell) editorShell = editorShell.QueryInterface(Components.interfaces.nsIEditorShell); if (editorShell) @@ -12,23 +10,20 @@ function doLoad() window.editorShell = editorShell; editorShell.Init(); - dump("init\n"); + // editorShell.SetWebShellWindow(window); // dump("SetWebShellWindow\n"); // editorShell.SetToolbarWindow(window) // dump("SetToolbarWindow\n"); + editorShell.SetEditorType("html"); - dump("SetEditorType\n"); editorShell.SetContentWindow(window.content); - // Get url for editor content and load it. - // the editor gets instantiated by the editor shell when the URL has finished loading. + // The editor gets instantiated by the editor shell when the URL has finished loading. editorShell.LoadUrl("about:blank"); gEditorShell = editorShell; - dump("doLoad() succeeded.\n"); } - else dump("doLoad(): problem loading component://netscape/editor/editorshell \n"); } function doClick(node) @@ -46,7 +41,13 @@ function doClick(node) if (internetSearchStore) { var src = rdf.GetResource(theID, true); + var bannerProperty = rdf.GetResource("http://home.netscape.com/NC-rdf#Banner", true); var htmlProperty = rdf.GetResource("http://home.netscape.com/NC-rdf#HTML", true); + + var banner = internetSearchStore.GetTarget(src, bannerProperty, true); + if (banner) banner = banner.QueryInterface(Components.interfaces.nsIRDFLiteral); + if (banner) banner = banner.Value; + var target = internetSearchStore.GetTarget(src, htmlProperty, true); if (target) target = target.QueryInterface(Components.interfaces.nsIRDFLiteral); if (target) target = target.Value; @@ -58,14 +59,17 @@ function doClick(node) } if (gEditorShell) { - var text = target; + var text = ""; + if (banner) + { + // add a and a
just in case + text += banner + "
"; + } + text += target; gEditorShell.SelectAll(); gEditorShell.DeleteSelection(2); -// gEditorShell.SetTextProperty("font", "size", "-2"); gEditorShell.InsertSource(text); -// gEditorShell.SelectAll(); -// gEditorShell.SetTextProperty("font", "size", "-2"); } } } diff --git a/xpfe/components/search/resources/internetresults.xul b/xpfe/components/search/resources/internetresults.xul index e884156e6759..879ec76852e4 100644 --- a/xpfe/components/search/resources/internetresults.xul +++ b/xpfe/components/search/resources/internetresults.xul @@ -6,7 +6,6 @@ @@ -18,7 +17,7 @@ ]> - @@ -67,7 +66,7 @@ - + @@ -136,5 +135,5 @@ - +