This session will demonstrate the approach used for the Extension Disaster Education Network’s (EDEN) public internet site’s custom branding in Sharepoint 2007. This session will walk through generating a custom solution package containing features that can be deployed to any farm running WSS 3.0 or MOSS 2007. This automated branding approach relies on custom master pages, page layouts, and CSS for customizing the look and feel without customizing any of the out of the box files.
2. Who Am I? Summer Prisock Extension Disaster Education Network (EDEN) Webmaster Located at the LSU AgCenter in Baton Rouge, LA About 2 ½ years experience working with SharePoint 2007 @grayguitar on Twitter sprisock@agcenter.lsu.edu May 26, 2010 NetC 2010
3. Quick EDEN Overview EDEN’s Mission The mission of the Extension Disaster Education Network (EDEN) is to share education resources to reduce the impact of natural and man-made disasters. Institutional Members from all 50 states & 3 territories 1862 & 1890 Land Grants, Sea Grants, & NIFA Over 200 delegates from these institutions For more info visit: www.EDEN.lsu.edu May 26, 2010 NetC 2010
4. Agenda Brief SharePoint Branding Overview Master Page Breakdown Delegate Controls Helpful Tools in Branding The Automated Solution Explained Gotcha’s Demo Q & A’s May 26, 2010 NetC 2010
6. Not Customized/Customized Not Customized (formerly “ghosted”) Lives on the file server not the content database Unedited files shipped with SharePoint Custom files created via features Customized (formerly “unghosted”) Lives in the content database Requires a request to the file system and the database Anything edited or created in SharePoint designer Can be harder to manage Possible post-service pack upgrade problems May 26, 2010 NetC 2010
7. SharePoint Themes More focused on changing colors and images, not on reorganization. Stored on Web Server Editing a theme requires: Making changes & copying to web server Reapplying the theme to each site that uses Controlling themes available requires editing OOTB file spsthemes.xml on the web server May 26, 2010 NetC 2010
9. Master Pages Swapping out Master Page for site pages relatively easy ~masterurlefault.master Applied to standard default.aspx page template used in Team Site & Blank site Also used in form pages such as Allitems.aspx and NewItem.aspx ~masterurlustom.master Used in publishing sites Includes all content pages within page libraries of MOSS publishing site Content pages designed to use a dynamic token for the MasterPageFile attribute May 26, 2010 NetC 2010
10. Master Pages No obvious way to swap out application.master, simple.master, dialog.master, pickerdialog.master Runs out of the LAYOUTS directory Can be addressed by implementing a custom HTTP Module For a great list of which pages use each of these master pages see: http://blogs.msdn.com/bgeoffro/archive/2007/11/12/branding-a-moss-corporate-intranet-portal-part-1a-high-level-overview-terminology-and-approach.aspx There are a set of content placeholders that must be in your master page in order for SharePoint to run properly Better to start with one of the base master pages to ensure you are including the requirements. May 26, 2010 NetC 2010
11. Master Pages Base Publishing Master Page before Base Publishing Master Page after May 26, 2010 NetC 2010
13. What is a DelegateControl? A DelegateControl is a ASP.NET control in SharePoint that acts as a placeholder for content or other controls. Basically just ContentPlaceholders with a SharePoint feature deployment method that can allow for activating content on a page. A lot of SharePoint’s default functionality uses them, ie: Search Global Links May 26, 2010 NetC 2010
19. The Tools SharePoint Designer 2007 Real time view of your master page’s look Firefox’s Firebug add-on Visualize the rendering Inspect elements to see which style is being read Heather Solomon’s blog Stripped down master pages CSS reference sheet Andrew Connel’s SharePoint Project Utility Quick automated folder creation Quick ddf and manifest creation (somewhat automated) May 26, 2010 NetC 2010
21. Solution Derived From Automated SharePoint Site Branding by Ted Pattison (C#) http://msdn.microsoft.com/en-us/magazine/cc700347.aspx A stripped down version of my adaption of this solution (VB) will be posted to the LSU AgCenter’s National MOSS Collaboration Wiki this week http://intranet.lsuagcenter.net/sites/team/mosswiki/National%20MOSS%20Repository/ May 26, 2010 NetC 2010
22. Intro to Automated Solution Three different primary features Central Feature: EDENInternetBranding Scope to a WSS or MOSS site collection & forces the entire solution to apply the branding. 2nd Feature: EDENInternetBrandingWebApplication Scoped to web app level, configured via a feature receiver class & updates the web.config 3rd Feature: EDENInternetBrandingChildSiteInitializer Scope to site level, copies top level site branding properties into the current child site. May 26, 2010 NetC 2010
23. Intro to Automated Solution Several features for different delegate controls Scoped to site level, specifies what delegate control(s) to display within the specific site Utility Class: BrandManager Contains all the code to apply and remove various branding elements EDENInterntBrandingHTTPModule Checks for enable and then swaps out application.master and simple.master May 26, 2010 NetC 2010
25. Elements manifest file elements.xml Contains provision logic to create an instance of this Master Page template & of you custom page layouts if you choose to include them Provisions a custom action in site settings that links to your custom Branding Manager May 26, 2010 NetC 2010
27. Contains methods to ensure web application-level feature has been activated or deactivated so that the HttpModule is properly registered or not registered with ASP.NET May 26, 2010 NetC 2010
28. Utility Class: BrandManager Synchronizes: pages to link to EDENInternetBranding.master pages to use an alternate CSS file pages to use a custom graphic for the site logo Adds support to swap out the Master Page for application pages May 26, 2010 NetC 2010
29. Contains several static properties that parse together URLs pointing to various resources. May 26, 2010 NetC 2010
30. Contains several methods which go through every site in the current site collection and updates each site’s corresponding property. May 26, 2010 NetC 2010
31. Contains methods that create a custom property on the top level site to indicate if swapping out the Master Page should be enabled or not May 26, 2010 NetC 2010
32. Custom HTTP Module: EDENBrandingHttpModule.vb Registers an event handler for one of the events in the ASP.NET page life cycle named PreInit May 26, 2010 NetC 2010
34. EDENInternetBrandingWebApplication Feature Scoped at the web application level Using a feature receiver, it updates the web.config to add the HttpModule entry in each web application May 26, 2010 NetC 2010
35. FeatureReceiverWebApplication class Function that creates the HttpModule entry Event handlers that add or remove the required HttpModule entry to the web.config May 26, 2010 NetC 2010
37. Feature stapling is used to get EDENInternetBrandingChildSiteInitializer to activate automatically Stapled to the main EDENInterntBranding feature via FeatureSiteTemplateAssociation element Figure 1:EDENInternetBranding Feature.xml excerpt Figure 2: EDENInternet Brandingstapling.xml excerpt May 26, 2010 NetC 2010
38. BrandManagement Class Pulls it all together when the user specifies what elements to use on this newly deployed page under site settings May 26, 2010 NetC 2010
40. Unknown Error Friendly Errors – turn them off; they’re not friendly (when debugging) Open web.config for site Change CallStack status to “true” <SafeModeMaxControls="200" CallStack="true"DirectFileDependencies="10" TotalFileDependencies="50" AllowPageLevelTrace="false"> Chance CustomErrors to “off” <customErrorsmode="Off" /> May 26, 2010 NetC 2010