var split = commandId.split("__commandseparator__");\r
var uuid = split[0];\r
var contentType = split[1];\r
- var url = org.argeo.slc.ria.SlcApi.buildGetAttachmentUrl(uuid, contentType);\r
+ var name = split[2];\r
+ var url = org.argeo.slc.ria.SlcApi.buildGetAttachmentUrl(uuid, contentType, name);\r
var win = window.open(url);\r
},\r
selectionChange : function(viewId, xmlNodes){\r
var submenus = [];\r
for(var i=0;i<attachs.length;i++){\r
var uuid = org.argeo.ria.util.Element.getSingleNodeText(attachs[i], "slc:uuid");\r
- var contentType = org.argeo.ria.util.Element.getSingleNodeText(attachs[i], "slc:content-type");\r
+ var contentType = (org.argeo.ria.util.Element.getSingleNodeText(attachs[i], "slc:content-type")||'');\r
var name = org.argeo.ria.util.Element.getSingleNodeText(attachs[i], "slc:name");\r
submenus.push({\r
label:name, \r
icon : 'resource/slc/mime-text-plain.png', \r
- commandId:uuid+'__commandseparator__'+contentType\r
+ commandId:uuid+'__commandseparator__'+contentType+'__commandseparator__'+name\r
});\r
}\r
this.setMenu(submenus);\r
return request;\r
},\r
\r
- buildGetAttachmentUrl : function(attachmentId, contentType){\r
+ buildGetAttachmentUrl : function(attachmentId, contentType, name){\r
return org.argeo.slc.ria.SlcApi.DEFAULT_CONTEXT + "/" + org.argeo.slc.ria.SlcApi.GET_ATTACHEMENT_SERVICE\r
- + "?uuid=" + attachmentId + "&contentType=" + contentType;\r
+ + "?uuid=" + attachmentId + "&contentType=" + contentType + "&name=" + name;\r
},\r
\r
/**\r
eventXPath : {check : "String", init:"//event"},\r
eventTypeXPath : {check : "String", init:"@type"},\r
eventDataXPath : {check : "String", init:"@data"},\r
+ answerStatusXPath : {check : "String", init:"slc:execution-answer/slc:status"},\r
timeout : { \r
init : 20000\r
},\r
+ errorTimeout : {\r
+ init : 5000\r
+ },\r
interrupt : {\r
check : "Boolean",\r
init : false\r
req.setParameter("timeout", this.getTimeout());\r
req.setTimeout(this.getTimeout() + 5000);\r
req.addListener("completed", this._pollHandler, this);\r
+ req.addListener("failed", this._errorHandler, this);\r
+ req.addListener("timeout", this._errorHandler, this);\r
+ req.addListener("aborted", this._errorHandler, this);\r
req.send();\r
},\r
_pollHandler : function(response){\r
// Parse response\r
+ var status = org.argeo.ria.util.Element.getSingleNodeText(response.getContent(), this.getAnswerStatusXPath());\r
+ if(status && status == "ERROR"){\r
+ this._errorHandler();\r
+ return;\r
+ }\r
var messages = org.argeo.ria.util.Element.selectNodes(response.getContent(), this.getEventXPath());\r
if(messages){\r
for(var i=0;i<messages.length;i++){\r
}\r
this._poll();\r
},\r
+ _errorHandler : function(){\r
+ // Wait an try again later\r
+ qx.event.Timer.once(this._poll, this, this.getErrorTimeout());\r
+ },\r
_getRequest : function(service, method, type){\r
return new qx.io.remote.Request(\r
this.getUri()+service, \r