Sue Hernandez's Blog

May 22, 2009

MOSS – Nested Master Pages

Filed under: Master Template, MOSS — Tags: , , — Susan Hernandez @ 1:29 am

In my first post, Moss Global Custom Master Template, I explained how to create a single custom master page as a feature, and then “Staple” that feature to site definitions (such that it will automatically activate for new sites).

In this post, we’ll talk about the challenges and pitfalls of making a Parent/Child Master Template (a Nested Master Template). The reason we may wish to have a Parent/Child template arrangement is so that we can control a “fixed” area of the page (the Parent), while allowing the Administrators to customize or brand the rest of the page (the Child).

There are 2 ways of approaching this challenge – (1) have an “orphaned” Parent, where the Parent Master page only has minimal code and a placeholder for the bulk of the code; and (2) have a full set of code for both Parent and Child such that they each can stand alone. We will take the second approach.

Design
We will create a template where we can “claim” the very top and the very bottom of the page for our Parent. We will put a custom Web Part in the very top bar, and we will put some disclaimer text and some links on the bottom.

Challenges
We will notice when we create a Parent/Child that there are 2 very big problems: (1) You cannot stop anyone with the appropriate SharePoint Designer rights from unghosting (customizing) both of the master pages; and (2) If you unghost (customize) the Child Master Page (which is the whole point of the excercise), you actually have to also unghost the Parent Master Page, or you break the web site.

The Code
View the HTML code for the templates at the very bottom of the post.

  • Open your site with SharePoint Designer.
  • Open the _catalogs/masterpage folder
  • Right-click on the masterpage folder and select New –> ASPX page.
  • Rename the page YourName.master, where “YourName” is the name you wish to make your custom Parent Master page.
  • Open the YourName.master page, and copy the code in from the Parent Master code sample. Don’t forget, if you copy and paste directly from Word, you get all of Word’s formatting, so I generally copy the code to Notepad first, then copy it over to Designer.
  • Save the page. Right-click the YourName.master page and select “Set as Default Master Page”
  • Set as Default Master Page

    Set as Default Master Page

  • You will be warned that you might break the page. Select OK. (or Yes)
  • Before you do anything with the Child Master page, view the default.aspx page with this master in the browser, and ensure that it loads correctly
    Default.aspx page

    Default.aspx page

  • Here are the images for the readers/viewers in case you like that feature of the Master Page (put them in the Layouts Images folder):
    DOC XLS PDF ZIP PPT
  • Right-click on the masterpage folder and select New –> ASPX page.
  • Rename the page YourName-Child.master, where “YourName” is the same name as your Parent Master page.
  • Open the YourName-Child.master page, and copy the code in from the Child Master code sample.
  • Save the page. Right-click the YourName-Child.master page and select “Set as Custom Master Page” .

All of the code inside the “PlaceHolderMainBase” inside of the Parent gets overridden by the Child. However, we need that code there so that the page is “complete” and standalone – i.e. can function as a master by itself. As many references out there in blog-land will tell you, there are certain placeholders you need by default for the page to work, whether you’re using them or not.

Taking it a step further
OK we did all of this in SharePoint Designer, right? What if we want this to be the default for all new sites, that is where my first article comes into play. We need, however, to make some modifications to the code in the Feature Receiver.

Namely, we have to add variables for BOTH the parent and child masters, as well as to set the web.MasterUrl property to the Parent, and the web.CustomMasterUrl to the Child.

 

 

public override void FeatureActivated(SPFeatureReceiverProperties properties)
{
  try
  {
    using (SPWeb web = (SPWeb)properties.Feature.Parent)
    {
      string customURLtoUsePARENT = customizedMasterUrlPARENT;
      string customURLtoUseCHILD = customizedMasterUrlCHILD;

      //Store the old Master URL's and Custom Master URL's
      web.AllProperties["OldMasterUrl"] = web.MasterUrl;
      web.AllProperties["OldCustomMasterUrl"] = web.CustomMasterUrl;
 
      //Assign the Master URL to both properties
      web.MasterUrl = customURLtoUsePARENT;
      web.CustomMasterUrl = customURLtoUseCHILD;

      //Update the Web
      web.Update();
    }
  }
  catch { }
}

You may also wish to remove BOTH files in the FeatureDeactivating function.

Finally, instead of stapling the feature to GLOBAL, we need to specify the templates. Namely, all of them except for the Meeting Workspaces templates. This is due to a SharePoint bug where if you create a meeting workspace from a recurring Calendar event, if you try to staple a feature to the new meeting workspace site, it breaks the scripting on the page such that you cannot switch dates.

<elements xmlns="http://schemas.microsoft.com/sharepoint/">
<featuresitetemplateassociation id="F647BBF6-5277-4118-9FA8-87D3E7C2059C" templatename="STS#0">
<featuresitetemplateassociation id="F647BBF6-5277-4118-9FA8-87D3E7C2059C" templatename="STS#1">
<featuresitetemplateassociation id="F647BBF6-5277-4118-9FA8-87D3E7C2059C" templatename="STS#2">
<featuresitetemplateassociation id="F647BBF6-5277-4118-9FA8-87D3E7C2059C" templatename="WIKI#0">
<featuresitetemplateassociation id="F647BBF6-5277-4118-9FA8-87D3E7C2059C" templatename="BLOG#0">
<featuresitetemplateassociation id="F647BBF6-5277-4118-9FA8-87D3E7C2059C" templatename="BDR#0">
<featuresitetemplateassociation id="F647BBF6-5277-4118-9FA8-87D3E7C2059C" templatename="EAWF#0">
<featuresitetemplateassociation id="F647BBF6-5277-4118-9FA8-87D3E7C2059C" templatename="OFFILE#0">
<featuresitetemplateassociation id="F647BBF6-5277-4118-9FA8-87D3E7C2059C" templatename="OFFILE#1">
<featuresitetemplateassociation id="F647BBF6-5277-4118-9FA8-87D3E7C2059C" templatename="PWA#0">
<featuresitetemplateassociation id="F647BBF6-5277-4118-9FA8-87D3E7C2059C" templatename="PWS#0">
<featuresitetemplateassociation id="F647BBF6-5277-4118-9FA8-87D3E7C2059C" templatename="SPS#0">
<featuresitetemplateassociation id="F647BBF6-5277-4118-9FA8-87D3E7C2059C" templatename="SPSMSITE#0">
<featuresitetemplateassociation id="F647BBF6-5277-4118-9FA8-87D3E7C2059C" templatename="SPSTOC#0">
<featuresitetemplateassociation id="F647BBF6-5277-4118-9FA8-87D3E7C2059C" templatename="SPSTOPIC#0">
<featuresitetemplateassociation id="F647BBF6-5277-4118-9FA8-87D3E7C2059C" templatename="SPSNEWS#0">
<featuresitetemplateassociation id="F647BBF6-5277-4118-9FA8-87D3E7C2059C" templatename="SPSNHOME#0">
<featuresitetemplateassociation id="F647BBF6-5277-4118-9FA8-87D3E7C2059C" templatename="SPSSITES#0">
<featuresitetemplateassociation id="F647BBF6-5277-4118-9FA8-87D3E7C2059C" templatename="SPSBWEB#0">
<featuresitetemplateassociation id="F647BBF6-5277-4118-9FA8-87D3E7C2059C" templatename="SPSCOMMU#0">
<featuresitetemplateassociation id="F647BBF6-5277-4118-9FA8-87D3E7C2059C" templatename="SPSREPORTCENTER#0">
<featuresitetemplateassociation id="F647BBF6-5277-4118-9FA8-87D3E7C2059C" templatename="SPSPORTAL#0">
<featuresitetemplateassociation id="F647BBF6-5277-4118-9FA8-87D3E7C2059C" templatename="SRCHCEN#0">
<featuresitetemplateassociation id="F647BBF6-5277-4118-9FA8-87D3E7C2059C" templatename="PROFILES#0">
<featuresitetemplateassociation id="F647BBF6-5277-4118-9FA8-87D3E7C2059C" templatename="CMSPUBLISHING#0">
<featuresitetemplateassociation id="F647BBF6-5277-4118-9FA8-87D3E7C2059C" templatename="BLANKINTERNET#0">
<featuresitetemplateassociation id="F647BBF6-5277-4118-9FA8-87D3E7C2059C" templatename="BLANKINTERNET#1">
<featuresitetemplateassociation id="F647BBF6-5277-4118-9FA8-87D3E7C2059C" templatename="BLANKINTERNET#2">
</elements>

