Lotus Notes - 编写设计元素创建的脚本

发布于 2024-07-23 08:29:56 字数 614 浏览 8 评论 0原文

我有一个 Lotus Notes 应用程序,它实际上由一个模板组成,其中包含所有必需的表单、视图和代理。 它还需要将此模板中的一些设计元素(自定义表单和我们自己类型的文档的视图)复制到邮件模板,以便在定期刷新后所有用户都拥有它。

该应用程序的工作方式如下:应用程序数据库(源自我提供的模板)在 Domino 服务器上创建。 在此数据库中运行的代理根据 http 请求在用户的邮件数据库中创建一个“自定义”文档。

然后,在客户端,用户可以使用我们的视图来显示该文档。

目前,部署过程如下:

  1. 根据我们的模板创建一个“主”应用程序数据库。
  2. 使用该数据库中的表单和视图填充一些数据(以配置应用程序的工作方式)
  3. 将自定义表单和视图复制到邮件模板。
  4. 在邮件模板上创建我们的按钮(以启动我们的视图和/或表单)。
  5. 每晚数据库刷新后,所有用户都会在其邮件数据库中收到自定义表单和视图,并且他们可以使用按钮查看我们的文档(如果有)。

现在,我想简化管理员的工作,并自动复制自定义表单和视图,以及创建邮件模板的按钮。

知道如何通过 NotesScript、JavaScript、Java 执行此操作吗?

I have a Lotus Notes application which actually consists of a template with all the required forms, views and agents needed. It also requires some design elements (a custom form and a view for our own type of documents) from this template to be copied over to the mail template, so after the regular refresh all users have it.

The application works like this: the application database (derived from the template I provide) is created on the Domino server. An agent, running in this database, upon http request, creates a "custom" document in user's mail database.

Then, on the client side, the user can use our view to display this document.

Currently, the deployment procedure goes like this:

  1. Create a "master" application database out of our template.
  2. Fill some data, using the forms and views in that database (to configure how the application works)
  3. Copy the custom form and view to the mail template.
  4. Create our button (to launch our view and/or form) on the mail template.
  5. After the nightly database refresh, all users receive the custom form and the view in their mail database, and they can use the button to view our documents (if any).

Now, I want to easy the admin's work, and automate the copying of the custom form and the view, and also the creation of the button to the mail template.

Any idea how I can do this from a NotesScript, JavaScript, Java?

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

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

发布评论

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

评论(2

帅的被狗咬 2024-07-30 08:29:57

尝试看看这些想法 --->
http://www.openntf.org/projects/pmt.nsf/ 3f2929edba6ef2808625724c00585215/9fe3084cab2f38ad8625754600078af6!OpenDocument

http://www. benpoole.com/80256B44004A7C14/articles /simpledxl

为了避免一些 DXL 已知问题,您可以尝试导出和导出 以编码的二进制格式导入。

**更新

在更仔细地查看您的情况后,我认为最简单的途径是使用模板继承。 因此,您可以将自定义模板中的元素复制到邮件模板中,并确保这些元素设置为从自定义模板继承。

Try looking at these for ideas --->
http://www.openntf.org/projects/pmt.nsf/3f2929edba6ef2808625724c00585215/9fe3084cab2f38ad8625754600078af6!OpenDocument

http://www.benpoole.com/80256B44004A7C14/articles/simpledxl

To avoid some of the DXL known issues you can try to export & import in encoded binary format.

**Update

After looking at your situation a bit more closely, I think the easiest route would be to use template inheritance. So you would copy the elements from your custom template into the Mail template and make sure the elements are setup to inherit from your custom template.

水染的天色ゝ 2024-07-30 08:29:56

这听起来可以通过 DXL 实现,而且我认为您可以使用 LotusScript 和 Java 来完成它。

类似的事情应该在 Java 中完成:

public class RenderDesign extends AgentBase {
public void NotesMain() {

    try { 
        Session session = getSession();
        AgentContext agentContext = session.getAgentContext();

        DxlImporter myimporter = session.createDxlImporter();
        try {
            myimporter.setDesignImportOption(myimporter.DXLIMPORTOPTION_REPLACE_ELSE_CREATE);
            myimporter.importDxl(this.getDxl(), agentContext.getCurrentDatabase());
            } 
        catch (Exception e) {
            System.out.println(this.getDxl());
            System.out.println(myimporter.getLog());            
        }

    } catch(Exception e) {
        e.printStackTrace();
    }
}

然后只需使用 DXL 构造一个字符串。 使用工具-> DXL 实用程序 -> 导出器(或查看器)来检查要添加或编辑的设计元素:

public String getDxl(String agentname, String replicaid) {
    return "<?xml version='1.0' encoding='utf-8'?>"+
            "<view name='(auto-view)'> "+/* ... */"</view>";
}

请注意,DXL 导入器一点也不健壮且容错:您可以使开发者客户端崩溃输入是有效的 XML 且符合 DTD。 例如,尝试在字段上设置 fieldhint=""。 开发时请记住这一点。

That sounds doable with DXL, and I think you can use both LotusScript and Java to accomplish it.

Something along the lines of this should do it in Java:

public class RenderDesign extends AgentBase {
public void NotesMain() {

    try { 
        Session session = getSession();
        AgentContext agentContext = session.getAgentContext();

        DxlImporter myimporter = session.createDxlImporter();
        try {
            myimporter.setDesignImportOption(myimporter.DXLIMPORTOPTION_REPLACE_ELSE_CREATE);
            myimporter.importDxl(this.getDxl(), agentContext.getCurrentDatabase());
            } 
        catch (Exception e) {
            System.out.println(this.getDxl());
            System.out.println(myimporter.getLog());            
        }

    } catch(Exception e) {
        e.printStackTrace();
    }
}

Then just construct a string with the DXL. Use Tools -> DXL Utilities -> Exporter (or Viewer) to inspect the design element you want to add or edit:

public String getDxl(String agentname, String replicaid) {
    return "<?xml version='1.0' encoding='utf-8'?>"+
            "<view name='(auto-view)'> "+/* ... */"</view>";
}

Note that the DXL importer is anything but robust and error-tolerant: You can make the Developer client crash on input that is valid XML and conformant with the DTD. For example, trying to set fieldhint="" on a field. Keep this in mind while developing.

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