aboutsummaryrefslogtreecommitdiffstats
path: root/lib/rhbzpage.js
diff options
context:
space:
mode:
authorMatěj Cepl <mcepl@redhat.com>2010-06-16 10:36:13 +0200
committerMatěj Cepl <mcepl@redhat.com>2010-06-16 10:36:13 +0200
commit21374b14830837fe525046c1a77a4b61f31df6fa (patch)
tree2901376c5b97e82413a1b97e6c187236c047843b /lib/rhbzpage.js
parent9c56aebdc7182fab939c900a6cf9580f38855f32 (diff)
downloadbugzilla-triage-21374b14830837fe525046c1a77a4b61f31df6fa.tar.gz
Port bugfixes from the -prototype branch. simpleStorage is apparently
not that simple and it will need to be fixed.
Diffstat (limited to 'lib/rhbzpage.js')
-rw-r--r--lib/rhbzpage.js28
1 files changed, 18 insertions, 10 deletions
diff --git a/lib/rhbzpage.js b/lib/rhbzpage.js
index c9d9b9f..9f8a39f 100644
--- a/lib/rhbzpage.js
+++ b/lib/rhbzpage.js
@@ -7,6 +7,7 @@ var util = require("util");
var xrpc = require("xmlrpc");
var xhr = require("xhr");
var clip = require("clipboard");
+var selection = require("selection");
// var TriagedDistro = 13;
// var NumberOfFrames = 7;
// var XMLRPCurl = "https://bugzilla.redhat.com/xmlrpc.cgi";
@@ -182,6 +183,7 @@ RHBugzillaPage.prototype.closeSomeRelease = function() {
* Additional commands specific for this subclass, overriding superclass one.
*/
RHBugzillaPage.prototype.centralCommandDispatch = function(cmdLabel, cmdParams) {
+ console.log("cmdLabel = " + cmdLabel + ", cmdParams = " + cmdParams);
switch (cmdLabel) {
// Set up our own commands
case "closeUpstream":
@@ -193,7 +195,7 @@ RHBugzillaPage.prototype.centralCommandDispatch = function(cmdLabel, cmdParams)
case "queryStringOurBugzilla":
this.queryForSelection();
break;
- case "queryUpstreamBugzilla":
+ case "queryStringUpstreamBugzilla":
this.queryUpstream();
break;
case "sendBugUpstream":
@@ -586,14 +588,23 @@ RHBugzillaPage.prototype.queryInNewTab = function(text, component, product) {
* Get the text to search for and prepare other things for the real executive
* function this.queryInNewTab, and run it.
*/
-RHBugzillaPage.prototype.queryForSelection = function() {
- let text = jetpack.selection.text;
+RHBugzillaPage.prototype.getSelectionOrClipboard = function() {
+ var text = selection.text;
console.log("selection = " + text);
if (!text) {
text = clip.get();
console.log("clipboard = " + text);
}
console.log("text = " + text);
+ return text;
+};
+
+/**
+ * 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);
}
@@ -603,12 +614,9 @@ RHBugzillaPage.prototype.queryForSelection = function() {
* Search simple query in the upstream bugzilla appropriate for the component.
*/
RHBugzillaPage.prototype.queryUpstream = function() {
- let text = jetpack.selection.text;
- if (!text) {
- text = clip.get();
- }
+ var text = this.getSelectionOrClipboard();
if (text) {
- let text = encodeURIComponent(text.trim());
+ text = encodeURIComponent(text.trim());
let queryUpstreamBugsURLArray = this.constantData.queryUpstreamBug;
let url = util.filterByRegexp(queryUpstreamBugsURLArray, this.component);
jetpack.tabs.open(url + text);
@@ -619,8 +627,8 @@ RHBugzillaPage.prototype.queryUpstream = function() {
*
*/
RHBugzillaPage.prototype.sendBugUpstream = function() {
- let url = util.filterByRegexp(this.constantData.newUpstreamBug, this
- .getOptionValue("component"));
+ var url = util.filterByRegexp(this.constantData.newUpstreamBug,
+ this.component);
let ret = jetpack.tabs.open(url);
let that = this;