将多个 Notes Rich Text 字段附加到一个文件 Download Control

Attaching multiple NotesRichText fields to a fileDownload Control

我目前正在使用 XPages 为旧的笔记数据库开发一个小型网络前端。

大多数文档是多个 RTfields 中的 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" 获取附件,而忽略其他字段中的所有附件。

有没有办法合并字段或提供多个字段作为数据源?我不得编辑笔记文档或其表格。

不可能以这种方式即时合并 RTIitem。您必须先保存项目...

但您可以创建自己的 "FileDownload"-Control。

Using Domino URLs to access attachments

To access a file attachment using a Domino URL, you must know the view name, the document name, and the file attachment name. Domino generates an URL for file attachments when it saves the documents to which the files are attached. These URLs end with the file name of the attachment.

Syntax:

http://Host/DatabaseName/View/DocumentName/$File/fileattachmentname

Where View is either the view name or the view ID, and DocumentName is the document name or ID. $File is a special identifier that indicates an attachment on a document. Fileattachmentname is the file name of the attachment.

Examples:

http://www.acme.com/products.nsf/Documents/$File/Spec_sheet.pdf