Web内容显示文档库中的所有文件

发布于 2025-01-06 08:59:52 字数 168 浏览 3 评论 0原文

我正在尝试使用 Web 内容显示来显示文档库特定文件夹中的所有文件。

我想继续自定义文件夹的选择。

您是否知道模板中是否存在指向文件夹而不是文档库中的特定字段的动态元素?

如果不可能有人知道另一种方法吗?

预先感

谢萨布丽娜

I'm trying to use a Web content Display to show all the files in a particular folder of document library.

I would like to keep customize the choice of the folder.

Do you know if exist a dynamic element in template that point to a folder not to a specific field in the document library?

If is not possible someone know a different way to do that?

thanks in advance

Sabrina

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

醉酒的小男人 2025-01-13 08:59:52

您可以创建包含名为“folderId”的folderId 文本字段的结构。

然后创建模板

#set($service = $serviceLocator.findService("com.liferay.portlet.documentlibrary.service.DLFileEntryLocalService"))
#set($gid = $getterUtil.getLong($request.get("theme-display").get("scope-group-id")))
#set($fid = $getterUtil.getLong($folderId.getData()))

#set($files = $service.getFileEntries($gid, $fid))

#foreach($doc in $files)
    #set($uet = $httpUtil.encodeURL($htmlUtil.unescape($doc.getTitle())))
    <a href="/documents/$gid/$fid/$uet">$doc.getTitle()</a><br />
#end

通过该模板/结构创建文章并输入要显示的文件夹 ID。添加显示本文的“Web 内容显示”portlet。

更新:

对于 Liferay 6.1 方法签名已更改,

List<DLFileEntry>   getFileEntries(long groupId, long folderId, int start, int end, OrderByComparator obc) 

因此对于 liferay 6.1 您应该将调用更改为至少

#set($files = $service.getFileEntries($gid, $fid, -1, -1, null))

或更改开始/结束/排序。

You can create structure that holds text field for folderId named "folderId".

Than create template

#set($service = $serviceLocator.findService("com.liferay.portlet.documentlibrary.service.DLFileEntryLocalService"))
#set($gid = $getterUtil.getLong($request.get("theme-display").get("scope-group-id")))
#set($fid = $getterUtil.getLong($folderId.getData()))

#set($files = $service.getFileEntries($gid, $fid))

#foreach($doc in $files)
    #set($uet = $httpUtil.encodeURL($htmlUtil.unescape($doc.getTitle())))
    <a href="/documents/$gid/$fid/$uet">$doc.getTitle()</a><br />
#end

Create article by that template/structure and enter folder id that you want to display. Add "Web content display" portlet that displays this article.

UPDATE:

For Liferay 6.1 method signature was changed and is

List<DLFileEntry>   getFileEntries(long groupId, long folderId, int start, int end, OrderByComparator obc) 

So for liferay 6.1 you should change call to be at least

#set($files = $service.getFileEntries($gid, $fid, -1, -1, null))

or change for start/end/sort.

心凉怎暖 2025-01-13 08:59:52

您可以使用文档库显示 portlet 来完成此操作。

You could use the Document Library Display portlet to accomplish this.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文