18
Aug
I work as a Microsoft Content Management Server (MCMS 2002) developer at Tam Tam. To make a step into the future I attended an introduction course of SharePoint 2007. Because the MCMS 2002 product will be part of SharePoint 2007. At this moment we are trying to deliver all our sites according to the latest Accessibility Guidelines. As SharePoint developers probably know Microsoft loves to render their products with tables. This trend was also followed when Microsoft introduced the .NET 2.0 Framework. For example the Menu control is default rendered as a table. This control is extended in SharePoint 2007 (AspMenu), but still renders as a table.
Other developers recognize this problem as well and started to write white papers of how to implement CSS friendly adapters in your website. All these white papers describe that you will need a .browser file that is compiled with your code. For a website project this is no problem, but when using Microsoft SharePoint 2007 you will get a precompiled web-site OOB. This is a problem when you want to implement the adapters. Together with some collegues of the teacher (Patrick Tisseghem, u2u) we made a proof of concept to implement these adapters in SharePoint 2007. So how is it possible to use these adapters within SharePoint 2007.
To get started download the Css Friendly ASP.NET 2.0 Control Adapters from the Microsoft site. The ASPNETCssFriendlyAdapters_beta1.1.vsi will add some new projects to your Visual Studio 2005.
After the installation open Visual Studio 2005 and create a new web-project based on the Css Friendly ASP.NET Control Adapters. This will provide you with all the code we are going to use.
To make the code for the adapters available in SharePoint 2007 we need to create a new project which is based on a Class Library.
In the Folder App_Code there are two folders we will need to copy the files form the directory Adapters to our just created Class Library and add the missing refferences. You are free to alter the code and make it compliant with your own whishes.
Now you can sign and rebuild your Class Library so we can install it in the GAC. Copy the CssAdapters.dll to the assembly folder in the Windows folder or use the gacutil.exe to register the dll in the GAC.
Now we get to the question how we can register the .browser file and make it available for SharePoint 2007. It is possible to extend the browser descriptions on your whole machine. By using the aspnet_regbrowsers.exe. Before we can do this we need to alter the current CssAdapter.browser file so it wil use the CssAdapters.dll from our GAC.
<browsers> <browser refID="Default"> <controlAdapters> <adapter controlType="System.Web.UI.WebControls.Menu" adapterType="CSSFriendly.MenuAdapter, CssAdapters, version=1.0.0.0, Culture=neutral, PublicKeyToken=<Your Token>"/> </controlAdapters> </browser> </browsers>
Replace the Version and the PublicKeyToken with your own. You can find this to get the properties of the assembly in your GAC.
Copy the CssAdapter.browser to the folder: C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CONFIG\Browsers Open a Visual Studio 2005 Command Promt so we can rebuild and register the browser extentions.
Now You can visit your portal site and check out what just happened.
This proof of concept shows you the steps of how to implement the CssFriendly Control Adapaters in your SharePoint 2007 solution. There are still some problems to be solved in the Architecture. Because all the sites that are created with SharePoint 2007 depend on the HTML structures provided by these Controls you need to alter all the pages that are used by SharePoint 2007. This is a bad idea, it is better to create a control that simply inherets from the control which you want to use with your adapter and specify the inhereted control in your browsers file. This way you have full control on where you want to use the adapter in SharePoint 2007 or web-site.
Comments (0)
Tam Tam brengt je wereld online.