Thursday, July 5, 2012

Form control Period.ftl

If your into doing the new share 4.0 forms for simple form doc.lib. actions (onActionFormDialog), you might what to use the Period.ftl control setting it up manually.

To do this it needs some specification of what goes into the drop-down etc.

This example adds all possibilities as an control-param containing a json array:

<control template="/org/alfresco/components/form/controls/period.ftl" >
     <control-param name="dataTypeParameters">                   [{"hasExpression":true,"expressionType":"int","expressionMandatory":false,"defaultExpression":"1","label":"End Of Quarter","type":"quarterend"},{"hasExpression":true,"expressionType":"int","expressionMandatory":false,"defaultExpression":"1","label":"Year","type":"year"},{"hasExpression":true,"expressionType":"int","expressionMandatory":false,"defaultExpression":"1","label":"Quarter","type":"quarter"},{"hasExpression":true,"expressionType":"int","expressionMandatory":false,"defaultExpression":"1","label":"Day","type":"day"},{"hasExpression":true,"expressionType":"int","expressionMandatory":false,"defaultExpression":"1","label":"End Of Month","type":"monthend"},{"hasExpression":false,"label":"None","type":"none"},{"hasExpression":false,"label":"Immediately","type":"immediately"},{"hasExpression":true,"expressionType":"int","expressionMandatory":false,"defaultExpression":"1","label":"End Of Financial Month","type":"fmend"},{"hasExpression":true,"expressionType":"int","expressionMandatory":false,"defaultExpression":"1","label":"End Of Year","type":"yearend"},{"hasExpression":true,"expressionType":"int","expressionMandatory":false,"defaultExpression":"1","label":"End Of Financial Year","type":"fyend"},{"hasExpression":true,"expressionType":"int","expressionMandatory":false,"defaultExpression":"1","label":"Week","type":"week"},{"hasExpression":true,"expressionType":"int","expressionMandatory":false,"defaultExpression":"1","label":"End Of Financial Quarter","type":"fqend"},{"hasExpression":true,"expressionType":"int","expressionMandatory":false,"defaultExpression":"1","label":"Month","type":"month"}]
     </control-param> 

</control>

:)