03-01-2013 09:52 AM
<config evaluator="model-type" condition="myprefix :mytype">
<forms>
<!– Document Library Common form –>
<form>
<field-visibility>
<show id="myprefix :mytype" force="true"/>
<show id="cm:title"/>
<show id="cm:content" for-mode="create"/>
</field-visibility>
<appearance>
<field id="cm:content" mandatory="true">
<control template="/my-upload.ftl"/>
</field>
</appearance>
</form>
</forms>
</config>
<div class="file-upload">
<span id="${fieldHtmlId}-fileUpload-button" class="yui-button yui-push-button">
<span class="first-child">
<button name="fileUpload">${msg("button.upload")}</button>
</span>
</span>
</div>
03-11-2013 01:40 PM
<!– Create Content Form –>
<component>
<region-id>create-content</region-id>
<url>/my/components/upload-file?destination={destination}&itemId={itemId}&path={path}</url>
<properties>
<itemKind>type</itemKind>
<itemId>{itemId}</itemId>
<mode>create</mode>
<submitType>multipart/form-data</submitType>
<showCaption>true</showCaption>
<showCancelButton>true</showCancelButton>
<submissionUrl>/my/type/{itemId}/formprocessor</submissionUrl>
<destination>{destination}</destination>
<path>{path}</path>
<formId>{formId}</formId>
</properties>
</component>
var nodeRef = model.persistedObject;
var content = null, node = null; redirectUrl = null;
for (var i = 0; i < formdata.fields.length; i++)
{
if(!formdata.fields.isFile) continue;
content = formdata.fields.content;
break;
}
node = search.findNode(nodeRef);
//Anadimos el contenido
if(content != null && node != null){
node.properties.content.write(content);
node.properties.content.guessMimetype(node.name);
try{
node.save();
}catch(error){
if(logger && logger.debug){
logger.debug("Problem by including the file content.");
}
status.redirect = true;
status.code = 301;
status.location = "/share/page/my-upload-content?destination=" + encodeURIComponent(destination) + "&itemId=" + encodeURIComponent(itemId) + "&path=" + encodeURIComponent(path) + "&errorCode=" + 500;
return;
}
}
status.redirect = true;
status.code = 301;
status.location = "/share/page/document-details?nodeRef=" + nodeRef;
03-12-2013 03:21 PM
03-13-2013 05:59 AM
<#include "alfresco-template.ftl" />
<@templateHeader />
<@templateBody>
<@markup id="alf-hd">
<div id="alf-hd">
<@region id="header" scope="global" />
<@region id="title" scope="template" />
<@region id="navigation" scope="template" />
</div>
</@>
<@markup id="bd">
<div id="bd">
<div class="share-form">
<@region id="create-content-mgr" scope="template" />
<@region id="create-content" scope="template" />
</div>
</div>
</@>
</@>
<@templateFooter>
<@markup id="alf-ft">
<div id="alf-ft">
<@region id="footer" scope="global" />
</div>
</@>
</@>
01-21-2014 10:09 AM
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.