Extension:StructuredInput

What can this extension do?
The goal of the StructuredInput extension is to provide a framework for taking form input and transforming it into a wiki page, which can be edited either with the form or in raw wiki text.

Installation
Copy the core StructuredInput files into your Mediawiki installation, creating directories as necessary:



Then add the following line to your : require_once("extensions/structuredInput.php");

Hack for Mediawiki 1.14.0
The following changes have to be made in :

1. Add the following line: set_include_path(get_include_path . PATH_SEPARATOR . $IP.'/includes/specials' ); 2. Replace this line: $this->mFile = "Special$name.php"; with this line: $this->mFile = dirname(__FILE__). "/specials/Special$name.php";

StructuredInput form
In, after the require_once line to include structuredInput.php, add the name of your form to the StructuredInput::$inputList array. For example, this is what your code should like if your form were called "Add activity": require_once("extensions/structuredInput.php"); StructuredInput::$inputList[] = 'Add activity';

To create the form page for "Add activity", create the file : function wfSpecialAddactivity { global $wgOut, $wgScriptPath; $action = $wgScriptPath.'/index.php?action=submit';

if (!empty($_GET['id'])) { $data = StructuredInput::getStructuredData($_GET['id']); } else { $data = array; }

$html = <<   Activity name: 

Goal: {$data['goal']}

Content Covered: 

Steps to Follow: {$data['instructions']}



TEMPLATE;

$wgOut->addHTML($html); }

By creating this file, you will enable a new special page,

Some important things to note:
 * The form input  determines what the page you're creating will be called. The   Javascript takes the input from the text file and incorporates it into the form action.
 * The hidden input  specifies what transformation to use. In this example   will be used.

Transformation code
A transformation file gets included when processing the StructuredInput request. There are two variables that you should be concerned about:
 * - A copy of the data from $_POST. Feel free to modify as needed, as it doesn't affect anything else
 * - You should set this variable to what you want to appear in the original wiki edit form. In order to mark this page as a StructuredInput page, you must include the following as part of :

So for our example it would be:

This tag won't appear on the wiki page itself. It just tells mediawiki to edit this page using the Addactivity StructuredInput form.

Additionally, to properly fill in the StructuredInput form, you must enclose the form variables in tags of the following form: value

Here is what  might look like: 

Code
Extension:StructuredInput/code