Building a Module for sitefinity (part 3) : Setting up the project

Posted on April 4, 2007. Filed under: Building a pluggable module, Projects |

WorkingAfter we have explained the basic concepts behind every Sitefinity module the time has come to leave the theory behind us, roll up our sleeves and do some building.

In order to create a module you need to create a new C# project and in it’s most rudimentary version, you need three files inside of this project. The module class, and two web control classes (for command panel and control panel). To ease this process for you, you can download the project to get you started. Regardless of what kind of module you are about to build you will needed these files.


In addition to this, you’ll need to reference following assemblies in your project :

  • System
  • System.Data
  • System.Drawing
  • System.Web
  • System.Xml
  • Telerik.Framework
  • Telerik.Security
  • Telerik.Cms.Web.UI

To put some kind of perspective, the sample module that will be built during this series of posts is “Contacts” module. This is a very simple module which will allow user to enter all relevant contacts across the organization (for example : CEO, sales, technical support…) with their names, emails, phone numbers, working hours and so on. More about this project you’ll be able to read in the next post. So, now that we know that we are building “Contacts” module we can continue with a little more clarity.

The first file in our project is the ContactsModule class. This is our module class and it has to inherit from Telerik.WebModule class in order to be used as a Sitefinity module. Apart from several properties that describe this module (such as name and description) there are two important methods here : CreateControlPanel and CreateToolBoxControls. The CreateControlPanel method returns any Control that will be used as a ControlPanel control (the one on the rigth side). The CreateToolBoxControls returns an IList<IToolboxItem> object, which in turn contains all controls you want to appear in the command panel (the one on the left side).

As you can imagine, the two other files that you’ll need are ControlPanel class (of type CompositeControl) and CommandPanel class (of type CompositeControl, but this class also needs to implement IControlPanelCommand interface).

This all fits together in the previously mentioned ContactsModule class. Namely, in CreateControlPanel method you create a new instance of ControlPanel class and return it, while in CreateToolBoxControls you create a new instance of CommandPanel class and add it to the IControlPanelCommand array.

And this is all that you really need to get our Contacts module work. In ControlPanel and Command panel class you can overwrite the CreateChildControls method and add just some arbitraly controls (e.g. I’ve added the labels in the attached project) to see what happens.

In the next post I’ll write some brief specs for the Contacts module and attach few mockups just so that we are all on the same page.

Make a Comment

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Liked it here?
Why not try sites on the blogroll...

%d bloggers like this: