SharePoint Theme Settings page and Enhanced Theming

If you create a site using the Blank template and go to Settings > Site Theme you get a simple page that lets you set your site theme.

If you create a site using the Team Site template and go to Settings > Site Theme, you get a more advanced page.

Both these experiences are supported by the one page (/_layouts/themeweb.aspx). So what gives? Continue reading “SharePoint Theme Settings page and Enhanced Theming”

SharePoint Theme Settings page and Enhanced Theming

Themes in SharePoint 2010

So, followers of this blog will know that I seem to get quite a lot of branding tasks, and that I don’t much like themes, preferring to use either the AlternateCssUrl and Features instead. Features are great – you can deploy the CSS/image files you need, set master pages (and handle Meeting Workspaces), themes, AlternateCssUrls. They can also add HTTP Modules for branding Application Pages.

Themes, on the other hand, are fiddly to install automatically, don’t work on the DatePicker, and are individual to each site once applied. To pick up changes to a global theme, you’d have to apply a different theme and then reapply the desired theme – for every site.

Well, that was with SharePoint 2007. SharePoint 2010 is a bit different, as I got to find out on a Combined Knowledge course in January (and this is the first time I’ve managed to write about it!) Continue reading “Themes in SharePoint 2010”

Themes in SharePoint 2010

Adding CSS links to your SharePoint pages or code…

I love Twitter – you get some though provoking questions on it. Thomas Resing asked the other day:

How are you applying styles to your custom web parts in #SharePoint? using CSSClass property, stuck on deploying css <Link> tag in the head

Well, for pages themselves you have the CSSRegistration control. It’s an ASP.NET control, and looks something like:

<SharePoint:CssRegistration name="/_layouts/myBrand/SomeStyle.css" runat="server"/>

This control registers the URL with the page, but doesn’t emit anything. That’s controlled by the CssLink control:

<Sharepoint:CssLink runat="server" />

It actually outputs the <link> elements, and this means that you can have a CSSRegistration control low down in the page (in a Content control, for example) and you can still output it in the <head> of your page. There’s a good post about this on CleverWorkarounds.

So, could we use that control? Well, we should be able to instantiate one – except it turns out that we don’t have to. We can just use the CSSRegistration.Register() static method – something like:

protected override void CreateChildControls(){
CssRegistration.Register("/_layouts/myBrand/SomeStyle.css");
}

Job done…

Adding CSS links to your SharePoint pages or code…

Rounded Corners on Web Parts

The Holy Grail of SharePoint branding – at least as far as I’m concerned – is rounded corners on Web Parts. Every design that comes in has this at first. As mentioned yesterday there are examples of doing this for the web part’s title – I’ve done this using Madalina’s instructions and Heather Solomon has some instructions too.

However, as far as I know nobody has yet figured out a way of putting rounded corners on the bottom corners of web parts. The HTML they have does not suit them to do this via CSS. The only idea I’ve had previously was to use ControlAdapters to modify the output of of the Web Part itself. And I’m pretty sure you’d have to write an adapter per web parts. That kind of sucks; no customer is going to be in a hurry to pay for that.

Well, when I was looking at putting borders around an entire web part zone, I had a thought. What we really need to do is insert elements into our page. jQuery can do that sort of thing. Could I use jQuery to find each web part and wrap some tags around it? Continue reading “Rounded Corners on Web Parts”

Rounded Corners on Web Parts

Rounded Corners on Web Part Zones

Curiously, one of my more popular blog posts is about putting rounded corners on things in SharePoint. It does seem that this is a pretty popular question. As a side note, Heather Solomon has a post about doing this for web part titles, though I followed Madalina’s instructions.

Anyway, one design requirement that come up repeatedly is rounded borders on Web Parts. I swear, it comes up with every design – and it isn’t possible (although I have an idea – more on that tomorrow). What you can do, though, is have a rounded border about the entire web part zone… Continue reading “Rounded Corners on Web Part Zones”

Rounded Corners on Web Part Zones

Automatically add themes to the SPThemes.xml file

I’m not sure I’ll use themes again over the AlternateCssUrl again in a hurry, but I did decide to take a look at the 10 example themes Microsoft Released in March. I’ll blog about how they look – sometime! (The short answer – some good, some bad, some awful!)

