Preliminary migration of various FTL function libs

Jens Pelzetter 2019-12-21 19:52:19 +01:00
parent 4aca200ec9
commit 34b29a1dd7
10 changed files with 1219 additions and 0 deletions

View File

@ -0,0 +1,40 @@
<#--filedoc
Functions for processing article items.
@depcrecated Use ccm-cms/article-item.ftl instea
-->
<#import "/ccm-cms/article-item.ftl" as Article>
<#--doc
Gets the lead text of the provided article.
@param item The article item to use.
@return The lead text of the article.
-->
<#function getLead item>
<#return Article.getLead(item)>
</#function>
<#--doc
Checks if the provided item has a lead property.
@param item The article item to use.
@return `true` If the provided article has a lead text, `false` otherwise.
-->
<#function hasLead item>
<#return Article.hasLead(item)>
</#function>
<#--doc
Gets the main text the the provided article.
@param item The article item to use.
@return The main text of the article.
-->
<#function getMainText item>
<#return Article.getMainText(item)>
</#function>

View File

@ -0,0 +1,342 @@
<#--filedoc
Functions for processing Event items.
@depcrecated Use ccm-cms/event-item.ftl
-->
<#import "/ccm-cms/event-item.ftl" as Event>
<#--doc
Gets the lead text of an event item
@param item The event item to use.
@return The lead text of the event item.
-->
<#function getLead item>
<#return Event.getLead(item)>
</#function>
<#--doc
Gets the main text of an event item
@param item The event item to use.
@return The main of the event item.
-->
<#function getMainText item>
<#return Event.getMainText(item)>
</#function>
<#--doc
Gets the end date of an event item
@param item The news event to use.
@return The date of the event item.
-->
<#function getEndDate item>
<#return Event.getEndDate(item)>
</#function>
<#--doc
Gets the year of the end date of the event.
@param item The event item to use.
@return The year of the end date of the event.
-->
<#function getEndDateYear item>
<#return Event.getEndDateYear(item)>
</#function>
<#--doc
Gets the month of the end date of the event.
@param item The event item to use.
@return The month of the end date of the event.
-->
<#function getEndDateMonth item>
<#return Event.getEndDateMonth(item)>
</#function>
<#--doc
Gets the day of the end date of the event.
@param item The event item to use.
@return The day of the end date of the event.
-->
<#function getEndDateDay item>
<#return Event.getEndDateDay(item)>
</#function>
<#--doc
Gets the short name of the day of the end date of the event.
@param item The event item to use.
@return The short name of the day of the end date of the event.
-->
<#function getEndDateDayNameShort item>
<#return Event.getEndDateDayNameShort(item)>
</#function>
<#--doc
Gets the end time of the event.
@param item The event item to use.
@return The end time of the event.
-->
<#function getEndTime item>
<#return Event.getEndTime(item)>
</#function>
<#--doc
Gets the hour of the end time of the event.
@param item The event item to use.
@return The hour of the end time of the event.
-->
<#function getEndTimeHour item>
<#return Event.getEndTimeHour(item)>
</#function>
<#--doc
Gets the minute of the end time of the event.
@param item The event item to use.
@return The minute of the end time of the event.
-->
<#function getEndTimeMinute item>
<#return Event.getEndTimeMinute(item)>
</#function>
<#--doc
Gets the second of the end time of the event.
@param item The event item to use.
@return The second of the end time of the event.
-->
<#function getEndTimeSecond item>
<#return Event.getEndTimeSecond(item)>
</#function>
<#--doc
Gets the start date of an event item
@param item The news event to use.
@return The start of the event item.
-->
<#function getStartDate item>
<#return Event.getStartDate(item)>
</#function>
<#--doc
Gets the year of the start date of the event.
@param item The event item to use.
@return The year of the start date of the event.
-->
<#function getStartDateYear item>
<#return Event.getStartDateYear(item)>
</#function>
<#--doc
Gets the month of the start date of the event.
@param item The event item to use.
@return The month of the start date of the event.
-->
<#function getStartDateMonth item>
<#return Event.getStartDateMonth(item)>
</#function>
<#--doc
Gets the day of the start date of the event.
@param item The event item to use.
@return The day of the start date of the event.
-->
<#function getStartDateDay item>
<#return Event.getStartDateDay(item)>
</#function>
<#--doc
Gets the short name of the day of the start date of the event.
@param item The event item to use.
@return The short name of the day of the start date of the event.
-->
<#function getStartDateDayNameShort item>
<#return Event.getStartDateDayNameShort(item)>
</#function>
<#--doc
Gets the start time of the event.
@param item The event item to use.
@return The start time of the event.
-->
<#function getStartTime item>
<#return Event.getStartTime(item)>
</#function>
<#--doc
Determines if the provided event item has a start time
@param item The event item to use.
@return `true` if the provided event item has a start time, `false` otherwise.
-->
<#function hasStartTime item>
<#return Event.hasStartTime(item)>
</#function>
<#--doc
Determines if the provided event item has a end time
@param item The event item to use.
@return `true` if the provided event item has a end time, `false` otherwise.
-->
<#function hasEndTime item>
<#return Event.getEndTime(item)>
</#function>
<#--doc
Determines if the provided event item has a start date.
@param item The event item to use.
@return `true` if the provided event item has a start date, `false` otherwise.
-->
<#function hasStartDate item>
<#return Event.hasStartDate(item)>
</#function>
<#--doc
Determines if the provided event item has a end date.
@param item The event item to use.
@return `true` if the provided event item has a end date, `false` otherwise.
-->
<#function hasEndDate item>
<#return Event.getEndDate(item)>
</#function>
<#--doc
Gets the hour of the start time of the event.
@param item The event item to use.
@return The hour of the start time of the event.
-->
<#function getstartTimeHour item>
<#return Event.getstartTimeHour(item)>
</#function>
<#--doc
Gets the minute of the start time of the event.
@param item The event item to use.
@return The minute of the start time of the event.
-->
<#function getstartTimeMinute item>
<#return Event.getstartTimeMinute(item)>
</#function>
<#--doc
Gets the second of the start time of the event.
@param item The event item to use.
@return The second of the start time of the event.
-->
<#function getstartTimeSecond item>
<#return Event.getstartTimeSecond(item)>
</#function>
<#--doc
Gets the location of the event.
@param item The event item to use.
@return The value of the `location` property of the event.
-->
<#function getLocation(item)>
<#return Event.getLocation(item)>
</#function>
<#--doc
Gets the main contributor of the event.
@param item The event item to use.
@return The value of the `mainContributor` property of the event.
-->
<#function getMainContributor item>
<#return Event.getMainContributor(item)>
</#function>
<#--doc
Gets the type of the event.
@param item The event item to use.
@return The value of the `eventType` property of the event.
-->
<#function getEventType item>
<#return Event.getEventType(item)>
</#function>
<#--doc
Gets the cost of the event.
@param item The event item to use.
@return The value of the `cost` property of the event.
-->
<#function getCost item>
<#return Event.getCost(item)>
</#function>
<#--doc
Gets the map link for the event.
@param item The event item to use.
@return The value of the `mapLink` property of the event.
-->
<#function getMapLink item>
<#return Event.getMapLink(item)>
</#function>
<#--doc
Gets the addendium of the event.
@param item The event item to use.
@return The value of the `eventDate` property of the event.
-->
<#function getEventDateAddendum item>
<#return Event.getEventDateAddendum(item)>
</#function>

