【用javascript自定义SharePoint文档库/列表项菜单】新版代码


<script language="javascript">
function Custom_AddDocLibMenuItems(m, ctx)
{
    strDisplayText 
= "我的菜单";
    
var rootMenu = CASubM(m,strDisplayText,"","",500);

    
var itemId = GetAttributeFromItemTable(itemTable, "ItemId""Id");//获取列表项ID
    var listId = ctx.listName;//获取列表ID


    strDisplayText 
= "我的菜单还是我的菜单";
    strAction 
= "STSNavigate('http://www.cnblogs.com')";
    strImagePath
=ctx.imagesPath+"oisweb.gif";
    menuOption 
= CAMOpt(rootMenu,strDisplayText,strAction,strImagePath);
    menuOption.id 
= "ID_MySubMenu";
    
return false;
}
</script>


 

function Custom_AddDocLibMenuItems(m, ctx) {
    
var otype = currentItemFSObjType = GetAttributeFromItemTable(itemTable, "OType""FSObjType");
    
if (otype != 1) {
        
var itemId = GetAttributeFromItemTable(itemTable, "ItemId""Id");
        
var listId = ctx.listName;

        
var action = 'Go_To_Page("' + ctx.HttpRoot + '/_layouts/custom/PAGES/mycustompage.aspx?ListId=' + listId + '&ListItemID=' + itemId + ');';
        CAMOpt(m, 
'Custom Menu Item', action, '/_layouts/custom/IMAGES/action.gif'''110);
        CAMSep(m);
    }
    
return false;
}

function Go_To_Page(page) {
    window.location 
= page;
}

 

借鉴:Order of SPDocumentLibrary menu items using Custom_AddDocLibMenuItems

 

Custom sharepoint list item action 

 

 

posted @ 2009-11-12 23:33  Glife  阅读(333)  评论(0)    收藏  举报