Tuesday, September 15, 2009

GoogleAnalytics Solution

Just finished a WSS3/Moss2007 Solution to provide GoogleAnalytics page-tracking.


The Solution consists of two seperate SiteCollection-features:




This is a snapshot of the configuration page which is accessible via SiteSettings:





The GoogleAnalytics-script will be injected via a DelegateControl which must be present in the head of the MasterPage.


The sourcecode and package is available for download from Codeplex Subversion.

Over here you'll be able to find a blog of Wesley Baker which also has a Google Analytics Solution. I reused some of his ideas for my implementation.

Monday, September 14, 2009

GoogleAJAXLibrariesAPI

Since over a year Google Code is hosting a set of clientside libraries under the name Google AJAX Libraries API. For easy usage in Sharepoint (WSS3 / Moss2007) i´ve wrapped the API's into seperate SiteCollection Features.



For the features to work, the Masterpages must be prepped by adding the following DelegateControl to the head:



When all Features of this Solution are activated, the following script will be rendered in the head:


The sourcecode and the package of the Solution can be downloaded from here. The solution is built using Visual Studio 2008 and WSPBuilder.
Because the scripts are loaded from the Google-servers, websites running under HTTPS might display clientside warnings to the visitor.
At this moment i've selected versions by a general string, as this would enable minor updates of the libraries to automatically be used. Selecting a specific version of a library is easy by changing the version-string in the elements.xml-files.

FieldContentPanel

The FieldContentPanel is a simple derivative of the standard System.Web.UI.WebControls.Panel. The control is extended with the functionality to suppress itself and it's contents depending on the presence of a value for the given field from the current page/listitem.

This control is based on this posting of Andrew Connell. The sourcecode and the ready-to-use WSP is available for download from the MRCL Codeplex Subversion repository.

This is an example of typical usage of the control:


The FieldName-attribute/property defines which field of the current listitem/page which will be checked for an empty value.

The AlwaysShowInEditMode-attribute/property defines if the panel needs to be displayed in edit-mode even if the fieldvalue would be empty. This setting is important when the FieldContentPanel checks the same field as one of it´s children FieldControl(s). Without this setting one would be unable to change the value of a Field after it has been set to empty.

The solution is built using Visual Studio 2008 and WSPBuilder. This version of the control is usable in WSS3 and Moss2007.

The control can be easily be extended to support custom field-types which have specific empty values.