aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorMatěj Cepl <mcepl@redhat.com>2010-07-25 14:44:41 +0200
committerMatěj Cepl <mcepl@redhat.com>2010-07-25 14:44:41 +0200
commit3a51ae92a501e9eb8dc1bed4eb1419473aba4604 (patch)
tree4ee3b33d3413d733622858816c765384b5662c61 /lib
parentd428a8122cbc803ef99acd6db03323ceb5b76f53 (diff)
downloadbugzilla-triage-3a51ae92a501e9eb8dc1bed4eb1419473aba4604.tar.gz
Move queryForSelection and affiiliated methods to BZPage.
Plus another attempt to make update.rdf work.
Diffstat (limited to 'lib')
-rw-r--r--lib/bzpage.js65
-rw-r--r--lib/rhbzpage.js147
2 files changed, 106 insertions, 106 deletions
diff --git a/lib/bzpage.js b/lib/bzpage.js
index 084b924..e315922 100644
--- a/lib/bzpage.js
+++ b/lib/bzpage.js
@@ -249,6 +249,9 @@ BZPage.prototype.centralCommandDispatch = function centralCommandDispatch (cmdLa
case "addCC":
this.addToCCList(cmdParams);
break;
+ case "queryStringOurBugzilla":
+ this.queryForSelection();
+ break;
// TODO flags, see also
case "commit":
@@ -488,7 +491,7 @@ BZPage.prototype.setConfigurationButton = function setConfigurationButton () {
BZPage.prototype.parseMailto = function parseMailto(aElement) {
if (aElement) {
var email = decodeURI(aElement.getAttribute("href")).
- split(":")[1];
+ split(":")[1];
}
return null;
};
@@ -839,6 +842,66 @@ BZPage.prototype.setUpLogging = function setUpLogging () {
}
};
+BZPage.prototype.getSelectionOrClipboard = function getSelectionOrClipboard () {
+ var text = selection.text;
+ if (!text) {
+ text = clip.get();
+ }
+ return text;
+};
+
+/**
+ * Opens a new tab with a query for the given text in the selected component
+ *
+ * @param text to be searched for
+ * @param component String with the component name (maybe latter regexp?)
+ * @param product (optional) string with the product name, if undefined,
+ * search in all products
+ * @return None
+ *
+ */
+BZPage.prototype.queryInNewTab = function(text, component, product) {
+ var urlStr = "https://bugzilla.redhat.com/buglist.cgi?query_format=advanced";
+ if (product) {
+ urlStr += "&product=" + product.trim();
+ }
+ if (component) {
+ urlStr += "&field0-0-0=component&type0-0-0=substring&value0-0-0="
+ + component.trim();
+ }
+ // using more complicated query tables here, because they can be more easily
+ // edited
+ // for further investigative searches
+ if (text) {
+ text = encodeURIComponent(text.trim());
+ var searchText = "&field1-0-0=longdesc&type1-0-0=substring&value1-0-0="
+ + text
+ + "&field1-0-1=attach_data.thedata&type1-0-1=substring&value1-0-1="
+ + text
+ + "&field1-0-2=status_whiteboard&type1-0-2=substring&value1-0-2="
+ + text;
+ urlStr += searchText;
+ tabs.open({
+ url: urlStr,
+ inBackground: true,
+ onOpen: function (t) {
+ tabs.activeTab = t;
+ }
+ });
+ }
+};
+
+/**
+ * Get the text to search for and prepare other things for the real executive
+ * function this.queryInNewTab, and run it.
+ */
+BZPage.prototype.queryForSelection = function() {
+ var text = this.getSelectionOrClipboard();
+ if (text) {
+ this.queryInNewTab(text, this.component);
+ }
+};
+
/**
* adds a person to the CC list, if it isn't already there
*
diff --git a/lib/rhbzpage.js b/lib/rhbzpage.js
index 4458e28..92c6e28 100644
--- a/lib/rhbzpage.js
+++ b/lib/rhbzpage.js
@@ -228,9 +228,6 @@ RHBugzillaPage.prototype.centralCommandDispatch = function(cmdLabel, cmdParams)
case "computeResolution":
this.closeSomeRelease();
break;
- case "queryStringOurBugzilla":
- this.queryForSelection();
- break;
case "queryStringUpstreamBugzilla":
this.queryUpstream();
break;
@@ -437,6 +434,48 @@ RHBugzillaPage.prototype.setBranding = function() {
}
};
+/**
+ * Search simple query in the upstream bugzilla appropriate for the component.
+ */
+RHBugzillaPage.prototype.queryUpstream = function() {
+ var text = this.getSelectionOrClipboard();
+ if (text) {
+ text = encodeURIComponent(text.trim());
+ var queryUpstreamBugsURLArray = this.constantData.queryUpstreamBug;
+ var urlBase = util.filterByRegexp(queryUpstreamBugsURLArray, this.component);
+ tabs.open({
+ url: urlBase + text,
+ inBackground: true,
+ onOpen: function (tab) {
+ tabs.activeTab = tab;
+ }
+ });
+ }
+};
+
+/**
+ *
+ */
+RHBugzillaPage.prototype.sendBugUpstream = function() {
+ var that = this;
+ var urlStr = util.filterByRegexp(JSON.parse(self.data.load("newUpstreamBug.json")), this
+ .getOptionValue("component"));
+
+ tabs.open({
+ url: urlStr,
+ inBackground: true,
+ onOpen: function (tab) {
+ var otherDoc = tab.contentDocument;
+ var otherElems = otherDoc.forms.namedItem("Create").elements;
+ otherElems.namedItem("short_desc").value = that.doc
+ .getElementById("short_desc_nonedit_display").textContent
+ .trim();
+ otherElems.namedItem("comment").value = that.collectComments();
+ tabs.activeTab = tab;
+ }
+ });
+};
+
RHBugzillaPage.prototype.addCheckXorgLogLink = function addCheckXorgLogLink() {
var that = this;
if (this.xorglogAnalysis) {
@@ -579,108 +618,6 @@ RHBugzillaPage.prototype.fillInChipMagic = function fillInChipMagic() {
this.XorgLogAttListIndex++;
};
-RHBugzillaPage.prototype.getSelectionOrClipboard = function getSelectionOrClipboard () {
- var text = selection.text;
- if (!text) {
- text = clip.get();
- }
- return text;
-};
-
-/**
- * Opens a new tab with a query for the given text in the selected component
- *
- * @param text to be searched for
- * @param component String with the component name (maybe latter regexp?)
- * @param product (optional) string with the product name, if undefined,
- * search in all products
- * @return None
- *
- */
-RHBugzillaPage.prototype.queryInNewTab = function(text, component, product) {
- var urlStr = "https://bugzilla.redhat.com/buglist.cgi?query_format=advanced";
- if (product) {
- urlStr += "&product=" + product.trim();
- }
- if (component) {
- urlStr += "&field0-0-0=component&type0-0-0=substring&value0-0-0="
- + component.trim();
- }
- // using more complicated query tables here, because they can be more easily
- // edited
- // for further investigative searches
- if (text) {
- text = encodeURIComponent(text.trim());
- var searchText = "&field1-0-0=longdesc&type1-0-0=substring&value1-0-0="
- + text
- + "&field1-0-1=attach_data.thedata&type1-0-1=substring&value1-0-1="
- + text
- + "&field1-0-2=status_whiteboard&type1-0-2=substring&value1-0-2="
- + text;
- urlStr += searchText;
- tabs.open({
- url: urlStr,
- inBackground: true,
- onOpen: function (t) {
- tabs.activeTab = t;
- }
- });
- }
-};
-
-/**
- * Get the text to search for and prepare other things for the real executive
- * function this.queryInNewTab, and run it.
- */
-RHBugzillaPage.prototype.queryForSelection = function() {
- var text = this.getSelectionOrClipboard();
- if (text) {
- this.queryInNewTab(text, this.component);
- }
-};
-
-/**
- * Search simple query in the upstream bugzilla appropriate for the component.
- */
-RHBugzillaPage.prototype.queryUpstream = function() {
- var text = this.getSelectionOrClipboard();
- if (text) {
- text = encodeURIComponent(text.trim());
- var queryUpstreamBugsURLArray = this.constantData.queryUpstreamBug;
- var urlBase = util.filterByRegexp(queryUpstreamBugsURLArray, this.component);
- tabs.open({
- url: urlBase + text,
- inBackground: true,
- onOpen: function (tab) {
- tabs.activeTab = tab;
- }
- });
- }
-};
-
-/**
- *
- */
-RHBugzillaPage.prototype.sendBugUpstream = function() {
- var that = this;
- var urlStr = util.filterByRegexp(JSON.parse(self.data.load("newUpstreamBug.json")), this
- .getOptionValue("component"));
-
- tabs.open({
- url: urlStr,
- inBackground: true,
- onOpen: function (tab) {
- var otherDoc = tab.contentDocument;
- var otherElems = otherDoc.forms.namedItem("Create").elements;
- otherElems.namedItem("short_desc").value = that.doc
- .getElementById("short_desc_nonedit_display").textContent
- .trim();
- otherElems.namedItem("comment").value = that.collectComments();
- tabs.activeTab = tab;
- }
- });
-};
-
/**
* Parse the row with the attachment
*