summaryrefslogtreecommitdiffstats
path: root/js
diff options
context:
space:
mode:
Diffstat (limited to 'js')
-rw-r--r--js/duplicates.js153
-rw-r--r--js/keyword-chooser.js141
-rw-r--r--[-rwxr-xr-x]js/params.js0
3 files changed, 0 insertions, 294 deletions
diff --git a/js/duplicates.js b/js/duplicates.js
deleted file mode 100644
index ccad539e3..000000000
--- a/js/duplicates.js
+++ /dev/null
@@ -1,153 +0,0 @@
-/* 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 the Bugzilla Bug Tracking System.
- *
- * The Initial Developer of the Original Code is Netscape Communications
- * Corporation. Portions created by Netscape are
- * Copyright (C) 1998 Netscape Communications Corporation. All
- * Rights Reserved.
- *
- * Contributor(s): Myk Melez <myk@mozilla.org>
- */
-
-// When the XUL window finishes loading, load the RDF data into it.
-window.addEventListener('load', loadData, false);
-
-// The base URL of this Bugzilla installation; derived from the page's URL.
-var gBaseURL = window.location.href.replace(/(jar:)?(.*?)duplicates\.(jar!|xul).*/, "$2");
-
-function loadData()
-{
- // Loads the duplicates data as an RDF data source, attaches it to the tree,
- // and rebuilds the tree to display the data.
-
- netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
-
- // Get the RDF service so we can use it to load the data source.
- var rdfService =
- Components
- .classes["@mozilla.org/rdf/rdf-service;1"]
- .getService(Components.interfaces.nsIRDFService);
-
- // When a bug report loads in the content iframe, a 'load' event bubbles up
- // to the browser window, which calls this load handler again, which reloads
- // the RDF data, which causes the tree to lose the selection. To prevent
- // this, we have to remove this handler.
- window.removeEventListener('load', loadData, false);
-
- // The URL of the RDF file; by default for performance a static file
- // generated by collectstats.pl, but a call to duplicates.cgi if the page's
- // URL contains parameters (so we can dynamically generate the RDF data
- // based on those parameters).
- var dataURL = gBaseURL + "data/duplicates.rdf";
- if (window.location.href.search(/duplicates\.xul\?.+/) != -1)
- dataURL = window.location.href.replace(/(duplicates\.jar!\/)?duplicates\.xul\?/, "duplicates.cgi?ctype=rdf&");
-
- // Get the data source and add it to the XUL tree's database to populate
- // the tree with the data.
- var dataSource = rdfService.GetDataSource(dataURL);
-
- // If we're using the static file, add an observer that detects failed loads
- // (in case this installation isn't generating the file nightly) and redirects
- // to the CGI version when loading of the static version fails.
- if (window.location.href.search(/duplicates\.xul\?.+/) == -1)
- {
- var sink = dataSource.QueryInterface(Components.interfaces.nsIRDFXMLSink);
- sink.addXMLSinkObserver(StaticDataSourceObserver);
- }
-
- // Add the data source to the tree, set the tree's "ref" attribute
- // to the base URL of the data source, and rebuild the tree.
- var resultsTree = document.getElementById('results-tree');
- resultsTree.database.AddDataSource(dataSource);
- resultsTree.setAttribute('ref', gBaseURL + "data/duplicates.rdf");
- resultsTree.builder.rebuild();
-}
-
-function getBugURI()
-{
- var tree = document.getElementById('results-tree');
- var index = tree.currentIndex;
-
- netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
- var builder = tree.builder.QueryInterface(Components.interfaces.nsIXULTreeBuilder);
- var resource = builder.getResourceAtIndex(index);
-
- return resource.Value;
-}
-
-function loadBugInWindow()
-{
- // Loads the selected bug in the browser window, replacing the duplicates report
- // with the bug report.
-
- var bugURI = getBugURI();
- window.location = bugURI;
-}
-
-function loadBugInPane()
-{
- // Loads the selected bug in the iframe-based content pane that is part of
- // this XUL document.
-
- var splitter = document.getElementById('report-content-splitter');
- var state = splitter.getAttribute('state');
- if (state != "collapsed")
- {
- var bugURI = getBugURI();
- var browser = document.getElementById('content-browser');
- browser.setAttribute('src', bugURI);
- }
-}
-
-var StaticDataSourceObserver = {
- onBeginLoad: function(aSink) { } ,
- onInterrupt: function(aSink) { } ,
- onResume: function(aSink) { } ,
- onEndLoad: function(aSink)
- {
- // Removes the observer from the data source so it doesn't stay around
- // when duplicates.xul is reloaded from scratch.
-
- netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
-
- aSink.removeXMLSinkObserver(StaticDataSourceObserver);
- } ,
- onError: function(aSink, aStatus, aErrorMsg)
- {
- // Tries the dynamic data source since the static one failed to load.
-
- netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
-
- // Get the RDF service so we can use it to load the data source.
- var rdfService =
- Components
- .classes["@mozilla.org/rdf/rdf-service;1"]
- .getService(Components.interfaces.nsIRDFService);
-
- // Remove the observer from the data source so it doesn't stay around
- // when duplicates.xul is reloaded from scratch.
- aSink.removeXMLSinkObserver(StaticDataSourceObserver);
-
- // Remove the static data source from the tree.
- var oldDataSource = aSink.QueryInterface(Components.interfaces.nsIRDFDataSource);
- var resultsTree = document.getElementById('results-tree');
- resultsTree.database.RemoveDataSource(oldDataSource);
-
- // Munge the URL to point to the CGI and load the data source.
- var dataURL = gBaseURL + "duplicates.cgi?ctype=rdf";
- newDataSource = rdfService.GetDataSource(dataURL);
-
- // Add the data source to the tree and rebuild the tree with the new data.
- resultsTree.database.AddDataSource(newDataSource);
- resultsTree.builder.rebuild();
- }
-};
diff --git a/js/keyword-chooser.js b/js/keyword-chooser.js
deleted file mode 100644
index 9440e5886..000000000
--- a/js/keyword-chooser.js
+++ /dev/null
@@ -1,141 +0,0 @@
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.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 Keyword Chooser.
- *
- * The Initial Developer of the Original Code is America Online, Inc.
- * Portions created by the Initial Developer are Copyright (C) 2004
- * Mozilla Foundation. All Rights Reserved.
- *
- * Contributor(s):
- * Christopher A. Aillon <christopher@aillon.com> (Original Author)
- *
- * ***** END LICENSE BLOCK ***** */
-
-function KeywordChooser(aParent, aChooser, aAvail, aChosen, aValidKeywords)
-{
- // Initialization
- this._parent = aParent;
- this._chooser = aChooser;
- this._available = aAvail;
- this._chosen = aChosen;
- this._validKeywords = aValidKeywords;
-
- this.setInitialStyles();
-
- // Register us, our properties, and our events
- this._parent.chooser = this;
- this._chooser.chooserElement = this._parent;
-}
-
-KeywordChooser.prototype =
-{
- // chooses the selected items
- choose: function()
- {
- this._swapSelected(this._available, this._chosen);
- },
-
- unchoose: function()
- {
- this._swapSelected(this._chosen, this._available);
- },
-
- positionChooser: function()
- {
- if (this._positioned) return;
- bz_overlayBelow(this._chooser, this._parent);
- this._positioned = true;
- },
-
- setInitialStyles: function()
- {
- this._chooser.style.display = "none";
- this._chooser.style.position = "absolute";
- this._positioned = false;
- },
-
- open: function()
- {
- this._chooser.style.display = "";
- this._available.style.display = "";
- this._chosen.style.display = "";
- this._parent.disabled = true;
- this.positionChooser();
- },
-
- ok: function()
- {
- var len = this._chosen.options.length;
-
- var text = "";
- for (var i = 0; i < len; i++) {
- text += this._chosen.options[i].text;
- if (i != len - 1) {
- text += ", ";
- }
- }
-
- this._parent.value = text;
- this._parent.title = text;
-
- this.close();
- },
-
- cancel: function()
- {
- var chosentext = this._parent.value;
- var chosenArray = new Array();
-
- if (chosentext != ""){
- chosenArray = chosentext.split(", ");
- }
-
- var availArray = new Array();
-
- for (var i = 0; i < this._validKeywords.length; i++) {
- if (!bz_isValueInArray(chosenArray, this._validKeywords[i])) {
- availArray[availArray.length] = this._validKeywords[i];
- }
- }
-
- bz_populateSelectFromArray(this._available, availArray, false, true);
- bz_populateSelectFromArray(this._chosen, chosenArray, false, true);
- this.close();
- },
-
- close: function()
- {
- this._chooser.style.display = "none";
- this._parent.disabled = false;
- },
-
- _swapSelected: function(aSource, aTarget)
- {
- var kNothingSelected = -1;
- while (aSource.selectedIndex != kNothingSelected) {
- var option = aSource.options[aSource.selectedIndex];
- aTarget.appendChild(option);
- option.selected = false;
- }
- }
-};
-
-function InitializeKeywordChooser(aValidKeywords)
-{
- var keywords = document.getElementById("keywords");
- var chooser = document.getElementById("keyword-chooser");
- var avail = document.getElementById("keyword-list");
- var chosen = document.getElementById("bug-keyword-list");
- var chooserObj = new KeywordChooser(keywords, chooser, avail, chosen, aValidKeywords);
-}
diff --git a/js/params.js b/js/params.js
index 453740799..453740799 100755..100644
--- a/js/params.js
+++ b/js/params.js