Extension talk:Workflow.php
Overview
Eventually we'd like to support many work-flow related features in the wiki, but the first and most important is to create the simplest possible means of moving articles from one point in a workflow sequence to another. To do that a parser function called "tag" has been created which allows predefined groups of content to be quickly cycled though without needing to edit the containing article.
This extension code consists of two main aspects:
- the parser-function rendering which includes the javascript for switching between states when clicked, and for making the AJAX requests to update the state after a delay.
- the response which includes updating one of the tag's template definitions in the article and returning the article's category-links
- Should enforce convension of Category:Name = Template:Value, which only allows category named parameters to work with template transcluded values.
- Make use of the
<div id="catlinks">... </div>
area to add additional workflow category information. - Need to define some simple examples.
Example 1
Switching between two binary states 1/0, on/off, yes/no. This may or may not categorize as it switches between states
- Parser function call
{{#tag: Yes = ...|No = ...}}
Example 2
An example sequence of three states in a workflow, Category:First state, Category:Second state, Category:Third state.
Tag Rendering
Switching Visible State
Making the Update State Request
The AJAX Response
The response to the AJAX requests requires a tag in the article to have its state updated, and for the category-links part of the rendered page to be returned to the client. To get the properly rendered category links, the parser needs to be instantiated and the page rendered, so the normal AJAX dispatcher must be bypassed since it is used to return data before instantiating the main article environment. The following code is called at start-up to achieve this. As can be seen it enables the two other aspects of the code, which are handled in their own functions described below. <php> if ($wgUseAjax && $_REQUEST['action'] == 'ajax' && $_REQUEST['rs'] == 'wfWorkflowUpdateTag' && is_array($_REQUEST['rsargs'])) { list($_REQUEST['title'],$wgWorkflowTagID,$wgWorkflowTagState) = $_REQUEST['rsargs']; $wgHooks['OutputPageBeforeHTML'][] = 'wfWorkflowReturnCatlinks'; $wgWorkflowUpdateTag = true; $_REQUEST['action'] = 'render'; } else $wgWorkflowUpdateTag = false; </php>