Jquery 如何在web浏览器(HTML)中显示对话框列表,以便用户可以从Lotus Notes中的通讯簿中选择信息

Jquery 如何在web浏览器(HTML)中显示对话框列表,以便用户可以从Lotus Notes中的通讯簿中选择信息,jquery,lotus-notes,lotus-domino,lotusscript,agent,Jquery,Lotus Notes,Lotus Domino,Lotusscript,Agent,在此之前,我要问一个问题,如何在中通过web浏览器显示通讯簿。然后,我找到了一个代理,它可以运行并查找地址簿中的所有信息。但我现在的问题是,我不知道如何显示对话框列表,以便用户可以选择任何信息 我的代理人如下: books = s.AddressBooks foundflag = False ForAll b In books If b.FileName="names.nsf" Then Call b.Open( "", "" ) Set view = b

在此之前,我要问一个问题,如何在中通过web浏览器显示通讯簿。然后,我找到了一个代理,它可以运行并查找地址簿中的所有信息。但我现在的问题是,我不知道如何显示对话框列表,以便用户可以选择任何信息

我的代理人如下:

books = s.AddressBooks
foundflag = False
ForAll b In books
    If b.FileName="names.nsf" Then
        Call b.Open( "", "" )
        Set view = b.GetView( "People" )
        Call view.Refresh
        foundflag = True
        Exit ForAll
    End If
End ForAll

If Not foundflag Then
    returnVal = "NSF file not found."
    GoTo endp
End If

count = 0
Set tmpdoc = view.GetFirstDocument
Do While Not tmpdoc Is Nothing
    If tmpdoc.MailFile(0) <> "" _
    And tmpdoc.MailAddress(0) = "" _
    And tmpdoc.InternetAddress(0)<>"" Then
        count = count + 1
        tmpstr = tmpdoc.LastName(0)
        If tmpstr="" Then tmpstr = tmpdoc.FirstName(0)
        tmplist(count) = tmpstr & "|@|" & tmpdoc.InternetAddress(0)
    End If
    Set tmpdoc = view.GetNextDocument(tmpdoc)
Loop

If count=0 Then
    returnVal = "No employee were found"
    GoTo endp
End If
$.post("http://server/pcspec.nsf/jsonEmpList?OpenAgent",
    function(data, status) {
        var arr = JSON.parse(data);
        if (arr.status == "success") {
            $(arr.items).each(function(i, item) {
                $("#PUserID").append('<option value="' + item.mail + '">' + item.name + ' (' + item.mail + ')</option>');
            });
        } else {
            alert(arr.message);
        }
    })
    .fail(function(xhr, status, error) {
        console.log("ERROR - " + xhr + " - " + status + " - " + error);
    })
我的jQuery可以调用这个代理,但我不知道如何用HTML显示列表。我的jQuery如下所示:

books = s.AddressBooks
foundflag = False
ForAll b In books
    If b.FileName="names.nsf" Then
        Call b.Open( "", "" )
        Set view = b.GetView( "People" )
        Call view.Refresh
        foundflag = True
        Exit ForAll
    End If
End ForAll

If Not foundflag Then
    returnVal = "NSF file not found."
    GoTo endp
End If

count = 0
Set tmpdoc = view.GetFirstDocument
Do While Not tmpdoc Is Nothing
    If tmpdoc.MailFile(0) <> "" _
    And tmpdoc.MailAddress(0) = "" _
    And tmpdoc.InternetAddress(0)<>"" Then
        count = count + 1
        tmpstr = tmpdoc.LastName(0)
        If tmpstr="" Then tmpstr = tmpdoc.FirstName(0)
        tmplist(count) = tmpstr & "|@|" & tmpdoc.InternetAddress(0)
    End If
    Set tmpdoc = view.GetNextDocument(tmpdoc)
Loop

If count=0 Then
    returnVal = "No employee were found"
    GoTo endp
End If
$.post("http://server/pcspec.nsf/jsonEmpList?OpenAgent",
    function(data, status) {
        var arr = JSON.parse(data);
        if (arr.status == "success") {
            $(arr.items).each(function(i, item) {
                $("#PUserID").append('<option value="' + item.mail + '">' + item.name + ' (' + item.mail + ')</option>');
            });
        } else {
            alert(arr.message);
        }
    })
    .fail(function(xhr, status, error) {
        console.log("ERROR - " + xhr + " - " + status + " - " + error);
    })

所以我的问题是,如何在web浏览器中提示对话框列表供用户选择。任何帮助都将不胜感激。谢谢大家!

如果您问我如何从代理向jQuery获取信息,答案是PRINT语句。我发现你在使用通讯录时出错,所以我硬编码了公共通讯录的名字。但是这个片段将返回一个JSON对象。当然,您需要声明适当的变量并相应地设置服务器名称

Set db = s.getDatabase("server/document","names.nsf",False)
If db Is nothing Then
    print "ERROR: Names.nsf not found</br>"
    exit sub
End If
Set view=db.getView("People")
Set tmpdoc = view.GetFirstDocument
Do While Not tmpdoc Is Nothing
    If tmpdoc.MailFile(0) <> "" _
    And tmpdoc.MailAddress(0) = "" _
    And tmpdoc.InternetAddress(0)<>"" Then
        tmpStr = ToJSON(tmpdoc)
        Print tmpStr + "<br />"
    End If
    Set tmpdoc = view.GetNextDocument(tmpdoc)
Loop

今晚早些时候我也在做类似的事情。但我的方法有些不同。在我的例子中,我使用下拉字段的插件,用户从列表中选择一个人

//初始化选择2下拉列表 $'[data dropdown=names]'。选择2{ allowClear:是的, 主题:“引导”, 宽度:“100%”, 研究的最小结果:20, 最小输入长度:3, 延误:450, 阿贾克斯:{ url:/agents/getContactList.json?OpenAgent, 数据类型:json, 数据:functionparams{ 变量查询={ 术语:params.term }; 返回查询; } } }; 联系人姓名
您不能只使用带有use formula for choices的Domino字段对话框列表字段,并使用公式@DbColumn:;服务器/域:names.nsf;人2.这对您的应用程序不起作用?第三种选择是在通讯簿中添加一个视图,该视图中的所有姓名记录都已用JSON格式化,甚至可以使用选择列表所需的HTML格式,然后只需进行一次访问。您好@Duston,我可以显示为您的答案,但它只显示names.nsf中的所有姓名。我希望能够选择。另外,我尝试您在@DbColumn:的评论中提出的建议;服务器/域:names.nsf;人2,但什么也没发生。对了,我的答案没有将项目放入列表框,您必须在jQuery中这样做。但是您的jQuery需要JSON回复,我的代码是JSON回复。您可以从那里获取它。WRT@DbColumn。。您是否为服务器名称和通讯簿输入了值,还是只是复制/粘贴了我的代码?不,我不是复制和粘贴。我写了类似于@DbColumn的东西:;www.me.com.my:names.nsf;人2.是否有遗漏的内容?服务器名称是Notes客户端或服务器所知道的服务器名称,而不是浏览器名称。域是Notes域,而不是DNS域。只要地址簿被命名为Names.nsf,就不能保证这一部分是正确的。嗨,卡尔,谢谢你。我会期待的。我得到解决方案后会回来的。谢谢你好@Karl,我昨天忘了问你了。您说过您在自己的类中使用URL查询字符串解析和JSON生成。此外,我仍在使用Domino9,因此没有任何内置类。我只是想知道在哪里可以得到URL和JSON类?另一个问题是,在jQuery中使用data dropdown=names,我真的不知道如何在jQuery和select之间集成。如果你给我发电子邮件,我可以给你发一封包含最新版本的.NSF。所有信息都在我的个人资料中。嗨@Karl,我执行了你的建议答案,但我仍然无法显示names.nsf中的名称。我还包括了你的URL和JSON类,但它仍然只是一个空白下拉列表。你验证过代理返回正确的JSON负载了吗?您修改了代理以指向your names.nsf和正确格式的视图?在我的示例中,视图中的第一列根据联系人的类型进行分类,然后是一个隐藏列,其中姓氏已排序,接下来是用作选项id的联系人的UNID,然后在第3列中,列计数从0开始。我在下拉列表中有要显示的名称。我在回复中插入了视图的屏幕截图。