Building a custom groupware solution with Simple Groupware

Workspace


If you have a need for custom groupware, try rolling your own with the Simple Groupware suite.

By Dmitri Popov

Finding the right groupware solution can be a tricky business. At first sight, any workgroup requires the same set of applications, such as email, a calendar, a project management tool, and a message board. But in reality, each and every workgroup has its own requirements. The special needs for your workgroup could consist of anything from a couple extra fields for project management data to a custom-designed task module.

You may be thinking that a user who chooses an Open Source groupware solution should be able to just tweak it as much as they like so the final result fits their needs perfectly. The truth is, however, few users have the knowledge and time to implement the required changes. A group of freelance writers, for instance, probably won't spend their free time programming PHP or writing SQL queries. Most groups must therefore make do with existing groupware solutions and adjust their work habits to the software.

But it really doesn't have to be that way. If you are looking for a groupware suite you can use on your own terms, Simple Groupware [1] might be the answer.

The name Simple Groupware doesn't really do this suite justice, since it is much more than a mere collection of groupware applications. Of course, Simple Groupware offers all the standard modules you would expect from a professional groupware solution, but Simple Groupware also has its own sgsML language that glues all the pieces together and offers an easy, yet extremely effective means for creating new groupware applications and customizing existing components.

Getting started with Simple Groupware

Not surprisingly, Simple Groupware is written in PHP and uses MySQL as its backend, so you can install Simple Groupware onto the standard LAMP (Linux, Apache, MySQL, and PHP) stack. The latest version of Simple Groupware also supports the PostgreSQL database. The installation process couldn't be easier; you can find detailed installation instructions at [2]. Once you've installed Simple Groupware, point your browser to it (e.g., http://serveraddress/sgs/, assuming you've installed the software into the sgs folder) and log in as administrator.

Although Simple Groupware offers a standard set of groupware applications (such as calendar, project manager, contacts, files, etc.), the design is different from other groupware solutions. Each application and module inside Simple Groupware is represented as a folder. A folder can be either, well, a folder or an application. In the latter case, the folder has what is called a mountpoint. For example, the Workspace folder in the default installation is a standard folder containing, among other things, the Email application folder.

Figure 1: Each application in Simple Groupware is a folder with a mountpoint.

To add an email account, you have to create a POP3 or IMAP mountpoint. To create a mountpoint, select the Email folder, click on the Mountpoint item, select POP3 or IMAP from the type drop-down list, and fill in the rest of the fields with the requested information. Click OK to save the settings, and the account is added to the Email folder.

This folder metaphor may seem a bit unusual in the beginning, but Simple Groupware's folders provide virtually unlimited flexibility. You can create as many folders as you like, each containing different sets of applications.

Figure 2: Simple Groupware also includes standard applications like a spreadsheet.

Figure 3: The To-do module in action.

sgsML

What really makes Simple Groupware truly unique software is its sgsML. This XML-based language allows even non-technical users to add features and develop groupware applications using simple markup. Better yet, sgsML is so efficient that you can create an application from scratch using just a few line of code. To illustrate how easy sgsML really is, let's build a simple To-do list module. Use your favorite text editor to create a text file. Since all applications in Simple Groupware use a database back-end, the first thing you have to do is to describe the table your To-do module is going to use and how the data is going to be displayed:

<table modulename="My To-do list" default_view="display" orderby="todo" order="asc" limit="20" enable_new="true" enable_edit="true" enable_delete="true" enable_empty="true"></table>

Most of this code should be obvious even if you've never used sgsML before. First, you specify the module's name (modulename="My To-do list"), then you define the default view (default_view="display"). The next three options (orderby="todo" order="asc" limit="20") tell the system that the data in the table should be sorted ascending by the todo field and allowing a maximum of 20 records per page.

Want to group your to-do items by priority (assuming you are going to have a priority field in your application)? No problem: add the groupby="priority" option. Finally, you can define whether the users will be able to add, modify, and delete data in the table (enable_new="true" enable_edit="true" enable_delete="true" enable_empty= "true").

Next, you have to specify a view (<view name="display" displayname="Display" />) and add fields to your application. Besides the mandatory Id field that acts as a primary key, you have to add at least three fields: todo, priority, and description.

<field name="id" simple_type="id" displayname="Id" />
<field name="todo" displayname="Todo" simple_type="text" required="true" />
<field name="priority" displayname="Priority" simple_type="select" simple_size="1" simple_default="Normal"> <data values="Low|Normal|Urgent"/> </field>
<field name="description" displayname="Description" simple_type="htmlarea" simple_size="4" />

Looking at this code, you can easily figure out what it does. For each field, you specify a type (simple_type="id" simple_type="text" and simple_type="select").

Besides the standard field types like text, id, and textarea, sgsML also allows you to add more advanced types of fields. In the preceding example, the description field is set to htmlarea, which adds a text formatting toolbar to the field. If you want to attach files to the to-do items, you can add a field of type files:

<field name="filedata" displayname="File" simple_type="files" simple_size="3" />

The simple_size option here specifies how many files you can attach to a to-do item.

Using sgsML, you can also link fields in different tables. This allows you to create sophisticated applications that pull data from different sources. In your To-do list module, for example, you can easily add a feature that allows users to assign to-do items to different contacts by simply selecting their names from a drop-down list.

To create this option of assigning to-do items to contacts, add a Contact value list that pulls data from the Workspace -> Contacts database, which is based on the simple_contacts table:

<field name="contactid" displayname="Contact" simple_type="select" simple_size="1" required="true" is_linked="simple_contacts|details|contactid"> <data function="dbselect|simple_contacts|contactid,concat(lastname;' ';firstname)|lastname asc|10"/></field>

The final code of your To-do module should look something like the code in Listing 1.

Listing 1: To-do Module
01 <table modulename="My To-do list" default_view="display" orderby="todo" order="asc"
02 limit="20" enable_new="true" enable_edit="true" enable_delete="true" enable_empty="true">
03 <view name="display" displayname="Display" />
04 <field name="id" simple_type="id" displayname="Id" />
05 <field name="todo" displayname="Todo" simple_type="text" required="true" />
06 <field name="priority" displayname="Priority" simple_type="select" simple_size="1"
07 simple_default="Normal"><data values="Low|Normal|Urgent"/> </field>
08 <field name="filedata" displayname="File" simple_type="files" simple_size="3" />
09 <field name="description" displayname="Description" simple_type="htmlarea" simple_size="4" />
10 <field name="contactid" displayname="Contact" simple_type="select" simple_size="1"
11 required="true" is_linked="simple_contacts|details|contactid">
12 <data function="dbselect|simple_contacts|contactid,concat(lastname;' ';firstname)||lastname asc|10"/> </field>
13 </table>

Save the result as a todo.xml file and move it into the sgs/bin/modules/schema/ folder. In Simple Groupware, select the Workplace folder (or whatever folder you want to add your new application to), and click on the Options item. In the New folder section, type a name for your application into the Name field and select todo from the Module drop-down list. Press OK, and your first Simple Groupware application is ready to go. When you open the folder for the first time, the system automatically creates the database structure.

Conclusion

If you have tried the other groupware tools and haven't found the perfect combination of features for your environment, Simple Groupware might be the solution you're looking for. The simple example described in this article shows only a fraction of Simple Groupware's capabilities. See the sgsML manual [3] for a more comprehensive overview of the sgsML language.

INFO
[1] Simple Groupware: http://www.simple-groupware.de/cms/
[2] Simple Groupware installation: http://www.simple-groupware.de/cms/index.php?n=Main.Installation
[3] sgsML manual: http://www.simple-groupware.de/cms/index.php?n=Main.SgsML