Sharepoint 2007 Site Branding: An Automated Approach


Published on

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.

Published in: Technology
  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Sharepoint 2007 Site Branding: An Automated Approach

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