Anyway, I was interested that the themes could all be activated as features. This rather kept with my feeling on how branding should be deployed.

However, some of the themes (though not all) were suddenly available in the ‘Site Themes’ page of my SharePoint system. I knew from experience that this isn’t something that ‘just happens’ – previously, I’ve done it by hand.

EDIT: See the comments – they describe an possible pit fall, but both have articles about how to do the same thing… Continue reading “Automatically add themes to the SPThemes.xml file”

Automatically add themes to the SPThemes.xml file

Putting actions into the PlaceHolderLeftActions

The Wiki and Blog sites have pages that make use of the PlaceHolderLeftActions content placeholder. I’ve mentioned this before regarding putting a web part zone below the quick launch menu. This time I wanted to list some actions for our ‘case’ system.

placeholderleftnavactions

The code to do this? Not very hard. Naturally, we’ll actually have some code to generate our actions and links…

<asp:Content ContentPlaceHolderId="PlaceHolderLeftActions" runat="server">
<DIV class="ms-quicklaunchouter">
<DIV class="ms-quickLaunch" style="WIDTH: 100%">
<DIV class="ms-quicklaunchheader">Case Actions</DIV>
<div>
<TABLE class="ms-navitem" cellSpacing="0" cellPadding="0" width="100%" border="0">
<TR><TD style="WIDTH: 100%">
<A class="ms-navitem" href="http://vm-moss/Default.aspx">Action 1</A>
</TD></TR></TABLE>
<TABLE class="ms-navitem" cellSpacing="0" cellPadding="0" width="100%" border="0">
<TR><TD style="WIDTH: 100%">
<A class="ms-navitem" href="http://vm-moss/Default.aspx">Action 2</A>
</TD></TR></TABLE>
</div>
</DIV>
</DIV>
</asp:Content>

Putting actions into the PlaceHolderLeftActions

Out-of-Box Publishing Page layouts suck too

So, might not be news, but SharePoint’s out of box Page Layouts suck. I’ve already described how the page layouts have an image on branding, introducing styles to change the navigation, etc.. This has led me to the conclusion that you shouldn’t use the out-of-box publishing sites – start from a minimal publishing site, and build from the ground up.

But what of customers who have naively thought that, I don’t know, a Collaboration Site Template might be a good template to use for the collaboration site? Well, this is the problem I’ve got now; a customer has used the out-of-box page layouts extensively, and now wants the styles of the text and so on to be consistent. How can I do that? Continue reading “Out-of-Box Publishing Page layouts suck too”

Out-of-Box Publishing Page layouts suck too

SharePoint Designer – grrr….

SharePoint designer is so like a wife – I love it to bits, sometimes I hate it, and I fervently hope for a cuter version in the future! No, I’m kidding.

But SPD currently has this persistence in adding a &nbsp; in front of my page’s title field. I don’t need that non-breaking space. I don’t want that non-breaking space. But I keep deleting it, and Designer keeps adding it back in.

For me, it’s a sign one of the two big problems with SharePoint Designer – robustness. When I’m in Visual Studio, I’m comfortable; it’s pretty reliable, normally, and behaves in ways I understand. Even the things that can blow it up are pretty well understood. Much as I hate to admit it, I do think that the reason that C# won out over Java was simpler, robust tooling – Visual Studio.

However, with SharePoint designer all sorts of weird stuff happens… Continue reading “SharePoint Designer – grrr….”

SharePoint Designer – grrr….

Deploy Publishing Pages and Content Types as a feature

Aka “CAML is the bastard spawn of Satan”.

So, I’m writing a site definition to create a Publishing site. This is a bit of a first for me. One of the things I want to do is deploy a new Publishing Page Content type, and associate some layouts with it.

I started by following Andrew Connell’s instructions for a Minimal Site Definition (as in his book). This all seemed to go pretty well; testing created a new, minimal site.

Next up I wanted to deploy the Content Type and associated page layouts. Well, there wasn’t much information in his book on this – like him, I’d figured I’d write a separate Feature for deploying just the content type and page layouts – but there was very little information in his book about this. Continue reading “Deploy Publishing Pages and Content Types as a feature”

Deploy Publishing Pages and Content Types as a feature