aboutsummaryrefslogtreecommitdiffstats
path: root/data/lib/queries.js
diff options
context:
space:
mode:
authorMatěj Cepl <mcepl@redhat.com>2011-03-25 16:23:51 +0100
committerMatěj Cepl <mcepl@redhat.com>2011-03-25 17:55:56 +0100
commit0ace4d34ece35b717b64ee1d3312cdc3c07696b5 (patch)
tree0e9cfe3000295c14d08a09c617b8aa8b89285cc4 /data/lib/queries.js
parenta9e66d84f83d3f21fffd4cd9872ac8934e455edf (diff)
downloadbugzilla-triage-0ace4d34ece35b717b64ee1d3312cdc3c07696b5.tar.gz
Cut out general bugzilla functions to a special module.
Diffstat (limited to 'data/lib/queries.js')
-rw-r--r--data/lib/queries.js34
1 files changed, 33 insertions, 1 deletions
diff --git a/data/lib/queries.js b/data/lib/queries.js
index b6e3661..0c00792 100644
--- a/data/lib/queries.js
+++ b/data/lib/queries.js
@@ -11,7 +11,6 @@ function getSelection () {
return text;
}
-
/**
* Opens a new tab with a query for the given text in the selected component
*
@@ -73,3 +72,36 @@ function queryForSelection() {
}
}
}
+
+/**
+ *
+ */
+function queryUpstreamCallback(text, queryUpBug) {
+ var searchData = filterByRegexp(queryUpBug, getComponent());
+ var urlBase = searchData.url;
+ text = searchData.searchBy+":"+searchData.fillIn+" "+text.trim();
+ if (searchData.fillIn == "$$$") {
+ text = text.replace("$$$", getComponent());
+ }
+ text = encodeURIComponent(text).replace("%20","+");
+ postMessage(new Message("OpenURLinTab", urlBase + text));
+}
+
+/**
+ * Search simple query in the upstream bugzilla appropriate for the component
+ *
+ * @return none
+ */
+function queryUpstream(qUpBug) {
+ if (!qUpBug) {
+ alert("We don't have constantData.queryUpstreamBug set up!");
+ return null;
+ }
+ var text = getSelection();
+ if (!text) {
+ postMessage(new Message("GetClipboard", "queryUpstream"));
+ }
+ else {
+ queryUpstreamCallback(text, qUpBug);
+ }
+}