SharePoint 2010 WebPart 个性化布局

发布于 2024-11-30 09:50:34 字数 952 浏览 1 评论 0 原文

我在内联网上有一个主页。它有超过 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>

不幸的是它不起作用。有什么想法吗?

我也会对“停止编辑”按钮执行相同的操作。

I have a homepage on an Intranet. It has at 15+ webparts (news, weather, etc.) I want to allow the users to customize the page by moving the webparts around or deleting them. At present I don't let them see the ribbon at the top so they don't have access to the "Edit page" button. I have pulled it out from the Ribbon

<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>

Unfortunately it is not working. Any thoughts?

I will be doing the same with the "Stop Editing" button as well.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

手长情犹 2024-12-07 09:50:34

根据这篇文章: http://artykul8.com/2011/03/useful-sharepoint -快捷方式/
诀窍是使用 MSOLayout_ToggleLayoutMode(); javascript 函数。

根据同一页面中的评论,在 SP2010 中,该 javascript 函数仅当页面中已有 Web 部件时才可用。 我观察到的行为与此不同,因为对我来说,此功能仅在页面已处于编辑模式时才起作用(即使页面没有添加 Web 部件,它也能起作用)。

我能够找到定义该函数的 javascript 文件,即 ie55up.js。您可以通过执行以下操作将其加载到母版页中:

<SharePoint:ScriptLink language="javascript" name="ie55up.js" OnDemand="false" runat="server" />

有关如何构建使用该 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:

<SharePoint:ScriptLink language="javascript" name="ie55up.js" OnDemand="false" runat="server" />

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

同尘 2024-12-07 09:50:34

我终于找到了这个问题的答案。确定了JS调用之后就很简单了。我相信这应该仅适用于 Web 部件页面。

通过 Javascript 调用将页面置于个性化编辑模式:

ChangeLayoutMode(true); // how simple is that??

通过 Javascript 调用停止页面编辑:

MSOLayout_ToggleLayoutMode(); // same as given in the other post

我相信“停止”编辑模式对于所有页面都是相同的,无论是否它是个性化页面、所有 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:

ChangeLayoutMode(true); // how simple is that??

To stop the editing of the page via a Javascript call:

MSOLayout_ToggleLayoutMode(); // same as given in the other post

The "Stop" edit mode I believe is the same for all pages no matter if it's a personalized page, all webparts page, etc.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文