|
|
@@ -742,11 +742,11 @@ o2.widget.AttachmentController = o2.widget.ATTER = new Class({
|
|
|
uploadAttachment: function(e, node){
|
|
|
if (this.module) this.module.uploadAttachment(e, node);
|
|
|
},
|
|
|
- doUploadAttachment: function(obj, action, invokeUrl, parameter, finish, every, beforeUpload, multiple, accept, size){
|
|
|
+ doUploadAttachment: function(obj, action, invokeUrl, parameter, finish, every, beforeUpload, multiple, accept, size, failureEvery){
|
|
|
if (FormData.expiredIE){
|
|
|
- this.doInputUploadAttachment(obj, action, invokeUrl, parameter, finish, every, beforeUpload, multiple, accept, size);
|
|
|
+ this.doInputUploadAttachment(obj, action, invokeUrl, parameter, finish, every, beforeUpload, multiple, accept, size, failureEvery);
|
|
|
}else{
|
|
|
- this.doFormDataUploadAttachment(obj, action, invokeUrl, parameter, finish, every, beforeUpload, multiple, accept, size);
|
|
|
+ this.doFormDataUploadAttachment(obj, action, invokeUrl, parameter, finish, every, beforeUpload, multiple, accept, size, failureEvery);
|
|
|
}
|
|
|
},
|
|
|
addUploadMessage: function(fileName){
|
|
|
@@ -788,7 +788,7 @@ o2.widget.AttachmentController = o2.widget.ATTER = new Class({
|
|
|
}
|
|
|
|
|
|
},
|
|
|
- doInputUploadAttachment: function(obj, action, invokeUrl, parameter, finish, every, beforeUpload, multiple, accept){
|
|
|
+ doInputUploadAttachment: function(obj, action, invokeUrl, parameter, finish, every, beforeUpload, multiple, accept, failureEvery){
|
|
|
var restActions = action;
|
|
|
if (typeOf(action)=="string"){
|
|
|
restActions = o2.Actions.get(action).action;
|
|
|
@@ -835,6 +835,7 @@ o2.widget.AttachmentController = o2.widget.ATTER = new Class({
|
|
|
if(finish) finish();
|
|
|
}else{
|
|
|
//formNode.unmask();
|
|
|
+ // if(failureEvery)failureEvery(json);
|
|
|
this.setMessageTitle(messageItem, o2.LP.desktop.action.sendError);
|
|
|
this.setMessageText(messageItem, o2.LP.desktop.action.sendError+": "+json.message);
|
|
|
o2.xDesktop.notice("error", {x: "right", y:"top"}, json.message);
|
|
|
@@ -897,7 +898,7 @@ o2.widget.AttachmentController = o2.widget.ATTER = new Class({
|
|
|
}.bind(this));
|
|
|
}.bind(this));
|
|
|
},
|
|
|
- doFormDataUploadAttachment: function(obj, action, invokeUrl, parameter, finish, every, beforeUpload, multiple, accept, size){
|
|
|
+ doFormDataUploadAttachment: function(obj, action, invokeUrl, parameter, finish, every, beforeUpload, multiple, accept, size, failureEvery){
|
|
|
if (!this.uploadFileAreaNode){
|
|
|
this.uploadFileAreaNode = new Element("div");
|
|
|
var html = "<input name=\"file\" multiple type=\"file\" accept=\"*/*\"/>";
|
|
|
@@ -909,6 +910,7 @@ o2.widget.AttachmentController = o2.widget.ATTER = new Class({
|
|
|
if (files.length){
|
|
|
var count = files.length;
|
|
|
var current = 0;
|
|
|
+ var hasFailUpload = false;
|
|
|
|
|
|
var restActions = action;
|
|
|
if (typeOf(action)=="string"){
|
|
|
@@ -918,7 +920,7 @@ o2.widget.AttachmentController = o2.widget.ATTER = new Class({
|
|
|
|
|
|
var callback = function(){
|
|
|
if (current == count){
|
|
|
- if(finish) finish();
|
|
|
+ if(finish) finish( hasFailUpload );
|
|
|
}
|
|
|
};
|
|
|
|
|
|
@@ -992,6 +994,14 @@ o2.widget.AttachmentController = o2.widget.ATTER = new Class({
|
|
|
current++;
|
|
|
if (every) every(json, current, count);
|
|
|
callback();
|
|
|
+ },
|
|
|
+ "failure": function (xhr) {
|
|
|
+ var json = JSON.decode(xhr.responseText);
|
|
|
+ if( json && json.message )o2.xDesktop.notice("error", {x: "right", y:"top"}, json.message);
|
|
|
+ current++;
|
|
|
+ hasFailUpload = true;
|
|
|
+ if (failureEvery) failureEvery(xhr, current, count);
|
|
|
+ callback();
|
|
|
}
|
|
|
});
|
|
|
}else{
|
|
|
@@ -1005,6 +1015,14 @@ o2.widget.AttachmentController = o2.widget.ATTER = new Class({
|
|
|
current++;
|
|
|
if (every) every(json, current, count);
|
|
|
callback();
|
|
|
+ },
|
|
|
+ "failure": function (xhr) {
|
|
|
+ var json = JSON.decode(xhr.responseText);
|
|
|
+ if( json && json.message )o2.xDesktop.notice("error", {x: "right", y:"top"}, json.message);
|
|
|
+ current++;
|
|
|
+ hasFailUpload = true;
|
|
|
+ if (failureEvery) failureEvery(xhr, current, count);
|
|
|
+ callback();
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
@@ -1036,6 +1054,14 @@ o2.widget.AttachmentController = o2.widget.ATTER = new Class({
|
|
|
current++;
|
|
|
if (every) every(json, current, count);
|
|
|
callback();
|
|
|
+ },
|
|
|
+ "failure": function (xhr) {
|
|
|
+ var json = JSON.decode(xhr.responseText);
|
|
|
+ if( json && json.message )o2.xDesktop.notice("error", {x: "right", y:"top"}, json.message);
|
|
|
+ current++;
|
|
|
+ hasFailUpload = true;
|
|
|
+ if (failureEvery) failureEvery(xhr, current, count);
|
|
|
+ callback();
|
|
|
}
|
|
|
});
|
|
|
}
|