From 98bf5f215f9810190295c27954ce1735738efd91 Mon Sep 17 00:00:00 2001 From: jensp Date: Sun, 3 Nov 2019 09:43:05 +0000 Subject: [PATCH] Documentation for ccm-cms-assets-fileattachments.ftl git-svn-id: https://svn.libreccm.org/ccm/trunk@6288 8810af33-2d31-482b-a856-94f89814c4df --- .../ccm-cms-assets-fileattachments.ftl | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/ccm-cms-assets-fileattachment/web/themes/freemarker/ccm-cms-assets-fileattachments.ftl b/ccm-cms-assets-fileattachment/web/themes/freemarker/ccm-cms-assets-fileattachments.ftl index 7a8c0b140..4f44e1233 100644 --- a/ccm-cms-assets-fileattachment/web/themes/freemarker/ccm-cms-assets-fileattachments.ftl +++ b/ccm-cms-assets-fileattachment/web/themes/freemarker/ccm-cms-assets-fileattachments.ftl @@ -5,6 +5,29 @@ "ui": "http://www.arsdigita.com/ui/1.0"} > +<#--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"]?map( @@ -28,6 +51,13 @@ <#return file.fileType> --> +<#--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> <#if (file["./mimeType/mimeType"].@@text == "text/plain") && file["./mimeType/label"].@@text == "caption"> <#return "caption">