#-- $This file is distributed under the terms of the license in /doc/license.txt$ --> <#-- This is an example of how we could call this macro from a custom form if we end up implementing this like the other freemarker "widgets". For now I just have this here as an example and I didn't really see any other way to get the jsp custom forms to call this at the moment. Needless to say, we need to be able to call the macro and pass parameters from within the original custom form --> <#-- Available variables: fieldName -- name of field minimumPrecision -- minimum precision accepted by validator requiredLevel -- maximum precision to display as required existingPrecision -- precision on an existing value, may be "" year -- year on an existing value, may be "" month -- month on an existing value, may be "" day -- day on an existing value, may be "" hour -- hour on an existing value, may be "" minute -- minute on an existing value, may be "" second -- second on an existing value, may be "" precisionConstants.none -- URI for precision precisionConstants.year -- URI for precision precisionConstants.month -- URI for precision precisionConstants.day -- URI for precision precisionConstants.hour -- URI for precision precisionConstants.minute -- URI for precision precisionConstants.second -- URI for precision --> <@dateTime precision="${minimumPrecision}" required="${requiredLevel}" /> <#macro dateTime precision="full" required=specificity> <#assign precLevel = 10 /> <#assign reqLevel = 10 /> <#if precision == "${precisionConstants.year}"> <#assign precLevel = 1 /> <#elseif precision == "${precisionConstants.month}"> <#assign precLevel = 2 /> <#-- allow to specify year, month and day using "date" --> <#elseif precision == "${precisionConstants.day}" || precision == "date"> <#assign precLevel = 3 /> <#elseif precision == "${precisionConstants.hour}"> <#assign precLevel = 4 /> <#-- allow to specify hours and minutes using "time" --> <#elseif precision == "${precisionConstants.minute}" || precision == "time"> <#assign precLevel = 5 /> <#elseif precision == "${precisionConstants.second}"> <#assign precLevel = 6 /> #if> <#if required == "${precisionConstants.year}"> <#assign reqLevel = 1 /> <#elseif required == "${precisionConstants.month}"> <#assign reqLevel = 2 /> <#-- allow to require year, month and day using "date" --> <#elseif required == "${precisionConstants.day}" || required == "date"> <#assign reqLevel = 3 /> <#elseif required == "${precisionConstants.hour}"> <#assign reqLevel = 4 /> <#-- allow to require hours and minutes using "time" --> <#elseif required == "${precisionConstants.minute}" || required == "time"> <#assign reqLevel = 5 /> <#elseif required == "${precisionConstants.second}"> <#assign reqLevel = 6 /> <#elseif required == "${precisionConstants.none}"> <#assign reqLevel = 0 /> #if>
#macro>