Documentation for the Freemarker functions provided ccm-cms-assets-fileattachment
git-svn-id: https://svn.libreccm.org/ccm/trunk@6105 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
57275b6d79
commit
7e4dab8465
|
|
@ -1,4 +1,7 @@
|
||||||
### ccm-cms-assets-fileattachment
|
# Functions for File Attachments
|
||||||
|
|
||||||
|
Import Path
|
||||||
|
: `/ccm-cms-assets-fileattachments.ftl`
|
||||||
|
|
||||||
This module provides functions for dealing with file attachments. A
|
This module provides functions for dealing with file attachments. A
|
||||||
possible usage these functions:
|
possible usage these functions:
|
||||||
|
|
@ -37,133 +40,38 @@ possible usage these functions:
|
||||||
</#list>
|
</#list>
|
||||||
```
|
```
|
||||||
|
|
||||||
#### getFileAttachments
|
## `getFileAttachments(item: Node): Sequence<Node>`
|
||||||
|
|
||||||
getFileAttachments(item: ContentItemNode): Sequence
|
Retrieves the file attachments of the provided content item.
|
||||||
|
|
||||||
Return the file attachments of a content items
|
## `getFileType(file: Node): String`
|
||||||
|
|
||||||
##### Parameters
|
|
||||||
|
|
||||||
`item` The content item from which the file attachments are retrieved.
|
|
||||||
|
|
||||||
##### Returns
|
|
||||||
|
|
||||||
A sequence of the file attachments of the provided content item.
|
|
||||||
|
|
||||||
#### getFileType
|
|
||||||
|
|
||||||
getFileType(file)
|
|
||||||
|
|
||||||
Returns the type of the file attachments which is either `caption` or `file`.
|
Returns the type of the file attachments which is either `caption` or `file`.
|
||||||
|
|
||||||
##### Parameters
|
## `getMimeType(file: Node): String`
|
||||||
|
|
||||||
`file` The file attachment
|
Returns the mime type of the file, for example `image/png` or `application/pdf`.
|
||||||
|
|
||||||
##### Returns
|
|
||||||
|
|
||||||
The type of the file attachment.
|
|
||||||
|
|
||||||
#### getMimeType
|
|
||||||
|
|
||||||
getMimeType(file)
|
|
||||||
|
|
||||||
Returns the mime type of the file.
|
|
||||||
|
|
||||||
##### Parameters
|
|
||||||
|
|
||||||
`file` The file
|
|
||||||
|
|
||||||
##### Returns
|
|
||||||
|
|
||||||
The mime type of the file.
|
|
||||||
|
|
||||||
#### getMimeTypeFileExtension
|
|
||||||
|
|
||||||
getMimeTypeFileExtension(file)
|
|
||||||
|
|
||||||
|
## `getMimeTypeFileExtension(file: Node): String`
|
||||||
|
|
||||||
Returns the usual file extension for the mime type of the file.
|
Returns the usual file extension for the mime type of the file.
|
||||||
|
|
||||||
##### Parameters
|
## `getFileSize(file: Node, unit: String = "byte"): Number`
|
||||||
|
|
||||||
`file` The file
|
Returns the size of the provided file. The unit in which the size of the file is returned can be changed by using the optional parameter `unit`. The default value for the unit is `byte`.
|
||||||
|
|
||||||
##### Returns
|
## `getFileId(file: Node): String`
|
||||||
|
|
||||||
The usual file extension for the mime type of the file.
|
|
||||||
|
|
||||||
#### getFileSize
|
|
||||||
|
|
||||||
getFileSize(file unit="byte")
|
|
||||||
|
|
||||||
Returns the size of the file in the provided unit.
|
|
||||||
|
|
||||||
##### Parameters
|
|
||||||
|
|
||||||
`file`The file
|
|
||||||
|
|
||||||
`unit` Optional parameter for unit in which the size is returned. Default
|
|
||||||
value is `byte`. Supported values are `byte`, `kB` `KiB`, `MB` and `MiB`.
|
|
||||||
All other values are interpreted as `byte`.
|
|
||||||
|
|
||||||
##### Returns
|
|
||||||
|
|
||||||
The size of the file in the provided unit.
|
|
||||||
|
|
||||||
|
|
||||||
#### getFileId
|
|
||||||
|
|
||||||
getFileId(file)
|
|
||||||
|
|
||||||
Returns the ID of the file.
|
Returns the ID of the file.
|
||||||
|
|
||||||
##### Parameters
|
## `getFileName(file: Node): String`
|
||||||
|
|
||||||
`file` The file
|
|
||||||
|
|
||||||
##### Returns
|
|
||||||
|
|
||||||
The ID of the file.
|
|
||||||
|
|
||||||
#### getFileName
|
|
||||||
|
|
||||||
getFileName(file)
|
|
||||||
|
|
||||||
Returns the name of file.
|
Returns the name of file.
|
||||||
|
|
||||||
##### Parameters
|
## `getFileDescription(file: Node): String`
|
||||||
|
|
||||||
`file` The file
|
Returns the description of the file.
|
||||||
|
|
||||||
##### Returns
|
#### `getFileUrl(file: Node): String`
|
||||||
|
|
||||||
The name of the file.
|
Returns the URL of the file.
|
||||||
|
|
||||||
#### getFileDescription
|
|
||||||
|
|
||||||
getFileDescription(file)
|
|
||||||
|
|
||||||
Returns the name of file.
|
|
||||||
|
|
||||||
##### Parameters
|
|
||||||
|
|
||||||
`file` The file
|
|
||||||
|
|
||||||
##### Returns
|
|
||||||
|
|
||||||
The description of the file.
|
|
||||||
|
|
||||||
#### getFileUrl
|
|
||||||
|
|
||||||
getFileUrl(file)
|
|
||||||
|
|
||||||
Returns the name of file.
|
|
||||||
|
|
||||||
##### Parameters
|
|
||||||
|
|
||||||
`file` The file
|
|
||||||
|
|
||||||
##### Returns
|
|
||||||
|
|
||||||
The URL of the file.
|
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@
|
||||||
<#elseif unit == "MiB">
|
<#elseif unit == "MiB">
|
||||||
<#return (file["./length"].@@text?number / 1048576)?round>
|
<#return (file["./length"].@@text?number / 1048576)?round>
|
||||||
<#else>
|
<#else>
|
||||||
<#return file["./length"]>
|
<#return file["./length"].@@text?number>
|
||||||
</#if>
|
</#if>
|
||||||
</#function>
|
</#function>
|
||||||
|
|
||||||
|
|
@ -48,7 +48,7 @@
|
||||||
</#function>
|
</#function>
|
||||||
|
|
||||||
<#function getFileName file>
|
<#function getFileName file>
|
||||||
<#return file["./name"]>
|
<#return file["./name"].@@text>
|
||||||
</#function>
|
</#function>
|
||||||
|
|
||||||
<#function getFileDescription file>
|
<#function getFileDescription file>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue