diff --git a/ccm-cms-types-formitem/web/themes/freemarker/ccm-cms-types-formitem.ftl b/ccm-cms-types-formitem/web/themes/freemarker/ccm-cms-types-formitem.ftl index 1aa5ac16b..afafb2064 100644 --- a/ccm-cms-types-formitem/web/themes/freemarker/ccm-cms-types-formitem.ftl +++ b/ccm-cms-types-formitem/web/themes/freemarker/ccm-cms-types-formitem.ftl @@ -5,10 +5,28 @@ "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> <#return item["./form/description"]> +<#--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> <#if (item["./remote"] == "true")> <#return item["./remoteURL"]> @@ -17,66 +35,178 @@ +<#--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> <#return (item["./honeypot"]?size > 0)> +<#--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> <#return item["./honeypot/@name"]> +<#--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> <#return (item["./minTimeCheck"]?size > 0)> +<#--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> <#return item["./minTimeCheck/@generated"]> +<#--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> <#return (item["./remote"] != "true")> +<#--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> <#return item["./name"]> +<#--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> <#return item["./formbuilder:pageState/bebop:pageState/@name"]> +<#--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> <#return item["./formbuilder:pageState/bebop:pageState/@value"]> +<#--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> <#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')]"]> +<#--doc + Gets the name of the component. + + @param component The model of the component. + + @return The name of the component. +--> <#function getComponentName component> <#return component["./parameterName"]> +<#--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> <#return component["./defaultValue"]> +<#--doc + Gets the description of the component. + + @param component The model of the component. + + @return The description of the component. +--> <#function getComponentDescription component> <#return component["./description"]> +<#--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> <#return component["./parameterName"]> +<#--doc + Gets the type of the component. + + @param component The model of the component. + + @return The type of the component. +--> <#function getComponentType component> <#return component["./defaultDomainClass"]> +<#--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> <#return formSection["./formSectionItem/title]> +<#--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> <#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')]"]>