aboutsummaryrefslogtreecommitdiffstats
path: root/data/lib/addAttachmentRow.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-06-05 14:44:00 +0200
commit470e0d853724feb51a991e9e8b867e366c8519ae (patch)
treeb74910c57356601cb8735de030686334cad49917 /data/lib/addAttachmentRow.js
parent3c3860cd080dec5a71ae6c3c7bc3438fa8875d94 (diff)
downloadbugzilla-triage-470e0d853724feb51a991e9e8b867e366c8519ae.tar.gz
Cut out general bugzilla functions to a special module.
Diffstat (limited to 'data/lib/addAttachmentRow.js')
-rw-r--r--data/lib/addAttachmentRow.js41
1 files changed, 41 insertions, 0 deletions
diff --git a/data/lib/addAttachmentRow.js b/data/lib/addAttachmentRow.js
new file mode 100644
index 0000000..13ad226
--- /dev/null
+++ b/data/lib/addAttachmentRow.js
@@ -0,0 +1,41 @@
+// Released under the MIT/X11 license
+// http://www.opensource.org/licenses/mit-license.php
+"use strict";
+
+function addAttachmentCallback(resp) {
+ var newAttachID = parseInt(resp.params.param.value.array.data.value.int, 10);
+ console.log("attachID = " + newAttachID);
+ // FIXME callback.call(param, newAttachID, data.length);
+}
+
+/**
+ *
+ * This has to stay in RHBugzillaPage because upstream doesn't have addAttachment
+ * XML-RPC call yet.
+ */
+function addAttachment(data, callback, param) {
+ var params = [];
+
+ if (!constantData.passwordState.passAvailable) {
+ console.error("addAttachment : No password, no XML-RPC calls; sorry");
+ return null;
+ }
+
+ params.push(getBugNo());
+ params.push({
+ description: titleParsedAttachment,
+ filename: "parsed-backtrace.txt",
+ contenttype: "text/plain",
+ data: window.btoa(data),
+ nomail: true
+ });
+
+ postMessage(new Message("MakeXMLRPCall", {
+ url: constantData.XMLRPCData[window.location.hostname].url,
+ login: getLogin(),
+ method: "bugzilla.addAttachment",
+ params: params,
+ callRPC: "AddAttachmentCallback"
+ }));
+ reqCounter++;
+}