Skip to content

Instantly share code, notes, and snippets.

@natecavanaugh
Created December 6, 2019 19:30
Show Gist options
  • Save natecavanaugh/6c876bf978df35e49a7f46b093490507 to your computer and use it in GitHub Desktop.
Save natecavanaugh/6c876bf978df35e49a7f46b093490507 to your computer and use it in GitHub Desktop.
<#assign dlFileEntryService = serviceLocator.findService("com.liferay.document.library.kernel.service.DLFileEntryLocalService")/>
<#if entries?has_content>
<#list entries as entry>
<#assign assetRenderer = entry.getAssetRenderer()>
<#assign title = htmlUtil.escape(assetRenderer.getTitle(locale))>
<#if assetRenderer.getType() == "document">
<#assign fileEntryId = assetRenderer.getClassPK()>
<#assign fileEntry = dlFileEntryService.getFileEntry(fileEntryId)>
<#assign version = fileEntry.getLatestFileVersion(false)>
<#assign viewURL = themeDisplay.getPortalURL() + themeDisplay.getPathContext() + "/documents/" + fileEntry.getGroupId() + "/" + fileEntry.getFolderId() + "/" + httpUtil.encodeURL(htmlUtil.unescape(fileEntry.getTitle())) + "/" + fileEntry.getUuid() + "?version=" + version.getVersion()>
<#if version.getSize() == 0>
No file uploaded
</#if>
</#if>
</#list>
</#if>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment