06-16-2014 11:39 AM
<config evaluator="string-compare" condition="DocLibCustom">
<dependencies>
<js src="/components/import/import-actions.js" />
</dependencies>
</config>
<config evaluator="string-compare" condition="DocLibActions">
<actions>
<action id="alfresco_import_permissions" type="javascript" label="action.import.permissions"
icon="import-permissions">
<param name="function">onActionOpenForm</param>
</action>
</actions>
<actionGroups>
<actionGroup id="folder-browse">
<action index="230" id="alfresco_import_permissions" />
</actionGroup>
</actionGroups>
</config>
(function() {
YAHOO.Bubbling.fire("registerAction", {
actionName : "onActionOpenForm",
fn : function onActionOpenForm(record) {
var actionUrl = YAHOO.lang.substitute(Alfresco.constants.PROXY_URI + "alfresco/importer/{uri}",
{
uri : this.doclistMetadata.parent.nodeRef.replace(":/", "")
});
var templateUrl = Alfresco.constants.URL_SERVICECONTEXT + "alfresco/import/uploadcontent";
var uploadZip = new Alfresco.module.SimpleDialog(this.id + "-uploadContent");
uploadZip.setOptions({
width : "50em",
templateUrl : templateUrl,
actionUrl : actionUrl,
onSuccess : {
fn : function DLTB_onUploadContent_success(response) {
alert("hi");
},
scope : this
},
onFailure : {
fn : function DLTB_onUploadContent_failure(response) {
alert("bye");
},
scope : this
}
});
uploadZip.show()
}
});
})();
<#assign el=args.htmlid?html>
<div id="${el}-dialog" class="upload-content">
<div id="${el}-dialogTitle" class="hd">${msg("page.importZipFile.title")}</div>
<div class="bd">
<form id="${el}-form" action="" method="post" enctype="multipart/form-data" accept-charset="utf-8">
<div class="yui-gd">
<div class="yui-u first"><label for="${el}-filedata">${msg("label.filedata")}:</label></div>
<div class="yui-u"><input type="file" id="${el}-filedata" name="filedata" tabindex="0" style="width:100%"/></div>
</div>
<div class="bdft">
<input type="submit" id="${el}-ok" value="${msg("button.ok")}" tabindex="0" />
<input type="button" id="${el}-cancel" value="${msg("button.cancel")}" tabindex="0" />
</div>
</form>
</div>
</div>
<webscript>
<shortname>Import permissions</shortname>
<description>Import permissions</description>
<url>/alfresco/importer/{nodeRef}</url>
<authentication>none</authentication>
<format default="json">argument</format>
<args>
<arg>
<shortname>nodeRef</shortname>
<description>NodeRef</description>
</arg>
</args>
</webscript>
package alfresco.beans.web.scripts;
import java.io.IOException;
import org.alfresco.service.cmr.repository.NodeService;
import org.json.simple.JSONObject;
import org.springframework.extensions.webscripts.AbstractWebScript;
import org.springframework.extensions.webscripts.WebScriptRequest;
import org.springframework.extensions.webscripts.WebScriptResponse;
public class ImportPermissions extends AbstractWebScript {
NodeService nodeService;
public final NodeService getNodeService() {
return nodeService;
}
public final void setNodeService(NodeService nodeService) {
this.nodeService = nodeService;
}
public ImportPermissions() {
}
@SuppressWarnings("unchecked")
@Override
public void execute(WebScriptRequest req, WebScriptResponse res) throws IOException {
JSONObject jsonObject = new JSONObject();
jsonObject.put("value1", "data1");
jsonObject.put("value2", "data2");
String jsonString = jsonObject.toString();
res.getWriter().write(jsonString);
}
}
02-26-2019 06:53 AM
Hello,
I have the same error with SimpleDialog when it wraps multipart form. In this situation, backed logic is executed correctly and 200 OK is returned but onSuccess callback is never triggered.
If we process with the same code the form with application/json enctype SimpleDialog works correctly and onSuccess or onFailure callbacks are triggered.
Did anybody have solution for this?
Thanks in advance
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.