Extension:RecordAdmin

Install using subversion on a unix system
To install from subversion under a unix system, change to the directory of your wiki extensions folder and check out the extension code. cd /var/www/mywiki/extensions svn co http://svn.wikimedia.org/svnroot/mediawiki/trunk/extensions/RecordAdmin/ You will need the svn client installed to use this method. Under debian/ubuntu or other apt based system use: apt-get install subversion Under Redhat/Centos or other RPM based unix use: yum install subversion

Configuring LocalSettings.php
Add this line to LocalSettings.php require_once("extensions/RecordAdmin/RecordAdmin.php");

Global configuration options

 * $wgRecordAdminCategory - Categorise a template with this category to tell RecordAdmin that the template represents a data type. Default value is Records so add   to your template. It is essential that you do this otherwise you will have no record types to work with.
 * $wgRecordAdminUseNamespaces

Handling records in a wiki
In a wiki the natural way of representing a record is by using template syntax in an article as in the following example:

The template (in this case Template:Member) defines how such a record should look to the public, and the corresponding article in the Form namespace (e.g. Form:Member) is used internally by administrators to manage and adjust the records. the template may not contain all the possible parameters because some of them are for internal use only, but the form needs to contain them all.

Forms
This extension was developed primarily for wikis used in business which don't allow public editing and can therefore have Raw HTML enabled, so the forms can be created using standard HTML as in the following example form. This means that normal Javascript validation techniques can be added. Title:  Mr                Mrs Miss Ms        First names:  Surname: 
 * The class attribute is only included so that CSS rules can be applied to the form if necessary.
 * Note that there is no need for any action parameter or submit inputs, all these aspects are handled by the RecordAdmin extension.
 * This may be adjusted in future to allow other extension's like SimpleForms to make the forms so that Raw HTML isn't necessary.

Setting up a template for use with RecordAdmin
Make a new template and this content into the page. Replace Visitor with whatever you call your record type. Next make a normal template definition to display the information you want.
 * Name:
 * Address:

Using the special page
If no type of record is specified in the special page URL parameter, then a selection of the available records is presented. The records available are obtained from finding all the template articles which are in Category:Records (the category used is set in the '$wgRecordAdminCategory global variable). After a record type as been selected, the form for that kind of record is shown and can then be used to create new records, or define parameters used to find matching records.



Searching for records
The search form works like a filter, so leaving it completely empty and then clicking search will list all members. Filling in some characters such as 123 into the phone field, then clicking search will list all members having 123 in their phone number somewhere. The results will be listed below the form in a sortable table such as in the following example image.



The fields in the search form are regular expressions, so more advanced searches can be done, for example putting ^445 into the phone field will search for all members who's phone number starts with "445".

Editing and viewing records
In the search results list, click edit to change any properties of the member, or click on a results title to go to that member's article to delete it or see its history etc.

Creating new records
If the Create button is clicked instead of Search, then the values in the form will be used to create a new record. If no value is supplied in the Record ID field when a record is created, then a unique ID will be used of the format yyyymmdd-xxxxx where y, m and d represent numbers for the year, month and day, and x are random unique digits and letters. This is useful for the kinds of records such as invoices or log entries which need no specific name.

Using the parser function
A parser function allows sets of records of a specified type exhibiting specified parameters to be rendered in a page using the template corresponding to the record type. This is useful for example for having an article contain certain kinds of products that are currently in stock, or to list members who conform to criteria such as interests or expertise.

Here's an example of the parser function syntax:

The "cols" parameter is used to specify which columns you'd like to be displayed and in what order. The column names are case sensitive. The first three columns shown in the example above are special ones which represent the link to the record article, the "edit" and "view" links, and the creation date respectively.

The sortable parameter specifies that the results be rendered in a sortable table so that it can be re-ordered by clicking on column headers, and the orderby parameter specifies which column the table should be sorted by initially.

The next two parameters are conditions in the form of regular expressions which are applied to the corresponding field name. In this case the table will contain records of type Inquiry and will be filtered to only those with phone numbers starting with "555" and having an "Open" status.

Form validation
Validation can be done with client side javascript. The extension does not support server side authentication.