Documentation for the FTL libs provided by ccm-cms-types-multiparticle

git-svn-id: https://svn.libreccm.org/ccm/trunk@6303 8810af33-2d31-482b-a856-94f89814c4df
master
jensp 2019-11-03 12:58:56 +00:00
parent 698604870a
commit 4fecc3fbb5
2 changed files with 129 additions and 0 deletions

View File

@ -5,18 +5,52 @@
"ui": "http://www.arsdigita.com/ui/1.0"} "ui": "http://www.arsdigita.com/ui/1.0"}
> >
<#--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> <#function getSections item>
<#return item["./cms:articleSectionPanel/toc/section"]> <#return item["./cms:articleSectionPanel/toc/section"]>
</#function> </#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> <#function getSectionTitle section>
<#return section> <#return section>
</#function> </#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> <#function getSectionLink section>
<#return section["./@link"]> <#return section["./@link"]>
</#function> </#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> <#function isActiveSection item section>
<#return (section["./@rank"].@@text == item["./rank"].@@text)> <#return (section["./@rank"].@@text == item["./rank"].@@text)>
</#function> </#function>

View File

@ -5,6 +5,17 @@
"ui": "http://www.arsdigita.com/ui/1.0"} "ui": "http://www.arsdigita.com/ui/1.0"}
> >
<#--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> <#function getSummary item>
<#if (item["./summary"]?size > 0)> <#if (item["./summary"]?size > 0)>
<#return item["./summary"]> <#return item["./summary"]>
@ -15,50 +26,134 @@
</#if> </#if>
</#function> </#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> <#function getSections item>
<#return item["./cms:articleSectionPanel/cms:item"]> <#return item["./cms:articleSectionPanel/cms:item"]>
</#function> </#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> <#function getSectionTitle section>
<#return section["./title"]> <#return section["./title"]>
</#function> </#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> <#function getSectionContent section>
<#return section["./text/content"]> <#return section["./text/content"]>
</#function> </#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> <#function getSectionRank section>
<#return section["./rank"]> <#return section["./rank"]>
</#function> </#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> <#function getPageNumber item>
<#return item["./articleSectionPanel/@pageNumber"]> <#return item["./articleSectionPanel/@pageNumber"]>
</#function> </#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> <#function getNumberOfPages item>
<#return item["./cms:mpadata/numberOfPages"]> <#return item["./cms:mpadata/numberOfPages"]>
</#function> </#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> <#function hasPreviousPage item>
<#return (item["./cms:articleSectionPanel/@pageNumber"] != "all" && item["./cms:articleSectionPanel/@pageNumber"]?number > 1)> <#return (item["./cms:articleSectionPanel/@pageNumber"] != "all" && item["./cms:articleSectionPanel/@pageNumber"]?number > 1)>
</#function> </#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> <#function hasNextPage item>
<#return (item["./cms:articleSectionPanel/@pageNumber"] != "all" && item["./cms:articleSectionPanel/@pageNumber"]?number < item["./cms:mpadata/numberOfPages"]?number)> <#return (item["./cms:articleSectionPanel/@pageNumber"] != "all" && item["./cms:articleSectionPanel/@pageNumber"]?number < item["./cms:mpadata/numberOfPages"]?number)>
</#function> </#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> <#function hasMultiplePages item>
<#return (item["./cms:articleSectionPanel/@pageNumber"] != "all") && item["./cms:articleSectionPanel/@pageNumber"] != "1"> <#return (item["./cms:articleSectionPanel/@pageNumber"] != "all") && item["./cms:articleSectionPanel/@pageNumber"] != "1">
</#function> </#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> <#function getLinkToPreviousPage item>
<#return "?page${item['./cms:articleSectionPanel/@pageNumber']?number - 1}"> <#return "?page${item['./cms:articleSectionPanel/@pageNumber']?number - 1}">
</#function> </#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> <#function getLinkToNextPage item>
<#return "?page${item['./cms:articleSectionPanel/@pageNumber']?number + 1}"> <#return "?page${item['./cms:articleSectionPanel/@pageNumber']?number + 1}">
</#function> </#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> <#function getAllSectionsLink item>
<#return "?page=all"> <#return "?page=all">
</#function> </#function>