Freemarker support for file attachments
git-svn-id: https://svn.libreccm.org/ccm/trunk@5955 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
92ac2d0cb9
commit
b6c42db2e5
|
|
@ -0,0 +1,63 @@
|
|||
<#ftl ns_prefixes={
|
||||
"bebop":"http://www.arsdigita.com/bebop/1.0",
|
||||
"cms":"http://www.arsdigita.com/cms/1.0",
|
||||
"nav":"http://ccm.redhat.com/navigation",
|
||||
"ui": "http://www.arsdigita.com/ui/1.0"}
|
||||
>
|
||||
|
||||
<#function getFileAttachments item>
|
||||
<#return item["./fileAttachments"]>
|
||||
</#function>
|
||||
|
||||
<#function getFileType file>
|
||||
<#if (file["./mimeType/mimeType"].@@text == "text/plain") && file["./mimeType/label"].@@text == "caption">
|
||||
<#return "caption">
|
||||
<#else>
|
||||
<#return "file">
|
||||
</#if>
|
||||
</#function>
|
||||
|
||||
<#function getMimeType file>
|
||||
<#return file["./mimeType/mimeType"]>
|
||||
</#function>
|
||||
|
||||
<#function getMimeTypeLabel file>
|
||||
<#return file["./mimeType/label"]>
|
||||
</#function>
|
||||
|
||||
<#function getMimeTypeFileExtension file>
|
||||
<#return file["./mimeType/fileExtension"]>
|
||||
</#function>
|
||||
|
||||
<#function getFileSize file unit="byte">
|
||||
<#if unit == "kB">
|
||||
<#return (file["./length"].@@text?number / 1000)?round>
|
||||
<#elseif unit == "KiB">
|
||||
<#return (file["./length"].@@text?number / 1024)?round>
|
||||
<#elseif unit == "MB">
|
||||
<#return (file["./length"].@@text?number / 1000000)?round>
|
||||
<#elseif unit == "MiB">
|
||||
<#return (file["./length"].@@text?number / 1048576)?round>
|
||||
<#else>
|
||||
<#return file["./length"]>
|
||||
</#if>
|
||||
</#function>
|
||||
|
||||
<#function getFileId file>
|
||||
<#return file["./id"]>
|
||||
</#function>
|
||||
|
||||
<#function getFileName file>
|
||||
<#return file["./name"]>
|
||||
</#function>
|
||||
|
||||
<#function getFileDescription file>
|
||||
<#return file["./description"]>
|
||||
</#function>
|
||||
|
||||
<#function getFileUrl file>
|
||||
<#return dispatcherPrefix + '/cms-service/stream/asset/' + getFileName(file) + '?asset_id=' + getFileId(file)>
|
||||
</#function>
|
||||
|
||||
|
||||
|
||||
|
|
@ -6,6 +6,7 @@
|
|||
>
|
||||
|
||||
<#function getRelatedLinks item linkListName="NONE">
|
||||
|
||||
<#return item["./links[./linkListName='${linkListName}']"]>
|
||||
</#function>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue