From 34b29a1dd7791e3b4eec3eef3551f39dccc04601 Mon Sep 17 00:00:00 2001 From: Jens Pelzetter Date: Sat, 21 Dec 2019 19:52:19 +0100 Subject: [PATCH] Preliminary migration of various FTL function libs --- .../freemarker/ccm-cms-types-article.ftl | 40 ++ .../themes/freemarker/ccm-cms-types-event.ftl | 342 ++++++++++++++++++ .../ccm-cms-types-multiparticle-toc.ftl | 53 +++ .../ccm-cms-types-multiparticle.ftl | 151 ++++++++ .../freemarker/ccm-cms/article-item.ftl | 36 ++ .../freemarker/ccm-cms/bookmark-item.ftl | 26 ++ .../ccm-cms/ccm-cms-types-bookmark.ftl | 35 ++ .../themes/freemarker/ccm-cms/event-item.ftl | 340 +++++++++++++++++ .../ccm-cms/multiparticle-item-toc.ftl | 49 +++ .../freemarker/ccm-cms/multiparticle-item.ftl | 147 ++++++++ 10 files changed, 1219 insertions(+) create mode 100644 ccm-cms/src/main/resources/themes/freemarker/ccm-cms-types-article.ftl create mode 100644 ccm-cms/src/main/resources/themes/freemarker/ccm-cms-types-event.ftl create mode 100644 ccm-cms/src/main/resources/themes/freemarker/ccm-cms-types-multiparticle-toc.ftl create mode 100644 ccm-cms/src/main/resources/themes/freemarker/ccm-cms-types-multiparticle.ftl create mode 100644 ccm-cms/src/main/resources/themes/freemarker/ccm-cms/article-item.ftl create mode 100644 ccm-cms/src/main/resources/themes/freemarker/ccm-cms/bookmark-item.ftl create mode 100644 ccm-cms/src/main/resources/themes/freemarker/ccm-cms/ccm-cms-types-bookmark.ftl create mode 100644 ccm-cms/src/main/resources/themes/freemarker/ccm-cms/event-item.ftl create mode 100644 ccm-cms/src/main/resources/themes/freemarker/ccm-cms/multiparticle-item-toc.ftl create mode 100644 ccm-cms/src/main/resources/themes/freemarker/ccm-cms/multiparticle-item.ftl diff --git a/ccm-cms/src/main/resources/themes/freemarker/ccm-cms-types-article.ftl b/ccm-cms/src/main/resources/themes/freemarker/ccm-cms-types-article.ftl new file mode 100644 index 000000000..680cef22d --- /dev/null +++ b/ccm-cms/src/main/resources/themes/freemarker/ccm-cms-types-article.ftl @@ -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)> + + +<#--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)> + + +<#--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)> + \ No newline at end of file diff --git a/ccm-cms/src/main/resources/themes/freemarker/ccm-cms-types-event.ftl b/ccm-cms/src/main/resources/themes/freemarker/ccm-cms-types-event.ftl new file mode 100644 index 000000000..2d5d66d37 --- /dev/null +++ b/ccm-cms/src/main/resources/themes/freemarker/ccm-cms-types-event.ftl @@ -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)> + + +<#--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)> + + +<#--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)> + + +<#--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)> + + +<#--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)> + + +<#--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)> + + +<#--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)> + + +<#--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)> + + +<#--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)> + + +<#--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)> + + +<#--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)> + + +<#--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)> + + +<#--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)> + + +<#--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)> + + +<#--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)> + + +<#--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)> + + +<#--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)> + + +<#--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)> + + +<#--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)> + + +<#--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)> + + +<#--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)> + + +<#--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)> + + +<#--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)> + + +<#--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)> + + +<#--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)> + + +<#--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)> + + +<#--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)> + + +<#--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)> + + +<#--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)> + + +<#--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)> + + + + + diff --git a/ccm-cms/src/main/resources/themes/freemarker/ccm-cms-types-multiparticle-toc.ftl b/ccm-cms/src/main/resources/themes/freemarker/ccm-cms-types-multiparticle-toc.ftl new file mode 100644 index 000000000..4a2f0cd75 --- /dev/null +++ b/ccm-cms/src/main/resources/themes/freemarker/ccm-cms-types-multiparticle-toc.ftl @@ -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)> + + +<#--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)> + + +<#--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)> + + +<#--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)> + \ No newline at end of file diff --git a/ccm-cms/src/main/resources/themes/freemarker/ccm-cms-types-multiparticle.ftl b/ccm-cms/src/main/resources/themes/freemarker/ccm-cms-types-multiparticle.ftl new file mode 100644 index 000000000..e9d15f028 --- /dev/null +++ b/ccm-cms/src/main/resources/themes/freemarker/ccm-cms-types-multiparticle.ftl @@ -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)> + + +<#--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)> + + +<#--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)> + + +<#--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)> + + +<#--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)> + + +<#--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)> + + +<#--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)> + + +<#--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)> + + +<#--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)> + + +<#--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)> + + +<#--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)> + + +<#--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)> + + +<#--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)> + + diff --git a/ccm-cms/src/main/resources/themes/freemarker/ccm-cms/article-item.ftl b/ccm-cms/src/main/resources/themes/freemarker/ccm-cms/article-item.ftl new file mode 100644 index 000000000..52b968d7f --- /dev/null +++ b/ccm-cms/src/main/resources/themes/freemarker/ccm-cms/article-item.ftl @@ -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> + + +<#--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)> + + +<#--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> + \ No newline at end of file diff --git a/ccm-cms/src/main/resources/themes/freemarker/ccm-cms/bookmark-item.ftl b/ccm-cms/src/main/resources/themes/freemarker/ccm-cms/bookmark-item.ftl new file mode 100644 index 000000000..4ba695f67 --- /dev/null +++ b/ccm-cms/src/main/resources/themes/freemarker/ccm-cms/bookmark-item.ftl @@ -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> + + +<#--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> + + diff --git a/ccm-cms/src/main/resources/themes/freemarker/ccm-cms/ccm-cms-types-bookmark.ftl b/ccm-cms/src/main/resources/themes/freemarker/ccm-cms/ccm-cms-types-bookmark.ftl new file mode 100644 index 000000000..0ecb724d5 --- /dev/null +++ b/ccm-cms/src/main/resources/themes/freemarker/ccm-cms/ccm-cms-types-bookmark.ftl @@ -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)> + + +<#--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)> + + + diff --git a/ccm-cms/src/main/resources/themes/freemarker/ccm-cms/event-item.ftl b/ccm-cms/src/main/resources/themes/freemarker/ccm-cms/event-item.ftl new file mode 100644 index 000000000..26ffa13a5 --- /dev/null +++ b/ccm-cms/src/main/resources/themes/freemarker/ccm-cms/event-item.ftl @@ -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)> + + +<#--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)> + + +<#--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> + + +<#--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> + + +<#--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> + + +<#--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> + + +<#--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> + + +<#--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> + + +<#--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> + + +<#--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> + + +<#--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> + + +<#--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> + + +<#--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> + + +<#--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> + + +<#--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> + + +<#--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> + + +<#--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> + + +<#--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??> + + +<#--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??> + + +<#--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??> + + +<#--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??> + + +<#--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> + + +<#--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> + + +<#--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> + + +<#--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> + + +<#--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> + + +<#--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> + + +<#--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]> + + +<#--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> + + +<#--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> + + + + + diff --git a/ccm-cms/src/main/resources/themes/freemarker/ccm-cms/multiparticle-item-toc.ftl b/ccm-cms/src/main/resources/themes/freemarker/ccm-cms/multiparticle-item-toc.ftl new file mode 100644 index 000000000..eb9280f3f --- /dev/null +++ b/ccm-cms/src/main/resources/themes/freemarker/ccm-cms/multiparticle-item-toc.ftl @@ -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"]> + + +<#--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> + + +<#--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> + + +<#--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> + diff --git a/ccm-cms/src/main/resources/themes/freemarker/ccm-cms/multiparticle-item.ftl b/ccm-cms/src/main/resources/themes/freemarker/ccm-cms/multiparticle-item.ftl new file mode 100644 index 000000000..726de9aad --- /dev/null +++ b/ccm-cms/src/main/resources/themes/freemarker/ccm-cms/multiparticle-item.ftl @@ -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> + + +<#--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> + + +<#--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> + + +<#--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> + + +<#--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> + + +<#--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> + + +<#--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> + + +<#--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)> + + +<#--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)> + + +<#--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"> + + +<#--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}"> + + +<#--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}"> + + +<#--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"> + +