Question

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.

Was it helpful?

Solution 2

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.

OTHER TIPS

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top