xpages - 将多个 NotesRichText 字段附加到文件下载控件
问题描述
我目前正在为带有 XPages 的旧笔记数据库开发一个小型 Web 前端。
大多数文档是多个 RT 字段中的 DWG 和 PDF 文件,用户应该能够通过 Web 前端下载这些文件。由于文件分布在 10-12 个 RTfields 之间,因此为每个字段设置文件下载控制似乎是一个糟糕的解决方案。所以我尝试通过 SSJS 将多个字段合并为一个,并将其作为文件下载控件的数据源。
<xp:fileDownload
rows="30"
id="fileDownload2"
displayLastModified="false"
displaySize="true"
displayType="false"
displayCreated="false">
<xp:this.value>
<![CDATA[#{javascript:
var allfiles:lotus.domino.RichTextItem=plan.getDocument().getFirstItem("VPL_datei");
allfiles.appendRTItem(plan.getDocument().getFirstItem("VPL_datei_1"));
allfiles.appendRTItem(plan.getDocument().getFirstItem("PGL_datei"));
allfiles.appendRTItem(plan.getDocument().getFirstItem("Plandatei"));
var file1:com.ibm.xsp.model.domino.wrapped.DominoRichTextItem = new com.ibm.xsp.model.domino.wrapped.DominoRichTextItem(plan, allfiles);
return file1;
}]]>
</xp:this.value>
</xp:fileDownload>
但这只会从第一个字段“VPL_datei”中获取附件,而忽略其他字段中的所有附件。
有没有办法合并字段或提供多个字段作为数据源?我不能编辑 notesdocument 或其表格。
解决方案
以这种方式无法即时合并 RTItems。您必须先保存项目...
但是您可以创建自己的“FileDownload”-Control。
使用 Domino URL 访问附件
要使用 Domino URL 访问文件附件,您必须知道视图名称、文档名称和文件附件名称。Domino 在保存文件所附加到的文档时会生成文件附件的 URL。这些 URL 以附件的文件名结尾。
句法:
http://Host/DatabaseName/View/DocumentName/ $File/fileattachmentname
其中 View 是视图名称或视图 ID,DocumentName 是文档名称或 ID。$File 是一个特殊标识符,表示文档上的附件。Fileattachmentname 是附件的文件名。
例子:
http://www.acme.com/products.nsf/Documents/ $File/Spec_sheet.pdf
推荐阅读
- html - “和”css中的一些选择器
- python - 应用程序错误 Azure:ModuleNotFoundError:没有名为“flask_socketio”的模块
- c++ - 从可变模板参数创建一个 std::tuple
- sql - SQL:查询只有所有匹配值的表
- angularjs - 使用 Laravel Socialite 作为 API(社交认证)
- css - OnClick 隐藏导航栏
- django - 如何让 self.request.user 返回附加到令牌的用户?
- mysql - Docker swarm 服务安全能力
- android - MediaMetadataRetriever 在 Android 11 中引发 RuntimeException
- scala - Arrays.asList(MyEnum.values) 返回 List[Array[T]] 而不是 List[T]