WikiRoster

Imagine: you work (yeah I know it’s rather hard to imagina yourself working, but try anyway). Then imagine you work in a team (wow, here come your social skills). Not everyone can be available at all times, and you would like to know who is and who isn’t, organised: easily viewable, non-redundantly updatable, and everyone needs to edit his own time out.

How it works

Are you familiar with Wikipedia? If you are, this couldn’t be too hard to understand for you, else, get to know MediaWiki first, this solution builds completely upon the MediaWiki core.

In MediaWiki (the system behind all wiki-like pages), you can have user-built extensions (the term “extension” is used throughout this article as well as it is the correct Wiki term). The extensions take the form of a special tag. A tag in this context refers to an (X)HTML tag, anything starting with <something> and ending with </something>. The WikiRoster extension is just like this! It begins with <roster> and ends with </roster>.

Wherever this tag appears on a Wiki page, it gets replaced by the XHTML code generate d by the user-written PHP script.
The problem described above is a rather simple one to implement in Wiki through this mechanism.

Tutorial

This section walks you through the easy usage of the tag.

Let us for example take July 2006, we have 5 members in our team, and we want to setup a roster for us five. We start the tag like this:

<roster

Now we specify the year, month and holidays this month (in Belgium, the 21st of July is the National Holiday):

year="2006"
month="7"
holidays="21"

Next, the attribute nembers of the roster tag should be specified (the names are fictive):


members="Merciano, Bergars, Brown, Mendez, Dubrille"

Every member should have an acronym, to be used for future reference in the source code (initials usually do the trick, don’t put spaces around the comma’s and you may use more than 2 letters, but keep it as short as possible):


acronyms="FM,MB,BB,GM,MD"

Now comes the real data section which the users will have to edit themselves:


FM="7:V, 24:E"
MB="17-20:E, 31:V"
BB="9-30:V"
GM="3-5:A, 25:V"
MD="1-30:A, 17-20:E"

The codevious code tells us that member Merciano (acronym FM) is on vacation the 7th of July, and in a course the 24th. Member Bergars is in Education from July 17th till July 20th and on vacation the 31st, and so on… A stands for absent, for example for meetings or other job requirements. You can add as much letters as you wish, even two-lettered, but this might shake up the layout…

Finally, you should always close the tag:


></roster>

Full code and output

Click here to see the output of the following code:


<roster
year="2006"
month="7"
holidays="21"
members="Merciano, Bergars, Brown, Mendez, Dubrille"
acronyms="FM,MB,BB,GM,MD"
FM="7:V, 24:E"
MB="17-20:E, 31:V"
BB="9-30:V"
GM="3-5:A, 25:V"
MD="1-30:A, 17-20:E"
></roster>

Notice that the style information is also sent to the webbrowser, without using the default stylesheet. This is done to avoid name clashes and to decentralize the huge amount of style definitions.

Pro’s and con’s

Pro’s:

  • Automatic input correction: no invalid numbers are used, but replaced by valid ones, so no 31st of February!
  • Wiki: everyone can participate and doesn’t need to learn an awful lot of tags and rules of Wiki.
  • Fully customizable layout: the CSS code is included in every webpage and overrides the standard stylesheet of MediaWiki, of course, you can remove and add any new classes to the stylesheet. The layout part of the code is also separated from the logic, so that you can easily change the way the roster appears.

Con’s:

  • If your webserver is rather slow, I discourage you to use this code. There are strong performance issues due to the use of indexed two-dimenional arrays in PHP, but I see no other way of coding the logic. So try it, but don’t cry if it doesn’t work, the parsing might take some time, but not every server will have this problem.
  • Wiki: users can also change each other’s data, this is of course not desirable, but if you can all work along, nothing serious should happen, don’t forget that you never lose data, there is always the history!

There are probably more pro’s and con’s but I can’t think of any more for the moment. I hope you enjoy using the script.

Download

WikiRoster

Advertisements

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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