From 56ba381833513bc15d0acf69ab939fe94aa10d72 Mon Sep 17 00:00:00 2001 From: Jens Pelzetter Date: Sat, 21 Dec 2019 18:56:15 +0100 Subject: [PATCH] Migrated FTL function lib for file attachments --- .../themes/ccm-cms-types-file-attachments.ftl | 29 +++++++++++++ .../freemarker/ccm-cms/file-attachments.ftl | 41 +++++++++++++++++++ 2 files changed, 70 insertions(+) create mode 100644 ccm-cms/src/main/resources/themes/ccm-cms-types-file-attachments.ftl create mode 100644 ccm-cms/src/main/resources/themes/freemarker/ccm-cms/file-attachments.ftl diff --git a/ccm-cms/src/main/resources/themes/ccm-cms-types-file-attachments.ftl b/ccm-cms/src/main/resources/themes/ccm-cms-types-file-attachments.ftl new file mode 100644 index 000000000..3b488e6f1 --- /dev/null +++ b/ccm-cms/src/main/resources/themes/ccm-cms-types-file-attachments.ftl @@ -0,0 +1,29 @@ +<#--filedoc + Functions for processing file attachments. + + @depcrecated Use ccm-cms/file-attachments.ftl +--> + +<#import "/ccm-cms/file-attachments" as FileAttachments> + +<#--doc + Gets the file attachements of an content item. + + @param item The content item providing the file attachments. + + @return A sequence of the file attachments +--> +<#function getFileAttachments item> + <#return FileAttachments.getFileAttachments(item)> + + +<#--doc + *Internal* function for determing the type of a file attachment. + + @param file The file attachment. + + @return The type the file. Either `caption` or `file`. +--> +<#function _getFileType file> + <#return FileAttachments._getFileType(file)> + diff --git a/ccm-cms/src/main/resources/themes/freemarker/ccm-cms/file-attachments.ftl b/ccm-cms/src/main/resources/themes/freemarker/ccm-cms/file-attachments.ftl new file mode 100644 index 000000000..fd6dc60a1 --- /dev/null +++ b/ccm-cms/src/main/resources/themes/freemarker/ccm-cms/file-attachments.ftl @@ -0,0 +1,41 @@ +<#--filedoc + Functions for processing file attachments. +--> + +<#--doc + Gets the file attachements of an content item. + + @param item The content item providing the file attachments. + + @return A sorted sequence of hashes (see Freemarker documentation) containing + the data the file attachments. The following keys are available: + + * `fileType`: Type of the attachments. Either `file` or `caption` + * `mimeType`: The mime type of the file. + * `mimeTypeLabel`: A human readable label for the mime type. + * `fileSize`: The size of the file. + * `fileExtension`: The extension part of the file name. + * `fileId`: The ID of the file. + * `fileName`: The name of the file. + * `description`: The description of the file attachment. + * `fileUrl`: The URL for downloading the file. + * `fileOrder`: The value of the order property of the file attachment. +--> + +<#function getFileAttachments item> + <#return item.fileAttachments> + + +<#--doc + *Internal* function for determing the type of a file attachment. + + @param file The file attachment. + + @depcrecated without replacement. + + @return The type the file. Starting with version 7.0.0 always `file`. +--> +<#function _getFileType file> + <#return "file"> + +