PARENT MASTER PAGE

<%@Master%>
<%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register Tagprefix="Utilities" Namespace="Microsoft.SharePoint.Utilities" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Import Namespace="Microsoft.SharePoint" %>
<%@ Import Namespace="Microsoft.SharePoint.ApplicationPages" %>
<%@ Register Tagprefix="WebPartPages" Namespace="Microsoft.SharePoint.WebPartPages" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register TagPrefix="wssuc" TagName="Welcome" src="~/_controltemplates/Welcome.ascx" %>
<%@ Register TagPrefix="wssuc" TagName="DesignModeConsole" src="~/_controltemplates/DesignModeConsole.ascx" %>
<HTML dir="<%$Resources:wss,multipages_direction_dir_value%>" runat="server" xmlns:o="urn:schemas-microsoft-com:office:office" __expr-val-dir="ltr">
<HEAD runat="server">
<META Content="Microsoft SharePoint">
<META Content="SharePoint.WebPartPage.Document">
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8">
<META HTTP-EQUIV="Expires" content="0">
<SharePoint:RobotsMetaTag runat="server"/>
<Title> <asp:ContentPlaceHolder runat="server" /></Title>
<SharePoint:CssLink runat="server"/>
<SharePoint:Theme runat="server"/>
<SharePoint:ScriptLink Defer="true" runat="server"/>
<SharePoint:CustomJSUrl runat="server"/>
<SharePoint:SoapDiscoveryLink runat="server"/>
<SharePoint:DelegateControl runat="server" ControlId="AdditionalPageHead" AllowMultipleControls="true"/>
<asp:ContentPlaceHolder runat="server" />
</HEAD>
<BODY scroll="yes">
<form runat="server">
<WebPartPages:SPWebPartManager runat="Server"/>
<TABLE CELLPADDING="0" CELLSPACING="0" BORDER="0" WIDTH="100%" HEIGHT="100%">
<tr><td><asp:ContentPlaceHolder runat="server">
<!-- ********************************************************
WARNING WARNING WARNING
Do not modify this master page.
********************************************************-->
<table CELLPADDING=0 CELLSPACING=0 BORDER=0 WIDTH="100%">
<tr>
<td colspan=4>
<span style="display:none">
<a href="#">
<SharePoint:EncodedLiteral runat="server" text="<%$Resources:wss,master_turnonaccessibility%>" EncodeMethod="HtmlEncode"/></a>
</span>
<A href="javascript:;" AccessKey="<%$Resources:wss,maincontent_accesskey%>" runat="server">
<SharePoint:EncodedLiteral runat="server" text="<%$Resources:wss,mainContentLink%>" EncodeMethod="HtmlEncode"/></A>
<table cellpadding=0 cellspacing=0 height=100%>
<tr>
<td style="padding-top: 2px;" height=100% valign=middle>
<div>
<span style="display:none">
<a href="#">
<SharePoint:EncodedLiteral runat="server" text="<%$Resources:wss,master_turnoffaccessibility%>" EncodeMethod="HtmlEncode"/></a>
</span>
<asp:ContentPlaceHolder runat="server">
<asp:SiteMapPath SiteMapProvider="SPSiteMapProvider" RenderCurrentNodeAsLink="true" SkipLinkText="" NodeStyle-CssClass="ms-sitemapdirectional" runat="server"/>
</asp:ContentPlaceHolder>
</div>
</td>
</tr>
</table>
<table cellpadding="0" cellspacing="0" height=100%>
<tr>
<td valign="middle" style="padding-left:3px; padding-right:6px;">
<SharePoint:DelegateControl runat="server" ControlId="GlobalSiteLink0"/>
</td>
<td valign="middle" style="padding-right:10px;">
YOUR TEXT OR WEB PART HERE
</td>
<td valign="middle">
<wssuc:Welcome runat="server" EnableViewState="false">
</wssuc:Welcome>
</td>
<td style="padding-left:1px;padding-right:3px;">|</td>
<td valign="middle">
<table cellspacing="0" cellpadding="0">
<tr>
<td>
<SharePoint:DelegateControl ControlId="GlobalSiteLink1" Scope="Farm" runat="server"/></td>
<td>
<SharePoint:DelegateControl ControlId="GlobalSiteLink2" Scope="Farm" runat="server"/></td>
</tr>
</table>
</td>
<td valign="middle">&nbsp;
<a href="javascript:TopHelpButtonClick('NavBarHelpHome')" AccessKey="<%$Resources:wss,multipages_helplink_accesskey%>" title="<%$Resources:wss,multipages_helplinkalt_text%>" runat="server"><img align='absmiddle' border=0 src="/_layouts/images/helpicon.gif" alt="<%$Resources:wss,multipages_helplinkalt_text%>" runat="server"></a>
</td>
</tr>
</table>
</td>
</tr>
</table>
</asp:ContentPlaceHolder></td></tr>
<asp:ContentPlaceHoldermso-bidi-font-weight: normal">PlaceHolderMainBase" runat="server" >
<!-- ********************************************************
The code below is overridden in the Child Master Page
********************************************************-->
<tr><td>
<table width=100% cellpadding=0 cellspacing=0 border=0><tr>
<td>
<SharePoint:SiteLogoImage LogoImageUrl="/_layouts/images/logo.jpg" runat="server"/></td>
<td width=100%>
<asp:ContentPlaceHolder runat="server">
<h1>
<SharePoint:SPLinkButton runat="server" NavigateUrl="~site/">
<SharePoint:ProjectProperty Property="Title" runat="server" />
</SharePoint:SPLinkButton>
</h1>
</asp:ContentPlaceHolder>
</td>
<td style="padding-top:8px;" valign=top>
<asp:ContentPlaceHolder runat="server">
<SharePoint:DelegateControl runat="server" ControlId="SmallSearchInputBox"/>
</asp:ContentPlaceHolder>
</td>
</tr>
</table>
</td>
</tr>
<TR>
<TD WIDTH=100%>
<asp:ContentPlaceHolder runat="server">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>
<td nowrap valign="middle"></td>
<td-banner width=99% nowrap>
<asp:ContentPlaceHolder runat="server">
<SharePoint:AspMenu
Runat="server"
DataSourceID="topSiteMap"
EnableViewState="false"
AccessKey="<%$Resources:wss,navigation_accesskey%>"
Orientation="Horizontal"
StaticDisplayLevels="2"
MaximumDynamicDisplayLevels="1"
DynamicHorizontalOffset="0"
StaticPopoutImageUrl="/_layouts/images/menudark.gif"
StaticPopoutImageTextFormatString=""
DynamicHoverStyle-BackColor="#CBE3F0"
SkipLinkText=""
StaticSubMenuIndent="0"
CssClass="ms-topNavContainer">
<StaticMenuStyle/>
<StaticMenuItemStyle CssClass="ms-topnav" ItemSpacing="0px"/>
<StaticSelectedStyle CssClass="ms-topnavselected" />
<StaticHoverStyle CssClass="ms-topNavHover" />
<DynamicMenuStyle BackColor="#F2F3F4" BorderColor="#A7B4CE" BorderWidth="1px"/>
<DynamicMenuItemStyle CssClass="ms-topNavFlyOuts"/>
<DynamicHoverStyle CssClass="ms-topNavFlyOutsHover"/>
<DynamicSelectedStyle CssClass="ms-topNavFlyOutsSelected"/>
</SharePoint:AspMenu>
<SharePoint:DelegateControl runat="server" ControlId="TopNavigationDataSource">
<Template_Controls>
<asp:SiteMapDataSource
ShowStartingNode="False"
SiteMapProvider="SPNavigationProvider"
runat="server"
StartingNodeUrl="sid:1002"/>
</Template_Controls>
</SharePoint:DelegateControl>
</asp:ContentPlaceHolder>
</td>
<td-banner>&nbsp;&nbsp;</td>
<td valign=bottom align=right style="position:relative;bottom:0;left:0;">
<table cellpadding=0 cellspacing=0 border=0>
<tr>
<td>
<table height=100% cellpadding=0 cellspacing=0>
<tr>
<td>
<SharePoint:SiteActions runat="server" AccessKey="<%$Resources:wss,tb_SiteActions_AK%>"
PrefixHtml="&lt;div&gt;&lt;div&gt;"
SuffixHtml="&lt;/div&gt;&lt;/div&gt;"
MenuNotVisibleHtml="&amp;nbsp;">
<CustomTemplate>
<SharePoint:FeatureMenuTemplate runat="server"
FeatureScope="Site"
Location="Microsoft.SharePoint.StandardMenu"
GroupId="SiteActions"
UseShortId="true"
>
<SharePoint:MenuItemTemplate runat="server"
Text="<%$Resources:wss,viewlsts_pagetitle_create%>"
Description="<%$Resources:wss,siteactions_createdescription%>"
ImageUrl="/_layouts/images/Actionscreate.gif"
MenuGroupId="100"
Sequence="100"
UseShortId="true"
ClientOnClickNavigateUrl="~site/_layouts/create.aspx"
PermissionsString="ManageLists, ManageSubwebs"
PermissionMode="Any" />
<SharePoint:MenuItemTemplate runat="server"
Text="<%$Resources:wss,siteactions_editpage%>"
Description="<%$Resources:wss,siteactions_editpagedescription%>"
ImageUrl="/_layouts/images/ActionsEditPage.gif"
MenuGroupId="100"
Sequence="200"
ClientOnClickNavigateUrl="javascript:MSOLayout_ChangeLayoutMode(false);"
/>
<SharePoint:MenuItemTemplate runat="server"
Text="<%$Resources:wss,settings_pagetitle%>"
Description="<%$Resources:wss,siteactions_sitesettingsdescription%>"
ImageUrl="/_layouts/images/ActionsSettings.gif"
MenuGroupId="100"
Sequence="300"
UseShortId="true"
ClientOnClickNavigateUrl="~site/_layouts/settings.aspx"
PermissionsString="EnumeratePermissions,ManageWeb,ManageSubwebs,AddAndCustomizePages,ApplyThemeAndBorder,ManageAlerts,ManageLists,ViewUsageData"
PermissionMode="Any" />
</SharePoint:FeatureMenuTemplate>
</CustomTemplate>
</SharePoint:SiteActions>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</asp:ContentPlaceHolder>
</TD>
</TR>
<asp:ContentPlaceHolder runat="server">
<wssuc:DesignModeConsole runat="server"/>
</asp:ContentPlaceHolder>
<asp:ContentPlaceHolder runat="server">
<SharePoint:DelegateControl runat="server" ControlId="PublishingConsole"
PrefixHtml="&lt;tr&gt;&lt;td colspan=&quot;4&quot; id=&quot;mpdmconsole&quot; class=&quot;ms-consolemptablerow&quot;&gt;"
SuffixHtml="&lt;/td&gt;&lt;/tr&gt;">
</SharePoint:DelegateControl>
</asp:ContentPlaceHolder>
<TR height="100%"><TD><TABLE width="100%" height="100%" cellspacing="0" cellpadding="0">
<tr>
<td valign="middle" nowrap><div style="height:100%"><asp:ContentPlaceHolder runat="server"/></div></td>
<td>
<asp:ContentPlaceHolder runat="server">
<div><IMG SRC="/_layouts/images/blank.gif" width=1 height=100% alt=""></div>
</asp:ContentPlaceHolder>
</td>
<td valign=top class='ms-pagetitleareaframe' nowrap>
<table cellpadding=0 cellspacing=0 width=100% border="0">
<tr>
<td valign="top">
<asp:ContentPlaceHolder runat="server">
<asp:SiteMapPath SiteMapProvider="SPContentMapProvider" SkipLinkText="" NodeStyle-CssClass="ms-sitemapdirectional" runat="server"/> &nbsp;
</asp:ContentPlaceHolder>
</td>
</tr>
<tr>
<td height=100% valign=top>
<h2>
<asp:ContentPlaceHolder runat="server" />
</h2>
</td>
</tr>
</table>
</td>
<td>
<asp:ContentPlaceHolder runat="server"/>
<asp:ContentPlaceHolder runat="server">
<div style='height:100%'><IMG SRC="/_layouts/images/blank.gif" width=1 height=1 alt=""></div>
</asp:ContentPlaceHolder></td>
</tr>
<asp:ContentPlaceHolder runat="server"/>
<TR>
<TD valign=top height=100%>
<table-nav width=100% height=100% cellpadding=0 cellspacing=0>
<tr>
<td>
<TABLE height="100%"-navframe CELLPADDING=0 CELLSPACING=0 border="0">
<tr valign="top">
<td width="4px"><IMG SRC="/_layouts/images/blank.gif" width=4 height=1 alt=""></td>
<td valign="top" width="100%">
<asp:ContentPlaceHolder runat="server" />
<asp:ContentPlaceHolder runat="server" />
<asp:ContentPlaceHolder runat="server"/>
<asp:ContentPlaceHolder runat="server">
<div>
<div style="width:100%">
<h3><label>
<SharePoint:EncodedLiteral runat="server" text="<%$Resources:wss,quiklnch_pagetitle%>" EncodeMethod="HtmlEncode"/></label>
<Sharepoint:SPSecurityTrimmedControl runat="server" PermissionsString="ViewFormPages">
<div><SharePoint:SPLinkButton runat="server" NavigateUrl="~site/_layouts/viewlsts.aspx" Text="<%$Resources:wss,quiklnch_allcontent%>" AccessKey="<%$Resources:wss,quiklnch_allcontent_AK%>"/></div>
</SharePoint:SPSecurityTrimmedControl>
</h3>
<Sharepoint:SPNavigationManager
runat="server"
QuickLaunchControlId="QuickLaunchMenu"
ContainedControl="QuickLaunch"
EnableViewState="false">
<div>
<SharePoint:DelegateControl runat="server"
ControlId="QuickLaunchDataSource">
<Template_Controls>
<asp:SiteMapDataSource
SiteMapProvider="SPNavigationProvider"
ShowStartingNode="False"
StartingNodeUrl="sid:1025"
runat="server"
/>
</Template_Controls>
</SharePoint:DelegateControl>
<SharePoint:AspMenu
DataSourceId="QuickLaunchSiteMap"
runat="server"
Orientation="Vertical"
StaticDisplayLevels="2"
ItemWrap="true"
MaximumDynamicDisplayLevels="0"
StaticSubMenuIndent="0"
SkipLinkText=""
>
<LevelMenuItemStyles>
<asp:MenuItemStyle CssClass="ms-navheader"/>
<asp:MenuItemStyle CssClass="ms-navitem"/>
</LevelMenuItemStyles>
<LevelSubMenuStyles>
<asp:SubMenuStyle CssClass="ms-navSubMenu1"/>
<asp:SubMenuStyle CssClass="ms-navSubMenu2"/>
</LevelSubMenuStyles>
<LevelSelectedStyles>
<asp:MenuItemStyle CssClass="ms-selectednavheader"/>
<asp:MenuItemStyle CssClass="ms-selectednav"/>
</LevelSelectedStyles>
</SharePoint:AspMenu>
</div>
</Sharepoint:SPNavigationManager>
<Sharepoint:SPNavigationManager
runat="server"
ContainedControl="TreeView">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td>
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td nowrap>
<SharePoint:SPLinkButton runat="server" NavigateUrl="~site/_layouts/viewlsts.aspx" Text="<%$Resources:wss,treeview_header%>" AccessKey="<%$Resources:wss,quiklnch_allcontent_AK%>"/>
</td>
</tr>
</table>
</td>
</tr>
</table>
<div>
<SharePoint:SPHierarchyDataSourceControl
runat="server"
RootContextObject="Web"
IncludeDiscussionFolders="true"
/>
<SharePoint:SPRememberScroll runat="server" Style="overflow: auto;height: 400px;width: 150px; ">
<Sharepoint:SPTreeView
id="WebTreeView"
runat="server"
ShowLines="false"
DataSourceId="TreeViewDataSource"
ExpandDepth="0"
SelectedNodeStyle-CssClass="ms-tvselected"
NodeStyle-CssClass="ms-navitem"
NodeStyle-HorizontalPadding="2"
SkipLinkText=""
NodeIndent="12"
ExpandImageUrl="/_layouts/images/tvplus.gif"
CollapseImageUrl="/_layouts/images/tvminus.gif"
NoExpandImageUrl="/_layouts/images/tvblank.gif"
>
</Sharepoint:SPTreeView>
</Sharepoint:SPRememberScroll>
</div>
</Sharepoint:SPNavigationManager>
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr><td>
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr><td nowrap>
<SharePoint:SPLinkButton runat="server" NavigateUrl="~site/_layouts/recyclebin.aspx" ImageUrl="/_layouts/images/recycbin.gif" Text="<%$Resources:wss,StsDefault_RecycleBin%>" PermissionsString="DeleteListItems"/>
</td></tr>
</table>
</td></tr></table>
</div>
</div>
</asp:ContentPlaceHolder>
<asp:ContentPlaceHolder runat="server"></asp:ContentPlaceHolder>
</td>
</tr>
<tr><td colspan=2><asp:ContentPlaceHolder runat="server"><IMG SRC="/_layouts/images/blank.gif" width=138 height=1 alt=""></asp:ContentPlaceholder></td></tr>
</TABLE></td><td><asp:ContentPlaceHolder runat="server"></asp:ContentPlaceHolder></td>
</tr></table></TD>
<td><asp:ContentPlaceHolder runat="server"><div><IMG SRC="/_layouts/images/blank.gif" width=10 height=1 alt=""></div></asp:ContentPlaceHolder></td>
<td class='ms-bodyareacell' valign="top">
<table width=100% height="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class='ms-bodyareaframe' valign="top" height="100%">
<A></A>
<asp:ContentPlaceHolder runat="server" />
<asp:ContentPlaceHolder runat="server" />
</td>
</tr>
</table>
</td>
<td><asp:ContentPlaceHolder runat="server">
<div><IMG SRC="/_layouts/images/blank.gif" width=10 height=1 alt=""></div>
</asp:ContentPlaceHolder></td>
</TR>
<tr>
<td><IMG SRC="/_layouts/images/blank.gif" width=1 height=10 alt=""></td>
<td><IMG SRC="/_layouts/images/blank.gif" width=1 height=10 alt=""></td>
<td><IMG SRC="/_layouts/images/blank.gif" width=1 height=10 alt=""></td>
<td><IMG SRC="/_layouts/images/blank.gif" width=1 height=10 alt=""></td>
</tr>
</TABLE>
<asp:ContentPlaceHolder runat="server" />
<asp:ContentPlaceHolder runat="server" />
</TD></TR>
</asp:ContentPlaceHolder>
<tr >
<td valign="top">
<table width="100%">
<tr>
<td>
<table>
<tr>
<td nowrap="nowrap"><b>YOUR LINKS HERE</b></td>
</tr>
</table>
</td>
<td width="100%" align="center" valign="middle">
</td>
<td valign="top" style="padding-left:3px; padding-right:20px;" nowrap="nowrap">
<b>Readers & Viewers</b><br />
<SharePoint:SPLinkButton Target="_new" ImageUrl="~site/_layouts/images/pdf.gif" runat="server" NavigateUrl="http://get.adobe.com/reader/" Text="PDF" PermissionsString="ViewPages"/>&nbsp;
<SharePoint:SPLinkButton Target="_new" ImageUrl="~site/_layouts/images/ppt.gif" runat="server" NavigateUrl="http://www.microsoft.com/downloads/details.aspx?FamilyId=428D5727-43AB-4F24-90B7-A94784AF71A4&displaylang=en" Text="PowerPoint" PermissionsString="ViewPages"/>&nbsp;
<SharePoint:SPLinkButton Target="_new" ImageUrl="~site/_layouts/images/zip.gif" runat="server" NavigateUrl="http://www.winzip.com/" Text="ZIP" PermissionsString="ViewPages"/>&nbsp;
<SharePoint:SPLinkButton Target="_new" ImageUrl="~site/_layouts/images/doc.gif" runat="server" NavigateUrl="http://www.microsoft.com/downloads/details.aspx?FamilyID=95e24c87-8732-48d5-8689-ab826e7b8fdf" Text="Word" PermissionsString="ViewPages"/>&nbsp;
<SharePoint:SPLinkButton Target="_new" ImageUrl="~site/_layouts/images/xls.gif" runat="server" NavigateUrl="http://www.microsoft.com/downloads/details.aspx?FamilyId=C8378BF4-996C-4569-B547-75EDBD03AAF0" Text="Excel" PermissionsString="ViewPages"/>
</td>
<td valign="top" nowrap="nowrap">
<b>
<SharePoint:SPLinkButton runat="server" NavigateUrl="~site/_layouts/YourPageHere.aspx" Text="Your Site Information" PermissionsString="ViewPages"/></b>
<br/>&nbsp;
</td>
</tr>
</table>
</td>
</tr>
<tr >
<td align="center">
<table style="background-image:url(YOUR-URL-TO-YOUR-WATERMARK.gif);background-position:center; background-repeat:no-repeat">
<tr>
<td align="center" valign="middle" style="padding-left:3px; padding-right:6px;">
YOUR DISCLAIMER TEXT
</td>
</tr>
</table>
</td>
</tr>
</table>
<asp:ContentPlaceHolder runat="server">
<SharePoint:FormDigest runat=server/>
</asp:ContentPlaceHolder>
<input style="display:none;" size=1/>
<input style="display:none;" size=1/>
<asp:ContentPlaceHolder runat="server">
</asp:ContentPlaceHolder>
</form>
</BODY>
</HTML>

