Hello,
I have done many searches on this subject but i can't make what i want after many attempts.
My objective is to customize the upload window to display the "edit metadata" form before the upload :
- Inside a folder which add an aspect on all uploaded files with a rule, the user selects one file on dnd-upload window.
- Instead of sending the file directly, i want to display the same form as in the "edit properties" popup (only for the aspect defined in the rule, the other folders without this aspect keep the same upload window)
- If the metadata are valid, upload the file with the metadata to create a 1.0 version.
Currently, I customized the edit form for the aspect through an extension file and everything works fine, i can see my fields when i edit uploaded file properties :
<config evaluator="aspect" condition="ns:myAspectName">
<forms>
<form id="doclib-simple-metadata">
<field-visibility>
...
</field-visibility>
<appearance>
...
</appearance>
</form>
</forms>
</config>
But i can't find a way to display the form on the document upload page and then save the metadata with the file. Is it possible? Can someone explain me the steps to succeed that? Thanks.
I'm not sure this addon is working with current Alfresco release:
GitHub - softwareloop/uploader-plus: An Alfresco uploader that prompts for metadata
But it's providing the feature you are looking for.
Thank you. Yes, it's almost what i want. I can't use the addon directly, so i try to develop a similar one.
I have created a type in my model associated to the aspect :
<types>
<type name="ns:typetest">
<parent>cm:content</parent>
<mandatory-aspects>
<aspect>ns:myAspectName</aspect>
</mandatory-aspects>
</type>
</types>
And I defined my form in the extension :
<config evaluator="model-type" condition="ns:typetest">
<forms>
<form>...
I can now display the form in a "metadata" div on the dnd-upload page with the following code :
Alfresco.DNDUpload.prototype.onFileSelection = function DNDUpload_onFileSelection(evt){
Dom.removeClass("metadata", "hidden");
var url = YAHOO.lang.substitute(
"{serviceContext}components/form"
+ "?mode={mode}&itemKind={itemKind}&itemId={itemId}&htmlid={htmlid}"
+ "&destination={destination}&siteId={siteId}&containerId={containerId}&uploadDirectory={uploadDirectory}",
{
serviceContext : Alfresco.constants.URL_SERVICECONTEXT,
mode: "create",
itemKind : "type",
itemId : "alpro:typetest",
htmlid : "something",
destination: encodeURIComponent(this.showConfig.destination || ""), // empty field ?
siteId: encodeURIComponent(this.showConfig.siteId || ""),
containerId: encodeURIComponent(this.showConfig.containerId || ""),
uploadDirectory: encodeURIComponent(this.showConfig.uploadDirectory || ""),
});
Alfresco.util.Ajax.request({
url: url,
successCallback: {
fn: function(response) {
YUIDom.get("metadata").innerHTML = response.serverResponse.responseText;
},
scope: this
}
});
}
My next step is to send the form to save the file and the metadata but i don't know how to do it.
Currently, I can't send the form ("javax.servlet.ServletException: Possible CSRF attack noted when comparing token in session and request parameter. Request: POST /share/proxy/alfresco/api/type/ns%3Atypetest/formprocessor").
Can you explain me the step for the save ?
Ask for and offer help to other Alfresco Content Services Users and members of the Alfresco team.
Related links:
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.