From 5ce509dad7a4804f0231b39fbfa9dc4c5ef8e623 Mon Sep 17 00:00:00 2001 From: Jens Pelzetter Date: Sat, 21 Dec 2019 17:32:09 +0100 Subject: [PATCH] Migrated item list (ex object list) --- .../themes/freemarker/ccm-cms/item-list.ftl | 460 ++++++++++++++++++ .../freemarker/ccm-navigation/object-list.ftl | 446 +++++++++++++++++ 2 files changed, 906 insertions(+) create mode 100644 ccm-cms/src/main/resources/themes/freemarker/ccm-cms/item-list.ftl create mode 100644 ccm-cms/src/main/resources/themes/freemarker/ccm-navigation/object-list.ftl diff --git a/ccm-cms/src/main/resources/themes/freemarker/ccm-cms/item-list.ftl b/ccm-cms/src/main/resources/themes/freemarker/ccm-cms/item-list.ftl new file mode 100644 index 000000000..60e6e8be0 --- /dev/null +++ b/ccm-cms/src/main/resources/themes/freemarker/ccm-cms/item-list.ftl @@ -0,0 +1,460 @@ +<#--filedoc + Functions for accessing item lists and their properties. +--> + +<#--doc + Retrieve the item (models) of an object list. This function can deal with + several different types of object lists, including `SimpleObjectList`, + `ComplexObjectList` and `CustomziableObjectList`. + + @param listId The ID of the object list from the the items are retrieved. + @param containerId The ID of the container of the list + + @return The models for the entries in the object list. If no list with + the provided `listId` is found and empty sequence is returned. +--> +<#function getItems listId containerId="container"> + <#return containerId?eval[listId].items> + + +<#--doc + Gets the number of objects/items in an object list. + + @param listId The ID of the object list to use. + @param containerId The ID of the container of the list + + @return The number of objects in the list. If no list with the provided + `listId` is found `0` is returned. +--> +<#function getObjectCount listId containerId="container"> + <#return getItems(listId, containerId)?size> + + +<#--doc + Gets the base URL for the paginator of an object list. + + @param listId The ID of the object list to use. + @param containerId The ID of the container of the list + + @return The base URL for the the paginator. +--> +<#function getPaginatorBaseUrl listId containerId="container"> + <#return containerId?eval[listId].paginator.baseUrl + + +<#--doc + Gets the index of the first item shown on the current page. + + @param listId The ID of the object list to use. + @param containerId The ID of the container of the list + + @return The index of the first item shown on the current page. +--> +<#function getPaginatorBegin listId containerId="container"> + <#return containerId?eval[listId].paginator.start> + + +<#--doc + Gets the index of the last item shown on the curent page. + + @param listId The ID of the object list to use. + @param containerId The ID of the container of the list + + @return The index of the last item shown on the current page. +--> +<#function getPaginatorEnd listId containerId="container"> + <#return containerId?eval[listId].paginator.end> + + +<#--doc + Get the number of pages of an object list. + + @param listId The ID of the object list to use. + @param containerId The ID of the container of the list + + @return The number of pages of the object list. If no list with the + provided `listId` is found the function will return `0`. +--> +<#function getPageCount listId containerId="container"> + <#return containerId?eval[listId].paginator.pageCount + + +<#--doc + Gets the number of the current page. + + @param listId The ID of the object list to use. + @param containerId The ID of the container of the list + + @return The number of the page currently shown. +--> +<#function getPageNumber listId containerId="container"> + <#return containerId?eval[listId].paginator.pageNumber> + + +<#--doc + Gets the name of the page URL parameter. + + @param listId The ID of the object list to use. + @param containerId The ID of the container of the list + + @return The name of the page URL parameter. +--> +<#function getPageParam listId containerId="container"> + <#return containerId?eval[listId].paginator.pageParam> + + +<#--doc + Gets the maximum number of items on a page. + + @param listId The ID of the object list to use. + @param containerId The ID of the container of the list + + @return The maxium number of items on a page. +--> +<#function getPageSize listId containerId="container"> + <#return containerId?eval[listId].paginator.pageSize> + + +<#--doc + Gets the link to the previous page. + + @param listId The ID of the object list to use. + @param containerId The ID of the container of the list + + @return The link to the previous page. +--> +<#function getPrevPageLink listId containerId="container"> + <#return containerId?eval[listId].paginator.prevPageLink> + + +<#--doc + Gets the link to the next page. + + @param listId The ID of the object list to use. + @param containerId The ID of the container of the list + + @return The link to the next page. +--> +<#function getNextPageLink listId containerId="container"> + <#return containerId?eval[listId].paginator.nextPageLink> + + +<#--doc + Gets the link to the first page. + + @param listId The ID of the object list to use. + @param containerId The ID of the container of the list + + @return The link to the first page. +--> +<#function getFirstPageLink listId containerId="container"> + <#return containerId?eval[listId].paginator.firstPageLink> + + +<#--doc + Gets the link to the last page. + + @param listId The ID of the object list to use. + @param containerId The ID of the container of the list + + @return The link to the last page. +--> +<#function getLastPageLink listId containerId="container"> + <#return containerId?eval[listId].paginator.lastPageLink> + + +<#--doc + Gets the title of an item from an object list. + + @param item The model of the list entry for the item. + @param containerId The ID of the container of the list + + @depcrecated Use the title property of the item directly + + @return The title of the item. +--> +<#function getItemTitle item> + <#return item.title> + + +<#--doc + Gets the link to the detail view of an item in a list. + + @param item The model of the list entry for the item. + + @return The link to the detail view of the item. +--> +<#function getItemLink item> + <#return "./" + item.name> + + +<#--doc + Checks if the model of the list entry of an item contains a value for the + `lead` property. + + @param item The model of the list entry for the item. + + @return `true` if the model provides a value of the `lead` property, + `false` if not. +--> +<#function hasItemLead item> + <#return item.lead??> + + +<#--doc + Gets the value of the `lead` property of an item. + + @param item The model of the list entry for the item. + + @return The value of the `lead` property. +--> +<#function getItemLead item> + <#return item.lead> + + +<#--doc + A generic function for checking if the model of a list entry for an item + has a specific property. + + @param item The model of the list entry for the item. + + @param property The name of the property to check for. + + @return `true` If the provided model provides an value for the property, + `false` if not. +--> +<#function hasItemProperty item property> + <#return false> + + +<#--doc + A generic function for retrieving the value of an property from the model + for a list entry for an item. + + @param item The model of the list entry for the item. + + @param property The name of the property to retrieve. + + @return The value of the property. +--> +<#function getItemProperty item property> + <#return ""> + + +<#--doc + Checks if the provided item has an associated image. + + @param item The model of the list entry for the item. + + @return `true` if the item has an associated image, `false` if not. +--> +<#function hasImage item> + <#return false> + + +<#--doc + Get the ID of an associated image. + + @param item The model of the list entry for the item. + + @return The ID of the associated image. +--> +<#function getImageId item> + <#return ""> + + +<#--doc + Generates the URL for an associated image. + + @param item The model of the list entry for the item. + + @return The URL of the associated image. +--> +<#function getImageUrl item> + <#return ""> + + +<#--doc + Gets the caption for the associated image. + + @param item The model of the list entry for the item. + + @return The caption for the associated image. +--> +<#function getImageCaption item> + <#return ""> + + +<#--doc + Retrieves the filters for an object list. + + @param listId The ID of the list to use. + + @return The filters for the list. An empty sequence is returned if no list + with the provided `listId` could be found or if the list does not have any filters. +--> +<#function getFilters listId containerId="container"> + <#return []> + + +<#--doc + Get the label of a filter. + + @param filter model of a filter as returned by `getFilters`. + + @return The label of the filter. +--> +<#function getFilterLabel filter> + <#return ""> + + +<#--doc + Get the type of a filter. + + @param filter model of a filter as returned by `getFilters`. + + @return The type of the filter. +--> +<#function getFilterType filter> + <#return ""> + + +<#--doc + Get the options of a select filter. + + @param filter model of a filter as returned by `getFilters`. + + @return The options of the select filter. +--> +<#function getSelectFilterOptions filter> + <#return []> + + +<#--doc + Get the currently selected option of a select filter. + + @param filter model of a filter as returned by `getFilters`. + + @return The currently selected option. +--> +<#function getSelectFilterSelection filter> + <#return ""> + + +<#--doc + The label for an option of a select filter. + + @param filter model of an option as returned by `getSelectFilterOptions`. + + @return The label of the option. +--> +<#function getSelectFilterOptionLabel option> + <#return ""> + + +<#--doc + Gets the search string of an category filter. + + @param filter model of a filter as returned by `getFilters`. + + @return The search string. +--> +<#function getCategoryFilterSearchString filter> + <#return ""> + + +<#--doc + Gets the separator for a category filter. + + @param filter The model of a filter as returned by `getFilters`. + + @return The separator for separating the categories in the search string. +--> +<#function getCategoryFilterSeparator filter> + <#return ""> + + +<#--doc + Determines if a category allows the selection of multiple categories. + + @param filter The model of a filter as returned by `getFilters`. + + @return `true` if the filter allows multiple selections, `false` otherwise. +--> +<#function getCategoryFilterMultiple filter> + <#return false> + + +<#--doc + Gets the selectable categories for a category filter. + + @param filter The model of a filter as returned by `getFilters`. + + @return The selectable categories. +--> +<#function getCategoryFilterCategories filter> + <#return []> + + +<#--doc + Gets the groups of a category filter. + + @param filter The model of a filter as returned by `getFilters`. + + @return The groups of a category filter. +--> +<#function getCategoryFilterCategoryGroups filter> + <#return []> + + +<#--doc + Gets the label of a category group. + + @param group The model of a category group as returned by + `getCategoryFilterCategoryGroups`. + + @return The label for the group. +--> +<#function getCategoryGroupLabel group> + <#return ""> + + +<#--doc + Gets the categories in a group. + + @param group The model of a category group as returned by + `getCategoryFilterCategoryGroups`. + + @return The categories in the group. +--> +<#function getCategoryFilterCategoryGroupsCategories groups> + + <#return ""> + + + +<#--doc + Gets the ID of a category of a category filter. + + @param category The model of a category as returned by + `getCategoryFilterCategoryGroupsCategories`. + + @return The ID of the category. +--> +<#function getCategoryFilterCategoryId category> + <#return ""> + + +<#--doc + Gets the label of a category of a category filter. + + @param category The model of a category as returned by + `getCategoryFilterCategoryGroupsCategories`. + + @return The label of the category. +--> +<#function getCategoryFilterCategoryLabel category> + <#return ""> + + + diff --git a/ccm-cms/src/main/resources/themes/freemarker/ccm-navigation/object-list.ftl b/ccm-cms/src/main/resources/themes/freemarker/ccm-navigation/object-list.ftl new file mode 100644 index 000000000..bb70dfd41 --- /dev/null +++ b/ccm-cms/src/main/resources/themes/freemarker/ccm-navigation/object-list.ftl @@ -0,0 +1,446 @@ +<#--filedoc + Functions for accessing objects lists and their properties. + + @depcrecated use ccmc-cms/item-list.ftl instead +--> + +<#import "/ccm-navigation/item-list.ftl" as ItemList> + +<#--doc + Retrieve the item (models) of an object list. This function can deal with + several different types of object lists, including `SimpleObjectList`, + `ComplexObjectList` and `CustomziableObjectList`. + + @param listId The ID of the object list from the the items are retrieved. + + @return The models for the entries in the object list. If no list with + the provided `listId` is found and empty sequence is returned. +--> +<#function getItems listId> + <#return ItemList.getItems(listId)> + + +<#--doc + Gets the number of objects/items in an object list. + + @param listId The ID of the object list to use. + + @return The number of objects in the list. If no list with the provided + `listId` is found `0` is returned. +--> +<#function getObjectCount listId> + <#return ItemList.getObjectCount(listId)> + + +<#--doc + Gets the base URL for the paginator of an object list. + + @param listId The ID of the object list to use. + + @return The base URL for the the paginator. +--> +<#function getPaginatorBaseUrl listId> + <#return ItemList.getPaginatorBaseUrl(listId)> + + +<#--doc + Gets the index of the first item shown on the current page. + + @param listId The ID of the object list to use. + + @return The index of the first item shown on the current page. +--> +<#function getPaginatorBegin listId> + <#return ItemList.getPaginatorBegin(listId)> + + +<#--doc + Gets the index of the last item shown on the curent page. + + @param listId The ID of the object list to use. + + @return The index of the last item shown on the current page. +--> +<#function getPaginatorEnd listId> + <#return ItemList.getPaginatorEnd(listId)> + + +<#--doc + Get the number of pages of an object list. + + @param listId The ID of the object list to use. + + @return The number of pages of the object list. If no list with the + provided `listId` is found the function will return `0`. +--> +<#function getPageCount listId> + <#return ItemList.getPageCount(listId)> + + +<#--doc + Gets the number of the current page. + + @param listId The ID of the object list to use. + + @return The number of the page currently shown. +--> +<#function getPageNumber listId> + <#return ItemList.getPageNumber(listId)> + + +<#--doc + Gets the name of the page URL parameter. + + @param listId The ID of the object list to use. + + @return The name of the page URL parameter. +--> +<#function getPageParam listId> + <#return ItemList.getPageParam(listId)> + + +<#--doc + Gets the maximum number of items on a page. + + @param listId The ID of the object list to use. + + @return The maxium number of items on a page. +--> +<#function getPageSize listId> + <#return ItemList.getPageSize(listId)> + + +<#--doc + Gets the link to the previous page. + + @param listId The ID of the object list to use. + + @return The link to the previous page. +--> +<#function getPrevPageLink listId> + <#return ItemList.getPrevPageLink(listId)> + + +<#--doc + Gets the link to the next page. + + @param listId The ID of the object list to use. + + @return The link to the next page. +--> +<#function getNextPageLink listId> + <#return ItemList.getNextPageLink(listId)> + + +<#--doc + Gets the link to the first page. + + @param listId The ID of the object list to use. + + @return The link to the first page. +--> +<#function getFirstPageLink listId> + <#return ItemList.getFirstPageLink(listId)> + + +<#--doc + Gets the link to the last page. + + @param listId The ID of the object list to use. + + @return The link to the last page. +--> +<#function getLastPageLink listId> + <#return ItemList.getLastPageLink(listId)> + + +<#--doc + Gets the title of an item from an object list. + + @param item The model of the list entry for the item. + + @return The title of the item. +--> +<#function getItemTitle item> + <#return ItemList.getItemTitle(item)> + + +<#--doc + Gets the link to the detail view of an item in a list. + + @param item The model of the list entry for the item. + + @return The link to the detail view of the item. +--> +<#function getItemLink item> + <#return ItemList.getItemLink(item)> + + +<#--doc + Checks if the model of the list entry of an item contains a value for the + `lead` property. + + @param item The model of the list entry for the item. + + @return `true` if the model provides a value of the `lead` property, + `false` if not. +--> +<#function hasItemLead item> + <#return ItemList.hasItemLead(item)> + + +<#--doc + Gets the value of the `lead` property of an item. + + @param item The model of the list entry for the item. + + @return The value of the `lead` property. +--> +<#function getItemLead item> + <#return ItemList.getItemLead(item)> + + +<#--doc + A generic function for checking if the model of a list entry for an item + has a specific property. + + @param item The model of the list entry for the item. + + @param property The name of the property to check for. + + @return `true` If the provided model provides an value for the property, + `false` if not. +--> +<#function hasItemProperty item property> + <#return ItemList.hasItemProperty(item, property)> + + +<#--doc + A generic function for retrieving the value of an property from the model + for a list entry for an item. + + @param item The model of the list entry for the item. + + @param property The name of the property to retrieve. + + @return The value of the property. +--> +<#function getItemProperty item property> + <#return ItemList.getItemProperty(item, property)> + + +<#--doc + Checks if the provided item has an associated image. + + @param item The model of the list entry for the item. + + @return `true` if the item has an associated image, `false` if not. +--> +<#function hasImage item> + <#return ItemList.hasImage(item)> + + +<#--doc + Get the ID of an associated image. + + @param item The model of the list entry for the item. + + @return The ID of the associated image. +--> +<#function getImageId item> + <#return ItemList.getImageId(item)> + + +<#--doc + Generates the URL for an associated image. + + @param item The model of the list entry for the item. + + @return The URL of the associated image. +--> +<#function getImageUrl item> + <#return ItemList.getImageUrl(item)> + + +<#--doc + Gets the caption for the associated image. + + @param item The model of the list entry for the item. + + @return The caption for the associated image. +--> +<#function getImageCaption item> + #return ItemList.getImageCaption(item)> + + +<#--doc + Retrieves the filters for an object list. + + @param listId The ID of the list to use. + + @return The filters for the list. An empty sequence is returned if no list + with the provided `listId` could be found or if the list does not have any filters. +--> +<#function getFilters listId> + <#return ItemList.getFilters(listId)> + + +<#--doc + Get the label of a filter. + + @param filter model of a filter as returned by `getFilters`. + + @return The label of the filter. +--> +<#function getFilterLabel filter> + <#return ItemList.getFilterLabel(filter)> + + +<#--doc + Get the type of a filter. + + @param filter model of a filter as returned by `getFilters`. + + @return The type of the filter. +--> +<#function getFilterType filter> + <#return ItemList.getFilterType(filter)> + + +<#--doc + Get the options of a select filter. + + @param filter model of a filter as returned by `getFilters`. + + @return The options of the select filter. +--> +<#function getSelectFilterOptions filter> + <#return ItemList.getSelectedFilterOptions(filter)> + + +<#--doc + Get the currently selected option of a select filter. + + @param filter model of a filter as returned by `getFilters`. + + @return The currently selected option. +--> +<#function getSelectFilterSelection filter> + <#return ItemList.getSelectFilterSelection(filter)> + + +<#--doc + The label for an option of a select filter. + + @param filter model of an option as returned by `getSelectFilterOptions`. + + @return The label of the option. +--> +<#function getSelectFilterOptionLabel option> + <#return ItemList.getSelectFilterOptionLabel(filter)> + + +<#--doc + Gets the search string of an category filter. + + @param filter model of a filter as returned by `getFilters`. + + @return The search string. +--> +<#function getCategoryFilterSearchString filter> + <#return ItemList.getCategoryFilterSearchString(filter)> + + +<#--doc + Gets the separator for a category filter. + + @param filter The model of a filter as returned by `getFilters`. + + @return The separator for separating the categories in the search string. +--> +<#function getCategoryFilterSeparator filter> + <#return ItemList.getCategoryFilterSeparator(filter)> + + +<#--doc + Determines if a category allows the selection of multiple categories. + + @param filter The model of a filter as returned by `getFilters`. + + @return `true` if the filter allows multiple selections, `false` otherwise. +--> +<#function getCategoryFilterMultiple filter> + <#return ItemList.getCategoryFilterMultiple(filter)> + + +<#--doc + Gets the selectable categories for a category filter. + + @param filter The model of a filter as returned by `getFilters`. + + @return The selectable categories. +--> +<#function getCategoryFilterCategories filter> + <#return ItemList.getCategoryFilterCategories(filter)> + + +<#--doc + Gets the groups of a category filter. + + @param filter The model of a filter as returned by `getFilters`. + + @return The groups of a category filter. +--> +<#function getCategoryFilterCategoryGroups filter> + <#return ItemList.getCategoryFilterCategoryGroups(filter)> + + +<#--doc + Gets the label of a category group. + + @param group The model of a category group as returned by + `getCategoryFilterCategoryGroups`. + + @return The label for the group. +--> +<#function getCategoryGroupLabel group> + <#return ItemList.getCategoryGroupLabel(filter)> + + +<#--doc + Gets the categories in a group. + + @param group The model of a category group as returned by + `getCategoryFilterCategoryGroups`. + + @return The categories in the group. +--> +<#function getCategoryFilterCategoryGroupsCategories groups> + + <#return ItemList.getCategoryFilterCategoryGroupsCategories(filter)> + + + +<#--doc + Gets the ID of a category of a category filter. + + @param category The model of a category as returned by + `getCategoryFilterCategoryGroupsCategories`. + + @return The ID of the category. +--> +<#function getCategoryFilterCategoryId category> + <#return ItemList.getCategoryFilterCategoryId(filter)> + + +<#--doc + Gets the label of a category of a category filter. + + @param category The model of a category as returned by + `getCategoryFilterCategoryGroupsCategories`. + + @return The label of the category. +--> +<#function getCategoryFilterCategoryLabel category> + <#return ItemList.getCategoryFilterCategoryLabel(category)> +