Archive

Posts Tagged ‘Web Content Management’

Custom Web Part Pages in WSS (Part 2)

January 21, 2009 2 comments

Following on from Part 1, we will create a custom content type for a Web Part Page for use in a Pages library that supports versioning and is able to be crawled by WSS Search…

Creating a new Site Column

The page body for the custom web part page is to come from a new custom site column, imaginatively called Page Body.  This should be configured to be of type Multiple lines of text and allow Enhanced rich text as shown below:

Create a new Site Column called Page Body

Note: the Allow unlimited length in document libraries option must be set to Yes.

Creating a new Content Type

The next step is to create a new Custom Web Page content type to be used for the custom web part page; this content type will allow for the page’s content to be stored within the page rather than in a web part:

newsitecontenttype2

Create a new Document Library

Add a new Document Library to the WSS site; use Web Part Page as the document template and ensure that versioning is switched on:  

newdocumentlibrary

Once this has been created, update the document library settings to use content types via the Advanced settings page.  

Then add the Custom Web Page content type to the library:

addcustomcontenttype

On the document library settings page,  click on the link for the Custom Web Page content type to open the List Content Type configuration page.   Add the Page Body site column using the Add from existing site of list columns link:

addcolumnstolistcontenttype 

Finally, remove the default Document content type from the list of content types for the library.

As this point the document library settings should look like this:

documentlibrarysettings

Update the WSS Web Part Page templates

The final step to complete is to update the WSS Web Part Page templates to make use of the new Page Body column and display the content.  

To do this, simply add the following code to the template in the location you want the content to be displayed, e.g. within the content area with ContentPlaceHolderId=”PlaceHolderMain”:

<tr>
  <td class="ms-pagebody" colspan="3" valign="top" width="100%">
    <SharePoint:ListItemProperty Property="Page_x0020_Body" runat="server"/>
  </td>
</tr>

Of course nothing is ever *that* simple.

WSS ships with eight Web Part Page templates located in the C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\TEMPLATE\1033\STS\DOCTEMP\SMARTPGS folder.  These files, named spstd1.aspx through spstd8.aspx cannot be renamed as they are used by the spcf.aspx page which serves as the document template for Web Part Pages.

Note: if you edit these templates you will be editing them for all Web Part Pages on that server, so bear this in mind.

Alternatively, create a new page template and associate it with the Custom Web Page content type created earlier.  This is done by specifying a new document template to replace spcf.aspx: open the content type definition for Custom Web Page, select Advanced Settings and then enter the location of the new document template:

Apply Custom Document Template

The new document template must replicate the features of spcf.aspx, i.e. create a new instance of the page template.  

In WSS 3.0, the functionality for this has been moved from embedded code in the aspx page to the owssvr.dll assembly.  Unfortunately this assembly expects the page templates to be named spstd1.aspx through spstd8.aspx.  So you’re left with editing the default pages or attempting to replicate the entire functionality yourself.  

Apparently it is possible to make use of a file written for WSS 2.0 to do this.  Instructions are to be found on MSDN here.  Ignore references to editing create.aspx; we’ve already associated the custom document template with the content type.  Just follow instructions 1 through 6 in the Adding a new Template section.

Using the Custom Web Part Page

Use the Create buttom on the document library task bar as normal.  Select the Web Part Page layout from the standard eight available with WSS.  

To add HTML content to the page, use the context menu for the page to select Edit Properties …

editpropertiesmenu

…and then enter content into the Page Body field:

Edit the Page Body field to enter HTML content

The Page Body field will be rendered as HTML on the page:

New Custom Web Part Page

Any HTML content added to the Page Body field will be versioned…

newpageversions

…and crawled for searching via the standard WSS Search.

Install and Configure Telerik RadEditor for MOSS Lite Edition

Whilst not necessary to provide versioned and searchable pages, the RadEditor is recommended as a superior HTML editor.  If deployed, ensure that the RadEditor feature is enabled for list items:

teleriksettings

The Lite Edition of the RadEditor for MOSS can be downloaded free of charge from Telerik.

Custom Web Part Pages in WSS (Part 1)

October 29, 2008 3 comments

Okay, so WSS 3.0 doesn’t have the nice publishing features available with MOSS 2007.  However, there are a few things that we can do to improve upon the Web Part Page available out-of-the-box with WSS.

This series of posts will guide you through the process of creating a content type for an enhanced Web Part Page that can be versioned within a document library, searched using WSS Search and takes advantage of the Telerik RadEditor Lite content editor.

Background

To place these posts within context, I’d recommend reading this blog article by Tuen Duynstee.  Tuen’s article was really my starting point for creating an internet-facing WSS 3.0 site.

Now to the fun stuff…

Problems with WSS Web Part Pages and the Content Editor Web Part

The most obvious way to provide users with a Web Content Management system using WSS is to drop the Content Editor Web Part onto a Web Part Page.

Unfortunately there are several serious issues with this approach:

  1. Content Editor Web Part content isn’t versioned.  You can create as many versions the web part page as you like, the actual content – which is contained within the Content Editor Web Part – isn’t versioned.  This is a wider problem with web parts in general, but especially of note when attempting to provide web content management.
  2. Content Editor Web Part content can’t be searched.  Yes, this is as bad as it seems.  Add your content to the Content Editor Web Part and it can’t be seen by the WSS Search.

 

There is another issue with the Content Editor Web Part; whenever you re-open the web part to update content it turns all server-relative URLs into absolute URLs.  Therefore if you have your content accessible from different addresses (when you have an extranet and an intranet for example) any linked content will be broken for one of them as soon as anyone updates the content.  The only way around this is to edit the HTML directly.  Hardly suitable for non-technical users.

Solution

In a nutshell: create a Content Type to contain the web content within the page itself and make use of the superior Telerik RadEditor Lite content editor.

Stay tuned for the step-by-step guide on how to do this in Part 2.