CHILD MASTER PAGE

<%@ master masterpagefile="~masterurl/default.master" meta:progid="SharePoint.WebPartPage.Document" %>

<%@ Import Namespace="Microsoft.SharePoint" %>
<%@ Register Tagprefix="SPSWC" Namespace="Microsoft.SharePoint.Portal.WebControls" Assembly="Microsoft.SharePoint.Portal, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register Tagprefix="SharePoint" Namespace="Microsoft.SharePoint.WebControls" Assembly="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register Tagprefix="PublishingWebControls" Namespace="Microsoft.SharePoint.Publishing.WebControls" Assembly="Microsoft.SharePoint.Publishing, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register Tagprefix="PublishingNavigation" Namespace="Microsoft.SharePoint.Publishing.Navigation" Assembly="Microsoft.SharePoint.Publishing, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
<%@ Register TagPrefix="wssuc" TagName="DesignModeConsole" src="~/_controltemplates/DesignModeConsole.ascx" %>
<%@ Register TagPrefix="PublishingVariations" TagName="VariationsLabelMenu" src="~/_controltemplates/VariationsLabelMenu.ascx" %>
<%@ Register Tagprefix="PublishingConsole" TagName="Console" src="~/_controltemplates/PublishingConsole.ascx" %>
<%@ Register TagPrefix="PublishingSiteAction" TagName="SiteActionMenu" src="~/_controltemplates/PublishingActionMenu.ascx" %>
<asp:Content ContentPlaceHolderID="PlaceHolderAdditionalPageHead" runat="server">
<asp:ContentPlaceHolder runat="server" />
</asp:Content>
<asp:Content ContentPlaceHolderID="PlaceHolderPageTitle" runat="server">
<asp:ContentPlaceHolder runat="server" />
</asp:Content>
<asp:Content runat="server" contentplaceholderid="PlaceHolderMainBase">
<tr><td>
<table width=100% cellpadding=0 cellspacing=0 border=0><tr>
<td>
<SharePoint:SiteLogoImage LogoImageUrl="/_layouts/images/logo.jpg" runat="server"/></td>
<td width=100%>
<asp:ContentPlaceHolder runat="server">
<h1>
<SharePoint:SPLinkButton runat="server" NavigateUrl="~site/">
<SharePoint:ProjectProperty Property="Title" runat="server" />
</SharePoint:SPLinkButton>
</h1>
</asp:ContentPlaceHolder>
</td>
<td style="padding-top:8px;" valign=top>
<asp:ContentPlaceHolder runat="server">
<SharePoint:DelegateControl runat="server" ControlId="SmallSearchInputBox"/>
</asp:ContentPlaceHolder>
</td>
</tr>
</table>
</td>
</tr>
<TR>
<TD WIDTH=100%>
<asp:ContentPlaceHolder runat="server">
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>
<td nowrap valign="middle"></td>
<td-banner width=99% nowrap>
<asp:ContentPlaceHolder runat="server">
<SharePoint:AspMenu
Runat="server"
DataSourceID="topSiteMap"
EnableViewState="false"
AccessKey="<%$Resources:wss,navigation_accesskey%>"
Orientation="Horizontal"
StaticDisplayLevels="2"
MaximumDynamicDisplayLevels="1"
DynamicHorizontalOffset="0"
StaticPopoutImageUrl="/_layouts/images/menudark.gif"
StaticPopoutImageTextFormatString=""
DynamicHoverStyle-BackColor="#CBE3F0"
SkipLinkText=""
StaticSubMenuIndent="0"
CssClass="ms-topNavContainer">
<StaticMenuStyle/>
<StaticMenuItemStyle CssClass="ms-topnav" ItemSpacing="0px"/>
<StaticSelectedStyle CssClass="ms-topnavselected" />
<StaticHoverStyle CssClass="ms-topNavHover" />
<DynamicMenuStyle BackColor="#F2F3F4" BorderColor="#A7B4CE" BorderWidth="1px"/>
<DynamicMenuItemStyle CssClass="ms-topNavFlyOuts"/>
<DynamicHoverStyle CssClass="ms-topNavFlyOutsHover"/>
<DynamicSelectedStyle CssClass="ms-topNavFlyOutsSelected"/>
</SharePoint:AspMenu>
<SharePoint:DelegateControl runat="server" ControlId="TopNavigationDataSource">
<Template_Controls>
<asp:SiteMapDataSource
ShowStartingNode="False"
SiteMapProvider="SPNavigationProvider"
runat="server"
StartingNodeUrl="sid:1002"/>
</Template_Controls>
</SharePoint:DelegateControl>
</asp:ContentPlaceHolder>
</td>
<td-banner>&nbsp;&nbsp;</td>
<td valign=bottom align=right style="position:relative;bottom:0;left:0;">
<table cellpadding=0 cellspacing=0 border=0>
<tr>
<td>
<table height=100% cellpadding=0 cellspacing=0>
<tr>
<td>
<SharePoint:SiteActions runat="server" AccessKey="<%$Resources:wss,tb_SiteActions_AK%>"
PrefixHtml="&lt;div&gt;&lt;div&gt;"
SuffixHtml="&lt;/div&gt;&lt;/div&gt;"
MenuNotVisibleHtml="&amp;nbsp;">
<CustomTemplate>
<SharePoint:FeatureMenuTemplate runat="server"
FeatureScope="Site"
Location="Microsoft.SharePoint.StandardMenu"
GroupId="SiteActions"
UseShortId="true"
>
<SharePoint:MenuItemTemplate runat="server"
Text="<%$Resources:wss,viewlsts_pagetitle_create%>"
Description="<%$Resources:wss,siteactions_createdescription%>"
ImageUrl="/_layouts/images/Actionscreate.gif"
MenuGroupId="100"
Sequence="100"
UseShortId="true"
ClientOnClickNavigateUrl="~site/_layouts/create.aspx"
PermissionsString="ManageLists, ManageSubwebs"
PermissionMode="Any" />
<SharePoint:MenuItemTemplate runat="server"
Text="<%$Resources:wss,siteactions_editpage%>"
Description="<%$Resources:wss,siteactions_editpagedescription%>"
ImageUrl="/_layouts/images/ActionsEditPage.gif"
MenuGroupId="100"
Sequence="200"
ClientOnClickNavigateUrl="javascript:MSOLayout_ChangeLayoutMode(false);"
/>
<SharePoint:MenuItemTemplate runat="server"
Text="<%$Resources:wss,settings_pagetitle%>"
Description="<%$Resources:wss,siteactions_sitesettingsdescription%>"
ImageUrl="/_layouts/images/ActionsSettings.gif"
MenuGroupId="100"
Sequence="300"
UseShortId="true"
ClientOnClickNavigateUrl="~site/_layouts/settings.aspx"
PermissionsString="EnumeratePermissions,ManageWeb,ManageSubwebs,AddAndCustomizePages,ApplyThemeAndBorder,ManageAlerts,ManageLists,ViewUsageData"
PermissionMode="Any" />
</SharePoint:FeatureMenuTemplate>
</CustomTemplate>
</SharePoint:SiteActions>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</asp:ContentPlaceHolder>
</TD>
</TR>
<asp:ContentPlaceHolder runat="server">
<wssuc:DesignModeConsole runat="server"/>
</asp:ContentPlaceHolder>
<asp:ContentPlaceHolder runat="server">
<SharePoint:DelegateControl runat="server" ControlId="PublishingConsole"
PrefixHtml="&lt;tr&gt;&lt;td colspan=&quot;4&quot; id=&quot;mpdmconsole&quot; class=&quot;ms-consolemptablerow&quot;&gt;"
SuffixHtml="&lt;/td&gt;&lt;/tr&gt;">
</SharePoint:DelegateControl>
</asp:ContentPlaceHolder>
<TR height="100%"><TD><TABLE width="100%" height="100%" cellspacing="0" cellpadding="0">
<tr>
<td valign="middle" nowrap><div style="height:100%"><asp:ContentPlaceHolder runat="server"/></div></td>
<td>
<asp:ContentPlaceHolder runat="server">
<div><IMG SRC="/_layouts/images/blank.gif" width=1 height=100% alt=""></div>
</asp:ContentPlaceHolder>
</td>
<td valign=top class='ms-pagetitleareaframe' nowrap>
<table cellpadding=0 cellspacing=0 width=100% border="0">
<tr>
<td valign="top">
<asp:ContentPlaceHolder runat="server">
<asp:SiteMapPath SiteMapProvider="SPContentMapProvider" SkipLinkText="" NodeStyle-CssClass="ms-sitemapdirectional" runat="server"/> &nbsp;
</asp:ContentPlaceHolder>
</td>
</tr>
<tr>
<td height=100% valign=top>
<h2>
<asp:ContentPlaceHolder runat="server" />
</h2>
</td>
</tr>
</table>
</td>
<td>
<asp:ContentPlaceHolder runat="server"/>
<asp:ContentPlaceHolder runat="server">
<div style='height:100%'><IMG SRC="/_layouts/images/blank.gif" width=1 height=1 alt=""></div>
</asp:ContentPlaceHolder></td>
</tr>
<asp:ContentPlaceHolder runat="server"/>
<TR>
<TD valign=top height=100%>
<table-nav width=100% height=100% cellpadding=0 cellspacing=0>
<tr>
<td>
<TABLE height="100%"-navframe CELLPADDING=0 CELLSPACING=0 border="0">
<tr valign="top">
<td width="4px"><IMG SRC="/_layouts/images/blank.gif" width=4 height=1 alt=""></td>
<td valign="top" width="100%">
<asp:ContentPlaceHolder runat="server" />
<asp:ContentPlaceHolder runat="server" />
<asp:ContentPlaceHolder runat="server"/>
<asp:ContentPlaceHolder runat="server">
<div>
<div style="width:100%">
<h3><label>
<SharePoint:EncodedLiteral runat="server" text="<%$Resources:wss,quiklnch_pagetitle%>" EncodeMethod="HtmlEncode"/></label>
<Sharepoint:SPSecurityTrimmedControl runat="server" PermissionsString="ViewFormPages">
<div><SharePoint:SPLinkButton runat="server" NavigateUrl="~site/_layouts/viewlsts.aspx" Text="<%$Resources:wss,quiklnch_allcontent%>" AccessKey="<%$Resources:wss,quiklnch_allcontent_AK%>"/></div>
</SharePoint:SPSecurityTrimmedControl>
</h3>
<Sharepoint:SPNavigationManager
runat="server"
QuickLaunchControlId="QuickLaunchMenu"
ContainedControl="QuickLaunch"
EnableViewState="false">
<div>
<SharePoint:DelegateControl runat="server"
ControlId="QuickLaunchDataSource">
<Template_Controls>
<asp:SiteMapDataSource
SiteMapProvider="SPNavigationProvider"
ShowStartingNode="False"
StartingNodeUrl="sid:1025"
runat="server"
/>
</Template_Controls>
</SharePoint:DelegateControl>
<SharePoint:AspMenu
DataSourceId="QuickLaunchSiteMap"
runat="server"
Orientation="Vertical"
StaticDisplayLevels="2"
ItemWrap="true"
MaximumDynamicDisplayLevels="0"
StaticSubMenuIndent="0"
SkipLinkText=""
>
<LevelMenuItemStyles>
<asp:MenuItemStyle CssClass="ms-navheader"/>
<asp:MenuItemStyle CssClass="ms-navitem"/>
</LevelMenuItemStyles>
<LevelSubMenuStyles>
<asp:SubMenuStyle CssClass="ms-navSubMenu1"/>
<asp:SubMenuStyle CssClass="ms-navSubMenu2"/>
</LevelSubMenuStyles>
<LevelSelectedStyles>
<asp:MenuItemStyle CssClass="ms-selectednavheader"/>
<asp:MenuItemStyle CssClass="ms-selectednav"/>
</LevelSelectedStyles>
</SharePoint:AspMenu>
</div>
</Sharepoint:SPNavigationManager>
<Sharepoint:SPNavigationManager
runat="server"
ContainedControl="TreeView">
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td>
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td nowrap>
<SharePoint:SPLinkButton runat="server" NavigateUrl="~site/_layouts/viewlsts.aspx" Text="<%$Resources:wss,treeview_header%>" AccessKey="<%$Resources:wss,quiklnch_allcontent_AK%>"/>
</td>
</tr>
</table>
</td>
</tr>
</table>
<div>
<SharePoint:SPHierarchyDataSourceControl
runat="server"
RootContextObject="Web"
IncludeDiscussionFolders="true"
/>
<SharePoint:SPRememberScroll runat="server" Style="overflow: auto;height: 400px;width: 150px; ">
<Sharepoint:SPTreeView
runat="server"
ShowLines="false"
DataSourceId="TreeViewDataSource"
ExpandDepth="0"
SelectedNodeStyle-CssClass="ms-tvselected"
NodeStyle-CssClass="ms-navitem"
NodeStyle-HorizontalPadding="2"
SkipLinkText=""
NodeIndent="12"
ExpandImageUrl="/_layouts/images/tvplus.gif"
CollapseImageUrl="/_layouts/images/tvminus.gif"
NoExpandImageUrl="/_layouts/images/tvblank.gif"
>
</Sharepoint:SPTreeView>
</Sharepoint:SPRememberScroll>
</div>
</Sharepoint:SPNavigationManager>
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr><td>
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr><td nowrap>
<SharePoint:SPLinkButton runat="server" NavigateUrl="~site/_layouts/recyclebin.aspx" ImageUrl="/_layouts/images/recycbin.gif" Text="<%$Resources:wss,StsDefault_RecycleBin%>" PermissionsString="DeleteListItems"/>
</td></tr>
</table>
</td></tr></table>
</div>
</div>
</asp:ContentPlaceHolder>
<asp:ContentPlaceHolder runat="server"></asp:ContentPlaceHolder>
</td>
</tr>
<tr><td colspan=2><asp:ContentPlaceHolder runat="server"><IMG SRC="/_layouts/images/blank.gif" width=138 height=1 alt=""></asp:ContentPlaceholder></td></tr>
</TABLE></td><td><asp:ContentPlaceHolder runat="server"></asp:ContentPlaceHolder></td>
</tr></table></TD>
<td><asp:ContentPlaceHolder runat="server"><div><IMG SRC="/_layouts/images/blank.gif" width=10 height=1 alt=""></div></asp:ContentPlaceHolder></td>
<td class='ms-bodyareacell' valign="top">
<table width=100% height="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class='ms-bodyareaframe' valign="top" height="100%">
<A></A>
<asp:ContentPlaceHolder runat="server" />
<asp:ContentPlaceHolder runat="server" />
</td>
</tr>
</table>
</td>
<td><asp:ContentPlaceHolder runat="server">
<div><IMG SRC="/_layouts/images/blank.gif" width=10 height=1 alt=""></div>
</asp:ContentPlaceHolder></td>
</TR>
<tr>
<td><IMG SRC="/_layouts/images/blank.gif" width=1 height=10 alt=""></td>
<td><IMG SRC="/_layouts/images/blank.gif" width=1 height=10 alt=""></td>
<td><IMG SRC="/_layouts/images/blank.gif" width=1 height=10 alt=""></td>
<td><IMG SRC="/_layouts/images/blank.gif" width=1 height=10 alt=""></td>
</tr>
</TABLE>
<asp:ContentPlaceHolder runat="server" />
<asp:ContentPlaceHolder runat="server" />
</TD></TR>
</asp:Content>

