已通过在Liferay门户动态数据列表上传下载文件 [英] Downloading files that has been uploaded via dynamic data list in Liferay portal
问题描述
<一个href=\"http://stackoverflow.com/questions/21087339/uploading-files-to-liferay-server/21089309?noredirect=1#21089309\">I'm上传文件通过动态数据列表文件
字段的。现在我想允许匿名用户下载这些文件,但目前他们只看到文件名,不以文件的链接:
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?
编辑:
正如@马克的建议,我已经创建了显示模板,并在编辑的freemarker我选择了显示器和媒体
字段。它产生以下我.ftl文件code:
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>
我已经保存更改并刷新页面。它给了我以下错误:防爆pression cur_record在10157#10197#16569未定义在第9行,第3列。
不应该cur_record由Liferay的填充?
Shouldn't cur_record be populated by the liferay?
推荐答案
新建显示模板魔女包括链接到文件:
Create new "Display Template" witch include the link to the Document:
更新:
定义记录
变量:
<#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>
此外,由于错误 https://support.liferay.com/browse/LPS-43149 ,更新 portal-ext.properties
:
的Liferay:如何配置Liferay门户
这篇关于已通过在Liferay门户动态数据列表上传下载文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!