From 272ab432ddc4562237c7235f8e0ab8a11bad3d3d Mon Sep 17 00:00:00 2001 From: Matěj Cepl Date: Fri, 29 Apr 2011 01:22:18 +0200 Subject: All XML-RPC calls are rewritten as JSON-RPC ones. * also MakeJSONRPCall is a functional call now * reorganization for dealing with the history. --- data/lib/addAttachmentRow.js | 32 ++++++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 6 deletions(-) (limited to 'data/lib/addAttachmentRow.js') diff --git a/data/lib/addAttachmentRow.js b/data/lib/addAttachmentRow.js index a2b67ee..3bee73a 100644 --- a/data/lib/addAttachmentRow.js +++ b/data/lib/addAttachmentRow.js @@ -2,6 +2,7 @@ // http://www.opensource.org/licenses/mit-license.php "use strict"; +// FIXME resp is JSON, not XML anymore function addAttachmentCallback(resp) { var newAttachID = parseInt( resp.params.param.value.array.data.value.int, 10); @@ -13,6 +14,25 @@ function addAttachmentCallback(resp) { * * This has to stay in RHBugzillaPage because upstream doesn't have * addAttachment XML-RPC call yet. + * + Params: $params = { + id => '', # ID of the bug report + comment => "", # OPTIONAL Text string containing comment to add. + description => "", # REQUIRED Text Description of the attachment. + isprivate => , # OPTIONAL Whether the Attachment + will be private # Default: false + filename => "", REQUIRED The name of the file to attach to the bug report. + obsoletes => [List of attach_id's to obsolete], OPTIONAL List if attachment ids that are + obsoleted by this new attachment. + ispatch => , OPTIONAL Whether the attachment is a Patch + or not, if not provided the it will be considered NON Patch attachment. + contenttype => "", OPTIONAL If the attachment is patch + REQUIRED If the attachment is not a patch + If the attachment is patch then contenttype will always be text/plain + data => "", REQUIRED It is a base64 + encoded string of the actual attachment data. + nomail => 0, OPTIONAL Flag that is either 1 or 0 if you want email + to be send ot not for this change } */ function addAttachment(data, callback, param) { var params = []; @@ -23,18 +43,18 @@ function addAttachment(data, callback, param) { return null; } - params.push(getBugNo()); - params.push({ + var params = { + id: getBugNo(), description : titleParsedAttachment, filename : "parsed-backtrace.txt", contenttype : "text/plain", data : window.btoa(data), nomail : true - }); + }; - self.postMessage(new Message("MakeXMLRPCall", { - url : constantData.XMLRPCData[window.location.hostname].url, - login : getLogin(), + self.postMessage(new Message("MakeJSONRPCCall", { + url : constantData.XMLRPCData[window.location.hostname].url. + replace("xmlrpc.cgi","jsonrpc.cgi"), method : "bugzilla.addAttachment", params : params, callRPC : "AddAttachmentCallback" -- cgit