SharePoint 2010 WebPart 个性化布局
我在内联网上有一个主页。它有超过 15 个 Web 部件(新闻、天气等)。我希望允许用户通过移动 Web 部件或删除它们来自定义页面。目前,我不允许他们看到顶部的功能区,因此他们无法访问“编辑页面”按钮。我已将其从功能区中取出,
<a unselectable="on" href="javascript:;" onclick="return false;" class="ms-cui-ctl-large" aria-describedby="Ribbon.WebPartPage.Edit.Edit.Menu.Actions.Edit_ToolTip" mscui:controltype="Button" role="button" style="height: auto;" id="Ribbon.WebPartPage.Edit.Edit-SelectedItem">
<span unselectable="on" class="ms-cui-ctl-largeIconContainer">
<span unselectable="on" class=" ms-cui-img-32by32 ms-cui-img-cont-float">
<img unselectable="on" alt="" src="/_layouts/1033/images/formatmap32x32.png" style="top: -160px; left: -96px;">
</span>
</span>
<span unselectable="on" class="ms-cui-ctl-largelabel" style="height: auto;">Edit<span unselectable="on">
</span>Page</span>
</a>
不幸的是它不起作用。有什么想法吗?
我也会对“停止编辑”按钮执行相同的操作。
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
根据这篇文章: http://artykul8.com/2011/03/useful-sharepoint -快捷方式/
诀窍是使用
MSOLayout_ToggleLayoutMode();
javascript 函数。根据同一页面中的评论,在 SP2010 中,该 javascript 函数仅当页面中已有 Web 部件时才可用。 我观察到的行为与此不同,因为对我来说,此功能仅在页面已处于编辑模式时才起作用(即使页面没有添加 Web 部件,它也能起作用)。
我能够找到定义该函数的 javascript 文件,即 ie55up.js。您可以通过执行以下操作将其加载到母版页中:
有关如何构建使用该 javascript 函数的 Web 控件的信息,请参阅此处:http://www.codeproject.com/KB/sharepoint/SwitchWPMode.aspx
希望这有帮助
According to this post: http://artykul8.com/2011/03/useful-sharepoint-shortcuts/
the trick is to use the
MSOLayout_ToggleLayoutMode();
javascript function.According to a comment in that same page, in SP2010, that javascript function is only available when you already have a web part in the page. The behavior I observed differs from this one, given that, to me, this function only worked when the page was in edit mode already (and it worked even when the page had no web part added).
I was able to find the javascript file where that function is defined, which is the ie55up.js. You can load it in your masterpage by doing:
For information about how to build a web control that uses that javascript function, see here: http://www.codeproject.com/KB/sharepoint/SwitchWPMode.aspx
Hope this helps
我终于找到了这个问题的答案。确定了JS调用之后就很简单了。我相信这应该仅适用于 Web 部件页面。
通过 Javascript 调用将页面置于个性化编辑模式:
通过 Javascript 调用停止页面编辑:
我相信“停止”编辑模式对于所有页面都是相同的,无论是否它是个性化页面、所有 Web 部件页面等。
I finally found the answer to this question. It was very simple after the JS call was determined. I believe this should be for a webpart only page.
To put the page in edit mode for Personalization via a Javascript call:
To stop the editing of the page via a Javascript call:
The "Stop" edit mode I believe is the same for all pages no matter if it's a personalized page, all webparts page, etc.