Documentation for ccm-cms-types-formitem.ftl

git-svn-id: https://svn.libreccm.org/ccm/trunk@6301 8810af33-2d31-482b-a856-94f89814c4df
master
jensp 2019-11-03 12:42:22 +00:00
parent 114f155c56
commit 142074d7c1
1 changed files with 130 additions and 0 deletions

View File

@ -5,10 +5,28 @@
"ui": "http://www.arsdigita.com/ui/1.0"} "ui": "http://www.arsdigita.com/ui/1.0"}
> >
<#--filedoc
Functions for processing form items.
-->
<#--doc
Gets the description of the form item.
@param The model of the form items to use.
@return The description of the form item.
-->
<#function getDescription item> <#function getDescription item>
<#return item["./form/description"]> <#return item["./form/description"]>
</#function> </#function>
<#--doc
Gets the action of the form item.
@param The model of the form items to use.
@return The action of the form item.
-->
<#function getFormAction item> <#function getFormAction item>
<#if (item["./remote"] == "true")> <#if (item["./remote"] == "true")>
<#return item["./remoteURL"]> <#return item["./remoteURL"]>
@ -17,66 +35,178 @@
</#if> </#if>
</#function> </#function>
<#--doc
Determines if the form item has a honeypot field.
@param The model of the form items to use.
@return `true` if the form item has a honeypot, `false` otherwise.
-->
<#function hasHoneypot item> <#function hasHoneypot item>
<#return (item["./honeypot"]?size > 0)> <#return (item["./honeypot"]?size > 0)>
</#function> </#function>
<#--doc
Gets the name of the honeypot field of the form item.
@param The model of the form items to use.
@return The name of the honeypot field of the form item.
-->
<#function getHoneypotName item> <#function getHoneypotName item>
<#return item["./honeypot/@name"]> <#return item["./honeypot/@name"]>
</#function> </#function>
<#--doc
Determines if the form item has a min time check.
@param The model of the form items to use.
@return `true` if the form item has a min time check, `false` otherwise.
-->
<#function hasMinTimeCheck item> <#function hasMinTimeCheck item>
<#return (item["./minTimeCheck"]?size > 0)> <#return (item["./minTimeCheck"]?size > 0)>
</#function> </#function>
<#--doc
Gets the value for the min time check of the form item.
@param The model of the form items to use.
@return The value for the min time check field of the form item.
-->
<#function getMinTimeCheckValue item> <#function getMinTimeCheckValue item>
<#return item["./minTimeCheck/@generated"]> <#return item["./minTimeCheck/@generated"]>
</#function> </#function>
<#--doc
Determines if the form item has a visited field.
@param The model of the form items to use.
@return `true` if the form item has a visited, `false` otherwise.
-->
<#function hasVisitedField item> <#function hasVisitedField item>
<#return (item["./remote"] != "true")> <#return (item["./remote"] != "true")>
</#function> </#function>
<#--doc
Gets the name of the visited field of the form item.
@param The model of the form items to use.
@return The name of the visited field of the form item.
-->
<#function getVisitedFieldName item> <#function getVisitedFieldName item>
<#return item["./name"]> <#return item["./name"]>
</#function> </#function>
<#--doc
Gets the name of the page state field of the form item.
@param The model of the form items to use.
@return The name of the page state field of the form item.
-->
<#function getPageStateFieldName item> <#function getPageStateFieldName item>
<#return item["./formbuilder:pageState/bebop:pageState/@name"]> <#return item["./formbuilder:pageState/bebop:pageState/@name"]>
</#function> </#function>
<#--doc
Gets the value of the page state field of the form item.
@param The model of the form items to use.
@return The value of the page state field of the form item.
-->
<#function getPageStateFieldValue item> <#function getPageStateFieldValue item>
<#return item["./formbuilder:pageState/bebop:pageState/@value"]> <#return item["./formbuilder:pageState/bebop:pageState/@value"]>
</#function> </#function>
<#--doc
Gets the components for the form.
@param The model of the form items to use.
@return A sequence of the models of the compoents of the form item.
-->
<#function getComponents item> <#function getComponents item>
<#return item["./form/component[(objectType != 'com.arsdigita.formbuilder.Widget' and objectType != 'com.arsdigita.formbuilder.DataDrivenSelect' or (defaultDomainClass = 'com.arsdigita.formbuilder.PersistentSubmit' or defaultDomainClass = 'com.arsdigita.formbuilder.PersistentHidden' or defaultDomainClass = 'com.arsdigita.formbuilder.HiddenIDGenerator')]"]> <#return item["./form/component[(objectType != 'com.arsdigita.formbuilder.Widget' and objectType != 'com.arsdigita.formbuilder.DataDrivenSelect' or (defaultDomainClass = 'com.arsdigita.formbuilder.PersistentSubmit' or defaultDomainClass = 'com.arsdigita.formbuilder.PersistentHidden' or defaultDomainClass = 'com.arsdigita.formbuilder.HiddenIDGenerator')]"]>
</#function> </#function>
<#--doc
Gets the name of the component.
@param component The model of the component.
@return The name of the component.
-->
<#function getComponentName component> <#function getComponentName component>
<#return component["./parameterName"]> <#return component["./parameterName"]>
</#function> </#function>
<#--doc
Gets the default value of the component.
@param component The model of the component.
@return The default value of the component.
-->
<#function getComponentDefaultValue component> <#function getComponentDefaultValue component>
<#return component["./defaultValue"]> <#return component["./defaultValue"]>
</#function> </#function>
<#--doc
Gets the description of the component.
@param component The model of the component.
@return The description of the component.
-->
<#function getComponentDescription component> <#function getComponentDescription component>
<#return component["./description"]> <#return component["./description"]>
</#function> </#function>
<#--doc
Gets the name of the parameter of the component.
@param component The model of the component.
@return The name of the parameter of the component.
-->
<#function getComponentParameterName component> <#function getComponentParameterName component>
<#return component["./parameterName"]> <#return component["./parameterName"]>
</#function> </#function>
<#--doc
Gets the type of the component.
@param component The model of the component.
@return The type of the component.
-->
<#function getComponentType component> <#function getComponentType component>
<#return component["./defaultDomainClass"]> <#return component["./defaultDomainClass"]>
</#function> </#function>
<#--doc
Gets the title of a form section.
@param component The model of form section.
@return The name of the form section.
-->
<#function getFormSectionTitle formSection> <#function getFormSectionTitle formSection>
<#return formSection["./formSectionItem/title]> <#return formSection["./formSectionItem/title]>
</#function> </#function>
<#--doc
Gets the components of a form section.
@param component The model of form section.
@return A sequence of the models of the compoents of the form item.
-->
<#function getFormSectionComponents formSection> <#function getFormSectionComponents formSection>
<#return formSection["./formSectionItem/formSection/component[(objectType != 'com.arsdigita.formbuilder.Widget' and objectType != 'com.arsdigita.formbuilder.DataDrivenSelect' or (defaultDomainClass = 'com.arsdigita.formbuilder.PersistentSubmit' or defaultDomainClass = 'com.arsdigita.formbuilder.PersistentHidden' or defaultDomainClass = 'com.arsdigita.formbuilder.HiddenIDGenerator')]"]> <#return formSection["./formSectionItem/formSection/component[(objectType != 'com.arsdigita.formbuilder.Widget' and objectType != 'com.arsdigita.formbuilder.DataDrivenSelect' or (defaultDomainClass = 'com.arsdigita.formbuilder.PersistentSubmit' or defaultDomainClass = 'com.arsdigita.formbuilder.PersistentHidden' or defaultDomainClass = 'com.arsdigita.formbuilder.HiddenIDGenerator')]"]>
</#function> </#function>