Functions for many freemarker related things, renaming of freemarker files
git-svn-id: https://svn.libreccm.org/ccm/trunk@5890 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
2fcae22fe7
commit
3c21aa0ceb
|
|
@ -7,15 +7,20 @@
|
|||
|
||||
<#--
|
||||
Outputs the lead text the provided article.
|
||||
|
||||
Disabled 2019-03-25, remove 2019-04-07 if this macro is not required
|
||||
-->
|
||||
<#macro lead item>
|
||||
<#-- <#macro lead item>
|
||||
<#if (item["./lead"]?size > 0)>
|
||||
${item["./lead"]}
|
||||
<#elseif (item["./nav:attribute[@name='lead']"]?size > 0)>
|
||||
${item["./nav:attribute[@name='lead']"]}
|
||||
</#if>
|
||||
</#macro>
|
||||
</#macro> -->
|
||||
|
||||
<#--
|
||||
Gets the lead text of the provided article.
|
||||
-->
|
||||
<#function getLead item>
|
||||
<#if (item["./lead"]?size > 0)>
|
||||
<#return item["./lead"]>
|
||||
|
|
@ -26,13 +31,18 @@
|
|||
|
||||
<#--
|
||||
Output the main text of the provided article.
|
||||
|
||||
Disabled 2019-03-25, remove 2019-04-07 if this macro is not required
|
||||
-->
|
||||
<#macro mainText item>
|
||||
<#-- <#macro mainText item>
|
||||
<#if (item["./textAsset"]?size > 0)>
|
||||
${item["./textAsset/content"]}
|
||||
</#if>
|
||||
</#macro>
|
||||
</#macro> -->
|
||||
|
||||
<#--
|
||||
Gets the main text the the provided article.
|
||||
-->
|
||||
<#function getMainText item>
|
||||
<#if (item["./textAsset"]?size > 0)>
|
||||
<#return item["./textAsset/content"]>
|
||||
|
|
@ -153,7 +153,7 @@
|
|||
</#if>
|
||||
</#macro>
|
||||
|
||||
<#function funEndDate item>
|
||||
<#function getEndDate item>
|
||||
<#if (item["./endDate"]?size > 0)>
|
||||
<#return item["./endDate"]>
|
||||
<#elseif (item["./nav:attribute[@name='endDate']"]?size > 0)>
|
||||
|
|
@ -161,7 +161,7 @@
|
|||
</#if>
|
||||
</#function>
|
||||
|
||||
<#function funEndDateYear item>
|
||||
<#function getEndDateYear item>
|
||||
<#if (item["./endDate"]?size > 0)>
|
||||
<#return item["./endDate/@year"]>
|
||||
<#elseif (item["./nav:attribute[@name='endDate']"]?size > 0)>
|
||||
|
|
@ -169,7 +169,7 @@
|
|||
</#if>
|
||||
</#function>
|
||||
|
||||
<#function funEndDateMonth item>
|
||||
<#function getEndDateMonth item>
|
||||
<#if (item["./endDate"]?size > 0)>
|
||||
<#return item["./endDate/@month"]>
|
||||
<#elseif (item["./nav:attribute[@name='endDate']"]?size > 0)>
|
||||
|
|
@ -177,7 +177,7 @@
|
|||
</#if>
|
||||
</#function>
|
||||
|
||||
<#function funEndDateDay item>
|
||||
<#function getEndDateDay item>
|
||||
<#if (item["./endDate"]?size > 0)>
|
||||
<#return item["./endDate/@day"]>
|
||||
<#elseif (item["./nav:attribute[@name='endDate']"]?size > 0)>
|
||||
|
|
@ -185,7 +185,7 @@
|
|||
</#if>
|
||||
</#function>
|
||||
|
||||
<#function funEndDateDayNameShort item>
|
||||
<#function getEndDateDayNameShort item>
|
||||
<#if (item["./endDate"]?size > 0)>
|
||||
<#return item["./endDate/@dayNameShort"]>
|
||||
<#elseif (item["./nav:attribute[@name='endDate']"]?size > 0)>
|
||||
|
|
@ -193,7 +193,7 @@
|
|||
</#if>
|
||||
</#function>
|
||||
|
||||
<#function funEndDateHour item>
|
||||
<#function getEndDateHour item>
|
||||
<#if (item["./endDate"]?size > 0)>
|
||||
<#return item["./endDate/@hour"]>
|
||||
<#elseif (item["./nav:attribute[@name='endDate']"]?size > 0)>
|
||||
|
|
@ -201,7 +201,7 @@
|
|||
</#if>
|
||||
</#function>
|
||||
|
||||
<#function funEndDateMinute item>
|
||||
<#function getEndDateMinute item>
|
||||
<#if (item["./endDate"]?size > 0)>
|
||||
<#return item["./endDate/@minute"]>
|
||||
<#elseif (item["./nav:attribute[@name='endDate']"]?size > 0)>
|
||||
|
|
@ -209,7 +209,7 @@
|
|||
</#if>
|
||||
</#function>
|
||||
|
||||
<#function funEndDateSecond item>
|
||||
<#function getEndDateSecond item>
|
||||
<#if (item["./endDate"]?size > 0)>
|
||||
<#return item["./endDate/@second"]>
|
||||
<#elseif (item["./nav:attribute[@name='endDate']"]?size > 0)>
|
||||
|
|
@ -217,7 +217,7 @@
|
|||
</#if>
|
||||
</#function>
|
||||
|
||||
<#function funStartDate item>
|
||||
<#function getStartDate item>
|
||||
<#if (item["./startDate"]?size > 0)>
|
||||
<#return item["./startDate"]>
|
||||
<#elseif (item["./nav:attribute[@name='startDate']"]?size > 0)>
|
||||
|
|
@ -225,7 +225,7 @@
|
|||
</#if>
|
||||
</#function>
|
||||
|
||||
<#function funStartDateYear item>
|
||||
<#function getStartDateYear item>
|
||||
<#if (item["./startDate"]?size > 0)>
|
||||
<#return item["./startDate/@year"]>
|
||||
<#elseif (item["./nav:attribute[@name='startDate']"]?size > 0)>
|
||||
|
|
@ -233,7 +233,7 @@
|
|||
</#if>
|
||||
</#function>
|
||||
|
||||
<#function funStartDateMonth item>
|
||||
<#function getStartDateMonth item>
|
||||
<#if (item["./startDate"]?size > 0)>
|
||||
<#return item["./startDate/@month"]>
|
||||
<#elseif (item["./nav:attribute[@name='startDate']"]?size > 0)>
|
||||
|
|
@ -241,7 +241,7 @@
|
|||
</#if>
|
||||
</#function>
|
||||
|
||||
<#function funStartDateDay item>
|
||||
<#function getStartDateDay item>
|
||||
<#if (item["./startDate"]?size > 0)>
|
||||
<#return item["./startDate/@day"]>
|
||||
<#elseif (item["./nav:attribute[@name='startDate']"]?size > 0)>
|
||||
|
|
@ -249,7 +249,7 @@
|
|||
</#if>
|
||||
</#function>
|
||||
|
||||
<#function funStartDateDayNameShort item>
|
||||
<#function getStartDateDayNameShort item>
|
||||
<#if (item["./startDate"]?size > 0)>
|
||||
<#return item["./startDate/@dayNameShort"]>
|
||||
<#elseif (item["./nav:attribute[@name='startDate']"]?size > 0)>
|
||||
|
|
@ -257,7 +257,7 @@
|
|||
</#if>
|
||||
</#function>
|
||||
|
||||
<#function funStartDateHour item>
|
||||
<#function getStartDateHour item>
|
||||
<#if (item["./startDate"]?size > 0)>
|
||||
<#return item["./startDate/@hour"]>
|
||||
<#elseif (item["./nav:attribute[@name='startDate']"]?size > 0)>
|
||||
|
|
@ -265,7 +265,7 @@
|
|||
</#if>
|
||||
</#function>
|
||||
|
||||
<#function funStartDateMinute item>
|
||||
<#function getStartDateMinute item>
|
||||
<#if (item["./startDate"]?size > 0)>
|
||||
<#return item["./startDate/@minute"]>
|
||||
<#elseif (item["./nav:attribute[@name='startDate']"]?size > 0)>
|
||||
|
|
@ -273,7 +273,7 @@
|
|||
</#if>
|
||||
</#function>
|
||||
|
||||
<#function funStartDateSecond item>
|
||||
<#function getStartDateSecond item>
|
||||
<#if (item["./startDate"]?size > 0)>
|
||||
<#return item["./startDate/@second"]>
|
||||
<#elseif (item["./nav:attribute[@name='startDate']"]?size > 0)>
|
||||
|
|
@ -25,7 +25,7 @@
|
|||
</#if>
|
||||
</#macro>
|
||||
|
||||
<#function funNewsDate item>
|
||||
<#function getNewsDate item>
|
||||
<#if (item["./newsDate"]?size > 0)>
|
||||
<#return item["./newsDate"].@@text />
|
||||
<#elseif (item["./nav:attribute[@name='newsDate']"]?size > 0)>
|
||||
|
|
@ -55,7 +55,7 @@
|
|||
</#if>
|
||||
</#macro>
|
||||
|
||||
<#function funNewsDateYear item>
|
||||
<#function getNewsDateYear item>
|
||||
<#if (item["./newsDate"]?size > 0)>
|
||||
<#return item["./newsDate/@year"]>
|
||||
<#elseif (item["./nav:attribute[@name='newsDate']"]?size > 0)>
|
||||
|
|
@ -74,7 +74,7 @@
|
|||
</#if>
|
||||
</#macro>
|
||||
|
||||
<#function funNewsDateMonth item>
|
||||
<#function getNewsDateMonth item>
|
||||
<#if (item["./newsDate"]?size > 0)>
|
||||
<#return item["./newsDate/@month"]>
|
||||
<#elseif (item["./nav:attribute[@name='newsDate']"]?size > 0)>
|
||||
|
|
@ -93,7 +93,7 @@
|
|||
</#if>
|
||||
</#macro>
|
||||
|
||||
<#function funNewsDateDay item>
|
||||
<#function getNewsDateDay item>
|
||||
<#if (item["./newsDate"]?size > 0)>
|
||||
<#return item["./newsDate/@day"]>
|
||||
<#elseif (item["./nav:attribute[@name='newsDate']"]?size > 0)>
|
||||
|
|
@ -113,7 +113,7 @@
|
|||
</#if>
|
||||
</#macro>
|
||||
|
||||
<#function funNewsDateDayNameShort item>
|
||||
<#function getNewsDateDayNameShort item>
|
||||
<#if (item["./newsDate"]?size > 0)>
|
||||
<#return item["./newsDate/@dayNameShort"]>
|
||||
<#elseif (item["./nav:attribute[@name='newsDate']"]?size > 0)>
|
||||
|
|
@ -6,7 +6,7 @@
|
|||
>
|
||||
|
||||
<#--
|
||||
Passed the content item provided by the model to the nested content if
|
||||
Passes the content item provided by the model to the nested content if
|
||||
the model provides a content item.
|
||||
-->
|
||||
<#macro contentPage>
|
||||
|
|
@ -6,39 +6,54 @@
|
|||
>
|
||||
|
||||
<#--
|
||||
Output all path tokens of the current category path. Provides the
|
||||
following parameters for nested content:
|
||||
|
||||
1: title
|
||||
2: url
|
||||
3: id
|
||||
|
||||
of the category.
|
||||
Get all categories from the category path.
|
||||
-->
|
||||
<#macro categoryPath>
|
||||
<#function getCategoryPath>
|
||||
<#return model["/bebop:page/nav:categoryPath/nav:category"]>
|
||||
</#function>
|
||||
|
||||
<#list model["/bebop:page/nav:categoryPath/nav:category"] as token>
|
||||
<#nested token["./@title"], token["./@url"], token["./@id"]>
|
||||
</#list>
|
||||
<#function isRootPage>
|
||||
<#return (model["/bebop:page/nav:categoryPath/nav:category"]?size <= 1)>
|
||||
</#function>
|
||||
|
||||
</#macro>
|
||||
<#function getSelectedCategory>
|
||||
<#return model["/bebop:page/nav:categoryPath/nav:category[last()]"]>
|
||||
</#function>
|
||||
|
||||
<#--
|
||||
Provides the following data about the current navigation instance to
|
||||
the nested content:
|
||||
|
||||
1. ID of the navigation menu from which the data was retrieved
|
||||
2. URL to the root of the navigation
|
||||
3. title of the navigation
|
||||
Get the title of the provided category.
|
||||
-->
|
||||
<#macro navigationRoot navId="categoryMenu">
|
||||
<#function getCategoryTitle category>
|
||||
<#return category["./@title"]>
|
||||
</#function>
|
||||
|
||||
<#assign url=model["/bebop:page/nav:categoryMenu[@id='${navId}']/nav:category/@url"]>
|
||||
<#assign title=model["/bebop:page/nav:categoryMenu[@id='categoryMenu']/nav:category/@title"]>
|
||||
<#--
|
||||
Get the URL of the provided category.
|
||||
-->
|
||||
<#function getCategoryUrl category>
|
||||
<#return category["./@url"]>
|
||||
</#function>
|
||||
|
||||
<#nested navId, url, title>
|
||||
<#--
|
||||
Get the ID get the provided category.
|
||||
-->
|
||||
<#function getCategoryId category>
|
||||
<#return category["./@id"]>
|
||||
</#function>
|
||||
|
||||
</#macro>
|
||||
<#--
|
||||
Get the URL of the root category of the navigation with the provided id.
|
||||
-->
|
||||
<#function getNavigationRootUrl navigationId="categoryMenu">
|
||||
<#return model["/bebop:page/nav:categoryMenu[@id='${navigationId}']/nav:category/@url"]>
|
||||
</#function>
|
||||
|
||||
<#--
|
||||
Get title of the navigation with the provided id.
|
||||
-->
|
||||
<#function getNavigationTitle navigationId="categoryMenu">
|
||||
<#return model["/bebop:page/nav:categoryMenu[@id='${navigationId}']/nav:category/@title"]>
|
||||
</#function>
|
||||
|
||||
<#--
|
||||
Checks if the a categoryMenu is available in the model and shows the
|
||||
|
|
@ -66,6 +81,22 @@
|
|||
|
||||
</#macro>
|
||||
|
||||
<#--
|
||||
Retrieves the first level of categories from the category menu with the provided ID.
|
||||
If no id is provided "categoryMenu" is used.
|
||||
-->
|
||||
<#function getCategoryMenu menuId="categoryMenu">
|
||||
<#return model["/bebop:page/nav:categoryMenu[@id='${menuId}']/nav:category/nav:category"]>
|
||||
</#function>
|
||||
|
||||
<#--
|
||||
Retrieves the first level of categories from the category hierachy with the provided ID.
|
||||
If no id is provided 'categoryNav' is used.
|
||||
-->
|
||||
<#function getCategoryHierarchy hierarchyId="categoryNav">
|
||||
<#return model["/bebop:page/nav:categoryHierarchy[@id='${hierarchyId}']/nav:category"]>
|
||||
</#function>
|
||||
|
||||
<#--
|
||||
Checks if an categoryHierachy is avialable in the model and shows the
|
||||
nested content if one is avialable. The optional parameter hierarchyId
|
||||
|
|
@ -118,6 +149,13 @@
|
|||
|
||||
</#macro>
|
||||
|
||||
<#--
|
||||
Gets the subcategories of the provided category.
|
||||
-->
|
||||
<#function getSubCategories ofCategory>
|
||||
<#return ofCategory["./nav:category"]>
|
||||
</#function>
|
||||
|
||||
<#--
|
||||
Passed the GreetingItem provided by the model to the nested content if their is an GreetingItem.
|
||||
-->
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
<#ftl ns_prefixes={
|
||||
"bebop":"http://www.arsdigita.com/bebop/1.0",
|
||||
"cms":"http://www.arsdigita.com/cms/1.0",
|
||||
"nav":"http://ccm.redhat.com/navigation",
|
||||
"ui": "http://www.arsdigita.com/ui/1.0"}
|
||||
>
|
||||
|
||||
<#function getAvailableLanguages>
|
||||
<#if (model["/bebop:page/cms:contentPanel"]?size > 0)>
|
||||
<#return model["/bebop:page/cms:contentPanel/availableLanguages/language/@locale"]>
|
||||
<#elseif (model["/bebop:page/nav:greetingItem"]?size > 0)>
|
||||
<#return model["/bebop:page/nav:greetingItem/availableLanguages/language/@locale"]>
|
||||
<#else>
|
||||
<#return model["/bebop:page/ui:siteBanner/supportedLanguages/language/@locale"]>
|
||||
</#if>
|
||||
</#function>
|
||||
|
||||
|
|
@ -5,11 +5,23 @@
|
|||
"ui": "http://www.arsdigita.com/ui/1.0"}
|
||||
>
|
||||
|
||||
<#-- Move to Navigation tags? -->
|
||||
<#-- Move to Navigation macros/functions? -->
|
||||
<#macro pageTitle>
|
||||
${model["//nav:categoryMenu/nav:category/@title"]}
|
||||
</#macro>
|
||||
|
||||
<#function getPageTitle>
|
||||
<#return model["//nav:categoryMenu/nav:category/@title"]>
|
||||
</#function>
|
||||
|
||||
<#function getSiteHostName>
|
||||
<#return model["/bebop:page/ui:siteBanner/@hostname"]>
|
||||
</#function>
|
||||
|
||||
<#function getSiteName>
|
||||
<#return model["/bebop:page/ui:siteBanner/@sitename"]>
|
||||
</#function>
|
||||
|
||||
<#function getBooleanAttrValue fromNode attrName>
|
||||
<#assign path='@' + attrName>
|
||||
<#if (fromNode[path]?size > 0)>
|
||||
|
|
@ -1,23 +0,0 @@
|
|||
<#ftl ns_prefixes={
|
||||
"bebop":"http://www.arsdigita.com/bebop/1.0",
|
||||
"cms":"http://www.arsdigita.com/cms/1.0",
|
||||
"nav":"http://ccm.redhat.com/navigation",
|
||||
"ui": "http://www.arsdigita.com/ui/1.0"}
|
||||
>
|
||||
|
||||
<#macro availableLanguages>
|
||||
|
||||
<#assign langs=["empty"]>
|
||||
<#if (model["/bebop:page/cms:contentPanel"]?size > 0)>
|
||||
<#assign langs=model["/bebop:page/cms:contentPanel/availableLanguages/language/@locale"]>
|
||||
<#elseif (model["/bebop:page/nav:greetingItem"]?size > 0)>
|
||||
<#assign langs=model["/bebop:page/nav:greetingItem/availableLanguages/language/@locale"]>
|
||||
<#else>
|
||||
<#assign langs=model["/bebop:page/ui:siteBanner/supportedLanguages/language/@locale"]>
|
||||
</#if>
|
||||
|
||||
<#list langs?sort as lang>
|
||||
<#nested lang, lang==negotiatedLanguage>
|
||||
</#list>
|
||||
|
||||
</#macro>
|
||||
Loading…
Reference in New Issue