Domino中B/S下的附件鏈接

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

二、可刪除鏈接
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>]";"")


但是,當附件的名稱中包含“#”、“&”等特殊符號時(例如jeep#beijing.jpg),上面寫的鏈接在特殊符號處就會被截斷,從而導致附件不能正常打開。要解決這個問題,需要在寫鏈接的時候把這些特殊符號進行轉換,具體方法如下:
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>]";"")

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章