diff options
author | Matěj Cepl <mcepl@redhat.com> | 2011-03-25 16:23:51 +0100 |
---|---|---|
committer | Matěj Cepl <mcepl@redhat.com> | 2011-03-25 17:55:56 +0100 |
commit | 0ace4d34ece35b717b64ee1d3312cdc3c07696b5 (patch) | |
tree | 0e9cfe3000295c14d08a09c617b8aa8b89285cc4 /data/lib/queries.js | |
parent | a9e66d84f83d3f21fffd4cd9872ac8934e455edf (diff) | |
download | bugzilla-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.js | 34 |
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); + } +} |