首页 > 其他 > 详细

SharePoint 2007 (MOSS/WSS) - how to remove "Download a Copy" context menu from a Document Library

时间:2015-10-30 14:00:25      阅读:273      评论:0      收藏:0      [点我收藏+]

One of my friend and colleague asked me this question. I found it tricky and a good post for my blog. Here is what you have to do:

Go to your 12 hive\TEMPLATE\LAYOUTS\1033 folder. Open up the Core.js file. Find the function AddSendSubMenu. Go to the last 3 lines:

strAction = "STSNavigate(‘" + ctx.HttpRoot + "/_layouts/download.aspx?" + "SourceUrl=" + currentItemEscapedFileUrl + "&Source=" + GetSource() + "&FldUrl=" + escapeProperly(ctx.SendToLocationUrl) + "‘)"; ;
 menuOption = CAMOpt(sm, L_DownloadACopy_Text, strAction, "");
 menuOption.id = "ID_DownloadACopy";

Now if you want to remove "Download a Copy" option from all the document libraries then comment all three lines.

If you want to remove it for some custom List Definition that you have created you may do like:

if(ctx.listTemplate !=10001)
{
           
strAction = "STSNavigate(‘" + ctx.HttpRoot + "/_layouts/download.aspx?" + "SourceUrl=" + currentItemEscapedFileUrl + "&Source=" + GetSource() + "&FldUrl=" + escapeProperly(ctx.SendToLocationUrl) + "‘)"; ;
 menuOption = CAMOpt(sm, L_DownloadACopy_Text, strAction, "");
 menuOption.id = "ID_DownloadACopy";
}

Where 10001 was your custom list template id.

If you want to do it for a specific Document Library then you would do like this:

if(ctx.listName !="{28958B49-8C76-4987-815C-CF5A107FF522}")
{
           
strAction = "STSNavigate(‘" + ctx.HttpRoot + "/_layouts/download.aspx?" + "SourceUrl=" + currentItemEscapedFileUrl + "&Source=" + GetSource() + "&FldUrl=" + escapeProperly(ctx.SendToLocationUrl) + "‘)"; ;
 menuOption = CAMOpt(sm, L_DownloadACopy_Text, strAction, "");
 menuOption.id = "ID_DownloadACopy";
}

As you can see you have to pass the list GUID as listName.

SharePoint 2007 (MOSS/WSS) - how to remove "Download a Copy" context menu from a Document Library

原文:http://www.cnblogs.com/ricky_li/p/4923065.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!