customURLtoUseCHILD = web.ServerRelativeUrl + customizedMasterUrlCHILD;
customURLtoUseCHILD = customURLtoUseCHILD.Replace(“//”, “/”);
// Store the old Master URL’s and Custom Master URL’s
web.AllProperties["OldMasterUrl"] = web.MasterUrl;
web.AllProperties["OldCustomMasterUrl"] = web.CustomMasterUrl;
// Assign the Master URL to both properties
web.MasterUrl = customURLtoUsePARENT;
web.CustomMasterUrl = customURLtoUseCHILD;
// Update the Web
web.Update();
}
}
catch { }
}
You may also wish to remove BOTH files in the FeatureDeactivating function.
Finally, instead of stapling the feature to GLOBAL, we need to specify the templates. Namely, all of them except for the Meeting Workspaces templates. This is due to a SharePoint bug where if you create a meeting workspace from a recurring Calendar event, if you try to staple a feature to the new meeting workspace site, it breaks the scripting on the page such that you cannot switch dates.
<elements xmlns="http://schemas.microsoft.com/sharepoint/">
<featuresitetemplateassociation id="F647BBF6-5277-4118-9FA8-87D3E7C2059C" templatename="STS#0">
<featuresitetemplateassociation id="F647BBF6-5277-4118-9FA8-87D3E7C2059C" templatename="STS#1">
<featuresitetemplateassociation id="F647BBF6-5277-4118-9FA8-87D3E7C2059C" templatename="STS#2">
<featuresitetemplateassociation id="F647BBF6-5277-4118-9FA8-87D3E7C2059C" templatename="WIKI#0">
<featuresitetemplateassociation id="F647BBF6-5277-4118-9FA8-87D3E7C2059C" templatename="BLOG#0">
<featuresitetemplateassociation id="F647BBF6-5277-4118-9FA8-87D3E7C2059C" templatename="BDR#0">
<featuresitetemplateassociation id="F647BBF6-5277-4118-9FA8-87D3E7C2059C" templatename="EAWF#0">
<featuresitetemplateassociation id="F647BBF6-5277-4118-9FA8-87D3E7C2059C" templatename="OFFILE#0">
<featuresitetemplateassociation id="F647BBF6-5277-4118-9FA8-87D3E7C2059C" templatename="OFFILE#1">
<featuresitetemplateassociation id="F647BBF6-5277-4118-9FA8-87D3E7C2059C" templatename="PWA#0">
<featuresitetemplateassociation id="F647BBF6-5277-4118-9FA8-87D3E7C2059C" templatename="PWS#0">
<featuresitetemplateassociation id="F647BBF6-5277-4118-9FA8-87D3E7C2059C" templatename="SPS#0">
<featuresitetemplateassociation id="F647BBF6-5277-4118-9FA8-87D3E7C2059C" templatename="SPSMSITE#0">
<featuresitetemplateassociation id="F647BBF6-5277-4118-9FA8-87D3E7C2059C" templatename="SPSTOC#0">
<featuresitetemplateassociation id="F647BBF6-5277-4118-9FA8-87D3E7C2059C" templatename="SPSTOPIC#0">
<featuresitetemplateassociation id="F647BBF6-5277-4118-9FA8-87D3E7C2059C" templatename="SPSNEWS#0">
<featuresitetemplateassociation id="F647BBF6-5277-4118-9FA8-87D3E7C2059C" templatename="SPSNHOME#0">
<featuresitetemplateassociation id="F647BBF6-5277-4118-9FA8-87D3E7C2059C" templatename="SPSSITES#0">
<featuresitetemplateassociation id="F647BBF6-5277-4118-9FA8-87D3E7C2059C" templatename="SPSBWEB#0">
<featuresitetemplateassociation id="F647BBF6-5277-4118-9FA8-87D3E7C2059C" templatename="SPSCOMMU#0">
<featuresitetemplateassociation id="F647BBF6-5277-4118-9FA8-87D3E7C2059C" templatename="SPSREPORTCENTER#0">
<featuresitetemplateassociation id="F647BBF6-5277-4118-9FA8-87D3E7C2059C" templatename="SPSPORTAL#0">
<featuresitetemplateassociation id="F647BBF6-5277-4118-9FA8-87D3E7C2059C" templatename="SRCHCEN#0">
<featuresitetemplateassociation id="F647BBF6-5277-4118-9FA8-87D3E7C2059C" templatename="PROFILES#0">
<featuresitetemplateassociation id="F647BBF6-5277-4118-9FA8-87D3E7C2059C" templatename="CMSPUBLISHING#0">
<featuresitetemplateassociation id="F647BBF6-5277-4118-9FA8-87D3E7C2059C" templatename="BLANKINTERNET#0">
<featuresitetemplateassociation id="F647BBF6-5277-4118-9FA8-87D3E7C2059C" templatename="BLANKINTERNET#1">
<featuresitetemplateassociation id="F647BBF6-5277-4118-9FA8-87D3E7C2059C" templatename="BLANKINTERNET#2">
</elements>

 

