Extension:DynamicForms

Purpose
Mediawiki doesn’t have a form generator. It has updating the content through raw data but not through forms. This extension helps to bridge that gap through forms. Dynamic Forms is an extension to MediaWiki that allows users to create survey forms, registration forms and all kinds of forms. This extension allows you to have forms for adding, editing and querying data on your wiki, without any programming. Forms can be created and edited not just by administrators, but by users themselves.Generating forms by taking a text file as an input.

Usage
The main components of this extensions are form definition pages, which exist in a new namespace,  'Form:' and text file. Text file will contain questions or field names and certain syntax to be converted into text fields, text areas and check boxes required for the form. In the Form special page, you can browse and add a text file. This text file will be converted into a form and it will be stored in the database.

This project is helpful to EnhanceEdu lab and possibly to the whole Mediawiki community replacing the google forms and developing separate forms for every survey or registration with Mediawiki forms.

Step 1:
Download the code for Dynamic forms from the following link:

http://enhanceedu.iiit.ac.in/wiki/images/DynamicForms.zip

Extract the zip file and copy that directory in extensions folder.

Step 2:
You should create the following tables into your wiki database

CREATE TABLE IF NOT EXISTS `answers` (`answerid` int(11) NOT NULL,`answer` text,PRIMARY KEY (`answerid`)) ENGINE=MyISAM DEFAULT CHARSET=latin1;

CREATE TABLE IF NOT EXISTS `answerwiki` ( `answerid` int(11) NOT NULL, `answer` text, PRIMARY KEY (`answerid`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1;

CREATE TABLE IF NOT EXISTS `fields` ( `fieldid` int(11) NOT NULL AUTO_INCREMENT, `fieldname` varchar(25) NOT NULL, PRIMARY KEY (`fieldid`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=48 ;

CREATE TABLE IF NOT EXISTS `files` ( `fileid` int(11) NOT NULL AUTO_INCREMENT, `filename` varchar(255) NOT NULL, PRIMARY KEY (`fileid`), UNIQUE KEY `filename` (`filename`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=19 ;

CREATE TABLE IF NOT EXISTS `form_que_field_option` ( `formque` int(11) NOT NULL AUTO_INCREMENT, `formid` int(11) NOT NULL, `queid` int(11) NOT NULL, `fieldid` int(11) NOT NULL, `optionid` int(11) NOT NULL, PRIMARY KEY (`formque`), KEY `formid` (`formid`), KEY `queid` (`queid`), KEY `fieldid` (`fieldid`), KEY `optionid` (`optionid`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=395 ;

CREATE TABLE IF NOT EXISTS `forms` ( `name_of_form` varchar(25) NOT NULL, `formid` int(11) NOT NULL AUTO_INCREMENT, `description` varchar(255) NOT NULL, PRIMARY KEY (`formid`), UNIQUE KEY `name_of_form` (`name_of_form`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=19 ;

CREATE TABLE IF NOT EXISTS `options` ( `optionid` int(11) NOT NULL AUTO_INCREMENT, `optionname` varchar(255) DEFAULT NULL, PRIMARY KEY (`optionid`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=59 ;

CREATE TABLE IF NOT EXISTS `questions` ( `queid` int(11) NOT NULL AUTO_INCREMENT, `quename` text, PRIMARY KEY (`queid`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=48 ;

CREATE TABLE IF NOT EXISTS `user_que_ans` ( `ins_time` datetime NOT NULL, `userid` int(11) NOT NULL, `formid` int(11) NOT NULL, `queid` int(11) NOT NULL, `answerid` int(11) NOT NULL, PRIMARY KEY (`ins_time`,`userid`,`formid`,`queid`,`answerid`), KEY `userid` (`userid`), KEY `queid` (`queid`), KEY `answerid` (`answerid`), KEY `formid` (`formid`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1;

Step 3:
In the file LocalSettings.php in the main MediaWiki directory, add the following lines
 * 1) require_once( "$IP/extensions/DynamicForms/ListOfDynamicForms.php" );
 * 2) require_once( "$IP/extensions/DynamicForms/DynamicForms.php" );
 * 3) require_once( "$IP/extensions/DynamicForms/NewForms.php" );
 * 4) require_once( "$IP/extensions/DynamicForms/Displayplugin.php" );
 * 5) require_once( "$IP/extensions/DynamicForms/Showplugin.php" );
 * 6) require_once( "$IP/extensions/DynamicForms/Answerdisplayplugin.php" );
 * 7) require_once( "$IP/extensions/DynamicForms/Finalplugin.php" );
 * 8) require_once( "$IP/extensions/DynamicForms/Removeplugin.php" );
 * 9) require_once( "$IP/extensions/DynamicForms/Uanswerdisplayplugin.php" );