zoukankan      html  css  js  c++  java
  • Sharepoint 2013 通过Feature隐藏(Site Action)菜单

    不善言语,直接贴代码(也可通过js或css去隐藏),以下是各个菜单选项

    zz2_ID_PersonalInformation 我的设置
    zz3_ID_LoginAsDifferentUser 以其它用户登录  (这个是自己加上去的,为了方便测试)
    zz4_ID_Logout   注销         
    zz5_ID_PersonalizePage  对本页面进行个性化设置
    zz8_MenuItem_ShareThisSite 共享
    zz9_MenuItem_Create  添加应用程序  
    zz10_MenuItem_ViewAllSiteContents 网站内容
    zz11_MenuItem_Settings 网站设置
    ctl00_ctl46_SiteActionsMenuMain_ctl00_wsaCreatePage 添加页
    ctl00_ctl46_SiteActionsMenuMain_ctl00_wsaDesignEditor 设计管理器
    ctl00_ctl46_SiteActionsMenuMain_ctl00_wsaEditPage
    ctl00_ctl46_SiteActionsMenuMain_ctl00_wsaShowMenu 显示功能区
    ctl00_SiteActionsMenuMain_ctl00_ctl00 入门

    <?xml version="1.0" encoding="utf-8"?>
    <Elements xmlns="http://schemas.microsoft.com/sharepoint/">
      <CustomAction
       Location="ScriptLink"
      ScriptBlock="                       
                function loadjQueryScripts(src) {          
                          
                          var head = document.getElementsByTagName('head')[0];          
                          var script = document.createElement('script');          
                          script.type = 'text/javascript';           
                          script.src = src;           
                          head.appendChild(script);  
                }                   
               function hideSiteActions() {
                var menuItems = document.getElementsByTagName('ie:menuitem');
                    for (var key in menuItems)
                    {
                    
                       if(key.endsWith('PersonalInformation'))
                          {
                              menuItems[key].parentNode.removeChild(menuItems[key]);
                          }                     
                    }
                    
    
              }
              _spBodyOnLoadFunctionNames.push('hideSiteActions');
    "
       Sequence="10001">
      </CustomAction>
    </Elements>

    比如我们需要隐藏网站内容: key.endsWith('ViewAllSiteContents') 即可。

  • 相关阅读:
    微服务Kong(三)——添加一个API
    微服务Kong(二)——快速入门
    Oracle 12c 创建用户
    汉字转拼音工具
    GITHUB一个新的项目发布
    Log4J 配置文件模板及代码说明
    Log4J2 配置文件模板及代码说明
    java 写入数据到Excel文件中_Demo
    关于数据库NULL值的几个问题思考
    详解Spring中的Profile
  • 原文地址:https://www.cnblogs.com/gaoxingstyle/p/3523690.html
Copyright © 2011-2022 走看看