Documentation for ccm-cms-assets-fileattachments.ftl

git-svn-id: https://svn.libreccm.org/ccm/trunk@6288 8810af33-2d31-482b-a856-94f89814c4df
master
jensp 2019-11-03 09:43:05 +00:00
parent 511180c0da
commit 98bf5f215f
1 changed files with 30 additions and 0 deletions

View File

@ -5,6 +5,29 @@
"ui": "http://www.arsdigita.com/ui/1.0"} "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> <#function getFileAttachments item>
<#return item["./fileAttachments"]?map( <#return item["./fileAttachments"]?map(
@ -28,6 +51,13 @@
<#return file.fileType> <#return file.fileType>
</#function> --> </#function> -->
<#--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> <#function _getFileType file>
<#if (file["./mimeType/mimeType"].@@text == "text/plain") && file["./mimeType/label"].@@text == "caption"> <#if (file["./mimeType/mimeType"].@@text == "text/plain") && file["./mimeType/label"].@@text == "caption">
<#return "caption"> <#return "caption">