cancel
Showing results for 
Search instead for 
Did you mean: 

How to call custom control template from share workflow form

skumar_us
Champ in-the-making
Champ in-the-making
Hi
I have created a custom template which I want to call it from the share-config workflow form as below ,it is not calling the custom template .Please guide ?

custom template in share config as

<show id="apwf:contentView" />

<field id="apwf:contentView">
   <control template="/org/alfresco/components/form/controls/customControl.ftl" />
</field>


workflow model has the property entry as

<property name="apwf:contentView">
                   <type>d:text</type>
</property>

The template file as customControl.ftl is

<@script type="text/javascript" src="${page.url.context}/res/components/form/custom-web-preview.js"></@script>
<@script type="text/javascript" src="${page.url.context}/res/components/preview/web-preview.js"></@script>
<@script src="${url.context}/res/components/preview/web-preview.js" />
<@script src="${url.context}/res/components/preview/WebPreviewer.js" />
<@script src="${url.context}/res/js/flash/extMouseWheel.js" />
<@script src="${url.context}/res/components/preview/StrobeMediaPlayback.js" />
<@script src="${url.context}/res/components/preview/Video.js" />
<@script src="${url.context}/res/components/preview/Audio.js" />
<@script src="${url.context}/res/components/preview/Flash.js" />
<@script src="${url.context}/res/components/preview/Image.js" />

<script type="text/javascript">//<![CDATA[
(
function()
{
    new Alfresco.customControl("${fieldHtmlId}").setMessages(${messages});
}
)
();

//]]></script>

<div id="${fieldHtmlId}">
   <div id="web-preview">
    
</div>
</div>
2 REPLIES 2

antoarva
Champ in-the-making
Champ in-the-making
I am also interesting in this. Do you have a solution on this ?

adamsz
Champ in-the-making
Champ in-the-making
It's possible. You should add script to ftl template like this:
1)
<#assign el=args.htmlid?html>
<@markup id="widgets">
    <@inlineScript group="connect-document">
        new Alfresco.getConnectDocumentInstance("${el}", "${url.context}", "${page.url.args['taskId']}").setOptions(
        {
        });
    </@>
</@>

2) in javascript you have to have function:
Alfresco.getConnectDocumentInstance = function(htmlId, urlContext, taskId)
{
    var instanceId = "excelenza-connect-cocument-instance";
    return Alfresco.util.ComponentManager.get(instanceId) || new Alfresco.ConnectDocument(instanceId, htmlId, urlContext, taskId);
};

and implementation of constuctor:
   Alfresco.ConnectDocument = function (instanceId, htmlId, urlContext, taskId) {
        var instance = Alfresco.util.ComponentManager.get(instanceId);
        if (instance !== null)
        {
            return instance;
        }

        this.name = "ConnectDocument";
        this.id = htmlId;
        this.urlContext = urlContext;
        this.taskId = taskId;

        Alfresco.util.ComponentManager.register(this);

        return this;
    };


voilà.