diff options
author | Matěj Cepl <mcepl@redhat.com> | 2011-03-25 16:23:51 +0100 |
---|---|---|
committer | Matěj Cepl <mcepl@redhat.com> | 2011-06-05 14:44:00 +0200 |
commit | 470e0d853724feb51a991e9e8b867e366c8519ae (patch) | |
tree | b74910c57356601cb8735de030686334cad49917 /data/lib/queries.js | |
parent | 3c3860cd080dec5a71ae6c3c7bc3438fa8875d94 (diff) | |
download | bugzilla-triage-470e0d853724feb51a991e9e8b867e366c8519ae.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); + } +} |