View File

@ -0,0 +1,53 @@
<#--filedoc
Functions for creating the table of contents of a multi part article.
@depcrecated Use ccm-cms/multiparticle-item-toc.ftl
-->
<#import "/ccm-cms/multiparticle-item-toc.ftl" as Toc>
<#--doc
Gets the sections of a multi part article.
@param item The model of the multi part article to use.
@return The sections of the multi part article.
-->
<#function getSections item>
<#return Toc.getSections(item)>
</#function>
<#--doc
Gets the title of a section.
@param section The model of the section as returned by `getSections`.
@return The title of the section.
-->
<#function getSectionTitle section>
<#return Toc.getSectionTitle(section)>
</#function>
<#--doc
Gets the link for the section.
@param section The model of the section as returned by `getSections`.
@return The link for the section.
-->
<#function getSectionLink section>
<#return Toc.getSectionLink(section)>
</#function>
<#--doc
Determines of the provided section is the active section.
@param item The model of the multi part article to use.
@param section The model of the section as returned by `getSections`.
@return `true` if the provided section is the active section, `false` otherwise.
-->
<#function isActiveSection item section>
<#return Toc.getActiveSection(item, section)>
</#function>

View File

@ -0,0 +1,151 @@
<#--filedoc
Functions for processing MultiPartArticles.
@depcrecated Use ccm-cms/multiparticle-item.ftl
-->
<#import "/ccm-cms/multiparticle-item.ftl" as Mpa>
<#--doc
Get the summary of a multi part article.
@param item The model of the multi part article to use.
@return The summary of the multi part article.
-->
<#function getSummary item>
<#return Map.getSummary(item)>
</#function>
<#--doc
Get the visible sections of a multi part article.
@param item The model of the multi part article to use.
@return The visible sections of the multi part article.
-->
<#function getSections item>
<#return Map.getSections(item)>
</#function>
<#--doc
Gets the title of a section.
@param section The model of the section to use, as returned by `getSections`.
@return The title of the section.
-->
<#function getSectionTitle section>
<#return Map.getSectionTitle(section)>
</#function>
<#--doc
Gets the content of a section.
@param section The model of the section to use, as returned by `getSections`.
@return The content of the section.
-->
<#function getSectionContent section>
<#return Map.getSectionContent(section)>
</#function>
<#--doc
Gets the rank (sort key) of a section.
@param section The model of the section to use, as returned by `getSections`.
@return The rank of the section.
-->
<#function getSectionRank section>
<#return Map.getSectionRank(section)>
</#function>
<#--doc
Gets the number of the current page.
@param item The model of the multi part article to use.
@return The number of the current page.
-->
<#function getPageNumber item>
<#return Map.getPageNumber(item)>
</#function>
<#--doc
Gets the number of the pages.
@param item The model of the multi part article to use.
@return The number of the pages.
-->
<#function getNumberOfPages item>
<#return Map.getNumberOfPages(item)>
</#function>
<#--doc
Determines if a link to the previous page is available.
@param item The model of the multi part article to use.
@return `true` if the link is available, `false` otherwise.
-->
<#function hasPreviousPage item>
<#return Mpa.hasPreviousPage(item)>
</#function>
<#--doc
Determines if a link to the next page is available.
@param item The model of the multi part article to use.
@return `true` if the link is available, `false` otherwise.
-->
<#function hasNextPage item>
<#return Map.hasNextPage(item)>
</#function>
<#--doc
Determines of the multi part article has multiple pages.
@param item The model of the multi part article to use.
@return `true` if the article has multiple pages, `false` otherwise.
-->
<#function hasMultiplePages item>
<#return Map.hasMultiplePages(item)>
</#function>
<#--doc
Gets the link to the previous page.
@param item The model of the multi part article to use.
@return The link to the previous page.
-->
<#function getLinkToPreviousPage item>
<#return Map.getLinkToPreviousPage(item)>
</#function>
<#--doc
Gets the link to the next page.
@param item The model of the multi part article to use.
@return The link to the next page.
-->
<#function getLinkToNextPage item>
<#return Map.getLinkToNextPage(item)>
</#function>
<#--doc
Gets the link for showing all sections on one page..
@param item The model of the multi part article to use.
@return The link for showing all sections on one page.
-->
<#function getAllSectionsLink item>
<#return Map.getAllSectionsLink(item)>
</#function>

View File

@ -0,0 +1,36 @@
<#--filedoc
Functions for processing article items.
-->
<#--doc
Gets the lead text of the provided article.
@param item The article item to use.
@return The lead text of the article.
-->
<#function getLead item>
<#return item.lead>
</#function>
<#--doc
Checks if the provided item has a lead property.
@param item The article item to use.
@return `true` If the provided article has a lead text, `false` otherwise.
-->
<#function hasLead item>
<#return (getLead(item)?length > 0)>
</#function>
<#--doc
Gets the main text the the provided article.
@param item The article item to use.
@return The main text of the article.
-->
<#function getMainText item>
<#return item.text>
</#function>

View File

@ -0,0 +1,26 @@
<#--filedoc
Functions for Bookmark items.
-->
<#--doc
Gets the description of a bookmark.
@param item The bookmark item to use.
@return The description of the provided bookmark.
-->
<#function getDescription item>
<#return item.description>
</#function>
<#--doc
Gets the link of a bookmark.
@param item The bookmark item to use.
@return The link of the provided bookmark.
-->
<#function getLink item>
<#return item.link>
</#function>

View File

@ -0,0 +1,35 @@
<#--filedoc
Functions for Bookmark items.
-->
<#--filedoc
Functions for Bookmark items.
@depcrecated Use ccm-cms/bookmark-item.ftl
-->
<#import "ccm-cms/bookmark-item.ftl" as Bookmark>
<#--doc
Gets the description of a bookmark.
@param item The bookmark item to use.
@return The description of the provided bookmark.
-->
<#function getDescription item>
<#return Bookmark.getDescription(item)>
</#function>
<#--doc
Gets the link of a bookmark.
@param item The bookmark item to use.
@return The link of the provided bookmark.
-->
<#function getLink item>
<#return Bookmark.getLink(item)>
</#function>

