-
-
diff --git a/mozilla/xpfe/components/directory/directory.js b/mozilla/xpfe/components/directory/directory.js
deleted file mode 100644
index a5fc41ac7c8..00000000000
--- a/mozilla/xpfe/components/directory/directory.js
+++ /dev/null
@@ -1,323 +0,0 @@
-/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; -*- */
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla 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/MPL/
- *
- * 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 the Initial Developer are Copyright (C) 1998
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- * Bradley Baetz
- * Joe Hewitt
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either of the GNU General Public License Version 2 or later (the "GPL"),
- * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-/*
- Script for the directory window
-*/
-
-const RDFSERVICE_CONTRACTID = "@mozilla.org/rdf/rdf-service;1";
-const DRAGSERVICE_CONTRACTID = "@mozilla.org/widget/dragservice;1";
-const TRANSFERABLE_CONTRACTID = "@mozilla.org/widget/transferable;1";
-const XULSORTSERVICE_CONTRACTID = "@mozilla.org/xul/xul-sort-service;1";
-const ARRAY_CONTRACTID = "@mozilla.org/supports-array;1";
-const WSTRING_CONTRACTID = "@mozilla.org/supports-string;1";
-
-const NC_NS = "http://home.netscape.com/NC-rdf#";
-const NC_NAME = NC_NS + "Name";
-const NC_URL = NC_NS + "URL";
-const NC_LOADING = NC_NS + "loading";
-
-const nsIHTTPIndex = Components.interfaces.nsIHTTPIndex;
-const nsIDragService = Components.interfaces.nsIDragService;
-const nsITransferable = Components.interfaces.nsITransferable;
-const nsIXULSortService = Components.interfaces.nsIXULSortService;
-const nsIRDFService = Components.interfaces.nsIRDFService;
-const nsIRDFLiteral = Components.interfaces.nsIRDFLiteral;
-const nsISupportsArray = Components.interfaces.nsISupportsArray;
-const nsISupportsString = Components.interfaces.nsISupportsString;
-
-// By the time this runs, The 'HTTPIndex' variable will have been
-// magically set on the global object by the native code.
-
-function debug(msg)
-{
- // Uncomment to print out debug info.
- //dump(msg);
-}
-
-var loadingArc = null;
-var loadingLevel = 0;
-
-var RDF_observer =
-{
- onAssert: function(ds, src, prop, target)
- {
- if (prop == loadingArc) {
- if (loadingLevel++ == 0)
- SetBusyCursor(window, true);
- debug("Directory: assert: loading level is " + loadingLevel + " for " + src.Value + "\n");
- }
- },
-
- onUnassert: function(ds, src, prop, target)
- {
- if (prop == loadingArc) {
- if (loadingLevel > 0)
- if (--loadingLevel == 0)
- SetBusyCursor(window, false);
- debug("Directory: unassert: loading level is " + loadingLevel + " for " + src.Value + "\n");
- }
- },
-
- onChange: function(ds, src, prop, old_target, new_target) { },
- onMove: function(ds, old_src, new_src, prop, target) { },
- onBeginUpdateBatch: function(ds) { },
- onEndUpdateBatch: function(ds) { }
-};
-
-function
-SetBusyCursor(window, enable)
-{
- // Defensive check: setCursor() is only available for
- // chrome windows. Since one of our frame might be a
- // non-chrome window, make sure the window we treat has
- // a setCursor method.
- if("setCursor" in window) {
- if(enable == true) {
- window.setCursor("wait");
- debug("Directory: cursor=busy\n");
- } else {
- window.setCursor("auto");
- debug("Directory: cursor=notbusy\n");
- }
- }
-
- var numFrames = window.frames.length;
- for (var i = 0; i < numFrames; i++)
- SetBusyCursor(window.frames[i], enable);
-}
-
-// We need this hack because we've completely circumvented the onload() logic.
-function Boot()
-{
- if (document.getElementById('tree'))
- Init();
- else
- setTimeout("Boot()", 500);
-}
-
-setTimeout("Boot()", 0);
-
-function Init()
-{
- debug("directory.js: Init()\n");
-
- var tree = document.getElementById('tree');
-
- // Initialize the tree's base URL to whatever the HTTPIndex is rooted at
- var baseURI = HTTPIndex.BaseURL;
-
- if (baseURI && (baseURI.indexOf("ftp://") == 0)) {
- // fix bug # 37102: if its a FTP directory
- // ensure it ends with a trailing slash
- if (baseURI.substr(baseURI.length - 1) != "/") {
- debug("append traiing slash to FTP directory URL\n");
- baseURI += "/";
- }
-
- // Lets also enable the loggin window.
-
- var node = document.getElementById("main-splitter");
- node.setAttribute("hidden", false);
-
- node = document.getElementById("logbox");
- node.setAttribute("hidden", false);
- }
-
- if (baseURI && (baseURI.indexOf("file://") != 0)) {
- // Note: DON'T add the HTTPIndex datasource into the tree
- // for file URLs, only do it for FTP/Gopher/etc URLs; the "rdf:files"
- // datasources handles file URLs
- tree.database.AddDataSource(HTTPIndex);
- }
-
- // Note: set encoding BEFORE setting "ref" (important!)
- var RDF = Components.classes[RDFSERVICE_CONTRACTID].getService();
- if (RDF) RDF = RDF.QueryInterface(nsIRDFService);
- if (RDF) {
- loadingArc = RDF.GetResource(NC_LOADING, true);
-
- var httpDS = HTTPIndex.DataSource;
- if (httpDS) httpDS = httpDS.QueryInterface(nsIHTTPIndex);
- if (httpDS) {
- httpDS.encoding = "ISO-8859-1";
-
- // Use a default character set.
- if (window.content.defaultCharacterset)
- httpDS.encoding = window.content.defaultCharacterset;
- }
- }
-
- // set window title
- document.title = baseURI;
-
- tree.database.AddObserver(RDF_observer);
- debug("Directory: added observer\n");
-
- // root the tree (do this last)
- tree.setAttribute("ref", baseURI);
-}
-
-function DoUnload()
-{
- var tree = document.getElementById("tree");
- if (tree) {
- tree.database.RemoveDataSource(HTTPIndex);
- tree.database.RemoveObserver(RDF_observer);
- debug("Directory: removed observer\n");
- }
-}
-
-function OnClick(event)
-{
- if (event.target.localName != "treechildren")
- return false;
- if( event.type == "click" && (event.button != 0 || event.detail != 2))
- return false;
- if( event.type == "keypress" && event.keyCode != 13)
- return false;
-
- var tree = document.getElementById("tree");
- if (tree.currentIndex >= 0) {
- var item = tree.contentView.getItemAtIndex(tree.currentIndex);
- window.content.location.href = item.getAttributeNS(NC_NS, "url");
- }
-}
-
-function doSort(aTarget)
-{
- if (aTarget.localName != "treecol")
- return;
-
- // determine column resource to sort on
- var sortResource = aTarget.getAttribute('resource');
-
- // switch between ascending & descending sort (no natural order support)
- var sortDirection = aTarget.getAttribute("sortDirection") == "ascending" ? "descending" : "ascending";
-
- try {
- var sortService = Components.classes[XULSORTSERVICE_CONTRACTID].getService(nsIXULSortService);
- sortService.sort(aTarget, sortResource, sortDirection);
- } catch(ex) { }
-}
-
-function BeginDragTree (event)
-{
- if (event.target.localName != "treechildren")
- return true;
-
- var dragStarted = false;
-
- try {
- // determine which treeitem was dragged
- var tree = document.getElementById("tree");
- var row = tree.treeBoxObject.getRowAt(event.clientX, event.clientY);
- var item = tree.contentView.getItemAtIndex(row);
-
- // get information from treeitem for drag
- var url = item.getAttributeNS(NC_NS, "url");
- var desc = item.getAttributeNS(NC_NS, "desc");
-
- var RDF = Components.classes[RDFSERVICE_CONTRACTID].getService(nsIRDFService);
- var transferable =
- Components.classes[TRANSFERABLE_CONTRACTID].createInstance(nsITransferable);
- var genDataURL =
- Components.classes[WSTRING_CONTRACTID].createInstance(nsISupportsString);
- var genDataHTML =
- Components.classes[WSTRING_CONTRACTID].createInstance(nsISupportsString);
- var genData =
- Components.classes[WSTRING_CONTRACTID].createInstance(nsISupportsString);
- var genDataURL =
- Components.classes[WSTRING_CONTRACTID].createInstance(nsISupportsString);
-
- transferable.addDataFlavor("text/x-moz-url");
- transferable.addDataFlavor("text/html");
- transferable.addDataFlavor("text/unicode");
-
- genDataURL.data = url + "\n" + desc;
- genDataHTML.data = "" + desc + "";
- genData.data = url;
-
- transferable.setTransferData("text/x-moz-url", genDataURL, genDataURL.data.length * 2);
- transferable.setTransferData("text/html", genDataHTML, genDataHTML.data.length * 2);
- transferable.setTransferData("text/unicode", genData, genData.data.length * 2);
-
- var transArray =
- Components.classes[ARRAY_CONTRACTID].createInstance(nsISupportsArray);
-
- // put it into the transferable as an |nsISupports|
- var genTrans = transferable.QueryInterface(Components.interfaces.nsISupports);
- transArray.AppendElement(genTrans);
-
- var dragService =
- Components.classes[DRAGSERVICE_CONTRACTID].getService(nsIDragService);
-
- dragService.invokeDragSession(event.target, transArray, null, nsIDragService.DRAGDROP_ACTION_COPY +
- nsIDragService.DRAGDROP_ACTION_MOVE);
-
- dragStarted = true;
- } catch (ex) { }
-
- return !dragStarted;
-}
-
-function scrollDown()
-{
- window.frames[0].scrollTo(0, window.frames[0].document.height);
-}
-
-function OnFTPControlLog( server, msg )
-{
- var logdoc = frames[0].document;
- var logdocDiv = logdoc.getElementById("logboxDiv");
- var div = document.createElementNS("http://www.w3.org/1999/xhtml",
- "html:div");
-
- if (server)
- div.setAttribute("class", "server");
- else
- div.setAttribute("class", "client");
-
- div.appendChild (document.createTextNode(msg));
-
- logdocDiv.appendChild(div);
-
- scrollDown();
-}
-
diff --git a/mozilla/xpfe/components/directory/directory.xul b/mozilla/xpfe/components/directory/directory.xul
deleted file mode 100644
index 02a54530b2a..00000000000
--- a/mozilla/xpfe/components/directory/directory.xul
+++ /dev/null
@@ -1,104 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/mozilla/xpfe/components/directory/locale/en-US/directory.dtd b/mozilla/xpfe/components/directory/locale/en-US/directory.dtd
deleted file mode 100644
index 01aa2cbe1e7..00000000000
--- a/mozilla/xpfe/components/directory/locale/en-US/directory.dtd
+++ /dev/null
@@ -1,3 +0,0 @@
-
-
-
diff --git a/mozilla/xpfe/components/history/resources/findHistory.js b/mozilla/xpfe/components/history/resources/findHistory.js
deleted file mode 100644
index 4b7dfda6fd7..00000000000
--- a/mozilla/xpfe/components/history/resources/findHistory.js
+++ /dev/null
@@ -1,84 +0,0 @@
-/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla 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/MPL/
- *
- * 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 the Initial Developer are Copyright (C) 1998
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- * Ben Goodger (Original Author)
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either of the GNU General Public License Version 2 or later (the "GPL"),
- * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-var gOKButton;
-var gSearchField;
-function Startup()
-{
- var bundle = document.getElementById("historyBundle");
- gOKButton = document.documentElement.getButton("accept");
- gOKButton.disabled = true;
- gSearchField = document.getElementById("searchField");
- gSearchField.focus();
-}
-
-function find()
-{
- // Build up a find URI from the search fields and open a new window
- // rooted on the URI.
- var match = document.getElementById("matchList");
- var method = document.getElementById("methodList");
- var searchURI = "find:datasource=history"
- searchURI += "&match=" + match.selectedItem.value;
- searchURI += "&method=" + method.selectedItem.value;
- searchURI += "&text=" + encodeURIComponent(gSearchField.value);
- var hstWindow = findMostRecentWindow("history:searchresults", "chrome://communicator/content/history/history.xul", searchURI);
-
- // Update the root of the tree if we're using an existing search window.
- if (!gCreatingNewWindow)
- hstWindow.setRoot(searchURI);
-
- hstWindow.focus();
- return true;
-}
-
-var gCreatingNewWindow = false;
-function findMostRecentWindow(aType, aURI, aParam)
-{
- var WM = Components.classes['@mozilla.org/appshell/window-mediator;1'].getService();
- WM = WM.QueryInterface(Components.interfaces.nsIWindowMediator);
- var topWindow = WM.getMostRecentWindow(aType);
- if (!topWindow) gCreatingNewWindow = true;
- return topWindow || openDialog("chrome://communicator/content/history/history.xul",
- "", "chrome,all,dialog=no", aParam);
-}
-
-function doEnabling()
-{
- gOKButton.disabled = !gSearchField.value;
-}
diff --git a/mozilla/xpfe/components/history/resources/findHistory.xul b/mozilla/xpfe/components/history/resources/findHistory.xul
deleted file mode 100644
index 75e31a5a274..00000000000
--- a/mozilla/xpfe/components/history/resources/findHistory.xul
+++ /dev/null
@@ -1,80 +0,0 @@
-
-
-
-
-
-
-
-
-
-
diff --git a/mozilla/xpfe/components/history/resources/history-panel.xul b/mozilla/xpfe/components/history/resources/history-panel.xul
deleted file mode 100644
index a7694a3931f..00000000000
--- a/mozilla/xpfe/components/history/resources/history-panel.xul
+++ /dev/null
@@ -1,82 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/mozilla/xpfe/components/history/resources/history-test.js b/mozilla/xpfe/components/history/resources/history-test.js
deleted file mode 100644
index 8b5970576f5..00000000000
--- a/mozilla/xpfe/components/history/resources/history-test.js
+++ /dev/null
@@ -1,60 +0,0 @@
-/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla 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/MPL/
- *
- * 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 the Initial Developer are Copyright (C) 1998
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either of the GNU General Public License Version 2 or later (the "GPL"),
- * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-function ShowLastPageVisited() {
- dump("start of ShowLastPageVisited()\n");
-
- var lastpagevisited = "failure...not set";
-
- var history = Components.classes['@mozilla.org/browser/global-history;1'];
- if (history) {
- history = history.getService();
- }
- if (history) {
- history = history.QueryInterface(Components.interfaces.nsIGlobalHistory);
- }
- if (history) {
- try {
- lastpagevisited = history.lastPageVisited;
- document.getElementById('result').value = lastpagevisited;
- }
- catch (ex) {
- dump(ex + "\n");
- document.getElementById('result').value = "Error check console";
- }
- }
-}
diff --git a/mozilla/xpfe/components/history/resources/history-test.xul b/mozilla/xpfe/components/history/resources/history-test.xul
deleted file mode 100644
index 163af3c83a7..00000000000
--- a/mozilla/xpfe/components/history/resources/history-test.xul
+++ /dev/null
@@ -1,20 +0,0 @@
-
-
-
-
-
-
-
-
-history test
-
-
-
-
-
-
-Show Last Page Visited
-
diff --git a/mozilla/xpfe/components/history/resources/history.js b/mozilla/xpfe/components/history/resources/history.js
deleted file mode 100644
index e1b652b5e9c..00000000000
--- a/mozilla/xpfe/components/history/resources/history.js
+++ /dev/null
@@ -1,543 +0,0 @@
-/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla 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/MPL/
- *
- * 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 the Initial Developer are Copyright (C) 1998
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- * Alec Flett
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either of the GNU General Public License Version 2 or later (the "GPL"),
- * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-// The history window uses JavaScript in bookmarks.js too.
-
-var gHistoryTree;
-var gLastHostname;
-var gLastDomain;
-var gGlobalHistory;
-var gPrefService;
-var gIOService;
-var gDeleteByHostname;
-var gDeleteByDomain;
-var gHistoryBundle;
-var gHistoryStatus;
-var gHistoryGrouping = "";
-
-function HistoryCommonInit()
-{
- gHistoryTree = document.getElementById("historyTree");
- gDeleteByHostname = document.getElementById("menu_deleteByHostname");
- gDeleteByDomain = document.getElementById("menu_deleteByDomain");
- gHistoryBundle = document.getElementById("historyBundle");
- gHistoryStatus = document.getElementById("statusbar-display");
-
- var treeController = new nsTreeController(gHistoryTree);
- var historyController = new nsHistoryController;
- gHistoryTree.controllers.appendController(historyController);
-
- gPrefService = Components.classes["@mozilla.org/preferences-service;1"]
- .getService(Components.interfaces.nsIPrefBranch);
- PREF = gPrefService; // need this for bookmarks.js
-
- if ("arguments" in window && window.arguments[0] && window.arguments.length >= 1) {
- // We have been supplied a resource URI to root the tree on
- var uri = window.arguments[0];
- gHistoryTree.setAttribute("ref", uri);
- if (uri.substring(0,5) == "find:" &&
- !(window.arguments.length > 1 && window.arguments[1] == "newWindow")) {
- // Update the windowtype so that future searches are directed
- // there and the window is not re-used for bookmarks.
- var windowNode = document.getElementById("history-window");
- windowNode.setAttribute("windowtype", "history:searchresults");
- document.title = gHistoryBundle.getString("search_results_title");
-
- }
- document.getElementById("groupingMenu").setAttribute("hidden", "true");
- }
- else {
- try {
- gHistoryGrouping = gPrefService.getCharPref("browser.history.grouping");
- }
- catch(e) {
- gHistoryGrouping = "day";
- }
- UpdateTreeGrouping();
- if (gHistoryStatus) { // must be the window
- switch(gHistoryGrouping) {
- case "none":
- document.getElementById("groupByNone").setAttribute("checked", "true");
- break;
- case "site":
- document.getElementById("groupBySite").setAttribute("checked", "true");
- break;
- case "day":
- default:
- document.getElementById("groupByDay").setAttribute("checked", "true");
- }
- }
- else { // must be the sidebar panel
- var pb = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);
- var pbi = pb.QueryInterface(Components.interfaces.nsIPrefBranch2);
- pbi.addObserver("browser.history.grouping", groupObserver, false);
- }
- }
-
- SortInNewDirection(find_sort_direction(find_sort_column()));
-
- if (gHistoryStatus)
- gHistoryTree.focus();
-
- if (gHistoryTree.view.rowCount > 0)
- gHistoryTree.view.selection.select(0);
- else if (gHistoryStatus)
- updateHistoryCommands();
-}
-
-function HistoryPanelUnload()
-{
- var pb = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);
- var pbi = pb.QueryInterface(Components.interfaces.nsIPrefBranch2);
- pbi.removeObserver("browser.history.grouping", groupObserver, false);
-}
-
-function updateHistoryCommands()
-{
- goUpdateCommand("cmd_deleteByHostname");
- goUpdateCommand("cmd_deleteByDomain");
-}
-
-function historyOnClick(aEvent)
-{
- // This is kind of a hack but matches the currently implemented behaviour.
- // If a status bar is not present, assume we're in sidebar mode, and thus single clicks on containers
- // will open the container. Single clicks on non-containers are handled below in historyOnSelect.
- if (gHistoryStatus && aEvent.button == 0)
- return;
-
- var target = BookmarksUtils.getBrowserTargetFromEvent(aEvent);
- if (!target)
- return;
-
- var row = { };
- var col = { };
- var elt = { };
- gHistoryTree.treeBoxObject.getCellAt(aEvent.clientX, aEvent.clientY, row, col, elt);
- if (row.value >= 0 && col.value) {
- if (!isContainer(gHistoryTree, row.value))
- OpenURL(target, aEvent);
- else if (aEvent.button == 0 && elt.value != "twisty")
- gHistoryTree.treeBoxObject.view.toggleOpenState(row.value);
- }
-}
-
-function historyOnSelect()
-{
- // every time selection changes, save the last hostname
- gLastHostname = "";
- gLastDomain = "";
- var match;
- var currentIndex = gHistoryTree.currentIndex;
- var rowIsContainer = currentIndex < 0 || (gHistoryGrouping != "none" && isContainer(gHistoryTree, currentIndex));
- var col = gHistoryTree.columns["URL"];
- var url = rowIsContainer ? "" : gHistoryTree.view.getCellText(currentIndex, col);
-
- if (url) {
- if (!gIOService)
- gIOService = Components.classes['@mozilla.org/network/io-service;1']
- .getService(Components.interfaces.nsIIOService);
- try {
- gLastHostname = gIOService.newURI(url, null, null).host;
- // matches the last foo.bar in foo.bar or baz.foo.bar
- match = gLastHostname.match(/([^.]+\.[^.]+$)/);
- if (match)
- gLastDomain = match[1];
- } catch (e) {}
- }
-
- if (gHistoryStatus)
- gHistoryStatus.label = url;
-
- document.commandDispatcher.updateCommands("select");
-}
-
-function nsHistoryController()
-{
-}
-
-nsHistoryController.prototype =
-{
- supportsCommand: function(command)
- {
- switch(command) {
- case "cmd_deleteByHostname":
- case "cmd_deleteByDomain":
- return true;
- default:
- return false;
- }
- },
-
- isCommandEnabled: function(command)
- {
- var enabled = false;
- var text;
- switch(command) {
- case "cmd_deleteByHostname":
- if (gLastHostname) {
- text = gHistoryBundle.getFormattedString("deleteHost", [ gLastHostname ]);
- enabled = true;
- } else {
- text = gHistoryBundle.getString("deleteHostNoSelection");
- }
-
- gDeleteByHostname.label = text;
- break;
- case "cmd_deleteByDomain":
- if (gLastDomain) {
- text = gHistoryBundle.getFormattedString("deleteDomain", [ gLastDomain ]);
- enabled = true;
- } else {
- text = gHistoryBundle.getString("deleteDomainNoSelection");
- }
-
- gDeleteByDomain.label = text;
- }
- return enabled;
- },
-
- doCommand: function(command)
- {
- switch(command) {
- case "cmd_deleteByHostname":
- if (!gGlobalHistory)
- gGlobalHistory = Components.classes["@mozilla.org/browser/global-history;2"].getService(Components.interfaces.nsIBrowserHistory);
- gGlobalHistory.removePagesFromHost(gLastHostname, false)
- return true;
-
- case "cmd_deleteByDomain":
- if (!gGlobalHistory)
- gGlobalHistory = Components.classes["@mozilla.org/browser/global-history;2"].getService(Components.interfaces.nsIBrowserHistory);
- gGlobalHistory.removePagesFromHost(gLastDomain, true)
- return true;
-
- default:
- return false;
- }
- }
-}
-
-var historyDNDObserver = {
- onDragStart: function (aEvent, aXferData, aDragAction)
- {
- var currentIndex = gHistoryTree.currentIndex;
- if (isContainer(gHistoryTree, currentIndex))
- return false;
- var col = gHistoryTree.columns["URL"];
- var url = gHistoryTree.view.getCellText(currentIndex, col);
- col = gHistoryTree.columns["Name"];
- var title = gHistoryTree.view.getCellText(currentIndex, col);
-
- var htmlString = "" + title + "";
- aXferData.data = new TransferData();
- aXferData.data.addDataForFlavour("text/unicode", url);
- aXferData.data.addDataForFlavour("text/html", htmlString);
- aXferData.data.addDataForFlavour("text/x-moz-url", url + "\n" + title);
- return true;
- }
-};
-
-function validClickConditions(event)
-{
- var currentIndex = gHistoryTree.currentIndex;
- if (currentIndex == -1) return false;
- var container = isContainer(gHistoryTree, currentIndex);
- return (event.button == 0 &&
- event.originalTarget.localName == 'treechildren' &&
- !container && gHistoryStatus);
-}
-
-function collapseExpand()
-{
- var currentIndex = gHistoryTree.currentIndex;
- gHistoryTree.treeBoxObject.view.toggleOpenState(currentIndex);
-}
-
-function OpenURL(aTarget, aEvent)
-{
- var currentIndex = gHistoryTree.currentIndex;
- var builder = gHistoryTree.builder.QueryInterface(Components.interfaces.nsIXULTreeBuilder);
- var url = builder.getResourceAtIndex(currentIndex).ValueUTF8;
- if (!gIOService)
- gIOService = Components.classes['@mozilla.org/network/io-service;1']
- .getService(Components.interfaces.nsIIOService);
- try {
- var scheme = gIOService.extractScheme(url);
- if (scheme == "javascript" || scheme == "data") {
- var strBundleService = Components.classes["@mozilla.org/intl/stringbundle;1"]
- .getService(Components.interfaces.nsIStringBundleService);
- var promptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
- .getService(Components.interfaces.nsIPromptService);
- var historyBundle = strBundleService.createBundle("chrome://communicator/locale/history/history.properties");
- var brandBundle = strBundleService.createBundle("chrome://branding/locale/brand.properties");
- var brandStr = brandBundle.GetStringFromName("brandShortName");
- var errorStr = historyBundle.GetStringFromName("load-js-data-url-error");
- promptService.alert(window, brandStr, errorStr);
- return false;
- }
- } catch (e) {
- return false;
- }
-
- if (aTarget != "current") {
- var count = gHistoryTree.view.selection.count;
- var URLArray = [];
- if (count == 1) {
- if (isContainer(gHistoryTree, currentIndex))
- openDialog("chrome://communicator/content/history/history.xul",
- "", "chrome,all,dialog=no", url, "newWindow");
- else
- URLArray.push(url);
- }
- else {
- var col = gHistoryTree.columns["URL"];
- var min = new Object();
- var max = new Object();
- var rangeCount = gHistoryTree.view.selection.getRangeCount();
- for (var i = 0; i < rangeCount; ++i) {
- gHistoryTree.view.selection.getRangeAt(i, min, max);
- for (var k = max.value; k >= min.value; --k) {
- url = gHistoryTree.view.getCellText(k, col);
- URLArray.push(url);
- }
- }
- }
- if (aTarget == "window") {
- for (i = 0; i < URLArray.length; i++) {
- openDialog(getBrowserURL(), "_blank", "chrome,all,dialog=no", URLArray[i]);
- }
- } else {
- if (URLArray.length > 0)
- OpenURLArrayInTabs(URLArray, BookmarksUtils.shouldLoadTabInBackground(aEvent));
- }
- }
- else if (!isContainer(gHistoryTree, currentIndex))
- openTopWin(url);
- return true;
-}
-
-// This opens the URLs contained in the given array in new tabs
-// of the most recent window, creates a new window if necessary.
-function OpenURLArrayInTabs(aURLArray, aBackground)
-{
- var browserWin = getTopWin();
- if (browserWin) {
- var browser = browserWin.getBrowser();
- var tab = browser.addTab(aURLArray[0]);
- if (!aBackground)
- browser.selectedTab = tab;
- for (var i = 1; i < aURLArray.length; ++i)
- browser.addTab(aURLArray[i]);
- } else {
- openTopWin(aURLArray.join("\n")); // Pretend that we're a home page group
- }
-}
-
-/**
- * Root the tree on a given URI (used for displaying search results)
- */
-function setRoot(root)
-{
- gHistoryTree.ref = root;
-}
-
-function GroupBy(aGroupingType)
-{
- gHistoryGrouping = aGroupingType;
- UpdateTreeGrouping();
- gPrefService.setCharPref("browser.history.grouping", aGroupingType);
-}
-
-function UpdateTreeGrouping()
-{
- var tree = document.getElementById("historyTree");
- switch(gHistoryGrouping) {
- case "none":
- tree.setAttribute("ref", "NC:HistoryRoot");
- break;
- case "site":
- tree.setAttribute("ref", "find:datasource=history&groupby=Hostname");
- break;
- case "day":
- default:
- tree.setAttribute("ref", "NC:HistoryByDate");
- break;
- }
-}
-
-var groupObserver = {
- observe: function(aPrefBranch, aTopic, aPrefName) {
- try {
- gHistoryGrouping = gPrefService.getCharPref("browser.history.grouping");
- }
- catch(e) {
- gHistoryGrouping = "day";
- }
- UpdateTreeGrouping();
- }
-}
-
-function historyAddBookmarks()
-{
- var urlCol = gHistoryTree.columns["URL"];
- var titleCol = gHistoryTree.columns["Name"];
-
- var count = gHistoryTree.view.selection.count;
- var url;
- var title;
- if (count == 1) {
- var currentIndex = gHistoryTree.currentIndex;
- url = gHistoryTree.treeBoxObject.view.getCellText(currentIndex, urlCol);
- title = gHistoryTree.treeBoxObject.view.getCellText(currentIndex, titleCol);
- BookmarksUtils.addBookmark(url, title, null, true);
- }
- else if (count > 1) {
- var min = new Object();
- var max = new Object();
- var rangeCount = gHistoryTree.view.selection.getRangeCount();
- if (!BMSVC) {
- initServices();
- initBMService();
- }
- for (var i = 0; i < rangeCount; ++i) {
- gHistoryTree.view.selection.getRangeAt(i, min, max);
- for (var k = max.value; k >= min.value; --k) {
- url = gHistoryTree.view.getCellText(k, urlCol);
- title = gHistoryTree.view.getCellText(k, titleCol);
- BookmarksUtils.addBookmark(url, title, null, false);
- }
- }
- }
-}
-
-
-function updateItems()
-{
- var count = gHistoryTree.view.selection.count;
- var openItem = document.getElementById("miOpen");
- var bookmarkItem = document.getElementById("miAddBookmark");
- var copyLocationItem = document.getElementById("miCopyLinkLocation");
- var sep1 = document.getElementById("pre-bookmarks-separator");
- var sep2 = document.getElementById("post-bookmarks-separator");
- var openItemInNewWindow = document.getElementById("miOpenInNewWindow");
- var openItemInNewTab = document.getElementById("miOpenInNewTab");
- var collapseExpandItem = document.getElementById("miCollapseExpand");
- if (count > 1) {
- var hasContainer = false;
- if (gHistoryGrouping != "none") {
- var min = new Object();
- var max = new Object();
- var rangeCount = gHistoryTree.view.selection.getRangeCount();
- for (var i = 0; i < rangeCount; ++i) {
- gHistoryTree.view.selection.getRangeAt(i, min, max);
- for (var k = max.value; k >= min.value; --k) {
- if (isContainer(gHistoryTree, k)) {
- hasContainer = true;
- break;
- }
- }
- }
- }
- collapseExpandItem.hidden = true;
- openItem.hidden = true;
- if (hasContainer) { // several items selected, folder(s) amongst them
- bookmarkItem.hidden = true;
- copyLocationItem.hidden = true;
- sep1.hidden = true;
- sep2.hidden = true;
- openItemInNewWindow.hidden = true;
- openItemInNewTab.hidden = true;
- }
- else { // several items selected, but no folder
- bookmarkItem.hidden = false;
- copyLocationItem.hidden = false;
- sep1.hidden = false;
- sep2.hidden = false;
- bookmarkItem.setAttribute("label", document.getElementById('multipleBookmarks').getAttribute("label"));
- bookmarkItem.setAttribute("accesskey", document.getElementById('multipleBookmarks').getAttribute("accesskey"));
- openItem.removeAttribute("default");
- openItemInNewWindow.setAttribute("default", "true");
- openItemInNewWindow.hidden = false;
- openItemInNewTab.hidden = false;
- }
- }
- else {
- openItemInNewWindow.hidden = false;
- bookmarkItem.setAttribute("label", document.getElementById('oneBookmark').getAttribute("label"));
- bookmarkItem.setAttribute("accesskey", document.getElementById('oneBookmark').getAttribute("accesskey"));
- sep2.hidden = false;
- var currentIndex = gHistoryTree.currentIndex;
- if (isContainer(gHistoryTree, currentIndex)) { // one folder selected
- openItem.hidden = true;
- openItem.removeAttribute("default");
- openItemInNewWindow.removeAttribute("default");
- openItemInNewTab.hidden = true;
- collapseExpandItem.hidden = false;
- collapseExpandItem.setAttribute("default", "true");
- bookmarkItem.hidden = true;
- copyLocationItem.hidden = true;
- sep1.hidden = true;
- if (isContainerOpen(gHistoryTree, currentIndex)) {
- collapseExpandItem.setAttribute("label", gHistoryBundle.getString("collapseLabel"));
- collapseExpandItem.setAttribute("accesskey", gHistoryBundle.getString("collapseAccesskey"));
- }
- else {
- collapseExpandItem.setAttribute("label", gHistoryBundle.getString("expandLabel"));
- collapseExpandItem.setAttribute("accesskey", gHistoryBundle.getString("expandAccesskey"));
- }
- return true;
- } // one entry selected (not a folder)
- openItemInNewTab.hidden = false;
- collapseExpandItem.hidden = true;
- bookmarkItem.hidden = false;
- copyLocationItem.hidden = false;
- sep1.hidden = false;
- if (!getTopWin()) {
- openItem.hidden = true;
- openItem.removeAttribute("default");
- openItemInNewWindow.setAttribute("default", "true");
- }
- else {
- openItem.hidden = false;
- if (!openItem.getAttribute("default"))
- openItem.setAttribute("default", "true");
- openItemInNewWindow.removeAttribute("default");
- }
- }
- return true;
-}
diff --git a/mozilla/xpfe/components/history/resources/history.xul b/mozilla/xpfe/components/history/resources/history.xul
deleted file mode 100644
index 1e250ef1ca3..00000000000
--- a/mozilla/xpfe/components/history/resources/history.xul
+++ /dev/null
@@ -1,160 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/mozilla/xpfe/components/history/resources/historyTreeOverlay.xul b/mozilla/xpfe/components/history/resources/historyTreeOverlay.xul
deleted file mode 100644
index ac682c8e62e..00000000000
--- a/mozilla/xpfe/components/history/resources/historyTreeOverlay.xul
+++ /dev/null
@@ -1,163 +0,0 @@
-
-
-
-
-%historyDTD;
-
-%contentAreaCommandsDTD;
-]>
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/mozilla/xpfe/components/history/resources/locale/en-US/findHistory.dtd b/mozilla/xpfe/components/history/resources/locale/en-US/findHistory.dtd
deleted file mode 100644
index bbd5d8f59fa..00000000000
--- a/mozilla/xpfe/components/history/resources/locale/en-US/findHistory.dtd
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/mozilla/xpfe/components/history/resources/locale/en-US/history.dtd b/mozilla/xpfe/components/history/resources/locale/en-US/history.dtd
deleted file mode 100644
index 3eaab3f6ecf..00000000000
--- a/mozilla/xpfe/components/history/resources/locale/en-US/history.dtd
+++ /dev/null
@@ -1,35 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/mozilla/xpfe/components/history/resources/locale/en-US/history.properties b/mozilla/xpfe/components/history/resources/locale/en-US/history.properties
deleted file mode 100644
index 4a1ef618a68..00000000000
--- a/mozilla/xpfe/components/history/resources/locale/en-US/history.properties
+++ /dev/null
@@ -1,20 +0,0 @@
-deleteHost=Delete History for %S
-deleteHostNoSelection=Delete History for Site
-deleteDomain=Delete History for *.%S
-deleteDomainNoSelection=Delete History for Domain
-
-finduri-AgeInDays-is-0=Today
-finduri-AgeInDays-is-1=Yesterday
-finduri-AgeInDays-is=%S days ago
-finduri-AgeInDays-isgreater=Older than %S days
-
-finduri-Hostname-is-=(no host)
-
-search_results_title=Search Results
-
-collapseLabel=Collapse
-expandLabel=Expand
-collapseAccesskey=C
-expandAccesskey=x
-
-load-js-data-url-error=For security reasons, javascript or data urls cannot be loaded from the history window or sidebar.
diff --git a/mozilla/xpfe/components/history/resources/locale/en-US/historyTreeOverlay.dtd b/mozilla/xpfe/components/history/resources/locale/en-US/historyTreeOverlay.dtd
deleted file mode 100644
index 4617d5ebd7b..00000000000
--- a/mozilla/xpfe/components/history/resources/locale/en-US/historyTreeOverlay.dtd
+++ /dev/null
@@ -1,16 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/mozilla/xpfe/components/permissions/content/aboutPopups.xul b/mozilla/xpfe/components/permissions/content/aboutPopups.xul
deleted file mode 100644
index 4d1445b7712..00000000000
--- a/mozilla/xpfe/components/permissions/content/aboutPopups.xul
+++ /dev/null
@@ -1,102 +0,0 @@
-
-
-
-
-
-
-
-
- %brandDTD;
-
- %aboutPopupsDTD;
-]>
-
-
diff --git a/mozilla/xpfe/components/permissions/content/cookieP3P.xul b/mozilla/xpfe/components/permissions/content/cookieP3P.xul
deleted file mode 100644
index ce6c6a484ad..00000000000
--- a/mozilla/xpfe/components/permissions/content/cookieP3P.xul
+++ /dev/null
@@ -1,262 +0,0 @@
-
-
-
-
-
-
-
-
-
-
diff --git a/mozilla/xpfe/components/permissions/content/cookieP3PDialog.xul b/mozilla/xpfe/components/permissions/content/cookieP3PDialog.xul
deleted file mode 100644
index a092f5874bd..00000000000
--- a/mozilla/xpfe/components/permissions/content/cookieP3PDialog.xul
+++ /dev/null
@@ -1,113 +0,0 @@
-
-
-
-
-
-
-
-
-
-
diff --git a/mozilla/xpfe/components/permissions/content/cookieTasksOverlay.xul b/mozilla/xpfe/components/permissions/content/cookieTasksOverlay.xul
deleted file mode 100644
index 784e906e99f..00000000000
--- a/mozilla/xpfe/components/permissions/content/cookieTasksOverlay.xul
+++ /dev/null
@@ -1,135 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/mozilla/xpfe/components/permissions/content/cookieViewer.js b/mozilla/xpfe/components/permissions/content/cookieViewer.js
deleted file mode 100644
index d8bd00a6bdf..00000000000
--- a/mozilla/xpfe/components/permissions/content/cookieViewer.js
+++ /dev/null
@@ -1,722 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
- *
- * ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla 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/MPL/
- *
- * 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 Communicator client code, released
- * March 31, 1998.
- *
- * The Initial Developer of the Original Code is
- * Netscape Communications Corporation.
- * Portions created by the Initial Developer are Copyright (C) 1998
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- * Ben Goodger
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-var kObserverService;
-
-// interface variables
-var cookiemanager = null; // cookiemanager interface
-var permissionmanager = null; // permissionmanager interface
-var promptservice = null; // promptservice interface
-var popupmanager = null; // popup manager
-var gDateService = null;
-
-// cookies and permissions list
-var cookies = [];
-var permissions = [];
-var deletedCookies = [];
-var deletedPermissions = [];
-
-// differentiate between cookies, images, and popups
-const nsIPermissionManager = Components.interfaces.nsIPermissionManager;
-const nsICookiePermission = Components.interfaces.nsICookiePermission;
-const cookieType = "cookie";
-const imageType = "image";
-const popupType = "popup";
-
-
-var dialogType = cookieType;
-if (window.arguments[0] == "imageManager")
- dialogType = imageType;
-else if (window.arguments[0] == "popupManager")
- dialogType = popupType;
-
-var cookieBundle;
-var gUpdatingBatch = "";
-
-function Startup() {
-
- // arguments passed to this routine:
- // cookieManager
- // cookieManagerFromIcon
- // imageManager
-
- // xpconnect to cookiemanager/permissionmanager/promptservice/popupmanager interfaces
- cookiemanager = Components.classes["@mozilla.org/cookiemanager;1"].getService();
- cookiemanager = cookiemanager.QueryInterface(Components.interfaces.nsICookieManager);
- permissionmanager = Components.classes["@mozilla.org/permissionmanager;1"].getService();
- permissionmanager = permissionmanager.QueryInterface(Components.interfaces.nsIPermissionManager);
- promptservice = Components.classes["@mozilla.org/embedcomp/prompt-service;1"].getService();
- promptservice = promptservice.QueryInterface(Components.interfaces.nsIPromptService);
- popupmanager = Components.classes["@mozilla.org/PopupWindowManager;1"].getService();
- popupmanager = popupmanager.QueryInterface(Components.interfaces.nsIPopupWindowManager);
-
- // intialize gDateService
- if (!gDateService) {
- const nsScriptableDateFormat_CONTRACTID = "@mozilla.org/intl/scriptabledateformat;1";
- const nsIScriptableDateFormat = Components.interfaces.nsIScriptableDateFormat;
- gDateService = Components.classes[nsScriptableDateFormat_CONTRACTID]
- .getService(nsIScriptableDateFormat);
- }
-
- // intialize string bundle
- cookieBundle = document.getElementById("cookieBundle");
-
- // label the close button
- document.documentElement.getButton("accept").label = cookieBundle.getString("close");
-
- // determine if labelling is for cookies or images
- try {
- var tabBox = document.getElementById("tabbox");
- var element;
- if (dialogType == cookieType) {
- element = document.getElementById("cookiesTab");
- tabBox.selectedTab = element;
- } else if (dialogType == imageType) {
- document.title = cookieBundle.getString("imageTitle");
-
- element = document.getElementById("permissionsTab");
- element.label = cookieBundle.getString("tabBannedImages");
- tabBox.selectedTab = element;
-
- element = document.getElementById("permissionsText");
- element.value = cookieBundle.getString("textBannedImages");
-
- // Hide a dummy vbox inside the real box
- // If the actual box is hidden, the tabbox gets confused.
- // The first tab now controls the second panel.
- // Hiding the first tab doesn't help.
- document.getElementById("dummyContainer").hidden = "true";
- document.getElementById("cookiesTab").hidden = "true";
-
- element = document.getElementById("btnSession");
- element.hidden = "true";
- } else {
- document.title = cookieBundle.getString("popupTitle");
-
- element = document.getElementById("permissionsTab");
- element.label = cookieBundle.getString("tabBannedPopups");
- tabBox.selectedTab = element;
-
- element = document.getElementById("permissionsText");
- element.value = cookieBundle.getString("textBannedPopups");
-
- document.getElementById("dummyContainer").hidden = "true";
- document.getElementById("cookiesTab").hidden = "true";
- }
- } catch(e) {
- }
- // load in the cookies and permissions
- cookiesTree = document.getElementById("cookiesTree");
- permissionsTree = document.getElementById("permissionsTree");
- if (dialogType == cookieType) {
- loadCookies();
- }
- loadPermissions();
-
- // be prepared to reload the display if anything changes
- kObserverService = Components.classes["@mozilla.org/observer-service;1"].getService(Components.interfaces.nsIObserverService);
- kObserverService.addObserver(cookieReloadDisplay, "cookie-changed", false);
- kObserverService.addObserver(cookieReloadDisplay, "perm-changed", false);
-}
-
-function Shutdown() {
- kObserverService.removeObserver(cookieReloadDisplay, "cookie-changed");
- kObserverService.removeObserver(cookieReloadDisplay, "perm-changed");
-}
-
-var cookieReloadDisplay = {
- observe: function(subject, topic, state) {
- if (topic == gUpdatingBatch)
- return;
- if (topic == "cookie-changed") {
- cookies.length = 0;
- if (lastCookieSortColumn == "rawHost") {
- lastCookieSortAscending = !lastCookieSortAscending; // prevents sort from being reversed
- }
- loadCookies();
- } else if (topic == "perm-changed") {
- permissions.length = 0;
- if (lastPermissionSortColumn == "rawHost") {
- lastPermissionSortAscending = !lastPermissionSortAscending; // prevents sort from being reversed
- }
- loadPermissions();
- }
- }
-}
-
-/*** =================== COOKIES CODE =================== ***/
-
-const nsICookie = Components.interfaces.nsICookie;
-
-var cookiesTreeView = {
- rowCount : 0,
- setTree : function(tree){},
- getImageSrc : function(row,column) {},
- getProgressMode : function(row,column) {},
- getCellValue : function(row,column) {},
- getCellText : function(row,column){
- var rv="";
- switch (column.id) {
- case "domainCol":
- rv = cookies[row].rawHost;
- break;
- case "nameCol":
- rv = cookies[row].name;
- break;
- case "statusCol":
- rv = cookies[row].status;
- break;
- case "expiresCol":
- rv = cookies[row].expires;
- break;
- }
- return rv;
- },
- isSeparator : function(index) {return false;},
- isSorted: function() { return false; },
- isContainer : function(index) {return false;},
- cycleHeader : function(aCol) {},
- getRowProperties : function(row,prop) {},
- getColumnProperties : function(column,prop) {},
- getCellProperties : function(row,column,prop) {}
- };
-var cookiesTree;
-
-function Cookie(id,name,value,isDomain,host,rawHost,path,isSecure,expires,
- status,policy) {
- this.id = id;
- this.name = name;
- this.value = value;
- this.isDomain = isDomain;
- this.host = host;
- this.rawHost = rawHost;
- this.path = path;
- this.isSecure = isSecure;
- this.expires = GetExpiresString(expires);
- this.expiresSortValue = expires;
- this.status = GetStatusString(status);
- this.policy = policy;
-}
-
-function loadCookies() {
- // load cookies into a table
- var enumerator = cookiemanager.enumerator;
- var count = 0;
- var showPolicyField = false;
- while (enumerator.hasMoreElements()) {
- var nextCookie = enumerator.getNext();
- if (!nextCookie) break;
- nextCookie = nextCookie.QueryInterface(Components.interfaces.nsICookie);
- var host = nextCookie.host;
- if (nextCookie.policy != nsICookie.POLICY_UNKNOWN) {
- showPolicyField = true;
- }
- cookies[count] =
- new Cookie(count++, nextCookie.name, nextCookie.value, nextCookie.isDomain, host,
- (host.charAt(0)==".") ? host.substring(1,host.length) : host,
- nextCookie.path, nextCookie.isSecure, nextCookie.expires,
- nextCookie.status, nextCookie.policy);
- }
- cookiesTreeView.rowCount = cookies.length;
-
- // sort and display the table
- cookiesTree.treeBoxObject.view = cookiesTreeView;
- if (window.arguments[0] == "cookieManagerFromIcon") { // came here by clicking on cookie icon
-
- // turn off the icon
- var observerService = Components.classes["@mozilla.org/observer-service;1"].getService(Components.interfaces.nsIObserverService);
- observerService.notifyObservers(null, "cookieIcon", "off");
-
- // unhide the status column and sort by reverse order on that column
- // Note that the sort routine normally does an ascending sort. The only
- // exception is if you sort on the same column more than once in a row.
- // In that case, the subsequent sorts will be the reverse of the previous ones.
- // So we are now going to force an initial reverse sort by fooling the sort routine
- // into thinking that it previously sorted on the status column and in ascending
- // order.
- document.getElementById("statusCol").removeAttribute("hidden");
- lastCookieSortAscending = true; // force order to have blanks last instead of vice versa
- lastCookieSortColumn = 'status';
- CookieColumnSort('status');
-
- } else {
- // sort by host column
- CookieColumnSort('rawHost');
- }
-
- // disable "remove all cookies" button if there are no cookies
- if (cookies.length == 0) {
- document.getElementById("removeAllCookies").setAttribute("disabled","true");
- } else {
- document.getElementById("removeAllCookies").removeAttribute("disabled");
- }
-
- // show policy field if at least one cookie has a policy
- if (showPolicyField) {
- document.getElementById("policyField").removeAttribute("hidden");
- }
-}
-
-function GetExpiresString(expires) {
- if (expires) {
- var date = new Date(1000*expires);
-
- // if a server manages to set a really long-lived cookie, the dateservice
- // can't cope with it properly, so we'll just return a blank string
- // see bug 238045 for details
- var expiry = "";
- try {
- expiry = gDateService.FormatDateTime("", gDateService.dateFormatLong,
- gDateService.timeFormatSeconds,
- date.getFullYear(), date.getMonth()+1,
- date.getDate(), date.getHours(),
- date.getMinutes(), date.getSeconds());
- } catch(ex) {
- // do nothing
- }
- return expiry;
- }
- return cookieBundle.getString("AtEndOfSession");
-}
-
-function GetStatusString(status) {
- switch (status) {
- case nsICookie.STATUS_ACCEPTED:
- return cookieBundle.getString("accepted");
- case nsICookie.STATUS_FLAGGED:
- return cookieBundle.getString("flagged");
- case nsICookie.STATUS_DOWNGRADED:
- return cookieBundle.getString("downgraded");
- }
- return "";
-}
-
-function GetPolicyString(policy) {
- switch (policy) {
- case nsICookie.POLICY_NONE:
- return cookieBundle.getString("policyUnstated");
- case nsICookie.POLICY_NO_CONSENT:
- return cookieBundle.getString("policyNoConsent");
- case nsICookie.POLICY_IMPLICIT_CONSENT:
- return cookieBundle.getString("policyImplicitConsent");
- case nsICookie.POLICY_EXPLICIT_CONSENT:
- return cookieBundle.getString("policyExplicitConsent");
- case nsICookie.POLICY_NO_II:
- return cookieBundle.getString("policyNoIICollected");
- }
- return "";
-}
-
-function CookieSelected() {
- var selections = GetTreeSelections(cookiesTree);
- if (selections.length) {
- document.getElementById("removeCookie").removeAttribute("disabled");
- } else {
- document.getElementById("removeCookie").setAttribute("disabled", "true");
- ClearCookieProperties();
- return true;
- }
-
- var idx = selections[0];
- if (idx >= cookies.length) {
- // Something got out of synch. See bug 119812 for details
- dump("Tree and viewer state are out of sync! " +
- "Help us figure out the problem in bug 119812");
- return false;
- }
-
- var props = [
- {id: "ifl_name", value: cookies[idx].name},
- {id: "ifl_value", value: cookies[idx].value},
- {id: "ifl_isDomain",
- value: cookies[idx].isDomain ?
- cookieBundle.getString("domainColon") : cookieBundle.getString("hostColon")},
- {id: "ifl_host", value: cookies[idx].host},
- {id: "ifl_path", value: cookies[idx].path},
- {id: "ifl_isSecure",
- value: cookies[idx].isSecure ?
- cookieBundle.getString("forSecureOnly") :
- cookieBundle.getString("forAnyConnection")},
- {id: "ifl_expires", value: cookies[idx].expires},
- {id: "ifl_policy", value: GetPolicyString(cookies[idx].policy)}
- ];
-
- var value;
- var field;
- for (var i = 0; i < props.length; i++)
- {
- field = document.getElementById(props[i].id);
- if ((selections.length > 1) && (props[i].id != "ifl_isDomain")) {
- value = ""; // clear field if multiple selections
- } else {
- value = props[i].value;
- }
- field.value = value;
- }
- return true;
-}
-
-function ClearCookieProperties() {
- var properties =
- ["ifl_name","ifl_value","ifl_host","ifl_path","ifl_isSecure","ifl_expires","ifl_policy"];
- for (var prop=0; prop
-
-
-
-
-
-
-
-
-
diff --git a/mozilla/xpfe/components/permissions/content/imageContextOverlay.xul b/mozilla/xpfe/components/permissions/content/imageContextOverlay.xul
deleted file mode 100644
index 17b6ca67d55..00000000000
--- a/mozilla/xpfe/components/permissions/content/imageContextOverlay.xul
+++ /dev/null
@@ -1,160 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/mozilla/xpfe/components/permissions/content/permissionsManager.js b/mozilla/xpfe/components/permissions/content/permissionsManager.js
deleted file mode 100644
index 81fe5622adc..00000000000
--- a/mozilla/xpfe/components/permissions/content/permissionsManager.js
+++ /dev/null
@@ -1,356 +0,0 @@
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla 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/MPL/
- *
- * 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 Communicator client code.
- *
- * The Initial Developer of the Original Code is
- * Netscape Communications Corporation.
- * Portions created by the Initial Developer are Copyright (C) 2002
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- * Ben Goodger
- * Blake Ross
- * Ian Neal (iann_bugzilla@arlen.demon.co.uk)
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either of the GNU General Public License Version 2 or later (the "GPL"),
- * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-const nsIPermissionManager = Components.interfaces.nsIPermissionManager;
-const nsICookiePermission = Components.interfaces.nsICookiePermission;
-
-var permissionManager;
-
-var additions = [];
-var removals = [];
-
-var sortColumn;
-var sortAscending;
-
-var permissionsTreeView = {
- rowCount: 0,
- setTree: function(tree) {},
- getImageSrc: function(row, column) {},
- getProgressMode: function(row, column) {},
- getCellValue: function(row, column) {},
- getCellText: function(row, column) {
- if (column.id == "siteCol")
- return additions[row].rawHost;
- else if (column.id == "statusCol")
- return additions[row].capability;
- return "";
- },
- isSeparator: function(index) { return false; },
- isSorted: function() { return false; },
- isContainer: function(index) { return false; },
- cycleHeader: function(column) {},
- getRowProperties: function(row, column, prop) {},
- getColumnProperties: function(column, prop) {},
- getCellProperties: function(row, column, prop) {}
- };
-
-var permissionsTree;
-var permissionType = "popup";
-
-var permissionsBundle;
-
-function Startup() {
- permissionManager = Components.classes["@mozilla.org/permissionmanager;1"]
- .getService(nsIPermissionManager);
-
- permissionsTree = document.getElementById("permissionsTree");
-
- permissionsBundle = document.getElementById("permissionsBundle");
-
- sortAscending = (permissionsTree.getAttribute("sortAscending") == "true");
- sortColumn = permissionsTree.getAttribute("sortColumn");
-
- if (window.arguments && window.arguments[0]) {
- document.getElementById("btnBlock").hidden = !window.arguments[0].blockVisible;
- document.getElementById("btnSession").hidden = !window.arguments[0].sessionVisible;
- document.getElementById("btnAllow").hidden = !window.arguments[0].allowVisible;
- setHost(window.arguments[0].prefilledHost);
- permissionType = window.arguments[0].permissionType;
- }
-
- var introString = permissionsBundle.getString(permissionType + "permissionstext");
- document.getElementById("permissionsText").textContent = introString;
-
- document.title = permissionsBundle.getString(permissionType + "permissionstitle");
-
- var dialogElement = document.getElementById("permissionsManager");
- dialogElement.setAttribute("windowtype", "permissions-" + permissionType);
-
- if (permissionManager) {
- handleHostInput(document.getElementById("url"));
- loadPermissions();
- }
- else {
- btnDisable(true);
- document.getElementById("removeAllPermissions").disabled = true;
- document.getElementById("url").disabled = true;
- document.documentElement.getButton("accept").disabled = true;
- }
-}
-
-function onAccept() {
- finalizeChanges();
-
- permissionsTree.setAttribute("sortAscending", !sortAscending);
- permissionsTree.setAttribute("sortColumn", sortColumn);
-
- if (permissionType != "popup")
- return true;
-
- var unblocked = additions;
- var windowMediator = Components.classes['@mozilla.org/appshell/window-mediator;1']
- .getService(Components.interfaces.nsIWindowMediator);
- var enumerator = windowMediator.getEnumerator("navigator:browser");
-
- //if a site that is currently open is unblocked, make icon go away
- while (enumerator.hasMoreElements()) {
- var win = enumerator.getNext();
-
- var browsers = win.getBrowser().browsers;
- for (var i in browsers) {
- var nextLocation;
- try {
- nextLocation = browsers[i].currentURI.hostPort;
- }
- catch(ex) {
- nextLocation = null; //blank window
- }
-
- if (nextLocation) {
- nextLocation = '.'+nextLocation;
- for (var j in unblocked) {
- var nextUnblocked = '.'+unblocked[j];
-
- if (nextUnblocked.length > nextLocation.length)
- continue; // can't be a match
-
- if (nextUnblocked ==
- nextLocation.substr(nextLocation.length - nextUnblocked.length)) {
- browsers[i].popupDomain = null;
- win.document.getElementById("popupIcon").hidden = true;
- }
- }
- }
- }
- }
-
- return true;
-}
-
-function setHost(aHost) {
- document.getElementById("url").value = aHost;
-}
-
-function Permission(id, host, rawHost, type, capability, perm) {
- this.id = id;
- this.host = host;
- this.rawHost = rawHost;
- this.type = type;
- this.capability = capability;
- this.perm = perm;
-}
-
-function handleHostInput(aSiteField) {
- // trim any leading and trailing spaces and scheme
- // and set buttons appropiately
- btnDisable(!trimSpacesAndScheme(aSiteField.value));
-}
-
-function trimSpacesAndScheme(aString) {
- if (!aString)
- return "";
- return aString.replace(/(^\s+)|(\s+$)/g, "")
- .replace(/([-\w]*:\/+)?/, "");
-}
-
-function btnDisable(aDisabled) {
- document.getElementById("btnSession").disabled = aDisabled;
- document.getElementById("btnBlock").disabled = aDisabled;
- document.getElementById("btnAllow").disabled = aDisabled;
-}
-
-function loadPermissions() {
- var enumerator = permissionManager.enumerator;
- var count = 0;
- var permission;
-
- try {
- while (enumerator.hasMoreElements()) {
- permission = enumerator.getNext().QueryInterface(Components.interfaces.nsIPermission);
- if (permission.type == permissionType)
- permissionPush(count++, permission.host, permission.type,
- capabilityString(permission.capability), permission.capability);
- }
- } catch(ex) {
- }
-
- permissionsTreeView.rowCount = additions.length;
-
- // sort and display the table
- permissionsTree.treeBoxObject.view = permissionsTreeView;
- permissionColumnSort(sortColumn, false);
-
- // disable "remove all" button if there are none
- document.getElementById("removeAllPermissions").disabled = additions.length == 0;
-}
-
-function capabilityString(aCapability) {
- var capability = null;
- switch (aCapability) {
- case nsIPermissionManager.ALLOW_ACTION:
- capability = "can";
- break;
- case nsIPermissionManager.DENY_ACTION:
- capability = "cannot";
- break;
- // we should only ever hit this for cookies
- case nsICookiePermission.ACCESS_SESSION:
- capability = "canSession";
- break;
- default:
- break;
- }
- return permissionsBundle.getString(capability);
-}
-
-function permissionPush(aId, aHost, aType, aString, aCapability) {
- var rawHost = (aHost.charAt(0) == ".") ? aHost.substring(1, aHost.length) : aHost;
- var p = new Permission(aId, aHost, rawHost, aType, aString, aCapability);
- additions.push(p);
-}
-
-function permissionColumnSort(aColumn, aUpdateSelection) {
- sortAscending =
- SortTree(permissionsTree, permissionsTreeView, additions,
- aColumn, sortColumn, sortAscending, aUpdateSelection);
- sortColumn = aColumn;
-}
-
-function permissionSelected() {
- if (permissionManager) {
- var selections = GetTreeSelections(permissionsTree);
- document.getElementById("removePermission").disabled = (selections.length < 1);
- }
-}
-
-function deletePermissions() {
- DeleteSelectedItemFromTree(permissionsTree, permissionsTreeView, additions, removals,
- "removePermission", "removeAllPermissions");
-}
-
-function deleteAllPermissions() {
- DeleteAllFromTree(permissionsTree, permissionsTreeView, additions, removals,
- "removePermission", "removeAllPermissions");
-}
-
-function finalizeChanges() {
- var ioService = Components.classes["@mozilla.org/network/io-service;1"]
- .getService(Components.interfaces.nsIIOService);
- var i, p;
-
- for (i in removals) {
- p = removals[i];
- try {
- permissionManager.remove(p.host, p.type);
- } catch(ex) {
- }
- }
-
- for (i in additions) {
- p = additions[i];
- try {
- var uri = ioService.newURI("http://" + p.host, null, null);
- permissionManager.add(uri, p.type, p.perm);
- } catch(ex) {
- }
- }
-}
-
-function handlePermissionKeyPress(e) {
- if (e.keyCode == 46) {
- deletePermissions();
- }
-}
-
-function addPermission(aPermission) {
- var textbox = document.getElementById("url");
- // trim any leading and trailing spaces and scheme
- var host = trimSpacesAndScheme(textbox.value);
- try {
- var ioService = Components.classes["@mozilla.org/network/io-service;1"]
- .getService(Components.interfaces.nsIIOService);
- var uri = ioService.newURI("http://" + host, null, null);
- host = uri.host;
- } catch(ex) {
- var promptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
- .getService(Components.interfaces.nsIPromptService);
- var message = permissionsBundle.getFormattedString("alertInvalid", [host]);
- var title = permissionsBundle.getString("alertInvalidTitle");
- promptService.alert(window, title, message);
- textbox.value = "";
- textbox.focus();
- handleHostInput(textbox);
- return;
- }
-
- // we need this whether the perm exists or not
- var stringCapability = capabilityString(aPermission);
-
- // check whether the permission already exists, if not, add it
- var exists = false;
- for (var i in additions) {
- if (additions[i].rawHost == host) {
- exists = true;
- additions[i].capability = stringCapability;
- additions[i].perm = aPermission;
- break;
- }
- }
-
- if (!exists) {
- permissionPush(additions.length, host, permissionType, stringCapability, aPermission);
-
- permissionsTreeView.rowCount = additions.length;
- permissionsTree.treeBoxObject.rowCountChanged(additions.length - 1, 1);
- permissionsTree.treeBoxObject.ensureRowIsVisible(additions.length - 1);
- }
- textbox.value = "";
- textbox.focus();
-
- // covers a case where the site exists already, so the buttons don't disable
- handleHostInput(textbox);
-
- // enable "remove all" button as needed
- document.getElementById("removeAllPermissions").disabled = additions.length == 0;
-}
-
-function doHelpButton() {
- openHelp(permissionsBundle.getString(permissionType + "permissionshelp"));
- return true;
-}
diff --git a/mozilla/xpfe/components/permissions/content/permissionsManager.xul b/mozilla/xpfe/components/permissions/content/permissionsManager.xul
deleted file mode 100644
index 28a963e50a5..00000000000
--- a/mozilla/xpfe/components/permissions/content/permissionsManager.xul
+++ /dev/null
@@ -1,103 +0,0 @@
-
-
-
-
-
-
-
-
-
diff --git a/mozilla/xpfe/components/permissions/content/permissionsNavigatorOverlay.xul b/mozilla/xpfe/components/permissions/content/permissionsNavigatorOverlay.xul
deleted file mode 100644
index 3a00924c031..00000000000
--- a/mozilla/xpfe/components/permissions/content/permissionsNavigatorOverlay.xul
+++ /dev/null
@@ -1,286 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/mozilla/xpfe/components/permissions/content/permissionsOverlay.js b/mozilla/xpfe/components/permissions/content/permissionsOverlay.js
deleted file mode 100644
index 7363c6bdd74..00000000000
--- a/mozilla/xpfe/components/permissions/content/permissionsOverlay.js
+++ /dev/null
@@ -1,98 +0,0 @@
-/* -*- Mode: Java; tab-width: 4; c-basic-offset: 4; -*-
- *
- * ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla 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/MPL/
- *
- * 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 the Initial Developer are Copyright (C) 1998
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- * Neil Rashbrook
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-function openCookieViewer(viewerType)
-{
- const wm = Components.classes["@mozilla.org/appshell/window-mediator;1"]
- .getService(Components.interfaces.nsIWindowMediator);
- var enumerator = wm.getEnumerator("mozilla:cookieviewer");
- while (enumerator.hasMoreElements()) {
- var viewer = enumerator.getNext();
- if (viewer.arguments[0] == viewerType) {
- viewer.focus();
- return;
- }
- }
- window.openDialog("chrome://communicator/content/permissions/cookieViewer.xul",
- "_blank", "chrome,resizable", viewerType);
-}
-
-function showPermissionsManager(viewerType, host) {
- var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"]
- .getService(Components.interfaces.nsIWindowMediator);
- var existingWindow = wm.getMostRecentWindow("permissions-" + viewerType);
- if (existingWindow) {
- existingWindow.setHost(host);
- existingWindow.focus();
- }
- else {
- var params = { blockVisible: (viewerType == "image"),
- sessionVisible: false,
- allowVisible: true,
- prefilledHost: host,
- permissionType: viewerType };
- window.openDialog("chrome://communicator/content/permissions/permissionsManager.xul", "_blank",
- "chrome,resizable=yes", params);
- }
-}
-
-function viewPopups(host) {
- showPermissionsManager("popup", host);
-}
-
-function viewImages() {
- showPermissionsManager("image", "");
-}
-
-function viewInstalls() {
- showPermissionsManager("install", "");
-}
-
-function viewCookies() {
- openCookieViewer("cookieManager");
-}
-
-function viewCookiesFromIcon() {
- openCookieViewer("cookieManagerFromIcon");
-}
-
-function viewP3P() {
- window.openDialog
- ("chrome://communicator/content/permissions/cookieP3P.xul","_blank","chrome,resizable=no");
-}
diff --git a/mozilla/xpfe/components/permissions/content/treeUtils.js b/mozilla/xpfe/components/permissions/content/treeUtils.js
deleted file mode 100644
index 8f176f02845..00000000000
--- a/mozilla/xpfe/components/permissions/content/treeUtils.js
+++ /dev/null
@@ -1,178 +0,0 @@
-/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
- *
- * ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla 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/MPL/
- *
- * 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 the Initial Developer are Copyright (C) 1998
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-function DeleteAllFromTree
- (tree, view, table, deletedTable, removeButton, removeAllButton) {
-
- // remove all items from table and place in deleted table
- for (var i=0; i= 0; s--) {
- var i = selections[s];
- deletedTable[deletedTable.length] = table[i];
- table[i] = null;
- }
-
- // collapse list by removing all the null entries
- for (var j=0; j second.expiresSortValue)
- return 1;
- else if (first.expiresSortValue < second.expiresSortValue)
- return -1;
- else
- return 0;
- }
- } else {
- compareFunc = function compare(first, second) {
- return first[column].toLowerCase().localeCompare(second[column].toLowerCase());
- }
- }
- table.sort(compareFunc);
- if (!ascending)
- table.reverse();
-
- // restore the selection
- var selectedRow = -1;
- if (selectedNumber>=0 && updateSelection) {
- for (var s=0; s= 0) {
- tree.treeBoxObject.ensureRowIsVisible(selectedRow)
- }
-
- return ascending;
-}
-
diff --git a/mozilla/xpfe/components/permissions/locale/en-US/aboutPopups.dtd b/mozilla/xpfe/components/permissions/locale/en-US/aboutPopups.dtd
deleted file mode 100644
index 17ec1c60c51..00000000000
--- a/mozilla/xpfe/components/permissions/locale/en-US/aboutPopups.dtd
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
-
-
-
-
-
-
diff --git a/mozilla/xpfe/components/permissions/locale/en-US/cookieP3P.dtd b/mozilla/xpfe/components/permissions/locale/en-US/cookieP3P.dtd
deleted file mode 100644
index 4d48282ac34..00000000000
--- a/mozilla/xpfe/components/permissions/locale/en-US/cookieP3P.dtd
+++ /dev/null
@@ -1,75 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/mozilla/xpfe/components/permissions/locale/en-US/cookieTasksOverlay.dtd b/mozilla/xpfe/components/permissions/locale/en-US/cookieTasksOverlay.dtd
deleted file mode 100644
index 9674fc64d87..00000000000
--- a/mozilla/xpfe/components/permissions/locale/en-US/cookieTasksOverlay.dtd
+++ /dev/null
@@ -1,3 +0,0 @@
-
-
-
diff --git a/mozilla/xpfe/components/permissions/locale/en-US/cookieViewer.dtd b/mozilla/xpfe/components/permissions/locale/en-US/cookieViewer.dtd
deleted file mode 100644
index c33759cde01..00000000000
--- a/mozilla/xpfe/components/permissions/locale/en-US/cookieViewer.dtd
+++ /dev/null
@@ -1,38 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/mozilla/xpfe/components/permissions/locale/en-US/cookieViewer.properties b/mozilla/xpfe/components/permissions/locale/en-US/cookieViewer.properties
deleted file mode 100644
index f0ee4adcab1..00000000000
--- a/mozilla/xpfe/components/permissions/locale/en-US/cookieViewer.properties
+++ /dev/null
@@ -1,73 +0,0 @@
-# ***** BEGIN LICENSE BLOCK *****
-# Version: MPL 1.1/GPL 2.0/LGPL 2.1
-#
-# The contents of this file are subject to the Mozilla 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/MPL/
-#
-# 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 the Initial Developer are Copyright (C) 1998
-# the Initial Developer. All Rights Reserved.
-#
-# Contributor(s):
-# Ben Goodger
-#
-# Alternatively, the contents of this file may be used under the terms of
-# either the GNU General Public License Version 2 or later (the "GPL"), or
-# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
-# in which case the provisions of the GPL or the LGPL are applicable instead
-# of those above. If you wish to allow use of your version of this file only
-# under the terms of either the GPL or the LGPL, and not to allow others to
-# use your version of this file under the terms of the MPL, indicate your
-# decision by deleting the provisions above and replace them with the notice
-# and other provisions required by the GPL or the LGPL. If you do not delete
-# the provisions above, a recipient may use your version of this file under
-# the terms of any one of the MPL, the GPL or the LGPL.
-#
-# ***** END LICENSE BLOCK *****
-
-# note this section of the code may require some tinkering in other languages =(
-# format in dialog: site [can/cannot] set cookies
-can=site can set cookies
-cannot=site cannot set cookies
-canSession=site can set session cookies
-canImages=site can load images
-cannotImages=site cannot load images
-canPopups=site can show popups
-cannotPopups=site cannot show popups
-domain=Domain for which this cookie applies:
-host=Server which set the cookie:
-imageTitle=Image Manager
-popupTitle=Pop-up Manager
-hostColon=Host:
-domainColon=Domain:
-forSecureOnly=Encrypted connections only
-forAnyConnection=Any type of connection
-AtEndOfSession = at end of session
-tabBannedImages=Image Sites
-tabBannedPopups=Pop-up Sites
-textBannedImages=Sites from which images are or are not loaded.
-textBannedPopups=Sites from which pop-up windows are or are not allowed.
-accepted=accepted
-downgraded=session
-flagged=flagged
-policyUnstated = no policy about storing identifiable information
-policyNoConsent = stores identifiable information without any user consent
-policyImplicitConsent = stores identifiable information unless user opts out
-policyExplicitConsent = stores identifiable information if user opts in
-policyNoIICollected = does not store identifiable information
-close=Close
-deleteAllCookies=Are you sure you want to delete all the cookies?
-deleteAllCookiesTitle=Remove All Cookies
-deleteAllCookiesSites=Are you sure you want to delete all of the cookie sites?
-deleteAllImagesSites=Are you sure you want to delete all of the image sites?
-deleteAllSitesTitle=Remove All Sites
diff --git a/mozilla/xpfe/components/permissions/locale/en-US/imageContextOverlay.dtd b/mozilla/xpfe/components/permissions/locale/en-US/imageContextOverlay.dtd
deleted file mode 100644
index 6655e1939c9..00000000000
--- a/mozilla/xpfe/components/permissions/locale/en-US/imageContextOverlay.dtd
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
-
-
diff --git a/mozilla/xpfe/components/permissions/locale/en-US/permissionsManager.dtd b/mozilla/xpfe/components/permissions/locale/en-US/permissionsManager.dtd
deleted file mode 100644
index a18e85a80a5..00000000000
--- a/mozilla/xpfe/components/permissions/locale/en-US/permissionsManager.dtd
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/mozilla/xpfe/components/permissions/locale/en-US/permissionsManager.properties b/mozilla/xpfe/components/permissions/locale/en-US/permissionsManager.properties
deleted file mode 100644
index e9351658039..00000000000
--- a/mozilla/xpfe/components/permissions/locale/en-US/permissionsManager.properties
+++ /dev/null
@@ -1,16 +0,0 @@
-installpermissionstext=You can specify which web sites are allowed to install extensions and updates. Type the exact address of the site you want to allow and then click Allow.
-installpermissionstitle=Allowed Sites - Software Installation
-installpermissionshelp=advanced_pref_installation
-popuppermissionstext=You can specify which web sites are allowed to open popup windows. Type the exact address of the site you want to allow and then click Allow.
-popuppermissionstitle=Allowed Sites - Popups
-popuppermissionshelp=pop_up_blocking
-imagepermissionstext=You can specify which web sites are allowed to load images. Type the exact address of the site you want to manage and then click Block or Allow.
-imagepermissionstitle=Exceptions - Images
-imagepermissionshelp=images-help-managing
-
-can=Allow
-canSession=Allow for Session
-cannot=Block
-
-alertInvalidTitle=Invalid Web Site Entered
-alertInvalid=The web site %S is invalid.
diff --git a/mozilla/xpfe/components/permissions/locale/en-US/permissionsNavigatorOverlay.dtd b/mozilla/xpfe/components/permissions/locale/en-US/permissionsNavigatorOverlay.dtd
deleted file mode 100644
index b0acc45f764..00000000000
--- a/mozilla/xpfe/components/permissions/locale/en-US/permissionsNavigatorOverlay.dtd
+++ /dev/null
@@ -1,47 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/mozilla/xpfe/components/related/resources/related-panel.js b/mozilla/xpfe/components/related/resources/related-panel.js
deleted file mode 100644
index 48f30263d1f..00000000000
--- a/mozilla/xpfe/components/related/resources/related-panel.js
+++ /dev/null
@@ -1,245 +0,0 @@
-/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
- *
- * ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla 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/MPL/
- *
- * 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 from Alexa Internet (www.alexa.com).
- *
- * The Initial Developer of the Original Code is
- * Alexa Internet.
- * Portions created by the Initial Developer are Copyright (C) 2000
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either of the GNU General Public License Version 2 or later (the "GPL"),
- * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-/*
- Code for the Related Links Sidebar Panel
- */
-
-
-var kUnknownReasonUrl = 'about:blank';
-var kMAMIUrl = 'http://xslt.alexa.com/data?cli=17&dat=nsa';
-
-var kNoHTTPReasonUrl = kMAMIUrl + 'req_type=secure_intranet';
-var kSkipDomainReasonUrl = kMAMIUrl + 'req_type=blocked_list';
-var kDataPrefixUrl = kMAMIUrl;
-
-var oNavObserver = null;
-
-// Our observer of Navigation Messages
-function NavObserver(oDisplayFrame,oContentWindow)
-{
- this.m_oDisplayFrame = oDisplayFrame;
- this.m_oContentWindow = oContentWindow;
- this.m_sWindowID = ''+parseInt(Math.random()*32767);
- this.m_sLastDataUrl = 'about:blank'; // The last url that we drove our display to.
-}
-
-NavObserver.prototype.observe =
-function (oSubject, sMessage, sContextUrl)
-{
- try {
- if (oSubject != this.m_oContentWindow) {
- // only pay attention to our client window.
- return;
- }
- var bReferrer = (this.m_oContentWindow.document.referrer)?true:false;
- if ((sMessage == 'EndDocumentLoad')
- && (sContextUrl != this.m_oContentWindow.location)) {
- // we were redirected...
- sContextUrl = '' + this.m_oContentWindow.location;
- bReferrer = true;
- }
- this.TrackContext(sContextUrl, bReferrer);
- } catch(ex) {
- }
-}
-
-NavObserver.prototype.GetCDT =
-function (bReferrer)
-{
- var sCDT = '';
- sCDT += 't=' +(bReferrer?'1':'0');
- sCDT += '&pane=nswr6';
- sCDT += '&wid='+this.m_sWindowID;
-
- return encodeURIComponent(sCDT);
-}
-
-NavObserver.prototype.TrackContext =
-function (sContextUrl, bReferrer)
-{
- if (sContextUrl != this.m_sLastContextUrl && this.m_oDisplayFrame) {
- var sDataUrl = this.TranslateContext(sContextUrl,bReferrer);
- this.m_oDisplayFrame.setAttribute('src', sDataUrl);
- this.m_sLastContextUrl = sContextUrl;
- }
-}
-
-NavObserver.prototype.TranslateContext =
-function (sUrl, bReferrer)
-{
- if (!sUrl || ('string' != typeof(sUrl))
- || ('' == sUrl) || sUrl == 'about:blank') {
- return kUnknownReasonUrl;
- }
-
- // Strip off any query strings (Don't want to be too nosy).
- var nQueryPart = sUrl.indexOf('?');
- if (nQueryPart != 1) {
- sUrl = sUrl.slice(0, nQueryPart);
- }
-
- // We can only get related links data on HTTP URLs
- if (0 != sUrl.indexOf("http://")) {
- return kNoHTTPReasonUrl;
- }
-
- // ...and non-intranet sites(those that have a '.' in the domain)
- var sUrlSuffix = sUrl.substr(7); // strip off "http://" prefix
-
- var nFirstSlash = sUrlSuffix.indexOf('/');
- var nFirstDot = sUrlSuffix.indexOf('.');
-
- if (-1 == nFirstDot)
- return kNoHTTPReasonUrl;
-
- if ((nFirstSlash < nFirstDot) && (-1 != nFirstSlash))
- return kNoHTTPReasonUrl;
-
- // url is http, non-intranet url: see if the domain is in their blocked list.
-
- var nPortOffset = sUrlSuffix.indexOf(":");
- var nDomainEnd = (((nPortOffset >=0) && (nPortOffset <= nFirstSlash))
- ? nPortOffset : nFirstSlash);
-
- var sDomain = sUrlSuffix;
- if (-1 != nDomainEnd) {
- sDomain = sUrlSuffix.substr(0,nDomainEnd);
- }
-
- if (DomainInSkipList(sDomain)) {
- return kSkipDomainReasonUrl;
- } else {
- // ok! it is a good url!
- var sFinalUrl = kDataPrefixUrl;
- sFinalUrl += 'cdt='+this.GetCDT(bReferrer);
- sFinalUrl += '&url='+sUrl;
- return sFinalUrl;
- }
-}
-
-
-function DomainInSkipList(sDomain)
-{
- var bSkipDomainFlag = false;
-
- if ('/' == sDomain[sDomain.length - 1]) {
- sDomain = sDomain.substring(0, sDomain.length - 1);
- }
-
- try {
- var pref = Components.classes["@mozilla.org/preferences-service;1"]
- .getService(Components.interfaces.nsIPrefBranch);
-
- var sDomainList = pref.getCharPref("browser.related.disabledForDomains");
- if ((sDomainList) && (sDomainList != "")) {
-
- var aDomains = sDomainList.split(",");
-
- // split on commas
- for (var x=0; x < aDomains.length; x++) {
- var sDomainCopy = sDomain;
-
- var sTestDomain = aDomains[x];
-
- if ('*' == sTestDomain[0]) { // wildcard match
-
- // strip off the asterisk
- sTestDomain = sTestDomain.substring(1);
- if (sDomainCopy.length > sTestDomain.length) {
- var sDomainIndex = sDomain.length - sTestDomain.length;
- sDomainCopy = sDomainCopy.substring(sDomainIndex);
- }
- }
-
- if (0 == sDomainCopy.lastIndexOf(sTestDomain)) {
-
- bSkipDomainFlag = true;
- break;
- }
- }
- }
- } catch(ex) {
- }
- return(bSkipDomainFlag);
-}
-
-function Init()
-{
- // Initialize the Related Links panel
-
- // Install our navigation observer so we can track the main client window.
-
- oContentWindow = window.content;
- oFrame = document.getElementById('daFrame');
-
- if (oContentWindow && oFrame) {
- var oObserverService = Components.classes["@mozilla.org/observer-service;1"].getService();
- oObserverService = oObserverService.QueryInterface(Components.interfaces.nsIObserverService);
-
- oNavObserver = new NavObserver(oFrame,oContentWindow);
- oNavObserver.TrackContext(''+oContentWindow.location);
-
- if (oObserverService && oNavObserver) {
- oObserverService.addObserver(oNavObserver, "StartDocumentLoad", false);
- oObserverService.addObserver(oNavObserver, "EndDocumentLoad", false);
- oObserverService.addObserver(oNavObserver, "FailDocumentLoad", false);
- } else {
- oNavObserver = null;
- dump("FAILURE to get observer service\n");
- }
- }
-}
-
-function Destruct()
-{
- // remove our navigation observer.
- var oObserverService = Components.classes["@mozilla.org/observer-service;1"].getService();
- oObserverService = oObserverService.QueryInterface(Components.interfaces.nsIObserverService);
- if (oObserverService && oNavObserver) {
- oObserverService.removeObserver(oNavObserver, "StartDocumentLoad");
- oObserverService.removeObserver(oNavObserver, "EndDocumentLoad");
- oObserverService.removeObserver(oNavObserver, "FailDocumentLoad");
- oNavObserver = null;
- } else {
- dump("FAILURE to get observer service\n");
- }
-}
-
-addEventListener("load", Init, false);
-addEventListener("unload", Destruct, false);
diff --git a/mozilla/xpfe/components/related/resources/related-panel.xul b/mozilla/xpfe/components/related/resources/related-panel.xul
deleted file mode 100644
index 4a9e7921cd3..00000000000
--- a/mozilla/xpfe/components/related/resources/related-panel.xul
+++ /dev/null
@@ -1,48 +0,0 @@
-
-
-
-
-
-
-
-
-
diff --git a/mozilla/xpfe/components/search/resources/internetresults.js b/mozilla/xpfe/components/search/resources/internetresults.js
deleted file mode 100644
index 6b6980164fb..00000000000
--- a/mozilla/xpfe/components/search/resources/internetresults.js
+++ /dev/null
@@ -1,266 +0,0 @@
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla 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/MPL/
- *
- * 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 Robert John Churchill.
- * Portions created by the Initial Developer are Copyright (C) 1999
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- * Robert John Churchill (Original Author)
- * Ben Goodger
- * Daniel Matejka
- * Eric Pollmann
- * Ray Whitmer
- * Peter Annema
- * Blake Ross
- * Joe Hewitt
- * Jan Varga
- * Karsten Duesterloh
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-function searchResultsOpenURL(event)
-{
- var tree = document.getElementById("resultsList");
- var node = tree.contentView.getItemAtIndex(tree.currentIndex);
-
- var url = node.id;
- var rdf = Components.classes["@mozilla.org/rdf/rdf-service;1"].getService();
- if (rdf) rdf = rdf.QueryInterface(Components.interfaces.nsIRDFService);
- if (rdf)
- {
- var ds = rdf.GetDataSource("rdf:internetsearch");
- if (ds)
- {
- var src = rdf.GetResource(url, 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) url = target;
- }
- }
-
- // Ignore "NC:" urls.
- if (url.substring(0, 3) == "NC:")
- return false;
-
- if ("loadURI" in top)
- top.loadURI(url);
- else
- top.content.location.href = url;
-
- return true;
-}
-
-
-// Workaround for bug 196057 (double onload event): accept only the first onload event
-// ( This workaround will fix bug 147068 (duplicate search results).
-// Without this fix, xpfe\components\search\src\nsInternetSearchService.cpp will
-// crash when removing the same tree node twice. )
-// If bug 196057 should be fixed eventually, this workaround does no harm -
-// nevertheless it should be removed then
-var gbProcessOnloadEvent = true;
-
-function onLoadInternetResults()
-{
- if (gbProcessOnloadEvent)
- { // forbid other onload events
- gbProcessOnloadEvent = false;
-
- // clear any previous results on load
- var iSearch = Components.classes["@mozilla.org/rdf/datasource;1?name=internetsearch"]
- .getService(Components.interfaces.nsIInternetSearchService);
- iSearch.ClearResultSearchSites();
-
- // the search URI is passed in as a parameter, so get it and then root the results list
- var searchURI = top.content.location.href;
- if (searchURI) {
- const lastSearchURIPref = "browser.search.lastMultipleSearchURI";
- var offset = searchURI.indexOf("?");
- if (offset > 0) {
- nsPreferences.setUnicharPref(lastSearchURIPref, searchURI); // evil
- searchURI = searchURI.substr(offset+1);
- loadResultsList(searchURI);
- }
- else {
- searchURI = nsPreferences.copyUnicharPref(lastSearchURIPref, "");
- offset = searchURI.indexOf("?");
- if (offset > 0) {
- nsPreferences.setUnicharPref(lastSearchURIPref, searchURI); // evil
- searchURI = searchURI.substr(offset+1);
- loadResultsList(searchURI);
- }
- }
- }
- }
- return true;
-}
-
-function loadResultsList( aSearchURL )
-{
- var resultsTree = document.getElementById( "resultsList" );
- if (!resultsTree) return false;
- resultsTree.setAttribute("ref", decodeURI(aSearchURL));
- return true;
-}
-
-
-
-function doEngineClick( event, aNode )
-{
- event.target.checked = true;
-
- var html = null;
-
- var resultsTree = document.getElementById("resultsList");
- var contentArea = document.getElementById("resultsContent");
- var splitter = document.getElementById("results-splitter");
- var engineURI = aNode.id;
- if (engineURI == "allEngines") {
- resultsTree.removeAttribute("hidden");
- splitter.removeAttribute("hidden");
- }
- else
- {
- resultsTree.setAttribute("hidden", "true");
- splitter.setAttribute("hidden", "true");
- try
- {
- var rdf = Components.classes["@mozilla.org/rdf/rdf-service;1"].getService();
- if (rdf) rdf = rdf.QueryInterface(Components.interfaces.nsIRDFService);
- if (rdf)
- {
- var internetSearchStore = rdf.GetDataSource("rdf:internetsearch");
- if (internetSearchStore)
- {
- var src = rdf.GetResource(engineURI, true);
- var htmlProperty = rdf.GetResource("http://home.netscape.com/NC-rdf#HTML", true);
- html = internetSearchStore.GetTarget(src, htmlProperty, true);
- if ( html ) html = html.QueryInterface(Components.interfaces.nsIRDFLiteral);
- if ( html ) html = html.Value;
- }
- }
- }
- catch(ex)
- {
- }
- }
-
- if ( html )
- {
- var doc = frames[0].document;
- if (doc)
- {
- doc.open("text/html", "replace");
- doc.writeln( html );
- doc.close();
- }
- }
- else
- frames[0].document.location.href =
- "chrome://communicator/locale/search/default.htm";
-}
-
-
-
-function doResultClick(node)
-{
- var theID = node.id;
- if (!theID) return(false);
-
- try
- {
- var rdf = Components.classes["@mozilla.org/rdf/rdf-service;1"].getService();
- if (rdf) rdf = rdf.QueryInterface(Components.interfaces.nsIRDFService);
- if (rdf)
- {
- var internetSearchStore = rdf.GetDataSource("rdf:internetsearch");
- if (internetSearchStore)
- {
- var src = rdf.GetResource(theID, true);
- var urlProperty = rdf.GetResource("http://home.netscape.com/NC-rdf#URL", 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 url = internetSearchStore.GetTarget(src, urlProperty, true);
- if (url) url = url.QueryInterface(Components.interfaces.nsIRDFLiteral);
- if (url) url = url.Value;
- if (url)
- {
- var statusNode = document.getElementById("status-button");
- if (statusNode)
- {
- statusNode.label = url;
- }
- }
-
- 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;
- if (target)
- {
- var text = "Search";
-
- if (banner)
- text += banner + " "; // add a and a just in case
- text += target;
- text += ""
-
- var doc = frames[0].document;
- doc.open("text/html", "replace");
- doc.writeln(text);
- doc.close();
- }
- }
- }
- }
- catch(ex)
- {
- }
- return(true);
-}
-
-function listSelect(event)
-{
- var tree = document.getElementById("resultsList");
- if (tree.view.selection.count != 1)
- return false;
- var selection = tree.contentView.getItemAtIndex(tree.currentIndex);
- return doResultClick(selection);
-}
-
-function listClick(event)
-{ // left double click opens URL
- if (event.detail == 2 && event.button == 0)
- searchResultsOpenURL(event);
- return true; // always allow further click processing
-}
diff --git a/mozilla/xpfe/components/search/resources/internetresults.xul b/mozilla/xpfe/components/search/resources/internetresults.xul
deleted file mode 100644
index 820f9f95bee..00000000000
--- a/mozilla/xpfe/components/search/resources/internetresults.xul
+++ /dev/null
@@ -1,124 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/mozilla/xpfe/components/search/resources/locale/en-US/default.htm b/mozilla/xpfe/components/search/resources/locale/en-US/default.htm
deleted file mode 100644
index 9100fe99086..00000000000
--- a/mozilla/xpfe/components/search/resources/locale/en-US/default.htm
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
- Search
-
-
-
-
-
SeaMonkey Search
-
-
-
diff --git a/mozilla/xpfe/components/search/resources/locale/en-US/internetresults.dtd b/mozilla/xpfe/components/search/resources/locale/en-US/internetresults.dtd
deleted file mode 100755
index d16d4c38cd5..00000000000
--- a/mozilla/xpfe/components/search/resources/locale/en-US/internetresults.dtd
+++ /dev/null
@@ -1,50 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/mozilla/xpfe/components/search/resources/locale/en-US/search-editor.dtd b/mozilla/xpfe/components/search/resources/locale/en-US/search-editor.dtd
deleted file mode 100755
index ba8a3ac5e32..00000000000
--- a/mozilla/xpfe/components/search/resources/locale/en-US/search-editor.dtd
+++ /dev/null
@@ -1,54 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/mozilla/xpfe/components/search/resources/locale/en-US/search-editor.properties b/mozilla/xpfe/components/search/resources/locale/en-US/search-editor.properties
deleted file mode 100755
index a7f739b5589..00000000000
--- a/mozilla/xpfe/components/search/resources/locale/en-US/search-editor.properties
+++ /dev/null
@@ -1,7 +0,0 @@
-NewCategoryPrompt=Enter the new category name:
-NewCategoryTitle=New Category
-RenameCategoryPrompt=Enter the new category name:
-RenameCategoryTitle=Rename Category
-RemoveCategoryPrompt=Delete this category?
-AddEnginePrompt=Add the selected search engine(s) into this category?
-RemoveEnginePrompt=Remove the selected search engine(s) from this category?
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
deleted file mode 100755
index 6ddafa7ac61..00000000000
--- a/mozilla/xpfe/components/search/resources/locale/en-US/search-panel.dtd
+++ /dev/null
@@ -1,55 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/mozilla/xpfe/components/search/resources/locale/en-US/search-panel.properties b/mozilla/xpfe/components/search/resources/locale/en-US/search-panel.properties
deleted file mode 100644
index dbe9857b502..00000000000
--- a/mozilla/xpfe/components/search/resources/locale/en-US/search-panel.properties
+++ /dev/null
@@ -1,15 +0,0 @@
-enterstringandlocation=Enter some text to search for and select at least one location to search.
-enableAdvanced=Enable advanced search options
-disableAdvanced=Disable advanced search options
-addtobookmarks=Add to bookmarks
-addquerytobookmarks=Add search query to bookmarks
-excludeurl=Exclude this URL from future searches
-excludedomain=Exclude this domain from future searches
-clearfilters=Clear all search filters
-searchButtonText=Search
-stopButtonText=Stop
-changeEngineTitle=Change default search engine?
-changeEngineMsg=Would you like to make %S your default search engine?
-dontAskAgainMsg=Change default engine without asking in the future
-thisEngine=this
-searchTitle=Search: '%S'
diff --git a/mozilla/xpfe/components/search/resources/search-editor.js b/mozilla/xpfe/components/search/resources/search-editor.js
deleted file mode 100644
index f5b7969588f..00000000000
--- a/mozilla/xpfe/components/search/resources/search-editor.js
+++ /dev/null
@@ -1,625 +0,0 @@
-/* -*- Mode: Java; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla 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/MPL/
- *
- * 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 the Initial Developer are Copyright (C) 1998
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- * Robert John Churchill
- * Blake Ross
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either of the GNU General Public License Version 2 or later (the "GPL"),
- * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-
-
-// global(s)
-var bundle = srGetStrBundle("chrome://communicator/locale/search/search-editor.properties");
-var promptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"].getService();
-promptService = promptService.QueryInterface(Components.interfaces.nsIPromptService);
-var pref = null;
-var RDF = null;
-var RDFC = null;
-var RDFCUtils = null;
-var catDS = null;
-var internetSearchDS = null;
-
-try
-{
- pref = Components.classes["@mozilla.org/preferences-service;1"]
- .getService(Components.interfaces.nsIPrefBranch);
-
- RDF = Components.classes["@mozilla.org/rdf/rdf-service;1"].getService(Components.interfaces.nsIRDFService);
-
- RDFC = Components.classes["@mozilla.org/rdf/container;1"].createInstance(Components.interfaces.nsIRDFContainer);
-
- RDFCUtils = Components.classes["@mozilla.org/rdf/container-utils;1"].getService(Components.interfaces.nsIRDFContainerUtils);
-}
-catch(e)
-{
- pref = null;
- RDF = null;
- RDFC = null;
- RDFCUtils = null;
-}
-
-
-
-function debug(msg)
-{
- // uncomment for noise
- // dump(msg+"\n");
-}
-
-
-
-function doLoad()
-{
- var categoryList = document.getElementById("categoryList");
- // adjust category popup
- var internetSearch = Components.classes["@mozilla.org/rdf/datasource;1?name=internetsearch"].getService();
- if (internetSearch) internetSearch = internetSearch.QueryInterface(Components.interfaces.nsIInternetSearchService);
- if (internetSearch)
- {
- internetSearchDS = internetSearch.QueryInterface(Components.interfaces.nsIRDFDataSource);
-
- catDS = internetSearch.GetCategoryDataSource();
- if (catDS) catDS = catDS.QueryInterface(Components.interfaces.nsIRDFDataSource);
- if (catDS)
- {
- if (categoryList)
- {
- categoryList.database.AddDataSource(catDS);
- categoryList.builder.rebuild();
- }
- var engineList = document.getElementById("engineList");
- if (engineList)
- {
- engineList.database.AddDataSource(catDS);
- engineList.builder.rebuild();
- }
- }
- }
-
- // try and determine last category name used
- var lastCategoryName = "";
- try
- {
- var pref = Components.classes["@mozilla.org/preferences-service;1"]
- .getService(Components.interfaces.nsIPrefBranch);
- lastCategoryName = pref.getCharPref( "browser.search.last_search_category" );
-
- if (lastCategoryName != "")
- {
- // strip off the prefix if necessary
- var prefix="NC:SearchCategory?category=";
- if (lastCategoryName.indexOf(prefix) == 0)
- {
- lastCategoryName = lastCategoryName.substr(prefix.length);
- }
- }
-
- }
- catch( e )
- {
- debug("Exception in SearchPanelStartup\n");
- lastCategoryName = "";
- }
- debug("\nSearchPanelStartup: lastCategoryName = '" + lastCategoryName + "'\n");
-
- // select the appropriate category
- var categoryPopup = document.getElementById( "categoryPopup" );
- if( categoryList && categoryPopup )
- {
- var found = false;
- for( var i = 0; i < categoryPopup.childNodes.length; i++ )
- {
- if( ( lastCategoryName == "" && categoryPopup.childNodes[i].getAttribute("value") == "NC:SearchEngineRoot" ) ||
- ( categoryPopup.childNodes[i].getAttribute("id") == lastCategoryName ) )
- {
- categoryList.selectedItem = categoryPopup.childNodes[i];
- found = true;
- break;
- }
- }
- if (categoryPopup.childNodes.length > 0)
- {
- if (found == false)
- {
- categoryList.selectedItem = categoryPopup.childNodes[0];
- }
- chooseCategory(categoryList.selectedItem);
- }
- }
-
-}
-
-
-
-function Commit()
-{
- // flush
- if (catDS)
- {
- var flushableDS = catDS.QueryInterface(Components.interfaces.nsIRDFRemoteDataSource);
- if (flushableDS)
- {
- flushableDS.Flush();
- }
- }
-
- return true;
-}
-
-
-
-function doUnload()
-{
- // Get the current window position/size.
- var x = window.screenX;
- var y = window.screenY;
- var h = window.outerHeight;
- var w = window.outerWidth;
-
- // Store these into the window attributes (for persistence).
- var win = document.getElementById( "search-editor-window" );
- win.setAttribute( "x", x );
- win.setAttribute( "y", y );
- win.setAttribute( "height", h );
- win.setAttribute( "width", w );
-}
-
-
-
-/* Note: doSort() does NOT support natural order sorting, unless naturalOrderResource is valid,
- in which case we sort ascending on naturalOrderResource
- */
-function doSort(sortColName, naturalOrderResource)
-{
- var node = document.getElementById(sortColName);
- // determine column resource to sort on
- var sortResource = node.getAttribute('resource');
- if (!sortResource) return(false);
-
- var sortDirection="ascending";
- var isSortActive = node.getAttribute('sortActive');
- if (isSortActive == "true")
- {
- sortDirection = "ascending";
-
- var currentDirection = node.getAttribute('sortDirection');
- if (currentDirection == "ascending")
- {
- if (sortResource != naturalOrderResource)
- {
- sortDirection = "descending";
- }
- }
- else if (currentDirection == "descending")
- {
- if (naturalOrderResource != null && naturalOrderResource != "")
- {
- sortResource = naturalOrderResource;
- }
- }
- }
-
- var isupports = Components.classes["@mozilla.org/xul/xul-sort-service;1"].getService();
- if (!isupports) return(false);
- var xulSortService = isupports.QueryInterface(Components.interfaces.nsIXULSortService);
- if (!xulSortService) return(false);
- try
- {
- xulSortService.sort(node, sortResource, sortDirection);
- }
- catch(ex)
- {
- debug("Exception calling xulSortService.sort()");
- }
- return(true);
-}
-
-
-
-function chooseCategory( aNode )
-{
- var category = "NC:SearchCategory?category=" + aNode.getAttribute("id");
- debug("chooseCategory: '" + category + "'\n");
-
- var treeNode = document.getElementById("engineList");
- if (treeNode)
- {
- dump("*** Set search engine list to category=" + category + "\n");
- treeNode.setAttribute( "ref", category );
- treeNode.builder.rebuild();
- }
- return(true);
-}
-
-
-
-function AddEngine()
-{
- var allenginesList = document.getElementById("allengines");
- if (!allenginesList) return(false);
- var select_list = allenginesList.selectedItems;
- if (!select_list) return(false)
- if (select_list.length < 1) return(false);
-
- // make sure we have at least one category to add engine into
- var categoryPopup = document.getElementById( "categoryPopup" );
- if (!categoryPopup) return(false);
- if (categoryPopup.childNodes.length < 1)
- {
- if (NewCategory() == false) return(false);
- }
-
- var engineList = document.getElementById("engineList");
- if (!engineList) return(false);
-
- var ref = engineList.getAttribute("ref");
- if ((!ref) || (ref == "")) return(false);
-
- var categoryRes = RDF.GetResource(ref);
- if (!categoryRes) return(false);
-
- RDFCUtils.MakeSeq(catDS, categoryRes);
-
- RDFC.Init(catDS, categoryRes);
-
- var urlRes = RDF.GetResource("http://home.netscape.com/NC-rdf#URL");
- if (!urlRes) return(false);
- var typeRes = RDF.GetResource("http://home.netscape.com/NC-rdf#searchtype");
- if (!typeRes) return(false);
- var engineRes = RDF.GetResource("http://home.netscape.com/NC-rdf#Engine");
- if (!engineRes) return(false);
-
- for (var x = 0; x < select_list.length; x++)
- {
- var id = select_list[x].getAttribute("id");
- if ((!id) || (id == "")) return(false);
- var idRes = RDF.GetResource(id);
- if (!idRes) return(false);
-
- // try and find/use alias to search engine
- var privateEngineFlag = internetSearchDS.HasAssertion(idRes, typeRes, engineRes, true);
- if (privateEngineFlag == true)
- {
- var node = internetSearchDS.GetTarget(idRes, urlRes, true);
- if (node) node = node.QueryInterface(Components.interfaces.nsIRDFLiteral);
- if (node)
- {
- if (node.Value)
- {
- id = node.Value;
- idRes = RDF.GetResource(id);
- if (!idRes) return(false);
- }
- }
- }
-
- var nodeIndex = RDFC.IndexOf(idRes);
- if (nodeIndex < 1)
- {
- RDFC.AppendElement(idRes);
- }
- }
-
- return(true);
-}
-
-
-
-function RemoveEngine()
-{
- var engineList = document.getElementById("engineList");
- if (!engineList) return(false);
- var select_list = engineList.selectedItems;
- if (!select_list) return(false)
- if (select_list.length < 1) return(false);
-
- var ref = engineList.getAttribute("ref");
- if ((!ref) || (ref == "")) return(false);
- var categoryRes = RDF.GetResource(ref);
- if (!categoryRes) return(false);
-
- RDFC.Init(catDS, categoryRes);
-
- // Note: walk backwards to make deletion easier
- for (var x = select_list.length - 1; x >= 0; x--)
- {
- var id = select_list[x].getAttribute("id");
- if ((!id) || (id == "")) return(false);
- var idRes = RDF.GetResource(id);
- if (!idRes) return(false);
-
- var nodeIndex = RDFC.IndexOf(idRes);
- if (nodeIndex > 0)
- {
- RDFC.RemoveElementAt(nodeIndex, true, idRes);
- }
- }
-
- return(true);
-}
-
-
-
-function MoveUp()
-{
- return MoveDelta(-1);
-}
-
-
-
-function MoveDown()
-{
- return MoveDelta(1);
-}
-
-
-
-function MoveDelta(delta)
-{
- var engineList = document.getElementById("engineList");
- if (!engineList) return(false);
- var select_list = engineList.selectedItems;
- if (!select_list) return(false)
- if (select_list.length != 1) return(false);
-
- var ref = engineList.getAttribute("ref");
- if (!ref) return(false);
- var categoryRes = RDF.GetResource(ref);
- if (!categoryRes) return(false);
-
- var id = select_list[0].id;
- if (!id) return(false);
- var idRes = RDF.GetResource(id);
- if (!idRes) return(false);
-
- RDFC.Init(catDS, categoryRes);
-
- var nodeIndex = RDFC.IndexOf(idRes);
- if (nodeIndex < 1) return(false); // how did that happen?
-
- var numItems = RDFC.GetCount();
-
- var newPos = -1;
- if (((delta == -1) && (nodeIndex > 1)) ||
- ((delta == 1) && (nodeIndex < numItems)))
- {
- newPos = nodeIndex + delta;
- RDFC.RemoveElementAt(nodeIndex, true, idRes);
- }
- if (newPos > 0)
- {
- RDFC.InsertElementAt(idRes, newPos, true);
- }
-
- selectItems(engineList, ref, id);
-
- return(true);
-}
-
-function doMoveDirectionEnabling()
-{
- var engineList = document.getElementById("engineList")
- var selectedItems = engineList.selectedItems;
- var nodeIndex = -1;
- if (selectedItems && selectedItems.length == 1) {
- var ref = engineList.getAttribute("ref");
- var categoryResource = RDF.GetResource(ref);
- var elementResource = RDF.GetResource(selectedItems[0].id);
- RDFC.Init(catDS, categoryResource);
- nodeIndex = RDFC.IndexOf(elementResource);
- }
-
- var moveUpButton = document.getElementById("up");
- var moveDownButton = document.getElementById("down");
-
- if (nodeIndex <= 1)
- moveUpButton.setAttribute("disabled", "true");
- else
- moveUpButton.removeAttribute("disabled");
-
- if (nodeIndex < 0 || nodeIndex >= RDFC.GetCount())
- moveDownButton.setAttribute("disabled", "true");
- else
- moveDownButton.removeAttribute("disabled");
-}
-
-
-function NewCategory()
-{
- var promptStr = bundle.GetStringFromName("NewCategoryPrompt");
- var newTitle = bundle.GetStringFromName("NewCategoryTitle");
- var result = {value:null};
- var confirmed = promptService.prompt(window, newTitle, promptStr, result, null, {value:0});
- if (!confirmed || (!result.value) || result.value == "") return(false);
-
- var newName = RDF.GetLiteral(result.value);
- if (!newName) return(false);
-
- var categoryRes = RDF.GetResource("NC:SearchCategoryRoot");
- if (!categoryRes) return(false);
-
- RDFC.Init(catDS, categoryRes);
-
- var randomID = Math.random();
- var categoryID = "NC:SearchCategory?category=urn:search:category:" + randomID.toString();
- var currentCatRes = RDF.GetResource(categoryID);
- if (!currentCatRes) return(false);
-
- var titleRes = RDF.GetResource("http://home.netscape.com/NC-rdf#title");
- if (!titleRes) return(false);
-
- // set the category's name
- catDS.Assert(currentCatRes, titleRes, newName, true);
-
- // and insert the category
- RDFC.AppendElement(currentCatRes);
-
- RDFCUtils.MakeSeq(catDS, currentCatRes);
-
- // try and select the new category
- var categoryList = document.getElementById( "categoryList" );
- var select_list = categoryList.getElementsByAttribute("id", categoryID);
- if (select_list && select_list.item(0))
- {
- categoryList.selectedItem = select_list[0];
- chooseCategory(categoryList.selectedItem);
- }
- return(true);
-}
-
-
-
-function RenameCategory()
-{
- // make sure we have at least one category
- var categoryPopup = document.getElementById( "categoryPopup" );
- if (!categoryPopup) return(false);
- if (categoryPopup.childNodes.length < 1) return(false);
-
- var categoryList = document.getElementById( "categoryList" );
- var currentName = categoryList.selectedItem.getAttribute("label");
- var promptStr = bundle.GetStringFromName("RenameCategoryPrompt");
- var renameTitle = bundle.GetStringFromName("RenameCategoryTitle");
- var result = {value:currentName};
- var confirmed = promptService.prompt(window,renameTitle,promptStr,result,null,{value:0});
- if (!confirmed || (!result.value) || (result.value == "") || result.value == currentName) return(false);
-
- var currentCatID = categoryList.selectedItem.getAttribute("id");
- var currentCatRes = RDF.GetResource(currentCatID);
- if (!currentCatRes) return(false);
-
- var titleRes = RDF.GetResource("http://home.netscape.com/NC-rdf#title");
- if (!titleRes) return(false);
-
- var newName = RDF.GetLiteral(result.value);
- if (!newName) return(false);
-
- var oldName = catDS.GetTarget(currentCatRes, titleRes, true);
- if (oldName) oldName = oldName.QueryInterface(Components.interfaces.nsIRDFLiteral);
- if (oldName)
- {
- catDS.Change(currentCatRes, titleRes, oldName, newName);
- }
- else
- {
- catDS.Assert(currentCatRes, titleRes, newName, true);
- }
-
- // force popup to update
- chooseCategory(categoryList.selectedItem);
-
- return(true);
-}
-
-
-
-function RemoveCategory()
-{
- // make sure we have at least one category
- var categoryPopup = document.getElementById( "categoryPopup" );
- if (!categoryPopup) return(false);
- if (categoryPopup.childNodes.length < 1) return(false);
-
- var promptStr = bundle.GetStringFromName("RemoveCategoryPrompt");
- if (!confirm(promptStr)) return(false);
-
- var categoryRes = RDF.GetResource("NC:SearchCategoryRoot");
- if (!categoryRes) return(false);
-
- var categoryList = document.getElementById( "categoryList" );
- if (!categoryList) return(false);
-
- var idNum = categoryList.selectedIndex;
-
- var id = categoryList.selectedItem.getAttribute("id");
- if ((!id) || (id == "")) return(false);
-
- var idRes = RDF.GetResource(id);
- if (!idRes) return(false);
-
- RDFC.Init(catDS, categoryRes);
-
- var nodeIndex = RDFC.IndexOf(idRes);
- if (nodeIndex < 1) return(false); // how did that happen?
-
- RDFC.RemoveElementAt(nodeIndex, true, idRes);
-
- // try and select another category
- if (idNum > 0) --idNum;
- else idNum = 0;
-
- if (categoryPopup.childNodes.length > 0)
- {
- categoryList.selectedItem = categoryPopup.childNodes[idNum];
- chooseCategory(categoryList.selectedItem);
- }
- else
- {
- // last category was deleted, so empty out engine list
- var treeNode = document.getElementById("engineList");
- if (treeNode)
- {
- treeNode.setAttribute( "ref", "" );
- }
- }
- return(true);
-}
-
-
-
-function selectItems(listbox, containerID, targetID)
-{
- var select_list = listbox.getElementsByAttribute("id", targetID);
- for (var x=0; x
-
-
-
-
-
-
-
-
-
diff --git a/mozilla/xpfe/components/search/resources/search-panel.js b/mozilla/xpfe/components/search/resources/search-panel.js
deleted file mode 100644
index f5f513ed53c..00000000000
--- a/mozilla/xpfe/components/search/resources/search-panel.js
+++ /dev/null
@@ -1,1149 +0,0 @@
-/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla 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/MPL/
- *
- * 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 the Initial Developer are Copyright (C) 1998
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- * Robert John Churchill (Original Author)
- * Peter Annema
- * Blake Ross
- * Ben Goodger
- * Rob Ginda
- * Steve Lamm
- * Samir Gehani
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either of the GNU General Public License Version 2 or later (the "GPL"),
- * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-const ISEARCH_CONTRACTID = "@mozilla.org/rdf/datasource;1?name=internetsearch";
-const RDFSERVICE_CONTRACTID = "@mozilla.org/rdf/rdf-service;1";
-const BMARKS_CONTRACTID = "@mozilla.org/browser/bookmarks-service;1";
-
-const nsIBookmarksService = Components.interfaces.nsIBookmarksService;
-const nsIRDFService = Components.interfaces.nsIRDFService;
-const nsIRDFLiteral = Components.interfaces.nsIRDFLiteral;
-const nsIRDFDataSource = Components.interfaces.nsIRDFDataSource;
-const nsIRDFRemoteDataSource = Components.interfaces.nsIRDFRemoteDataSource;
-const nsIInternetSearchService = Components.interfaces.nsIInternetSearchService;
-
-const DEBUG = false;
-
-var debug;
-if (!DEBUG)
-{
- debug = function(msg) {};
-}
-else
-{
- debug = function(msg)
- {
- dump("\t ^^^ search-panel.js: " + msg + "\n");
- };
-}
-
-var rootNode;
-var textArc;
-var modeArc;
-var searchBundle;
-var regionalBundle;
-var gSearchButtonText = null;
-var gStopButtonText = null;
-
-var sidebarInitiatedSearch = false;
-
-var RDF_observer =
-{
- onAssert : function(ds, src, prop, target)
- {
- if (src == rootNode) {
- if (prop == textArc)
- rememberSearchText(target);
- else if (prop == modeArc)
- updateSearchMode();
- }
- },
-
- onUnassert : function(ds, src, prop, target)
- {
- },
-
- onChange : function(ds, src, prop, old_target, new_target)
- {
- if (src == rootNode) {
- if (prop == textArc)
- rememberSearchText(new_target);
- else if (prop == modeArc)
- updateSearchMode();
- }
- },
-
- onMove : function(ds, old_src, new_src, prop, target)
- {
- },
-
- onBeginUpdateBatch : function(ds)
- {
- },
-
- onEndUpdateBatch : function(ds)
- {
- }
-}
-
-function rememberSearchText(target)
-{
- if (sidebarInitiatedSearch) {
- // this avoids updating the sidebar textbox twice
- return;
- }
- if (target) {
- target = target.QueryInterface(nsIRDFLiteral).Value;
- if (target) {
- // convert plusses (+) back to spaces
- target = target.replace(/\+/g, " ");
- var textNode = document.getElementById("sidebar-search-text");
-
- if (target != textNode.value) {
- // category is unknown, therefore use "All Engines"
- var categoryPopup = document.getElementById( "categoryPopup" );
- var categoryList = document.getElementById( "categoryList" );
- if (categoryPopup && categoryList) {
- categoryList.selectedItem = categoryPopup.childNodes[0];
- }
- }
-
- textNode.value = decodeURIComponent(target);
- doEnabling();
- }
- }
- // show the results tab
- switchTab(0);
-}
-
-function getIndexToSelect(haveDefault, defaultEngine, enginePopup)
-{
- if (haveDefault)
- {
- // iterate over constrained engine list for a default engine match
- for (var i = 0; i < enginePopup.childNodes.length; ++i)
- {
- if (enginePopup.childNodes[i].id == defaultEngine)
- {
- // found match with default engine!
- return i;
- }
- }
- }
-
- return 0; // default to first engine at index '0'
-}
-
-function getMinVer()
-{
- var minVerStr = nsPreferences.
- copyUnicharPref("browser.search.basic.min_ver");
- var minVer = parseFloat(minVerStr);
- if (isNaN(minVer))
- minVer = 0; // no pref or not a number so default to min ver 0.0
-
- debug("Float value of minVer = " + minVer);
- return minVer;
-}
-
-/**
- * Constrain the list of engines to only those that
- * contain ver >= browser.search.basic.min_ver pref
- * value to be displayed in the basic popup list of
- * engines.
- */
-function constrainBasicList()
-{
- debug("constrainBasicList");
-
- var basicEngineMenu = document.getElementById("basicEngineMenu");
- if (!basicEngineMenu)
- {
- debug("Ack! basicEngineList is empty!");
- return;
- }
-
- var basicEngines = basicEngineMenu.childNodes[1];
- var len = basicEngines.childNodes.length;
- var currDesc;
- var currVer;
- var haveDefault = false;
-
- debug("Found " + len + " sherlock plugins.");
- var defaultEngine = nsPreferences.
- copyUnicharPref("browser.search.defaultengine");
-
- // we constrain the basic list to all engines with ver >= minVer
- var minVer = getMinVer();
-
- for (var i = 0; i < len; ++i)
- {
- currDesc = basicEngines.childNodes[i].getAttribute("desc");
- debug("Engine[" + i + "] = " + currDesc);
-
- // make sure we leave the default engine (check if we already have
- // the default to avoid duplicates)
- if (basicEngines.childNodes[i].id == defaultEngine && !haveDefault)
- {
- haveDefault = true;
- }
- else
- {
- // remove if not a basic engine
- currVer = basicEngines.childNodes[i].getAttribute("ver");
- if (!currVer || isNaN(parseFloat(currVer)))
- {
- // missing version attr or not a number: default to ver 1.0
- currVer = 1;
- }
- debug("Version of " + (currDesc ? currDesc : "") +
- " is: " + currVer);
-
- if (parseFloat(currVer) < minVer)
- {
- try
- {
- basicEngines.removeChild(basicEngines.childNodes[i]);
- --i;
- --len;
- }
- catch (ex)
- {
- debug("Exception: Couldn't remove " + currDesc +
- " from engine list!");
- }
- }
- }
- }
-
- // mark selected engine
- var selected = getIndexToSelect(haveDefault, defaultEngine, basicEngines);
- basicEngineMenu.selectedItem = basicEngines.childNodes[selected];
-}
-
-function updateSearchMode()
-{
- debug("updateSearchMode");
-
- var searchMode = nsPreferences.getIntPref("browser.search.mode");
- var categoryBox = document.getElementById("categoryBox");
- var basicBox = document.getElementById("basicBox");
-
- debug("search mode is " + searchMode);
- if (searchMode == 0)
- {
- categoryBox.setAttribute("collapsed", "true");
- basicBox.removeAttribute("collapsed");
- switchTab(0);
-
- constrainBasicList();
- }
- else
- {
- categoryBox.removeAttribute("collapsed");
- basicBox.setAttribute("collapsed", "true");
- switchTab(1);
- }
-
- return searchMode;
-}
-
-function readRDFString(aDS,aRes,aProp) {
- var n = aDS.GetTarget(aRes, aProp, true);
- if (n)
- return n.QueryInterface(Components.interfaces.nsIRDFLiteral).Value;
- return null;
-}
-
-
-function ensureDefaultEnginePrefs(aRDF,aDS)
-{
- var prefbranch = Components.classes["@mozilla.org/preferences-service;1"]
- .getService(Components.interfaces.nsIPrefBranch);
- var defaultName = prefbranch.getComplexValue("browser.search.defaultenginename",
- Components.interfaces.nsIPrefLocalizedString).data;
- var kNC_Root = aRDF.GetResource("NC:SearchEngineRoot");
- var kNC_child = aRDF.GetResource("http://home.netscape.com/NC-rdf#child");
- var kNC_Name = aRDF.GetResource("http://home.netscape.com/NC-rdf#Name");
-
- var arcs = aDS.GetTargets(kNC_Root, kNC_child, true);
- while (arcs.hasMoreElements()) {
- var engineRes = arcs.getNext().QueryInterface(Components.interfaces.nsIRDFResource);
- var name = readRDFString(aDS, engineRes, kNC_Name);
- if (name == defaultName)
- prefbranch.setCharPref("browser.search.defaultengine", engineRes.Value);
- }
-}
-
-function AskChangeDefaultEngine(aSelectedEngine)
-{
- const kDontAskAgainPref = "browser.search.set_default.dont_ask_again";
- const kDefaultEnginePref = "browser.search.defaultengine";
-
- // don't prompt user if selection is same as old default engine
- var oldDefault = nsPreferences.copyUnicharPref(kDefaultEnginePref);
- if (aSelectedEngine.getAttribute("value") == oldDefault)
- return;
-
- // check "don't ask again" pref
- var dontAskAgain = nsPreferences.getBoolPref(kDontAskAgainPref, false);
- var change = false; // should we change the default engine?
-
- // if "don't ask again" pref was set
- if (dontAskAgain)
- {
- change = true;
- }
- else
- {
- // prompt user if we should change their default engine
- var promptSvc = Components.
- classes["@mozilla.org/embedcomp/prompt-service;1"].
- getService(Components.interfaces.nsIPromptService);
- if (!promptSvc)
- return;
- var title = searchBundle.getString("changeEngineTitle");
- var dontAskAgainMsg = searchBundle.getString("dontAskAgainMsg");
- var engineName = aSelectedEngine.getAttribute("label");
- if (!engineName || engineName == "")
- engineName = searchBundle.getString("thisEngine");
- var changeEngineMsg = searchBundle.stringBundle.formatStringFromName(
- "changeEngineMsg", [engineName], 1);
-
- var checkbox = {value:0};
- var choice = promptSvc.confirmEx(window, title, changeEngineMsg,
- (promptSvc.BUTTON_TITLE_YES * promptSvc.BUTTON_POS_0) +
- (promptSvc.BUTTON_TITLE_NO * promptSvc.BUTTON_POS_1),
- null, null, null, dontAskAgainMsg, checkbox);
- if (choice == 0)
- change = true;
-
- // store "don't ask again" pref from checkbox value (if changed)
- debug("dontAskAgain: " + dontAskAgain);
- debug("checkbox.value: " + checkbox.value);
- if (checkbox.value != dontAskAgain)
- nsPreferences.setBoolPref(kDontAskAgainPref, checkbox.value);
- }
-
- // if confirmed true, i.e., change default engine, then set pref
- if (change)
- nsPreferences.setUnicharPref(kDefaultEnginePref, aSelectedEngine.value);
-
- disableNavButtons();
-}
-
-function disableNavButtons()
-{
- var nextButton = document.getElementById("next-results");
- var prevButton = document.getElementById("prev-results");
- if (nextButton && nextButton.getAttribute("disabled") != "true")
- nextButton.setAttribute("disabled", "true");
- if (prevButton && prevButton.getAttribute("disabled") != "true")
- prevButton.setAttribute("disabled", "true");
-}
-
-function ensureSearchPref()
-{
- var rdf = Components.classes["@mozilla.org/rdf/rdf-service;1"]
- .getService(Components.interfaces.nsIRDFService);
- var prefbranch = Components.classes["@mozilla.org/preferences-service;1"]
- .getService(Components.interfaces.nsIPrefBranch);
- var ds = rdf.GetDataSource("rdf:internetsearch");
- var kNC_Name = rdf.GetResource("http://home.netscape.com/NC-rdf#Name");
- var defaultEngine;
-
- try {
- defaultEngine = prefbranch.getCharPref("browser.search.defaultengine");
- } catch(ex) {
- ensureDefaultEnginePrefs(rdf, ds);
- defaultEngine = prefbranch.getCharPref("browser.search.defaultengine");
- }
-}
-
-// Initialize the Search panel:
-// 1) init the category list
-// 2) load the search engines associated with this category
-// 3) initialize the checked state of said engines
-function SearchPanelStartup()
-{
- searchBundle = document.getElementById("searchBundle");
-
- var rdf = Components.classes[RDFSERVICE_CONTRACTID].getService(nsIRDFService);
- rootNode = rdf.GetResource("NC:LastSearchRoot", true);
- textArc = rdf.GetResource("http://home.netscape.com/NC-rdf#LastText", true);
- modeArc = rdf.GetResource("http://home.netscape.com/NC-rdf#SearchMode", true);
-
- ensureSearchPref()
-
- var resultList = document.getElementById("resultList");
- resultList.database.AddObserver(RDF_observer);
-
- var categoryList = document.getElementById("categoryList");
- var internetSearch = Components.classes[ISEARCH_CONTRACTID].getService(nsIInternetSearchService);
- var catDS = internetSearch.GetCategoryDataSource();
- if (catDS) {
- catDS = catDS.QueryInterface(nsIRDFDataSource);
- categoryList.database.AddDataSource(catDS);
- categoryList.builder.rebuild();
- var engineList = document.getElementById("searchengines");
- engineList.database.AddDataSource(catDS);
- engineList.builder.rebuild();
- engineList.addEventListener("CheckboxStateChange", saveEngine, false);
- }
-
- // try and determine last category name used
- var lastCategoryName = nsPreferences.copyUnicharPref("browser.search.last_search_category", "");
- if (lastCategoryName) {
- // strip off the prefix if necessary
- var prefix = "NC:SearchCategory?category=";
- if (lastCategoryName.indexOf(prefix) == 0)
- lastCategoryName = lastCategoryName.substr(prefix.length);
- }
-
- // select the appropriate category
- var categoryPopup = document.getElementById("categoryPopup");
- var found = false;
- for (var i = 0; i < categoryPopup.childNodes.length; ++i) {
- if (lastCategoryName == "" &&
- categoryPopup.childNodes[i].getAttribute("value") == "NC:SearchEngineRoot" ||
- categoryPopup.childNodes[i].getAttribute("id") == lastCategoryName)
- {
- categoryList.selectedItem = categoryPopup.childNodes[i];
- found = true;
- break;
- }
- }
- if (!found)
- categoryList.selectedItem = categoryPopup.childNodes[0];
-
- if (!lastCategoryName)
- lastCategoryName = "NC:SearchEngineRoot";
- else if (lastCategoryName != "NC:SearchEngineRoot")
- lastCategoryName = "NC:SearchCategory?category=" + lastCategoryName;
-
- var treeNode = document.getElementById("searchengines");
- treeNode.setAttribute("ref", lastCategoryName);
-
- loadEngines(lastCategoryName);
-
- // if we have search results, show them, otherwise show engines
- if (updateSearchMode() != 0)
- {
- if (haveSearchResults())
- switchTab(0);
- else
- switchTab(1);
- }
-}
-
-function haveSearchResults()
-{
- var ds = document.getElementById("resultList").database;
- if (!ds)
- return false;
-
- var rdf = Components.classes[RDFSERVICE_CONTRACTID].getService(nsIRDFService);
- var source = rdf.GetResource("NC:LastSearchRoot", true);
- var childProperty = rdf.GetResource("http://home.netscape.com/NC-rdf#LastText", true);
- var target = ds.GetTarget(source, childProperty, true);
- if (target) {
- target = target.QueryInterface(nsIRDFLiteral).Value;
- if (target) {
- // convert plusses (+) back to spaces
- target = target.replace(/\+/g, " ");
- var textNode = document.getElementById("sidebar-search-text");
- textNode.value = decodeURI(target);
- return true;
- }
- }
- return false;
-}
-
-function getNumEngines()
-{
- var listbox = document.getElementById("searchengines");
- return listbox.getElementsByTagName("listitem").length;
-}
-
-function chooseCategory(aNode)
-{
- var category = !aNode.id ? "NC:SearchEngineRoot" :
- "NC:SearchCategory?category=" + aNode.getAttribute("id");
- nsPreferences.setUnicharPref("browser.search.last_search_category", category);
-
- var treeNode = document.getElementById("searchengines");
- treeNode.setAttribute("ref", category);
-
- loadEngines(category);
-}
-
-function saveEngine(event)
-{
- var rdf = Components.classes[RDFSERVICE_CONTRACTID].getService(nsIRDFService);
- var localStore = rdf.GetDataSource("rdf:local-store");
- if (!localStore)
- return;
-
- var checkedProperty = rdf.GetResource("http://home.netscape.com/NC-rdf#checked", true);
- var engines = event.currentTarget;
- var categorySRC = rdf.GetResource(engines.ref, true);
-
- var itemNode = event.target;
- var engineSRC = rdf.GetResource(itemNode.id, true);
-
- if (itemNode.checked)
- localStore.Assert(categorySRC, checkedProperty, engineSRC, true);
- else
- localStore.Unassert(categorySRC, checkedProperty, engineSRC, true);
-
- // save changes; flush out the localstore
- try {
- var flushableStore = localStore.QueryInterface(nsIRDFRemoteDataSource);
- flushableStore.Flush();
- }
- catch (ex) {}
-}
-
-// initialize the appropriate engine list, and the checked state of the engines
-function loadEngines(aCategory)
-{
- var rdf = Components.classes[RDFSERVICE_CONTRACTID].getService(nsIRDFService);
- var localStore = rdf.GetDataSource("rdf:local-store");
- if (localStore) {
- var engineBox = document.getElementById("searchengines");
- var numEngines = engineBox.childNodes.length;
- var checkedProperty = rdf.GetResource("http://home.netscape.com/NC-rdf#checked", true);
- var categorySRC = rdf.GetResource(aCategory, true);
- for (var x = 0; x < numEngines; ++x) {
- var listitemNode = engineBox.childNodes[x];
- if (listitemNode.localName == "listitem") {
- var engineURI = listitemNode.getAttribute("id");
- var engineSRC = rdf.GetResource(engineURI, true);
-
- var hasAssertion = localStore.HasAssertion(categorySRC, checkedProperty, engineSRC, true);
- if (hasAssertion)
- listitemNode.checked = true;
- }
- }
- }
-}
-
-function SearchPanelShutdown()
-{
- var tree = document.getElementById("resultList");
- tree.database.RemoveObserver(RDF_observer);
-}
-
-function doStop()
-{
- if (!gSearchButtonText)
- gSearchButtonText = searchBundle.getString("searchButtonText");
-
- var searchButtonNode = document.getElementById("searchButton");
- searchButtonNode.removeAttribute("stop");
- searchButtonNode.setAttribute("label", gSearchButtonText);
-
- // should stop button press also stop the load of the page in the browser? I think so.
- var progressNode = parent.document.getElementById("statusbar-icon");
- if (progressNode)
- progressNode.setAttribute("mode", "normal");
-
- // stop any network connections
- var internetSearchService = Components.classes[ISEARCH_CONTRACTID].getService(nsIInternetSearchService);
- internetSearchService.Stop();
-
- // show appropriate column(s)
- var navWindow = getNavigatorWindow(false);
- var resultsList = navWindow ? navWindow.content.document.getElementById("resultsList") : null;
- if (!resultsList)
- return;
-
- var searchURL = resultsList.getAttribute("ref");
- if (!searchURL)
- return;
-
- var internetSearch = internetSearchService.QueryInterface(nsIRDFDataSource);
-
- // get various services
- var rdf = Components.classes[RDFSERVICE_CONTRACTID].getService(nsIRDFService);
-
- var searchResource = rdf.GetResource(searchURL, true);
- var priceProperty = rdf.GetResource("http://home.netscape.com/NC-rdf#Price", true);
- var availabilityProperty = rdf.GetResource("http://home.netscape.com/NC-rdf#Availability", true);
- var relevanceProperty = rdf.GetResource("http://home.netscape.com/NC-rdf#Relevance", true);
- var dateProperty = rdf.GetResource("http://home.netscape.com/NC-rdf#Date", true);
- var trueProperty = rdf.GetLiteral("true");
- var hasPriceFlag = internetSearch.HasAssertion(searchResource, priceProperty, trueProperty, true);
- var hasAvailabilityFlag = internetSearch.HasAssertion(searchResource, availabilityProperty, trueProperty, true);
- var hasRelevanceFlag = internetSearch.HasAssertion(searchResource, relevanceProperty, trueProperty, true);
- var hasDateFlag = internetSearch.HasAssertion(searchResource, dateProperty, trueProperty, true);
- var colNode;
- var sortSetFlag = false;
-
- if (hasPriceFlag) {
- colNode = navWindow.content.document.getElementById("PriceColumn");
- if (colNode) {
- colNode.removeAttribute("hidden");
- if (!sortSetFlag) {
- top.content.setInitialSort(colNode, "ascending");
- sortSetFlag = true;
- }
- }
- }
-
- if (hasAvailabilityFlag) {
- colNode = navWindow.content.document.getElementById("AvailabilityColumn");
- if (colNode)
- colNode.removeAttribute("hidden");
- }
-
- if (hasDateFlag) {
- colNode = navWindow.content.document.getElementById("DateColumn");
- if (colNode)
- colNode.removeAttribute("hidden");
- }
-
- if (hasRelevanceFlag) {
- colNode = navWindow.content.document.getElementById("RelevanceColumn");
- if (colNode) {
- colNode.removeAttribute("hidden");
- if (!sortSetFlag) {
- navWindow.content.setInitialSort(colNode, "descending");
- sortSetFlag = true;
- }
- }
- }
-
- if (!sortSetFlag) {
- colNode = navWindow.content.document.getElementById("PageRankColumn");
- if (colNode)
- navWindow.content.setInitialSort(colNode, "ascending");
- }
-
- switchTab(0);
-}
-
-function doSearch()
-{
- var navWindow = getNavigatorWindow(true);
- if (navWindow.content)
- onNavWindowLoad();
- else
- navWindow.addEventListener("load", onNavWindowLoad, false);
-}
-
-function onNavWindowLoad() {
- var navWindow = getNavigatorWindow(true);
-
- // hide various columns
- if (navWindow && "content" in navWindow && "isMozillaSearchWindow" in navWindow.content) {
- colNode = navWindow.content.document.getElementById("RelevanceColumn");
- if (colNode)
- colNode.setAttribute("hidden", "true");
-
- colNode = navWindow.content.document.getElementById("PriceColumn");
- if (colNode)
- colNode.setAttribute("hidden", "true");
-
- colNode = navWindow.content.document.getElementById("AvailabilityColumn");
- if (colNode)
- colNode.setAttribute("hidden", "true");
- }
-
- // get user text to find
- var textNode = document.getElementById("sidebar-search-text");
-
- if (!textNode.value) {
- alert(searchBundle.getString("enterstringandlocation"));
- return;
- }
-
- var searchMode = nsPreferences.getIntPref("browser.search.mode", 0);
- var engineURIs = [];
- if (searchMode > 0) {
- var foundEngine = false;
- var itemNode;
- var engineBox = document.getElementById("searchengines");
-
- // in advanced search mode, get selected search engines
- // (for the current search category)
- for (var x = 0; x < engineBox.childNodes.length; ++x) {
- itemNode = engineBox.childNodes[x];
-
- if (itemNode.localName == "listitem" && itemNode.checked) {
- var engineURI = itemNode.id;
-
- if (engineURI) {
- engineURIs[engineURIs.length] = engineURI;
- foundEngine = true;
- }
- }
- }
-
- if (!foundEngine) {
- if (getNumEngines() == 1) {
- // only one engine in this category, check it
- itemNode = engineBox.firstChild;
- engineURIs[engineURIs.length] = itemNode.id;
- }
- else {
- for (var i = 0; i < engineBox.childNodes.length; ++i) {
- itemNode = engineBox.childNodes[i];
- var theID = itemNode.id;
- if (theID.indexOf("google.src") != -1) {
- engineURIs[engineURIs.length] = theID;
- foundEngine = true;
- break;
- }
- }
-
- if (!foundEngine) {
- alert(searchBundle.getString("enterstringandlocation"));
- return;
- }
- }
- }
- }
- else
- {
- var basicEngines = document.getElementById("basicEngineMenu");
- engineURIs[0] = basicEngines.selectedItem.id;
- debug("basic mode URI = " + engineURIs[0]);
- }
-
- if (!gStopButtonText)
- gStopButtonText = searchBundle.getString("stopButtonText");
-
- var searchButtonNode = document.getElementById("searchButton");
- searchButtonNode.setAttribute("stop", "true");
- searchButtonNode.setAttribute("label", gStopButtonText);
-
- var progressNode = top.document.getElementById("statusbar-icon");
- if (progressNode)
- progressNode.setAttribute("mode", "undetermined");
-
- // run the search
- OpenSearch(textNode.value, engineURIs);
- switchTab(0);
-}
-
-function checkSearchProgress()
-{
- var activeSearchFlag = false;
- var navWindow = getNavigatorWindow(false);
-
- if (navWindow) {
- var resultsList = navWindow.content.document.getElementById("resultsList");
- if (resultsList) {
- var treeref = resultsList.getAttribute("ref");
- var ds = resultsList.database;
- if (ds && treeref) {
- try {
- var rdf = Components.classes[RDFSERVICE_CONTRACTID].getService(nsIRDFService);
- var source = rdf.GetResource(treeref, true);
- var loadingProperty = rdf.GetResource("http://home.netscape.com/NC-rdf#loading", true);
- var target = ds.GetTarget(source, loadingProperty, true);
- if (target)
- target = target.QueryInterface(nsIRDFLiteral).Value;
- activeSearchFlag = target == "true" ? true : false;
- }
- catch (ex) {
- activeSearchFlag = false;
- }
- }
- }
- }
-
- if (activeSearchFlag)
- setTimeout("checkSearchProgress()", 1000);
- else
- doStop();
-
- return activeSearchFlag;
-}
-
-function sidebarOpenURL(listitem)
-{
- var id = listitem.id;
- if (!id)
- return;
-
- // rjc: add support for anonymous resources; if the node has
- // a "#URL" property, use it, otherwise default to using the id
- try {
- var ds = document.getElementById("resultList").database;
- if (ds) {
- var rdf = Components.classes[RDFSERVICE_CONTRACTID].getService(nsIRDFService);
- 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(nsIRDFLiteral).Value;
- if (target)
- id = target;
- }
- }
- } catch (ex) {
- }
-
- // mark result as visited
- listitem.setAttribute("visited", "true");
-
- loadURLInContent(id);
-}
-
-function OpenSearch(aSearchStr, engineURIs)
-{
- gPageNumber = 0;
-
- var searchEngineURI = nsPreferences.copyUnicharPref("browser.search.defaultengine", null);
- var defaultSearchURL = nsPreferences.getLocalizedUnicharPref("browser.search.defaulturl", null);
-
- if (!defaultSearchURL) {
- regionalBundle = document.getElementById("regionalBundle");
- defaultSearchURL = regionalBundle.getString("defaultSearchURL");
- }
-
- var searchDS = Components.classes[ISEARCH_CONTRACTID].getService(nsIInternetSearchService);
-
- var escapedSearchStr = encodeURIComponent(aSearchStr);
- sidebarInitiatedSearch = true;
- searchDS.RememberLastSearchText(escapedSearchStr);
- sidebarInitiatedSearch = false;
-
- var gURL;
- try {
- if (!engineURIs || engineURIs.length <= 1) {
- // not called from sidebar or only one engine selected
- if (engineURIs && engineURIs.length == 1) {
- searchEngineURI = engineURIs[0];
- gURL = "internetsearch:engine=" + searchEngineURI + "&text=" + escapedSearchStr;
- }
-
- if (!searchEngineURI)
- searchEngineURI = regionalBundle.getString("defaultSearchURL");
-
- // look up the correct search URL format for the given engine
- try {
- var whichButtons = new Object;
- whichButtons.value = 0;
- var searchURL = searchDS.GetInternetSearchURL(searchEngineURI, escapedSearchStr, 0, 0, whichButtons);
- doNavButtonEnabling(whichButtons.value, searchDS, 0);
- }
- catch (ex) {
- debug("Exception when calling GetInternetSearchURL: " + ex);
- searchURL = "";
- }
-
- defaultSearchURL = searchURL ? searchURL : defaultSearchURL + escapedSearchStr;
- if (!searchURL)
- gURL = "";
-
- // load the results page of selected or default engine in the content area
- if (defaultSearchURL)
- loadURLInContent(defaultSearchURL);
- }
- else {
- // multiple providers
- searchURL = "";
- for (var i = 0; i < engineURIs.length; ++i) {
- searchURL += !searchURL ? "internetsearch:" : "&";
- searchURL += "engine=" + engineURIs[i];
- }
- searchURL += ("&text=" + escapedSearchStr);
- gURL = searchURL;
- loadURLInContent(encodeURI("chrome://communicator/content/search/internetresults.xul?" + searchURL));
- }
- }
- catch (ex) {
- debug("Exception: " + ex);
- }
-
- setTimeout("checkSearchProgress()", 1000);
-}
-
-function saveSearch()
-{
- var ds = document.getElementById("resultList").database;
- if (!ds)
- return;
-
- var lastSearchURI = "";
- var lastSearchText = "";
-
- var rdf = Components.classes[RDFSERVICE_CONTRACTID].getService(nsIRDFService);
- // look for last search URI
- var source = rdf.GetResource("NC:LastSearchRoot", true);
- var childProperty = rdf.GetResource("http://home.netscape.com/NC-rdf#ref", true);
- var target = ds.GetTarget(source, childProperty, true);
- if (target) {
- target = target.QueryInterface(nsIRDFLiteral).Value;
- if (target)
- lastSearchURI = target;
- }
-
- // look for last search text
- childProperty = rdf.GetResource("http://home.netscape.com/NC-rdf#LastText", true);
- target = ds.GetTarget(source, childProperty, true);
- if (target) {
- target = target.QueryInterface(nsIRDFLiteral).Value;
- if (target) {
- // convert plusses (+) back to spaces
- target = target.replace(/\+/g, " ");
- lastSearchText = decodeURIComponent(target);
- }
- }
-
- if (!lastSearchURI)
- return;
-
- // rjc says: if lastSearchText is empty/null, that's still OK, synthesize the text
- if (!lastSearchText) {
- lastSearchText = lastSearchURI;
- var siteOffset = lastSearchText.indexOf("://");
- if (siteOffset > 0) {
- siteOffset += 3;
- var endOffset = lastSearchText.indexOf("/", siteOffset);
- if (endOffset > 0)
- lastSearchText = lastSearchText.substr(0, endOffset+1);
- }
- }
-
- var searchTitle = searchBundle.stringBundle.formatStringFromName(
- "searchTitle", [lastSearchText], 1);
-
- var bmks = Components.classes[BMARKS_CONTRACTID].getService(nsIBookmarksService);
- bmks.addBookmarkImmediately(lastSearchURI, searchTitle, bmks.BOOKMARK_SEARCH_TYPE, null);
-}
-
-var gPageNumber = 0;
-/**
- * showMoreResults
- *
- * Run a query to show the next/previous page of search results for the
- * current search term.
- *
- * @param direction : -1 => previous
- * 1 => next
- */
-function showMoreResults(direction)
-{
- // XXX check if we are in basic search mode
-
- // get search engine
- var engine = document.getElementById("basicEngineMenu").selectedItem;
- var engineURI = engine.id;
-
- // get search term
- var searchTerm = document.getElementById("sidebar-search-text").value;
- searchTerm = encodeURIComponent(searchTerm);
-
- // change page number
- if (direction > 0)
- ++gPageNumber;
- else
- --gPageNumber;
-
- // get qualified URL
- var searchService = Components.classes[ISEARCH_CONTRACTID].
- getService(nsIInternetSearchService);
- var whichButtons = new Object;
- whichButtons.value = 0;
- var searchURL = searchService.GetInternetSearchURL(engineURI, searchTerm,
- direction, gPageNumber, whichButtons);
-
- doNavButtonEnabling(whichButtons.value, searchService, gPageNumber);
-
- // load URL in navigator
- loadURLInContent(searchURL);
-}
-
-function doNavButtonEnabling(whichButtons, searchService, pageNumber)
-{
- var nextButton = document.getElementById("next-results");
- var nextDisabled = nextButton.getAttribute("disabled");
- var prevButton = document.getElementById("prev-results");
- var prevDisabled = prevButton.getAttribute("disabled");
-
- if (whichButtons & searchService.kHaveNext)
- {
- if (nextDisabled)
- nextButton.removeAttribute("disabled");
- }
- else
- {
- if (!nextDisabled)
- nextButton.setAttribute("disabled", "true");
- }
-
- if ((pageNumber > 0) && (whichButtons & searchService.kHavePrev))
- {
- if (prevDisabled)
- prevButton.removeAttribute("disabled");
- }
- else
- {
- if (!prevDisabled)
- prevButton.setAttribute("disabled", "true");
- }
-}
-
-function doCustomize()
-{
- //Switching from Edit Categories back to All Engines then launching customize window
- var category = document.getElementById("categoryList");
- category.selectedIndex = 0;
- window.openDialog("chrome://communicator/content/search/search-editor.xul", "internetsearch:editor", "centerscreen,chrome,resizable");
-}
-
-function loadURLInContent(url)
-{
- var navigatorWindow = getNavigatorWindow(true);
- navigatorWindow.loadURI(url);
-}
-
-function search_getBrowserURL()
-{
- return nsPreferences.copyUnicharPref("browser.chromeURL", "chrome://navigator/content/navigator.xul");
-}
-
-function doEnabling()
-{
- var searchButton = document.getElementById("searchButton");
- var sidebarSearchText = document.getElementById("sidebar-search-text");
- searchButton.disabled = !sidebarSearchText.value;
-}
-
-//Step up the dom until getting the desired node.
-function getItemNode(aNode,nodeName)
-{
- var node = aNode;
- while (node.localName != nodeName) {
- node = node.parentNode;
- }
- return node ? node : null;
-}
-
-function getArcValueForID(aArc, aID)
-{
- var val = null;
-
- try
- {
- var ds = document.getElementById("resultList").database;
- if (ds)
- {
- var rdf = Components.classes[RDFSERVICE_CONTRACTID].
- getService(nsIRDFService);
- var src = rdf.GetResource(aID, true);
- var prop = rdf.GetResource(
- "http://home.netscape.com/NC-rdf#"+aArc, true);
- val = ds.GetTarget(src, prop, true);
- if (val)
- val = val.QueryInterface(nsIRDFLiteral).Value;
- }
- }
- catch (ex)
- {
- dump("Exception: no value for " + aArc + "!\t" + ex + "\n");
- val = null;
- }
-
- return val;
-}
-
-//Fill in tooltip in the search results panel
-function FillInDescTooltip(tipElement)
-{
- var retValue = false;
-
- //Get the Name of the listitem for first item in the tooltip
- var nodeLabel = tipElement.getAttribute("label");
- var nodeID = tipElement.id;
-
- //Query RDF to get URL of listitem
- if (nodeID)
- var url = getArcValueForID("URL", nodeID);
-
- //Fill in the the text nodes
- //collapse them if there is not a node
- if (nodeLabel || url) {
- var tooltipTitle = document.getElementById("titleText");
- var tooltipUrl = document.getElementById("urlText");
- if (nodeLabel) {
- if (tooltipTitle.getAttribute("hidden") == "true")
- tooltipTitle.removeAttribute("hidden");
- tooltipTitle.setAttribute("value",nodeLabel);
- }
- else {
- tooltipTitle.setAttribute("hidden", "true");
- }
- if (url) {
- if (tooltipUrl.getAttribute("hidden") == "true")
- tooltipUrl.removeAttribute("hidden");
- if (url.length > 100)
- url = url.substr(0,100) + "...";
- tooltipUrl.setAttribute("value",url);
- }
- else {
- tooltipUrl.setAttribute("hidden", "true");
- }
- retValue = true;
- }
- return retValue;
-}
-
-var nsResultDNDObserver =
-{
- onDragStart: function(aEvent, aXferData, aDragAction)
- {
- var node = getItemNode(aEvent.target, "listitem");
- var URL = getArcValueForID("URL", node.id);
- var title = getArcValueForID("Name", node.id);
- var htmlString = "" + title + "";
- var urlString = URL + "\n" + title;
-
- aXferData.data = new TransferData();
- aXferData.data.addDataForFlavour("text/x-moz-url", URL);
- aXferData.data.addDataForFlavour("text/unicode", urlString);
- aXferData.data.addDataForFlavour("text/html", htmlString);
- }
-};
-
-function HandleResultDragGesture(aEvent)
-{
- nsDragAndDrop.startDrag(aEvent, nsResultDNDObserver);
- return true;
-}
-
diff --git a/mozilla/xpfe/components/search/resources/search-panel.xul b/mozilla/xpfe/components/search/resources/search-panel.xul
deleted file mode 100644
index 636d7d74f4b..00000000000
--- a/mozilla/xpfe/components/search/resources/search-panel.xul
+++ /dev/null
@@ -1,199 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- &choose.label;
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/mozilla/xpfe/components/search/resources/shared.js b/mozilla/xpfe/components/search/resources/shared.js
deleted file mode 100644
index 46a9cfeff1c..00000000000
--- a/mozilla/xpfe/components/search/resources/shared.js
+++ /dev/null
@@ -1,448 +0,0 @@
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla 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/MPL/
- *
- * 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 Robert John Churchill.
- * Portions created by the Initial Developer are Copyright (C) 2002
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- * Robert John Churchill (Original Author)
- * Karsten Duesterloh
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-function fillContextMenu(name, treeName)
-{
- if (!name) return(false);
- var popupNode = document.getElementById(name);
- if (!popupNode) return(false);
- // remove the menu node (which tosses all of its kids);
- // do this in case any old command nodes are hanging around
- while (popupNode.hasChildNodes())
- {
- popupNode.removeChild(popupNode.lastChild);
- }
-
- var treeNode = document.getElementById(treeName);
- if (!treeNode) return(false);
- var db = treeNode.database;
- if (!db) return(false);
-
- var compositeDB = db.QueryInterface(Components.interfaces.nsIRDFDataSource);
- if (!compositeDB) return(false);
-
- var isupports = Components.classes["@mozilla.org/rdf/rdf-service;1"].getService();
- if (!isupports) return(false);
- var rdf = isupports.QueryInterface(Components.interfaces.nsIRDFService);
- if (!rdf) return(false);
-
- var target_item = document.popupNode.parentNode.parentNode;
- if (target_item && target_item.nodeName == "treeitem")
- {
- if (target_item.getAttribute('selected') != 'true') {
- treeNode.selectItem(target_item);
- }
- }
-
- var select_list = treeNode.selectedItems;
-
- var separatorResource = rdf.GetResource("http://home.netscape.com/NC-rdf#BookmarkSeparator");
- if (!separatorResource) return(false);
-
- // perform intersection of commands over selected nodes
- var cmdArray = new Array();
- var selectLength = select_list.length;
- if (selectLength == 0) selectLength = 1;
- for (var nodeIndex=0; nodeIndex < selectLength; nodeIndex++)
- {
- var id = null;
-
- // if nothing is selected, get commands for the "ref" of the tree root
- if (select_list.length == 0)
- {
- id = treeNode.getAttribute("ref");
- if (!id) break;
- }
- else
- {
- var node = select_list[nodeIndex];
- if (!node) break;
- id = node.getAttribute("id");
- if (!id) break;
- }
-
- var rdfNode = rdf.GetResource(id);
- if (!rdfNode) break;
- var cmdEnum = db.GetAllCmds(rdfNode);
- if (!cmdEnum) break;
-
- var nextCmdArray = new Array();
- while (cmdEnum.hasMoreElements())
- {
- var cmd = cmdEnum.getNext();
- if (!cmd) break;
- if (nodeIndex == 0)
- {
- cmdArray[cmdArray.length] = cmd;
- }
- else
- {
- nextCmdArray[cmdArray.length] = cmd;
- }
- }
- if (nodeIndex > 0)
- {
- // perform command intersection calculation
- for (var cmdIndex = 0; cmdIndex < cmdArray.length; cmdIndex++)
- {
- var cmdFound = false;
- for (var nextCmdIndex = 0; nextCmdIndex < nextCmdArray.length; nextCmdIndex++)
- {
- if (nextCmdArray[nextCmdIndex] == cmdArray[cmdIndex])
- {
- cmdFound = true;
- break;
- }
- }
- if ((cmdFound == false) && (cmdArray[cmdIndex]))
- {
- var cmdResource = cmdArray[cmdIndex].QueryInterface(Components.interfaces.nsIRDFResource);
- if ((cmdResource) && (cmdResource != separatorResource))
- {
- cmdArray[cmdIndex] = null;
- }
- }
- }
- }
- }
-
- // need a resource to ask RDF for each command's name
- var rdfNameResource = rdf.GetResource("http://home.netscape.com/NC-rdf#Name");
- if (!rdfNameResource) return(false);
-
- // build up menu items
- if (cmdArray.length < 1) return(false);
-
- var lastWasSep = false;
-
- for (var cmdIndex = 0; cmdIndex < cmdArray.length; cmdIndex++)
- {
- var cmd = cmdArray[cmdIndex];
- if (!cmd) continue;
- var cmdResource = cmd.QueryInterface(Components.interfaces.nsIRDFResource);
- if (!cmdResource) break;
-
- // handle separators
- if (cmdResource == separatorResource)
- {
- if (lastWasSep != true)
- {
- lastWasSep = true;
- var menuItem = document.createElement("menuseparator");
- popupNode.appendChild(menuItem);
- }
- continue;
- }
-
- lastWasSep = false;
-
- var cmdNameNode = compositeDB.GetTarget(cmdResource, rdfNameResource, true);
- if (!cmdNameNode) break;
- cmdNameLiteral = cmdNameNode.QueryInterface(Components.interfaces.nsIRDFLiteral);
- if (!cmdNameLiteral) break;
- cmdName = cmdNameLiteral.Value;
- if (!cmdName) break;
-
- var menuItem = document.createElement("menuitem");
- menuItem.setAttribute("label", cmdName);
- popupNode.appendChild(menuItem);
- // work around bug # 26402 by setting "oncommand" attribute AFTER appending menuitem
- menuItem.setAttribute("oncommand", "return doContextCmd('" + cmdResource.Value + "', '" + treeName + "');");
- }
-
- // strip off leading/trailing menuseparators
- while (popupNode.hasChildNodes())
- {
- if (popupNode.firstChild.tagName != "menuseparator")
- break;
- popupNode.removeChild(popupNode.firstChild);
- }
- while (popupNode.hasChildNodes())
- {
- if (popupNode.lastChild.tagName != "menuseparator")
- break;
- popupNode.removeChild(popupNode.lastChild);
- }
-
- var searchMode = 0;
- if (pref) searchMode = pref.getIntPref("browser.search.mode");
- if (pref && bundle)
- {
- // then add a menu separator (if necessary)
- if (popupNode.hasChildNodes())
- {
- if (popupNode.lastChild.tagName != "menuseparator")
- {
- var menuSep = document.createElement("menuseparator");
- popupNode.appendChild(menuSep);
- }
- }
- // And then add a "Search Mode" menu item
- var propMenuName = (searchMode == 0) ? bundle.GetStringFromName("enableAdvanced") : bundle.GetStringFromName("disableAdvanced");
- var menuItem = document.createElement("menuitem");
- menuItem.setAttribute("label", propMenuName);
- popupNode.appendChild(menuItem);
- // Work around bug # 26402 by setting "oncommand" attribute
- // AFTER appending menuitem
- menuItem.setAttribute("oncommand", "return setSearchMode();");
- }
-
- return(true);
-}
-
-
-
-function setSearchMode()
-{
- var searchMode = 0;
- if (pref) searchMode = pref.getIntPref("browser.search.mode");
- if (searchMode == 0) searchMode = 1;
- else searchMode = 0;
- if (pref) pref.setIntPref("browser.search.mode", searchMode);
- return(true);
-}
-
-
-
-function doContextCmd(cmdName, treeName)
-{
- var treeNode = document.getElementById(treeName);
- if (!treeNode) return(false);
- var db = treeNode.database;
- if (!db) return(false);
-
- var compositeDB = db.QueryInterface(Components.interfaces.nsIRDFDataSource);
- if (!compositeDB) return(false);
-
- var isupports = Components.classes["@mozilla.org/rdf/rdf-service;1"].getService();
- if (!isupports) return(false);
- var rdf = isupports.QueryInterface(Components.interfaces.nsIRDFService);
- if (!rdf) return(false);
-
- // need a resource for the command
- var cmdResource = rdf.GetResource(cmdName);
- if (!cmdResource) return(false);
- cmdResource = cmdResource.QueryInterface(Components.interfaces.nsIRDFResource);
- if (!cmdResource) return(false);
-
- // set up selection nsISupportsArray
- var selectionInstance = Components.classes["@mozilla.org/supports-array;1"].createInstance();
- var selectionArray = selectionInstance.QueryInterface(Components.interfaces.nsISupportsArray);
-
- // set up arguments nsISupportsArray
- var argumentsInstance = Components.classes["@mozilla.org/supports-array;1"].createInstance();
- var argumentsArray = argumentsInstance.QueryInterface(Components.interfaces.nsISupportsArray);
-
- // get argument (parent)
- var parentArc = rdf.GetResource("http://home.netscape.com/NC-rdf#parent");
- if (!parentArc) return(false);
-
- var select_list = treeNode.selectedItems;
- if (select_list.length < 1)
- {
- // if nothing is selected, default to using the "ref" on the root of the tree
- var uri = treeNode.getAttribute("ref");
- if (!uri || uri=="") return(false);
- var rdfNode = rdf.GetResource(uri);
- // add node into selection array
- if (rdfNode)
- {
- selectionArray.AppendElement(rdfNode);
- }
- }
- else for (var nodeIndex=0; nodeIndex
-
-
-
-
-
- &sidebar.pagenotfound.label;
-
-
diff --git a/mozilla/xpfe/components/sidebar/resources/customize-panel.js b/mozilla/xpfe/components/sidebar/resources/customize-panel.js
deleted file mode 100644
index e904065fa3e..00000000000
--- a/mozilla/xpfe/components/sidebar/resources/customize-panel.js
+++ /dev/null
@@ -1,77 +0,0 @@
-/* -*- Mode: Java -*-
- * ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla 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/MPL/
- *
- * 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 Communicator.
- *
- * The Initial Developer of the Original Code is
- * Netscape Communications Corp.
- * Portions created by the Initial Developer are Copyright (C) 1999
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- * Stephen Lamm
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either of the GNU General Public License Version 2 or later (the "GPL"),
- * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-// the rdf service
-var RDF = '@mozilla.org/rdf/rdf-service;1'
-RDF = Components.classes[RDF].getService();
-RDF = RDF.QueryInterface(Components.interfaces.nsIRDFService);
-
-var NC = "http://home.netscape.com/NC-rdf#";
-
-var sidebarObj = new Object;
-var customizeObj = new Object;
-
-function Init()
-{
- customizeObj.id = window.arguments[0];
- customizeObj.url = window.arguments[1];
- sidebarObj.datasource_uri = window.arguments[2];
- sidebarObj.resource = window.arguments[3];
-
- sidebarObj.datasource = RDF.GetDataSource(sidebarObj.datasource_uri);
-
- var customize_frame = document.getElementById('customize_frame');
- customize_frame.setAttribute('src', customizeObj.url);
-}
-
-// Use an assertion to pass a "refresh" event to all the sidebars.
-// They use observers to watch for this assertion (in sidebarOverlay.js).
-function RefreshPanel() {
- var sb_resource = RDF.GetResource(sidebarObj.resource);
- var refresh_resource = RDF.GetResource(NC + "refresh_panel");
- var panel_resource = RDF.GetLiteral(customizeObj.id);
-
- sidebarObj.datasource.Assert(sb_resource,
- refresh_resource,
- panel_resource,
- true);
- sidebarObj.datasource.Unassert(sb_resource,
- refresh_resource,
- panel_resource);
-}
-
diff --git a/mozilla/xpfe/components/sidebar/resources/customize-panel.xul b/mozilla/xpfe/components/sidebar/resources/customize-panel.xul
deleted file mode 100644
index a8fa2e955fb..00000000000
--- a/mozilla/xpfe/components/sidebar/resources/customize-panel.xul
+++ /dev/null
@@ -1,51 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/mozilla/xpfe/components/sidebar/resources/customize.js b/mozilla/xpfe/components/sidebar/resources/customize.js
deleted file mode 100644
index f660d48d4d0..00000000000
--- a/mozilla/xpfe/components/sidebar/resources/customize.js
+++ /dev/null
@@ -1,717 +0,0 @@
-/* -*- Mode: Java; tab-width: 4; insert-tabs-mode: nil; c-basic-offset: 2 -*-
- * ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla 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/MPL/
- *
- * 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 Communicator client code, released
- * March 31, 1998.
- *
- * The Initial Developer of the Original Code is
- * Netscape Communications Corporation.
- * Portions created by the Initial Developer are Copyright (C) 1998-1999
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either of the GNU General Public License Version 2 or later (the "GPL"),
- * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-//////////////////////////////////////////////////////////////
-// Global variables
-//////////////////////////////////////////////////////////////
-
-// Set to true for noise
-const CUST_DEBUG = false;
-
-// the rdf service
-var RDF = '@mozilla.org/rdf/rdf-service;1'
-RDF = Components.classes[RDF].getService();
-RDF = RDF.QueryInterface(Components.interfaces.nsIRDFService);
-
-var NC = "http://home.netscape.com/NC-rdf#";
-
-var sidebarObj = new Object;
-var allPanelsObj = new Object;
-var original_panels = new Array();
-
-//////////////////////////////////////////////////////////////
-// Sidebar Init/Destroy
-//////////////////////////////////////////////////////////////
-
-function sidebar_customize_init()
-{
- allPanelsObj.datasources = window.arguments[0];
- allPanelsObj.resource = window.arguments[1];
- sidebarObj.datasource_uri = window.arguments[2];
- sidebarObj.resource = window.arguments[3];
-
- debug("Init: all panels datasources = " + allPanelsObj.datasources);
- debug("Init: all panels resource = " + allPanelsObj.resource);
- debug("Init: sidebarObj.datasource_uri = " + sidebarObj.datasource_uri);
- debug("Init: sidebarObj.resource = " + sidebarObj.resource);
-
- var all_panels = document.getElementById('other-panels');
- var current_panels = document.getElementById('current-panels');
-
- debug("Adding observer to all panels database.");
- all_panels.database.AddObserver(panels_observer);
-
- allPanelsObj.datasources = allPanelsObj.datasources.replace(/^\s+/,'');
- allPanelsObj.datasources = allPanelsObj.datasources.replace(/\s+$/,'');
- allPanelsObj.datasources = allPanelsObj.datasources.split(/\s+/);
- for (var ii = 0; ii < allPanelsObj.datasources.length; ii++) {
- debug("Init: Adding "+allPanelsObj.datasources[ii]);
-
- // This will load the datasource, if it isn't already.
- var datasource = RDF.GetDataSource(allPanelsObj.datasources[ii]);
- all_panels.database.AddDataSource(datasource);
- }
-
- // Add the datasource for current list of panels. It selects panels out
- // of the other datasources.
- debug("Init: Adding current panels, "+sidebarObj.datasource_uri);
- sidebarObj.datasource = RDF.GetDataSource(sidebarObj.datasource_uri);
-
- // Root the customize dialog at the correct place.
- debug("Init: reset all panels ref, "+allPanelsObj.resource);
- all_panels.setAttribute('ref', allPanelsObj.resource);
-
- // Create a "container" wrapper around the current panels to
- // manipulate the RDF:Seq more easily.
- var panel_list = sidebarObj.datasource.GetTarget(RDF.GetResource(sidebarObj.resource), RDF.GetResource(NC + "panel-list"), true);
- sidebarObj.container = Components.classes["@mozilla.org/rdf/container;1"].createInstance(Components.interfaces.nsIRDFContainer);
- sidebarObj.container.Init(sidebarObj.datasource, panel_list);
-
- // Add all the current panels to the tree
- current_panels = sidebarObj.container.GetElements();
- while (current_panels.hasMoreElements()) {
- var panel = current_panels.getNext().QueryInterface(Components.interfaces.nsIRDFResource);
- if (add_node_to_current_list(sidebarObj.datasource, panel) >= 0) {
- original_panels.push(panel.Value);
- original_panels[panel.Value] = true;
- }
- }
-
- var links =
- all_panels.database.GetSources(RDF.GetResource(NC + "haslink"),
- RDF.GetLiteral("true"), true);
-
- while (links.hasMoreElements()) {
- var folder =
- links.getNext().QueryInterface(Components.interfaces.nsIRDFResource);
- var folder_name = folder.Value;
- debug("+++ fixing up remote container " + folder_name + "\n");
- fixup_remote_container(folder_name);
- }
-
- sizeToContent();
-}
-
-function sidebar_customize_destruct()
-{
- var all_panels = document.getElementById('other-panels');
- debug("Removing observer from all_panels database.");
- all_panels.database.RemoveObserver(panels_observer);
-}
-
-
-//////////////////////////////////////////////////////////////////
-// Panels' RDF Datasource Observer
-//////////////////////////////////////////////////////////////////
-var panels_observer = {
- onAssert : function(ds,src,prop,target) {
- //debug ("observer: assert");
- // "refresh" is asserted by select menu and by customize.js.
- if (prop == RDF.GetResource(NC + "link")) {
- setTimeout("fixup_remote_container('"+src.Value+"')",100);
- //fixup_remote_container(src.Value);
- }
- },
- onUnassert : function(ds,src,prop,target) {
- //debug ("observer: unassert");
- },
- onChange : function(ds,src,prop,old_target,new_target) {
- //debug ("observer: change");
- },
- onMove : function(ds,old_src,new_src,prop,target) {
- //debug ("observer: move");
- },
- onBeginUpdateBatch : function(ds) {
- //debug ("observer: onBeginUpdateBatch");
- },
- onEndUpdateBatch : function(ds) {
- //debug ("observer: onEndUpdateBatch");
- }
-};
-
-function fixup_remote_container(id)
-{
- debug('fixup_remote_container('+id+')');
-
- var container = document.getElementById(id);
- if (container) {
- container.setAttribute('container', 'true');
- container.removeAttribute('open');
- }
-}
-
-function fixup_children(id) {
- // Add container="true" on nodes with "link" attribute
- var treeitem = document.getElementById(id);
-
- var children = treeitem.childNodes.item(1).childNodes;
- for (var ii=0; ii < children.length; ii++) {
- var child = children.item(ii);
- if (child.getAttribute('link') != '' &&
- child.getAttribute('container') != 'true') {
- child.setAttribute('container', 'true');
- child.removeAttribute('open');
- }
- }
-}
-
-function get_attr(registry,service,attr_name)
-{
- var attr = registry.GetTarget(service,
- RDF.GetResource(NC + attr_name),
- true);
- if (attr)
- attr = attr.QueryInterface(Components.interfaces.nsIRDFLiteral);
- if (attr)
- attr = attr.Value;
- return attr;
-}
-
-function SelectChangeForOtherPanels(event, target)
-{
- enable_buttons_for_other_panels();
-}
-
-function ClickOnOtherPanels(event)
-{
- var tree = document.getElementById("other-panels");
-
- var rowIndex = -1;
- if (event.type == "click" && event.button == 0) {
- var row = {}, col = {}, obj = {};
- var b = tree.treeBoxObject;
- b.getCellAt(event.clientX, event.clientY, row, col, obj);
-
- if (obj.value == "twisty" || event.detail == 2) {
- rowIndex = row.value;
- }
- }
-
- if (rowIndex < 0) return;
-
- var treeitem = tree.contentView.getItemAtIndex(rowIndex);
- var res = RDF.GetResource(treeitem.id);
-
- if (treeitem.getAttribute('container') == 'true') {
- if (treeitem.getAttribute('open') == 'true') {
- var link = treeitem.getAttribute('link');
- var loaded_link = treeitem.getAttribute('loaded_link');
- if (link != '' && !loaded_link) {
- debug("Has remote datasource: "+link);
- add_datasource_to_other_panels(link);
- treeitem.setAttribute('loaded_link', 'true');
- } else {
- setTimeout('fixup_children("'+ treeitem.getAttribute('id') +'")', 100);
- }
- }
- }
-
- // Remove the selection in the "current" panels list
- var current_panels = document.getElementById('current-panels');
- current_panels.view.selection.clearSelection();
- enable_buttons_for_current_panels();
-}
-
-function add_datasource_to_other_panels(link) {
- // Convert the |link| attribute into a URL
- var url = document.location;
- debug("Current URL: " +url);
- debug("Current link: " +link);
-
- var uri = Components.classes['@mozilla.org/network/standard-url;1'].createInstance();
- uri = uri.QueryInterface(Components.interfaces.nsIURI);
- uri.spec = url;
- uri = uri.resolve(link);
-
- debug("New URL: " +uri);
-
- // Add the datasource to the tree
- var all_panels = document.getElementById('other-panels');
- all_panels.database.AddDataSource(RDF.GetDataSource(uri));
-
- // XXX This is a hack to force re-display
- //all_panels.setAttribute('ref', allPanelsObj.resource);
-}
-
-// Handle a selection change in the current panels.
-function SelectChangeForCurrentPanels() {
- // Remove the selection in the available panels list
- var all_panels = document.getElementById('other-panels');
- all_panels.view.selection.clearSelection();
-
- enable_buttons_for_current_panels();
-}
-
-// Move the selected item up the the current panels list.
-function MoveUp() {
- var tree = document.getElementById('current-panels');
- if (tree.view.selection.count == 1) {
- var index = tree.currentIndex;
- var selected = tree.contentView.getItemAtIndex(index);
- var before = selected.previousSibling;
- if (before) {
- before.parentNode.removeChild(selected);
- before.parentNode.insertBefore(selected, before);
- tree.view.selection.select(index-1);
- tree.treeBoxObject.ensureRowIsVisible(index-1);
- }
- }
-}
-
-// Move the selected item down the the current panels list.
-function MoveDown() {
- var tree = document.getElementById('current-panels');
- if (tree.view.selection.count == 1) {
- var index = tree.currentIndex;
- var selected = tree.contentView.getItemAtIndex(index);
- if (selected.nextSibling) {
- if (selected.nextSibling.nextSibling)
- selected.parentNode.insertBefore(selected, selected.nextSibling.nextSibling);
- else
- selected.parentNode.appendChild(selected);
- tree.view.selection.select(index+1);
- tree.treeBoxObject.ensureRowIsVisible(index+1);
- }
- }
-}
-
-function PreviewPanel()
-{
- var tree = document.getElementById('other-panels');
- var database = tree.database;
- var sel = tree.view.selection;
- var rangeCount = sel.getRangeCount();
- for (var range = 0; range < rangeCount; ++range) {
- var min = {}, max = {};
- sel.getRangeAt(range, min, max);
- for (var index = min.value; index <= max.value; ++index) {
- var item = tree.contentView.getItemAtIndex(index);
- var res = RDF.GetResource(item.id);
-
- var preview_name = get_attr(database, res, 'title');
- var preview_URL = get_attr(database, res, 'content');
- if (!preview_URL || !preview_name) continue;
-
- window.openDialog("chrome://communicator/content/sidebar/preview.xul",
- "_blank", "chrome,resizable,close,dialog=no",
- preview_name, preview_URL);
- }
- }
-}
-
-// Add the selected panel(s).
-function AddPanel()
-{
- var added = -1;
-
- var tree = document.getElementById('other-panels');
- var database = tree.database;
- var sel = tree.view.selection;
- var ranges = sel.getRangeCount();
- for (var range = 0; range < ranges; ++range) {
- var min = {}, max = {};
- sel.getRangeAt(range, min, max);
- for (var index = min.value; index <= max.value; ++index) {
- var item = tree.contentView.getItemAtIndex(index);
- if (item.getAttribute("container") != "true") {
- var res = RDF.GetResource(item.id);
- // Add the panel to the current list.
- added = add_node_to_current_list(database, res);
- }
- }
- }
-
- if (added >= 0) {
- // Remove the selection in the other list.
- // Selection will move to "current" list.
- tree.view.selection.clearSelection();
-
- var current_panels = document.getElementById('current-panels');
- current_panels.view.selection.select(added);
- current_panels.treeBoxObject.ensureRowIsVisible(added);
- }
-}
-
-// Copy a panel node into a database such as the current panel list.
-function add_node_to_current_list(registry, service)
-{
- debug("Adding "+service.Value);
-
- // Copy out the attributes we want
- var option_title = get_attr(registry, service, 'title');
- var option_customize = get_attr(registry, service, 'customize');
- var option_content = get_attr(registry, service, 'content');
- if (!option_title || !option_content)
- return -1;
-
- var tree = document.getElementById('current-panels');
- var tree_root = tree.lastChild;
-
- // Check to see if the panel already exists...
- var i = 0;
- for (var treeitem = tree_root.firstChild; treeitem; treeitem = treeitem.nextSibling) {
- if (treeitem.id == service.Value)
- // The panel is already in the current panel list.
- // Avoid adding it twice.
- return i;
- ++i;
- }
-
- // Create a treerow for the new panel
- var item = document.createElement('treeitem');
- var row = document.createElement('treerow');
- var cell = document.createElement('treecell');
-
- // Copy over the attributes
- item.setAttribute('id', service.Value);
- cell.setAttribute('label', option_title);
-
- // Add it to the current panels tree
- item.appendChild(row);
- row.appendChild(cell);
- tree_root.appendChild(item);
- return i;
-}
-
-// Remove the selected panel(s) from the current list tree.
-function RemovePanel()
-{
- var tree = document.getElementById('current-panels');
- var sel = tree.view.selection;
-
- var nextNode = -1;
- var rangeCount = sel.getRangeCount();
- for (var range = rangeCount-1; range >= 0; --range) {
- var min = {}, max = {};
- sel.getRangeAt(range, min, max);
- for (var index = max.value; index >= min.value; --index) {
- var item = tree.contentView.getItemAtIndex(index);
- nextNode = item.nextSibling ? index : -1;
- item.parentNode.removeChild(item);
- }
- }
-
- if (nextNode >= 0)
- sel.select(nextNode);
-}
-
-// Bring up a new window with the customize url
-// for an individual panel.
-function CustomizePanel()
-{
- var tree = document.getElementById('current-panels');
- var numSelected = tree.view.selection.count;
-
- if (numSelected == 1) {
- var index = tree.currentIndex;
- var selectedNode = tree.contentView.getItemAtIndex(index);
- var panel_id = selectedNode.getAttribute('id');
- var customize_url = selectedNode.getAttribute('customize');
-
- debug("url = " + customize_url);
-
- if (!customize_url) return;
-
- window.openDialog('chrome://communicator/content/sidebar/customize-panel.xul',
- '_blank',
- 'chrome,resizable,width=690,height=600,dialog=no,close',
- panel_id,
- customize_url,
- sidebarObj.datasource_uri,
- sidebarObj.resource);
- }
-}
-
-function BrowseMorePanels()
-{
- var url = '';
- var browser_url = "chrome://navigator/content/navigator.xul";
- var locale;
- try {
- var prefs = Components.classes["@mozilla.org/preferences-service;1"]
- .getService(Components.interfaces.nsIPrefBranch);
- url = prefs.getCharPref("sidebar.customize.more_panels.url");
- var temp = prefs.getCharPref("browser.chromeURL");
- if (temp) browser_url = temp;
- } catch(ex) {
- debug("Unable to get prefs: "+ex);
- }
- window.openDialog(browser_url, "_blank", "chrome,all,dialog=no", url);
-}
-
-function customize_getBrowserURL()
-{
- return url;
-}
-
-// Serialize the new list of panels.
-function Save()
-{
- persist_dialog_dimensions();
-
- var all_panels = document.getElementById('other-panels');
- var current_panels = document.getElementById('current-panels');
-
- // See if list membership has changed
- var panels = [];
- var tree_root = current_panels.lastChild.childNodes;
- var list_unchanged = (tree_root.length == original_panels.length);
- for (var i = 0; i < tree_root.length; i++) {
- var panel = tree_root[i].id;
- panels.push(panel);
- panels[panel] = true;
- if (list_unchanged && original_panels[i] != panel)
- list_unchanged = false;
- }
- if (list_unchanged)
- return;
-
- // Remove all the current panels from the datasource.
- current_panels = sidebarObj.container.GetElements();
- while (current_panels.hasMoreElements()) {
- panel = current_panels.getNext().QueryInterface(Components.interfaces.nsIRDFResource);
- if (panel.Value in panels) {
- // This panel will remain in the sidebar.
- // Remove the resource, but keep all the other attributes.
- // Removing it will allow it to be added in the correct order.
- // Saving the attributes will preserve things such as the exclude state.
- sidebarObj.container.RemoveElement(panel, false);
- } else {
- // Kiss it goodbye.
- delete_resource_deeply(sidebarObj.container, panel);
- }
- }
-
- // Add the new list of panels
- for (var ii = 0; ii < panels.length; ++ii) {
- var id = panels[ii];
- var resource = RDF.GetResource(id);
- if (id in original_panels) {
- sidebarObj.container.AppendElement(resource);
- } else {
- copy_resource_deeply(all_panels.database, resource, sidebarObj.container);
- }
- }
- refresh_all_sidebars();
-
- // Write the modified panels out.
- sidebarObj.datasource.QueryInterface(Components.interfaces.nsIRDFRemoteDataSource).Flush();
-}
-
-// Search for an element in an array
-function has_element(array, element) {
- for (var ii=0; ii < array.length; ii++) {
- if (array[ii] == element) {
- return true;
- }
- }
- return false;
-}
-
-// Search for targets from resource in datasource
-function has_targets(datasource, resource) {
- var arcs = datasource.ArcLabelsOut(resource);
- return arcs.hasMoreElements();
-}
-
-// Use an assertion to pass a "refresh" event to all the sidebars.
-// They use observers to watch for this assertion (in sidebarOverlay.js).
-function refresh_all_sidebars() {
- sidebarObj.datasource.Assert(RDF.GetResource(sidebarObj.resource),
- RDF.GetResource(NC + "refresh"),
- RDF.GetLiteral("true"),
- true);
- sidebarObj.datasource.Unassert(RDF.GetResource(sidebarObj.resource),
- RDF.GetResource(NC + "refresh"),
- RDF.GetLiteral("true"));
-}
-
-// Remove a resource and all the arcs out from it.
-function delete_resource_deeply(container, resource) {
- var arcs = container.DataSource.ArcLabelsOut(resource);
- while (arcs.hasMoreElements()) {
- var arc = arcs.getNext();
- var targets = container.DataSource.GetTargets(resource, arc, true);
- while (targets.hasMoreElements()) {
- var target = targets.getNext();
- container.DataSource.Unassert(resource, arc, target, true);
- }
- }
- container.RemoveElement(resource, false);
-}
-
-// Copy a resource and all its arcs out to a new container.
-function copy_resource_deeply(source_datasource, resource, dest_container) {
- var arcs = source_datasource.ArcLabelsOut(resource);
- while (arcs.hasMoreElements()) {
- var arc = arcs.getNext();
- var targets = source_datasource.GetTargets(resource, arc, true);
- while (targets.hasMoreElements()) {
- var target = targets.getNext();
- dest_container.DataSource.Assert(resource, arc, target, true);
- }
- }
- dest_container.AppendElement(resource);
-}
-
-function enable_buttons_for_other_panels()
-{
- var add_button = document.getElementById('add_button');
- var preview_button = document.getElementById('preview_button');
- var all_panels = document.getElementById('other-panels');
-
- var sel = all_panels.view.selection;
- var num_selected = sel ? sel.count : 0;
- if (sel) {
- var ranges = sel.getRangeCount();
- for (var range = 0; range < ranges; ++range) {
- var min = {}, max = {};
- sel.getRangeAt(range, min, max);
- for (var index = min; index <= max; ++index) {
- var node = all_panels.contentView.getItemAtIndex(index);
- if (node.getAttribute('container') != 'true') {
- ++num_selected;
- }
- }
- }
- }
-
- if (num_selected > 0) {
- add_button.removeAttribute('disabled');
- preview_button.removeAttribute('disabled');
- } else {
- add_button.setAttribute('disabled','true');
- preview_button.setAttribute('disabled','true');
- }
-}
-
-function enable_buttons_for_current_panels() {
- var up = document.getElementById('up');
- var down = document.getElementById('down');
- var tree = document.getElementById('current-panels');
- var customize = document.getElementById('customize-button');
- var remove = document.getElementById('remove-button');
-
- var numSelected = tree.view.selection.count;
- var canMoveUp = false, canMoveDown = false, customizeURL = '';
-
- if (numSelected == 1 && tree.view.selection.isSelected(tree.currentIndex)) {
- var selectedNode = tree.view.getItemAtIndex(tree.currentIndex);
- customizeURL = selectedNode.getAttribute('customize');
- canMoveUp = selectedNode != selectedNode.parentNode.firstChild;
- canMoveDown = selectedNode != selectedNode.parentNode.lastChild;
- }
-
- up.disabled = !canMoveUp;
- down.disabled = !canMoveDown;
- customize.disabled = !customizeURL;
- remove.disabled = !numSelected;
-}
-
-function persist_dialog_dimensions() {
- // Stole this code from navigator.js to
- // insure the windows dimensions are saved.
-
- // Get the current window position/size.
- var x = window.screenX;
- var y = window.screenY;
- var h = window.outerHeight;
- var w = window.outerWidth;
-
- // Store these into the window attributes (for persistence).
- var win = document.getElementById( "main-window" );
- win.setAttribute( "x", x );
- win.setAttribute( "y", y );
- win.setAttribute( "height", h );
- win.setAttribute( "width", w );
-}
-
-///////////////////////////////////////////////////////////////
-// Handy Debug Tools
-//////////////////////////////////////////////////////////////
-var debug = null;
-var dump_attributes = null;
-var dump_tree = null;
-var _dump_tree_recur = null;
-
-if (!CUST_DEBUG) {
- debug = function (s) {};
- dump_attributes = function (node, depth) {};
- dump_tree = function (node) {};
- _dump_tree_recur = function (node, depth, index) {};
-} else {
- debug = function (s) { dump("-*- sb customize: " + s + "\n"); };
-
- dump_attributes = function (node, depth) {
- var attributes = node.attributes;
- var indent = "| | | | | | | | | | | | | | | | | | | | | | | | | | | | . ";
-
- if (!attributes || attributes.length == 0) {
- debug(indent.substr(indent.length - depth*2) + "no attributes");
- }
- for (var ii=0; ii < attributes.length; ii++) {
- var attr = attributes.item(ii);
- debug(indent.substr(indent.length - depth*2) + attr.name +
- "=" + attr.value);
- }
- }
- dump_tree = function (node) {
- _dump_tree_recur(node, 0, 0);
- }
- _dump_tree_recur = function (node, depth, index) {
- if (!node) {
- debug("dump_tree: node is null");
- }
- var indent = "| | | | | | | | | | | | | | | | | | | | | | | | | | | | + ";
- debug(indent.substr(indent.length - depth*2) + index +
- " " + node.nodeName);
- if (node.nodeType != Node.TEXT_NODE) {
- dump_attributes(node, depth);
- }
- var kids = node.childNodes;
- for (var ii=0; ii < kids.length; ii++) {
- _dump_tree_recur(kids[ii], depth + 1, ii);
- }
- }
-}
-
-//////////////////////////////////////////////////////////////
-// Install the load/unload handlers
-//////////////////////////////////////////////////////////////
-addEventListener("load", sidebar_customize_init, false);
-addEventListener("unload", sidebar_customize_destruct, false);
diff --git a/mozilla/xpfe/components/sidebar/resources/customize.xul b/mozilla/xpfe/components/sidebar/resources/customize.xul
deleted file mode 100644
index 0705fcf1c74..00000000000
--- a/mozilla/xpfe/components/sidebar/resources/customize.xul
+++ /dev/null
@@ -1,170 +0,0 @@
-
-
-
-
-
-
-
-
-%customizeDTD;
-
-%brandDTD;
-]>
-
-
-
diff --git a/mozilla/xpfe/components/sidebar/resources/local-panels.rdf b/mozilla/xpfe/components/sidebar/resources/local-panels.rdf
deleted file mode 100644
index a26212bc2c1..00000000000
--- a/mozilla/xpfe/components/sidebar/resources/local-panels.rdf
+++ /dev/null
@@ -1,75 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- &sidebar.whats-related.label;
- chrome://communicator/content/related/related-panel.xul
-
-
- &sidebar.search.label;
- chrome://communicator/content/search/search-panel.xul
-
-
- &sidebar.client-bookmarks.label;
- chrome://communicator/content/bookmarks/bm-panel.xul
-
-
- &sidebar.client-history.label;
- chrome://communicator/content/history/history-panel.xul
-
-
- &sidebar.client-addressbook.label;
- chrome://messenger/content/addressbook/addressbook-panel.xul
-
-
diff --git a/mozilla/xpfe/components/sidebar/resources/locale/en-US/customize.dtd b/mozilla/xpfe/components/sidebar/resources/locale/en-US/customize.dtd
deleted file mode 100644
index 7e4a16679aa..00000000000
--- a/mozilla/xpfe/components/sidebar/resources/locale/en-US/customize.dtd
+++ /dev/null
@@ -1,60 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/mozilla/xpfe/components/sidebar/resources/locale/en-US/local-panels.dtd b/mozilla/xpfe/components/sidebar/resources/locale/en-US/local-panels.dtd
deleted file mode 100644
index ac2f4ee105e..00000000000
--- a/mozilla/xpfe/components/sidebar/resources/locale/en-US/local-panels.dtd
+++ /dev/null
@@ -1,44 +0,0 @@
-
-
-
-
-
-
-
-
-
diff --git a/mozilla/xpfe/components/sidebar/resources/locale/en-US/preview.dtd b/mozilla/xpfe/components/sidebar/resources/locale/en-US/preview.dtd
deleted file mode 100644
index 84381076374..00000000000
--- a/mozilla/xpfe/components/sidebar/resources/locale/en-US/preview.dtd
+++ /dev/null
@@ -1,39 +0,0 @@
-
-
-
-
diff --git a/mozilla/xpfe/components/sidebar/resources/locale/en-US/sidebar.properties b/mozilla/xpfe/components/sidebar/resources/locale/en-US/sidebar.properties
deleted file mode 100644
index 6cbeddff5c8..00000000000
--- a/mozilla/xpfe/components/sidebar/resources/locale/en-US/sidebar.properties
+++ /dev/null
@@ -1,9 +0,0 @@
-addPanelConfirmTitle=Add Tab to Sidebar
-addPanelConfirmMessage=Add the tab '%title%' to the %name%?##Source: %url%
-persistentPanelWarning=The sidebar tab you are adding can transfer data across the Internet and run JavaScript even while %name% is closed.
-
-dupePanelAlertTitle=Sidebar
-dupePanelAlertMessage=%url% already exists in the %name%.
-
-addEngineConfirmTitle=Add Search Engine
-addEngineConfirmMessage=Add the following search engine to the %name% Internet Search tab?##Name: %title%#Search Category: %category%#Source: %url%
diff --git a/mozilla/xpfe/components/sidebar/resources/locale/en-US/sidebarOverlay.dtd b/mozilla/xpfe/components/sidebar/resources/locale/en-US/sidebarOverlay.dtd
deleted file mode 100644
index 5c337b06786..00000000000
--- a/mozilla/xpfe/components/sidebar/resources/locale/en-US/sidebarOverlay.dtd
+++ /dev/null
@@ -1,65 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/mozilla/xpfe/components/sidebar/resources/preview.js b/mozilla/xpfe/components/sidebar/resources/preview.js
deleted file mode 100644
index 0fd2f157c22..00000000000
--- a/mozilla/xpfe/components/sidebar/resources/preview.js
+++ /dev/null
@@ -1,48 +0,0 @@
-/* -*- Mode: Java -*-
- * ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla 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/MPL/
- *
- * 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 Communicator.
- *
- * The Initial Developer of the Original Code is
- * Netscape Communications Corp.
- * Portions created by the Initial Developer are Copyright (C) 1999
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- * Stephen Lamm
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either of the GNU General Public License Version 2 or later (the "GPL"),
- * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-function Init()
-{
- var panel_name = window.arguments[0];
- var panel_URL = window.arguments[1];
-
- var panel_title = document.getElementById('paneltitle');
- var preview_frame = document.getElementById('previewframe');
- panel_title.setAttribute('label', panel_name);
- preview_frame.setAttribute('src', panel_URL);
-}
diff --git a/mozilla/xpfe/components/sidebar/resources/preview.xul b/mozilla/xpfe/components/sidebar/resources/preview.xul
deleted file mode 100644
index 5c80f7d9b79..00000000000
--- a/mozilla/xpfe/components/sidebar/resources/preview.xul
+++ /dev/null
@@ -1,62 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/mozilla/xpfe/components/sidebar/resources/sidebarBindings.xml b/mozilla/xpfe/components/sidebar/resources/sidebarBindings.xml
deleted file mode 100644
index b292dcdc67c..00000000000
--- a/mozilla/xpfe/components/sidebar/resources/sidebarBindings.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/mozilla/xpfe/components/sidebar/resources/sidebarOverlay.css b/mozilla/xpfe/components/sidebar/resources/sidebarOverlay.css
deleted file mode 100644
index ffd83c0b472..00000000000
--- a/mozilla/xpfe/components/sidebar/resources/sidebarOverlay.css
+++ /dev/null
@@ -1,101 +0,0 @@
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla 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/MPL/
- *
- * 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 Communicator.
- *
- * The Initial Developer of the Original Code is
- * Netscape Communications Corp.
- * Portions created by the Initial Developer are Copyright (C) 1999
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- * Stephen Lamm
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either of the GNU General Public License Version 2 or later (the "GPL"),
- * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-/** sidebarOverlay.css [CONTENT]
- * This file is for style rules essential for correct sidebar operation.
- * These rules will not change on a skin-by-skin basis.
- **/
-
-#sidebar-box {
- width: 162px;
- min-height: 10px;
- min-width: 30px;
- max-width: 400px;
-}
-
-#sidebar-panels {
- min-width: 1px;
- min-height: 10px;
-}
-
-.iframe-panel {
- min-width: 1px;
- min-height: 1px;
-}
-
-#sidebar-iframe-no-panels {
- min-width: 1px;
- min-height: 1px;
- overflow: auto;
-}
-
-.browser-sidebar {
- min-width: 1px;
- min-height: 1px;
-}
-
-/*
- * Sidebar and Panel title buttons
- */
-sidebarheader[type="box"] {
- -moz-binding: url(chrome://communicator/content/sidebar/sidebarBindings.xml#sidebar-header-box);
-}
-sidebarheader[type="splitter"] {
- -moz-binding: url(chrome://communicator/content/sidebar/sidebarBindings.xml#sidebar-header-splitter);
- /* a vertical splitter */
- cursor: n-resize;
-}
-
-.sidebarheader-main {
- min-width: 1px;
- min-height: 1px;
-}
-
-/**
- * texttab folder lookalike e.g. for sidebar panel headers
- */
- .box-texttab
- {
- min-height : 10px;
- min-width : 10px;
- }
-
- .box-texttab-right-space
- {
- min-width : 1px;
- }
-
diff --git a/mozilla/xpfe/components/sidebar/resources/sidebarOverlay.js b/mozilla/xpfe/components/sidebar/resources/sidebarOverlay.js
deleted file mode 100644
index 70365115bae..00000000000
--- a/mozilla/xpfe/components/sidebar/resources/sidebarOverlay.js
+++ /dev/null
@@ -1,1651 +0,0 @@
-/* -*- Mode: Java; tab-width: 4; insert-tabs-mode: nil; c-basic-offset: 2 -*-
- *
- * ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla 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/MPL/
- *
- * 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 Communicator client code, released
- * March 31, 1998.
- *
- * The Initial Developer of the Original Code is
- * Netscape Communications Corporation.
- * Portions created by the Initial Developer are Copyright (C) 1998-1999
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either of the GNU General Public License Version 2 or later (the "GPL"),
- * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-// xul/id summary:
-//
-// sidebar-box
-// sidebar-panels-splitter
-// sidebar-panels-splitter-box*
-// sidebar-title-box
-// sidebar-panel-picker*
-// sidebar-panel-picker-popup
-// sidebar-panels
-// sidebar-template*
-// sidebar-iframe-no-panels
-// sidebar-splitter
-// menu_View_Popup*
-//