Subversion Repositories linshare

Compare Revisions

Rev 1647 → Rev 1648

/trunk/plugins/thunderbird/content/server/linshareServerAPIv3.js
16,17 → 16,13
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
 
if ( typeof(LinshareServerAPIv2) == "undefined" ) {
if ( typeof(LinshareServerAPIBase) == "undefined" ) {
var scriptLoader = Components
.classes["@mozilla.org/moz/jssubscript-loader;1"]
.createInstance(Components.interfaces.mozIJSSubScriptLoader);
scriptLoader.loadSubScript("chrome://linshare/content/server/LinshareServerAPIv2.js");
scriptLoader.loadSubScript("chrome://linshare/content/server/linshareServerAPIBase.js");
 
var msg = Components
.classes["@mozilla.org/moz/jssubscript-loader;1"]
.createInstance(Components.interfaces.mozIJSSubScriptLoader);
 
// nsIMsgCompFields: Components.classes["@mozilla.org/messengercompose/composefields;1"]
// .getService(Components.interfaces.nsIMsgCompFields);
 
37,8 → 33,53
}
 
LinshareServerAPIv3.prototype = {
__proto__: new LinshareServerAPIv2(),
__proto__: new LinshareServerAPIBase(),
uploadFileUrl: function (url) {
return url + "/webservice/rest/document/upload";
},
multipleShareDocumentsUrl: function (url) {
return url + "/webservice/rest/share/multiplesharedocuments";
},
 
pluginInfoUrl: function (url) {
return url + "/webservice/rest/plugin/information";
},
uploadFile: function (serverInfo, attachment, callback) {
var file = this.openFile(attachment.url);
this.logInfo("uploading file : " + attachment.name);
var request = this.newFileUploadRequest(file, attachment.name, this.uploadFileUrl(serverInfo.url), true, serverInfo.username, serverInfo.password);
request.setRequestHeader("Accept", "application/json");
request.onreadystatechange = function (e) {
if (request.readyState == 4) {
this.logInfo("upload request status : " + request.status)
if (request.status == 200) {
try {
var doc = JSON.parse(request.responseText);
callback.success(doc.uuid, file);
} catch(e) {
Components.utils.reportError("error : " + request.status + " : " + e);
callback.error(request.status, e);
}
} else {
Components.utils.reportError("request error code : " + request.status);
callback.error(request.status);
}
}
};
 
try {
request.sendFile();
} catch(e) {
callback.error(-1, e);
}
return request;
},
shareMultipleFiles: function (serverInfo, fileIds, recipient) {
var fileParams = "";
/trunk/plugins/thunderbird/content/linshareSend.js
29,7 → 29,7
.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefService)
.getBranch("extensions.linshare.")
.QueryInterface(Components.interfaces.nsIPrefBranch2);
.QueryInterface(Components.interfaces.nsIPrefBranch2);
this.scriptLoader = Components
.classes["@mozilla.org/moz/jssubscript-loader;1"]
.createInstance(Components.interfaces.mozIJSSubScriptLoader);