View File

@ -0,0 +1,340 @@
<#import "./article-item.ftl" as Article>
<#--filedoc
Functions for processing Event items.
-->
<#--doc
Gets the lead text of an event item
@param item The event item to use.
@return The lead text of the event item.
-->
<#function getLead item>
<#return Article.getLead(item)>
</#function>
<#--doc
Gets the main text of an event item
@param item The event item to use.
@return The main of the event item.
-->
<#function getMainText item>
<#return Article.getMainText(item)>
</#function>
<#--doc
Gets the end date of an event item
@param item The news event to use.
@return The date of the event item.
-->
<#function getEndDate item>
<#return item.endDate>
</#function>
<#--doc
Gets the year of the end date of the event.
@param item The event item to use.
@return The year of the end date of the event.
-->
<#function getEndDateYear item>
<#return item.endDate.year>
</#function>
<#--doc
Gets the month of the end date of the event.
@param item The event item to use.
@return The month of the end date of the event.
-->
<#function getEndDateMonth item>
<#return item.endDate.month>
</#function>
<#--doc
Gets the day of the end date of the event.
@param item The event item to use.
@return The day of the end date of the event.
-->
<#function getEndDateDay item>
<#return item.endDate.day>
</#function>
<#--doc
Gets the short name of the day of the end date of the event.
@param item The event item to use.
@return The short name of the day of the end date of the event.
-->
<#function getEndDateDayNameShort item>
<#return item.endDate.day>
</#function>
<#--doc
Gets the end time of the event.
@param item The event item to use.
@return The end time of the event.
-->
<#function getEndTime item>
<#return item.endTime>
</#function>
<#--doc
Gets the hour of the end time of the event.
@param item The event item to use.
@return The hour of the end time of the event.
-->
<#function getEndTimeHour item>
<#return item.endTime.hour>
</#function>
<#--doc
Gets the minute of the end time of the event.
@param item The event item to use.
@return The minute of the end time of the event.
-->
<#function getEndTimeMinute item>
<#return item.endTime.minute>
</#function>
<#--doc
Gets the second of the end time of the event.
@param item The event item to use.
@return The second of the end time of the event.
-->
<#function getEndTimeSecond item>
<#return item.endTime.second>
</#function>
<#--doc
Gets the start date of an event item
@param item The news event to use.
@return The start of the event item.
-->
<#function getStartDate item>
<#return item.startDate>
</#function>
<#--doc
Gets the year of the start date of the event.
@param item The event item to use.
@return The year of the start date of the event.
-->
<#function getStartDateYear item>
<#return item.startDate.year>
</#function>
<#--doc
Gets the month of the start date of the event.
@param item The event item to use.
@return The month of the start date of the event.
-->
<#function getStartDateMonth item>
<#return item.startDate.minute>
</#function>
<#--doc
Gets the day of the start date of the event.
@param item The event item to use.
@return The day of the start date of the event.
-->
<#function getStartDateDay item>
<#return item.startDate.day>
</#function>
<#--doc
Gets the short name of the day of the start date of the event.
@param item The event item to use.
@return The short name of the day of the start date of the event.
-->
<#function getStartDateDayNameShort item>
<#return item.startDate.day>
</#function>
<#--doc
Gets the start time of the event.
@param item The event item to use.
@return The start time of the event.
-->
<#function getStartTime item>
<#return item.startTime>
</#function>
<#--doc
Determines if the provided event item has a start time
@param item The event item to use.
@return `true` if the provided event item has a start time, `false` otherwise.
-->
<#function hasStartTime item>
<#return item.startTime??>
</#function>
<#--doc
Determines if the provided event item has a end time
@param item The event item to use.
@return `true` if the provided event item has a end time, `false` otherwise.
-->
<#function hasEndTime item>
<#return item.endTime??>
</#function>
<#--doc
Determines if the provided event item has a start date.
@param item The event item to use.
@return `true` if the provided event item has a start date, `false` otherwise.
-->
<#function hasStartDate item>
<#return item.startDate??>
</#function>
<#--doc
Determines if the provided event item has a end date.
@param item The event item to use.
@return `true` if the provided event item has a end date, `false` otherwise.
-->
<#function hasEndDate item>
<#return item.endDate??>
</#function>
<#--doc
Gets the hour of the start time of the event.
@param item The event item to use.
@return The hour of the start time of the event.
-->
<#function getstartTimeHour item>
<#return item.startTime.hour>
</#function>
<#--doc
Gets the minute of the start time of the event.
@param item The event item to use.
@return The minute of the start time of the event.
-->
<#function getstartTimeMinute item>
<#return item.startTime.minute>
</#function>
<#--doc
Gets the second of the start time of the event.
@param item The event item to use.
@return The second of the start time of the event.
-->
<#function getstartTimeSecond item>
<#return item.startTime.second>
</#function>
<#--doc
Gets the location of the event.
@param item The event item to use.
@return The value of the `location` property of the event.
-->
<#function getLocation(item)>
<#return item.location>
</#function>
<#--doc
Gets the main contributor of the event.
@param item The event item to use.
@return The value of the `mainContributor` property of the event.
-->
<#function getMainContributor item>
<#return item.mainContributor>
</#function>
<#--doc
Gets the type of the event.
@param item The event item to use.
@return The value of the `eventType` property of the event.
-->
<#function getEventType item>
<#return item.eventType>
</#function>
<#--doc
Gets the cost of the event.
@param item The event item to use.
@return The value of the `cost` property of the event.
-->
<#function getCost item>
<#return item.cost]>
</#function>
<#--doc
Gets the map link for the event.
@param item The event item to use.
@return The value of the `mapLink` property of the event.
-->
<#function getMapLink item>
<#return item.mapLink>
</#function>
<#--doc
Gets the addendium of the event.
@param item The event item to use.
@return The value of the `eventDate` property of the event.
-->
<#function getEventDateAddendum item>
<#return item.eventDate>
</#function>

