<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);
}
}
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
Content from pre 2016 and from language groups that have been closed.
Content is read-only.
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.