已通过在Liferay门户动态数据列表上传下载文件 [英] Downloading files that has been uploaded via dynamic data list in Liferay portal

查看:745
本文介绍了已通过在Liferay门户动态数据列表上传下载文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<一个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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