View File

@ -0,0 +1,49 @@
<#--filedoc
Functions for creating the table of contents of a multi part article.
-->
<#--doc
Gets the sections of a multi part article.
@param item The model of the multi part article to use.
@return The sections of the multi part article.
-->
<#function getSections item>
<#return item.toc.sections"]>
</#function>
<#--doc
Gets the title of a section.
@param section The model of the section as returned by `getSections`.
@return The title of the section.
-->
<#function getSectionTitle section>
<#return section.title>
</#function>
<#--doc
Gets the link for the section.
@param section The model of the section as returned by `getSections`.
@return The link for the section.
-->
<#function getSectionLink section>
<#return section.link>
</#function>
<#--doc
Determines of the provided section is the active section.
@param item The model of the multi part article to use.
@param section The model of the section as returned by `getSections`.
@return `true` if the provided section is the active section, `false` otherwise.
-->
<#function isActiveSection item section>
<#return section.rank == item.rank>
</#function>

View File

@ -0,0 +1,147 @@
<#--filedoc
Functions for processing MultiPartArticles.
-->
<#--doc
Get the summary of a multi part article.
@param item The model of the multi part article to use.
@return The summary of the multi part article.
-->
<#function getSummary item>
<#return item.summary>
</#function>
<#--doc
Get the visible sections of a multi part article.
@param item The model of the multi part article to use.
@return The visible sections of the multi part article.
-->
<#function getSections item>
<#return item.sections>
</#function>
<#--doc
Gets the title of a section.
@param section The model of the section to use, as returned by `getSections`.
@return The title of the section.
-->
<#function getSectionTitle section>
<#return section.title>
</#function>
<#--doc
Gets the content of a section.
@param section The model of the section to use, as returned by `getSections`.
@return The content of the section.
-->
<#function getSectionContent section>
<#return section.text>
</#function>
<#--doc
Gets the rank (sort key) of a section.
@param section The model of the section to use, as returned by `getSections`.
@return The rank of the section.
-->
<#function getSectionRank section>
<#return section.rank>
</#function>
<#--doc
Gets the number of the current page.
@param item The model of the multi part article to use.
@return The number of the current page.
-->
<#function getPageNumber item>
<#return item.pageNumber>
</#function>
<#--doc
Gets the number of the pages.
@param item The model of the multi part article to use.
@return The number of the pages.
-->
<#function getNumberOfPages item>
<#return item.numberOfPages>
</#function>
<#--doc
Determines if a link to the previous page is available.
@param item The model of the multi part article to use.
@return `true` if the link is available, `false` otherwise.
-->
<#function hasPreviousPage item>
<#return (item.pageNumber != "all" && item.numberOfPages > 1)>
</#function>
<#--doc
Determines if a link to the next page is available.
@param item The model of the multi part article to use.
@return `true` if the link is available, `false` otherwise.
-->
<#function hasNextPage item>
<#return (item.pageNumber != "all" && item.pageNumber < itemnumberOfPages)>
</#function>
<#--doc
Determines of the multi part article has multiple pages.
@param item The model of the multi part article to use.
@return `true` if the article has multiple pages, `false` otherwise.
-->
<#function hasMultiplePages item>
<#return item.pageNumber != "all" && item.pageNumber != "1">
</#function>
<#--doc
Gets the link to the previous page.
@param item The model of the multi part article to use.
@return The link to the previous page.
-->
<#function getLinkToPreviousPage item>
<#return "?page${item.pageNumber - 1}">
</#function>
<#--doc
Gets the link to the next page.
@param item The model of the multi part article to use.
@return The link to the next page.
-->
<#function getLinkToNextPage item>
<#return "?page${item.pageNumber + 1}">
</#function>
<#--doc
Gets the link for showing all sections on one page..
@param item The model of the multi part article to use.
@return The link for showing all sections on one page.
-->
<#function getAllSectionsLink item>
<#return "?page=all">
</#function>