Wednesday, April 04, 2007

Sharepoint 2003: customize the webparts zones

I know, today we can use the new Microsoft Office Sharepoint Server (MOSS), but there are a lot of Sharepoint 2003 installation around, and recently I had to face some request from a (french, Paris-based) customer that asked me to make some "deep" customizations for their intranet, both in terms of look&feel and of webparts disposition on the page.

This request was both for the Sharepoint Portal pages and for the Windows Sharepoint Services sites and pages.

I'm not discussing here the "layout" modification, maybe I'll collect some good links that explain this task, let's say here that this was in my case solved mainly with some (not so easy) CSS modifications.

Let's focus on the webpart zones disposition, and how it can be changed.

First of all: I assume in all the samples below that your Sharepoint is installed in the default folder on drive C:\, and that you have the english setup (so in the paths you'll see the \1033\ folder, if you have other language packs you will have to deal with other paths).

The standard, "out-of-the-box" placement of the webparts in the page is ok for a lot of us; but sometimes you want to have some particular disposition of the webparts, in order to make a better use of the page space for your particular needs.

To reach this goal you will have to make some HTML coding in some .aspx pages, located in different paths. These paths correspond to the various "kind" of pages that Sharepoint 2003 offers to us: The Sharepoint main pages, the pages for the various Areas, the News pages, the Topics pages... and on and on down to the Windows Sharepoint Sites pages, both the simple and the Multi Page one.

All the .aspx pages you'll want to modify reside under this path:

C:\Program Files\Common Files\Microsoft Shared\Web server extensions\60\Template\1033\

Down that folder you'll find 13 subfolders. Each folder corresponds to a particular "kind" of page template on the Sharepoint portal or in the WSS sites. Below I'll give you a pair of lists that shows this correspondance.

The main file you'll find under the folder (let's say the first, the \SPS folder) is default.aspx.

This file, at run time, is used by Sharepoint as a template that is "filled" with the webparts you'll have decided to place in the various web part "zones". These zones are explicitly defined in the html of the default.aspx page, and have this look:

<WebPartPages:WebPartZone runat="server" Title="loc:Left" ID="Left" FrameType="TitleBarOnly" AllowPersonalization="false"/>

I will not enter in the details of the various tags; here we'll on ly note that the "ID" tag is the one that gives the name you will see in the sharepoint page, when in design mode.

There are many of these WebPartZone already in place in your default.aspx, go and look for them; you'll see that they are inside an html structure that you can easily hack for your needs; you can alse define more WebPartZones around the page, only be careful to give them unique IDs.

The following list shows each SharePoint Portal Server 2003 area or subarea and the corrisponding folder:
- Root site: \SPS folder
- My Site: \SPSMSITE folder
- News: \SPSNHOME folder
- Company News, External News and Press Announcements, and all areas that are under the News area: \SPSNEWS folder
- Site Directory: \SPSSITES folder
- Topics: \SPSTOC folder
- Divisions, Human Resources, Locations, Marketing, Operations, Projects, Resources, Sales, Strategy and Support, and all areas under the Topics area: \SPSTOPIC folder
- Community Template: \SPSCOMMU folder

Then there are some other folders that are relating to the Windows Sharepoint Services side of the coin; the two main folders are:

- \STS: all the pages for the WSS sites
- \MPS: for the Multi Page Template pages under WSS sites

This last one is a little more tricky, because when you modify the default.aspx page... this modifications will show up only in the main page, and not in the various subpages. To have also these pages modified you'll have to edit another page, in the folder:

C:\Program Files\Common Files\Microsoft Shared\web server extensions\60\TEMPLATE\1033\MPS\DOCTEMP\SMARTPGS

The file is named spstd1.aspx. modify and save it... and you're done.

Now: I'm not saying that all this process is easy and safe;  you'll want to have backup copies of all the files you modify, and you'll want to make a lot of experiments before deploying all this in production... but as soon as you make the first test you'll find comfortable with the other.

Hope this helps...


No comments: