下载通过Liferay门户中的动态数据列表上传的文件 [英] Downloading files that has been uploaded via dynamic data list in Liferay portal
问题描述
,更新 portal-ext.properties
:
Liferay:如何配置Liferay Portal
I'm uploading files via dynamic data list Document
field. Now I would like to allow anonymous users to download those files, but currently they see only file name without the link to file:
Do you have any suggestions about how can I achieve that?
Edit:
As @Mark suggested, I've created Display Templated and in freemarker editor I've selected Display and Media
field. It generated following code in my .ftl file:
<a href="${ddmUtil.getDisplayFieldValue(themeDisplay, cur_record.getFieldValue("Documents_and_Media1422", locale), cur_record.getFieldType("Documents_and_Media1422"))}">
${languageUtil.format(locale, "download-x", "Documents and Media")}
</a>
I've saved changes and refreshed page. It gave me following error:
Expression cur_record is undefined on line 9, column 3 in 10157#10197#16569.
Shouldn't cur_record be populated by the liferay?
Create new "Display Template" witch include the link to the Document:
UPDATE:
Define the records
variable:
<#assign DDLRecordLocalService = serviceLocator.findService("com.liferay.portlet.dynamicdatalists.service.DDLRecordLocalService")>
<#assign records = DDLRecordLocalService.getRecords(reserved_record_set_id)>
<#if records?has_content>
<#list records as cur_record>
<a href="${ddmUtil.getDisplayFieldValue(themeDisplay, cur_record.getFieldValue("Documents_and_Media1422", locale), cur_record.getFieldType("Documents_and_Media1422"))}">
${languageUtil.format(locale, "download-x", "Documents and Media")}
</a>
</#list>
</#if>
Also, due to bug https://support.liferay.com/browse/LPS-43149, update the portal-ext.properties
:
Liferay: How to configure Liferay Portal
这篇关于下载通过Liferay门户中的动态数据列表上传的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!