views:

271

answers:

4

My customer wants to provide 2 themes for a SharePoint application. Is there a strategy to accomplish this in MOSS 2007?

We want to apply user profile-based theme selection, and maybe even a drop-down to switch modes.

A: 

Here are the options that I’ve come up with from research and feedback. Both of which seem mostly infeasible.

  • Implement major UI layout changes in JavaScript. This would lead to client slowdowns, would be difficult to code, and would be completely unsupported by Microsoft due to the need to reference SharePoint objects that may change with subsequent SharePoint patches.

  • Provide two parallel themed sites based on the same data, and provide a way to switch between them. This would require that we deploy each site to multiple locations, and would require retooling of any site creation mechanisms in code (since they'd need to target two sites instead of one).

paulwhit
A: 

One another thing you can try is to use the Theme Changer and ThemeChangerStaple from codeplex , That is implemented as feature you can use the same code logic to archive what you want with bit of modification, give it as an option for the user using CustomAction.

Kusek
+1  A: 

I don't know how extensive you want your re-theming to be. However if it could be CSS-only you could use this approach:

  1. Store the CSS files for the different themes in the Style Library.

  2. Create a list that stores the user and their chosen theme.

  3. Write a feature and custom application page to allow the user to change their theme.

  4. Write a control that does a lookup on the list against the current user and obtains the a reference to the corresponding CSS file in the Style Library. The control would then output the CssRegistration and CssLink controls to the page for this file.

  5. Add this control to the master page so it executes on every page (caching should be added).

I can't see why this wouldn't be supportable by Microsoft as you're only changing CSS.

If you need to do more than that then another option is to write an HTTP module that changes the HTML output. Or of course JavaScript. With these two options you may have supportability issues (it depends on how extensive your changes are).

Alex Angas
While this sounds like a good idea, one look at Sharepoint's HTML and CSS will leave you curled up in a little ball, rocking back and forth....and then again when you look at a different part of the site, which is of course put together entirely differently.
Andy Mikula
It's true that SharePoint's markup sucks. However there are CSS resources out there that help decode it for you: http://www.heathersolomon.com/content/sp07cssreference.htm . Also, you have more control/less crap markup if you are using MOSS publishing sites.
Alex Angas
I need more than CSS but this is a thorough answer. Thanks.
paulwhit
+1  A: 

There is also SPThemes now available on Codeplex from Bjørn Furuknap. Users can choose their own themes and they can be applied at different scopes.

Alex Angas
cool! will check it out
paulwhit