MOSS 2013研究系列---隐藏Ribbon
2024-08-25 14:33:52
我们在开发Sharepoint 2013 的时候,常常需要隐藏Ribbon,那个Ribbon是属于Office的特征,但是我们做门户的时候,大家都不希望看见到它,但是我们又离不开它,以管理的身份进行设计列表或文档库的时候,必须需要它,没有它的话,很多功能就无法实现了。基于以上背景需求,我们可以利用母版页里面的SPSecurityTrimmedControl控件,它的用途就是识别当前用户在网站的角色,有了它就比较好办了,我们找到Ribbon 的样式class,在自己的样式表中,我们隐藏掉它,当是管理员角色登录的时候,我们就显示出Ribbon,如下代码:
<!--MS:<SharePoint:SPSecurityTrimmedControl runat="server" AuthenticationRestrictions="AuthenticatedUsersOnly" Permissions="AddAndCustomizePages">-->
<script type="text/javascript">
document.getElementById("s4-ribbonrow").style.display = "block";
document.getElementById("suiteBar").style.display = "block"; </script>
<!--ME:</SharePoint:SPSecurityTrimmedControl>-->
如此简单就解决了,其实还有好几个办法也能实现。
Javascript的实现方案:
function ShowRibbon() { $("#s4-ribbonrow").show(); $("#s4-workspace").height($(document).height() - $("#s4-ribbonrow").height() * ); } function HideRibbon() { $("#s4-ribbonrow").hide(); var newHeight = $(document).height(); if ($.browser.msie) {newHeight = newHeight - ; } $("#s4-workspace").height(newHeight); } _spBodyOnLoadFunctionNames.push("HideRibbon");
封装好JS文件,然后用VS开发工具,打包成解决方案包,直接部署就OK了。
最新文章
- Singleton(单例模式)
- python远程连接paramiko 模块和堡垒机实现
- Springfox Reference Documentation
- Oracle的数据恢复——Flashback用法汇总
- [C语言](二)01 获取Windows图形构件大小信息
- Jabber/XMPP协议与架构
- git 基础命令
- CSS 布局Float 【2】
- [LeetCode 114] - 将树平面化为链表(Flatten Binary Tree to Linked List)
- 动态绑定ReportViewer控件之经验总结
- 实现table中checkbox复选框、以及判断checked是否被选中、js操作checkedbox选中
- java实现https请求
- Go:学习笔记兼吐槽(1)
- 潭州课堂25班:Ph201805201 tornado 项目 第九课 深入应用 WebSockets(课堂笔记)
- 深入理解JVM(七)JVM类加载机制
- SVN与资源库同步后动作的字母意义
- Think Python 2E中译本 _site
- 国内混合APP开发技术选型
- laravel 前后端分离 token
- GIT 分布式版本控制系统的简单使用介绍
热门文章
- [转载]Java导出Excel
- MVC和EF中的 Model First 和 Code First
- UITextField点击选中文字
- The program environment for cypress cy8ckit-002
- 【SQL查询】分区查询Over
- Caused by: java.lang.AbstractMethodError: org.hibernate.validator.internal.engine.ConfigurationImpl
- 怎么样在python 3.6里安装tensorflow?
- js `` 手机不支持
- Swift 发送邮件和发短信
- swift实现label换行