customURLtoUsePARENT = web.ServerRelativeUrl + customizedMasterUrlPARENT;
customURLtoUsePARENT = customURLtoUsePARENT.Replace(“//”, “/”);
// Store the old Master URL’s and Custom Master URL’s
web.AllProperties["OldMasterUrl"] = web.MasterUrl;
web.AllProperties["OldCustomMasterUrl"] = web.CustomMasterUrl;
// Assign the Master URL to both properties
web.MasterUrl = customURLtoUsePARENT;
web.CustomMasterUrl = customURLtoUseCHILD;
// Update the Web
web.Update();
}
}
catch { }
}
You may also wish to remove BOTH files in the FeatureDeactivating function.
Finally, instead of stapling the feature to GLOBAL, we need to specify the templates. Namely, all of them except for the Meeting Workspaces templates. This is due to a SharePoint bug where if you create a meeting workspace from a recurring Calendar event, if you try to staple a feature to the new meeting workspace site, it breaks the scripting on the page such that you cannot switch dates.
<elements xmlns="http://schemas.microsoft.com/sharepoint/">
<featuresitetemplateassociation id="F647BBF6-5277-4118-9FA8-87D3E7C2059C" templatename="STS#0">
<featuresitetemplateassociation id="F647BBF6-5277-4118-9FA8-87D3E7C2059C" templatename="STS#1">
<featuresitetemplateassociation id="F647BBF6-5277-4118-9FA8-87D3E7C2059C" templatename="STS#2">
<featuresitetemplateassociation id="F647BBF6-5277-4118-9FA8-87D3E7C2059C" templatename="WIKI#0">
<featuresitetemplateassociation id="F647BBF6-5277-4118-9FA8-87D3E7C2059C" templatename="BLOG#0">
<featuresitetemplateassociation id="F647BBF6-5277-4118-9FA8-87D3E7C2059C" templatename="BDR#0">
<featuresitetemplateassociation id="F647BBF6-5277-4118-9FA8-87D3E7C2059C" templatename="EAWF#0">
<featuresitetemplateassociation id="F647BBF6-5277-4118-9FA8-87D3E7C2059C" templatename="OFFILE#0">
<featuresitetemplateassociation id="F647BBF6-5277-4118-9FA8-87D3E7C2059C" templatename="OFFILE#1">
<featuresitetemplateassociation id="F647BBF6-5277-4118-9FA8-87D3E7C2059C" templatename="PWA#0">
<featuresitetemplateassociation id="F647BBF6-5277-4118-9FA8-87D3E7C2059C" templatename="PWS#0">
<featuresitetemplateassociation id="F647BBF6-5277-4118-9FA8-87D3E7C2059C" templatename="SPS#0">
<featuresitetemplateassociation id="F647BBF6-5277-4118-9FA8-87D3E7C2059C" templatename="SPSMSITE#0">
<featuresitetemplateassociation id="F647BBF6-5277-4118-9FA8-87D3E7C2059C" templatename="SPSTOC#0">
<featuresitetemplateassociation id="F647BBF6-5277-4118-9FA8-87D3E7C2059C" templatename="SPSTOPIC#0">
<featuresitetemplateassociation id="F647BBF6-5277-4118-9FA8-87D3E7C2059C" templatename="SPSNEWS#0">
<featuresitetemplateassociation id="F647BBF6-5277-4118-9FA8-87D3E7C2059C" templatename="SPSNHOME#0">
<featuresitetemplateassociation id="F647BBF6-5277-4118-9FA8-87D3E7C2059C" templatename="SPSSITES#0">
<featuresitetemplateassociation id="F647BBF6-5277-4118-9FA8-87D3E7C2059C" templatename="SPSBWEB#0">
<featuresitetemplateassociation id="F647BBF6-5277-4118-9FA8-87D3E7C2059C" templatename="SPSCOMMU#0">
<featuresitetemplateassociation id="F647BBF6-5277-4118-9FA8-87D3E7C2059C" templatename="SPSREPORTCENTER#0">
<featuresitetemplateassociation id="F647BBF6-5277-4118-9FA8-87D3E7C2059C" templatename="SPSPORTAL#0">
<featuresitetemplateassociation id="F647BBF6-5277-4118-9FA8-87D3E7C2059C" templatename="SRCHCEN#0">
<featuresitetemplateassociation id="F647BBF6-5277-4118-9FA8-87D3E7C2059C" templatename="PROFILES#0">
<featuresitetemplateassociation id="F647BBF6-5277-4118-9FA8-87D3E7C2059C" templatename="CMSPUBLISHING#0">
<featuresitetemplateassociation id="F647BBF6-5277-4118-9FA8-87D3E7C2059C" templatename="BLANKINTERNET#0">
<featuresitetemplateassociation id="F647BBF6-5277-4118-9FA8-87D3E7C2059C" templatename="BLANKINTERNET#1">
<featuresitetemplateassociation id="F647BBF6-5277-4118-9FA8-87D3E7C2059C" templatename="BLANKINTERNET#2">
</elements>

 

About these ads

Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

The Silver is the New Black Theme. Create a free website or blog at WordPress.com.

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: