首先在视图或文件夹中增设一列,列值为
unid:=@Text(@DocumentUniqueID);
"[<input type=\"checkbox\" id=\"kk\" name=\"Delete\" value=\"" + unid + "\">]"
将视图嵌入表单view template for ($Inbox)中,在表单中作一个删除按钮,在其onclick事件中调用函数delete1(),在表单的JS header中写JS:
function Delete1()
{
ttt='';
num=document.forms[0].kk.length;
for (var i=0;i<num;i<i++)
{
var e = document.all.Delete[i];
if (e.checked)
ttt=ttt+e.value+";";
}
if (ttt=="")
{
var e = document.all.Delete;
if (e.checked)
ttt=e.value+";";
}
if (ttt!="")
{
sss='del1agent?openagent&'+ttt;
window.location.href=sss;
}
else
{
alert('您还没有选择文件!');
}
return true;
}
最后在代理del1agent中写LS:
Sub Initialize
REM 删除视图中被选中的文档
Dim session As New NotesSession
Dim db As NotesDatabase
Dim doc As NotesDocument
Dim docToDelete As NotesDocument
Dim unid As String
Set db = session.CurrentDatabase
Set doc = session.DocumentContext
Dim tempstr As String
Dim curid As String
tempstr=Strright(doc.Query_String(0),"&")
curid=Strleft(tempstr,";")
tempstr=Strright(tempstr,";")
Dim agentlog As New noteslog("Agent log")
Call agentlog.openagentlog
Call agentlog.logaction("start")
Call agentlog.logaction(doc.Query_String(0))
kk:
If curid<>"" Then
Call agentlog.logaction("curid_"+curid)
Call agentlog.logaction("tempstr_"+tempstr)
Set docToDelete = db.GetDocumentByUNID(curid)
Call agentlog.logaction("step1")
Call docToDelete.RemoveFromFolder("($Inbox)")
Call agentlog.logaction("step2")
Call docToDelete.save(True,False)
curid=Strleft(tempstr,";")
tempstr=Strright(tempstr,";")
Goto kk
End If