domino如何隐藏上传的附件


原因:Domino表单上传附件后会在表单最下面显示一个丑丑的table,table里显示的附件信息,显示这个不要紧,严重影响了页面的排版、布局。


解决办法:


在表单上添加一个域:$V2AttachmentOptions,设置默认值:"0",从而隐藏系统默认的附件链接,然后自己写附件的链接。
域:$V2AttachmentOptions
类型:文本 显示时计算
默认值:"0"


Jquery方法:
$(document).ready(function(){
var table_clone = $("table:has(img[alt])").clone();
$("table:has(img[alt])").css({"display":"none"});
$("#attachinfo").append(table_clone);
});


此方法还不够严谨,我还在寻找另外的方法。


自己写链接的公式如下(转自网络):


一、只读情况下的链接


CODE:
thisDb:=@ReplaceSubstring(@ReplaceSubstring(@Subset(@DbName;-1);" ";"+");"\\";"/");
@If(@Attachments!=0;"[<a href=\"/"+thisDb+"/0/"+@Text(@DocumentUniqueID)+"/$FILE/"+@AttachmentNames+"\" target=\"_blank\">"+@AttachmentNames+"</a>]";"")


二、包含选择框供用户删除时的链接


CODE:
thisDb:=@ReplaceSubstring(@ReplaceSubstring(@Subset(@DbName;-1);" ";"+");"\\";"/");
@If(@Attachments!=0;"[<INPUT TYPE=checkbox NAME=\"%%Detach.1\" VALUE=\""+@AttachmentNames+"\"><a href=\"/"+thisDb+"/0/"+@Text(@DocumentUniqueID)+"/$FILE/"+@AttachmentNames+"\" target=\"_blank\">"+@AttachmentNames+"</a>]";"")


但是,当附件名称中包含“#”、“&”等特殊符号时,上面写的链接在特殊符号处就会被截断,从而导致附件不能正常打开。要解决这个问题,需要在写链接的时候把这些特殊符号进行转换,具体方法如下:


CODE:
thisDb:=@ReplaceSubstring(@ReplaceSubstring(@Subset(@DbName;-1);" ";"+");"\\";"/");
aa:=@URLEncode("domino";@AttachmentNames);
@If(@Attachments!=0;"[<a href=\"/"+thisDb+"/0/"+@Text(@DocumentUniqueID)+"/$FILE/"+aa+"\" target=\"_blank\">"+@AttachmentNames+"</a>]";"")


以上方法需要建两个计算文本并且设置读写显示不显示,对以上方法进行改造。根据文章读写状态显示不同链接,读状态会显示附件图标,同时计算附件文件的长度。


CODE:
@If(
@Attachments;
@If(@IsDocBeingEdited;
@Implode("<input type=\"checkbox\" name=\"%%Detach\" value=\""+@AttachmentNames+"\">"+@AttachmentNames; "<br>");
@Implode("<a href=\"/" + DBPath + "/rsrc/" + rsrcName + "/$file/" + @AttachmentNames + "\"><img src=\"/icons/vwicn005.gif\" width=\"13\" height=\"11\" border=\"0\">" + @AttachmentNames + " (" + @Text(@Round(@AttachmentLengths/1024)) + " Kbytes) <br></a>"));"")