%META:TOPICINFO{author="TWikiContributor" date="1295069644" format="1.1" version="$Rev$"}%
---+!! !MetaWorkflowPlugin
<!--
   Contributions to this TWiki plugin are appreciated. Please update the plugin page at
   http://twiki.org/cgi-bin/view/Plugins/MetaWorkflowPlugin or provide feedback at
   http://twiki.org/cgi-bin/view/Plugins/MetaWorkflowPluginDev.
   If you are a TWiki contributor please update the plugin in the SVN repository.
-->
<sticky><div style="float:right; background-color:#EBEEF0; margin:0 0 20px 20px; padding: 0 10px 0 10px;">
%TOC{title="Page contents"}%
</div></sticky>
%SHORTDESCRIPTION%

---++ Introduction

This plugin defines a workflow based on updated meta data in a number of topics. It was originally written for use with the [[TWiki:Plugins.WorkflowPlugin][WorkflowPlugin]], but can also be used to create a workflow using %SYSTEMWEB%.TWikiForms or any other changing meta data. To view the meta data of a topic, append ==?raw=debug== to the URL (i.e. %SCRIPTURL{"view"}%/%WEB%/%TOPIC%?raw=debug).

---++ Usage

To use this plugin, you must first create a Meta Worflow Definition table. This can either be in the topic you want to display the message from, or in another topic specified by the following setting:
<verbatim>
   * Set METAWORKFLOWDEFINITION = Web.SomeTopic
</verbatim>

The meta workflow definition table starts with the =%<nop>METAWORKFLOW{...}%= variable, which can have the following parameters:

| *Parameter* | *Comment* | *Default* |
| =type= | The type of meta data. | required |
| =name= | The name of the meta data type. Needed if you are working with multiple entries of the same type (i.e. for FIELD). | none |
| =key= | The key of the meta data you want to match (i.e. value). | =name= |

The table itself must follow immediately after the =%<nop>METAWORKFLOW{...}%= variable. It is made up of three columns, as explained below.

| *Topic* | *Value* | *Message* |
| _The topic where the meta data is coming from._ | _Defines what the value needs to be equal to before moving to the next row of the table._ | _The message displayed if the value is not equal._ |

The topic column can also contain the word =FINAL=, which will display a message once the workflow has been completed. The plugin will ignore header rows.

The message is displayed using the =%<nop>METAWORKFLOWCURRENT%= variable. This needs to be in the same topic as the definition table, or in a topic with the =METAWORKFLOWDEFINITION= setting.

---++ Example

A working example of using this plugin to create a workflow based on the value of a form field can be found at [[Sandbox.MetaWorkflowExample]], once you have installed and enabled the plugin.

---++ Plugin Settings

   * To suppress warnings on your topic, use the following (Note: only has effect on the topic it is set on):
<verbatim>
      * Set METAWORKFLOWWARNING = off
</verbatim>

   * One line description, is shown in the %SYSTEMWEB%.TextFormattingRules topic:
      * Set SHORTDESCRIPTION = Define a workflow based on updated meta data (such as form fields, or meta data from another plugin)

---++ Installation Instructions

You do not need to install anything in the browser to use this extension. The following instructions are for the administrator who installs the extension on the server where TWiki is running.

Like many other TWiki extensions, this module is shipped with a fully
automatic installer script written using the Build<nop>Contrib.
   * If you have TWiki 4.2 or later, you can install from the =configure= interface (Go to Plugins->Find More Extensions)
      * See the [[http://twiki.org/cgi-bin/view/Plugins/BuildContribInstallationSupplement][installation supplement]] on TWiki.org for more information.
   * If you have any problems, then you can still install manually from the command-line:
      1 Download one of the =.zip= or =.tgz= archives
      1 Unpack the archive in the root directory of your TWiki installation.
      1 Run the installer script ( =perl &lt;module&gt;_installer= )
      1 Run =configure= and enable the module, if it is a plugin.
      1 Repeat for any missing dependencies.
   * If you are *still* having problems, then instead of running the installer script:
      1 Make sure that the file permissions allow the webserver user to access all files.
      1 Check in any installed files that have existing =,v= files in your existing install (take care *not* to lock the files when you check in)
      1 Manually edit !LocalSite.cfg to set any configuration variables.

%IF{"defined 'SYSTEMWEB'" else="<div class='twikiAlert'>%X% WARNING: SYSTEMWEB is not defined in this TWiki. Please add these definitions to your %MAINWEB%.TWikiPreferences, if they are not already there:<br><pre>   * <nop>Set SYSTEMWEB = %<nop>TWIKIWEB%<br>   * <nop>Set USERSWEB = %<nop>MAINWEB%</pre></div>"}%


---++ Plugin Files

   | *File:* | *Description:* |
   | ==data/TWiki/MetaWorkflowPlugin.txt== | Documentation |
   | ==data/Sandbox/MetaWorkflowExample.txt== | Example |
   | ==data/Sandbox/MetaWorkflowExampleFormDefinition.txt== | Example |
   | ==data/Sandbox/MetaWorkflowExamplePhaseOne.txt== | Example |
   | ==data/Sandbox/MetaWorkflowExamplePhaseThree.txt== | Example |
   | ==data/Sandbox/MetaWorkflowExamplePhaseTwo.txt== | Example |
   | ==lib/TWiki/Plugins/MetaWorkflowPlugin.pm== | Perl module |


---++ Plugin Info

|  Plugin Author: | TWiki:Main.AndrewRJones |
|  Copyright: | &copy; 2007 TWiki:Main.AndrewRJones <br /> &copy; 2007-2011 TWiki:TWiki.TWikiContributor |
|  License: | GPL ([[http://www.gnu.org/copyleft/gpl.html][GNU General Public License]]) |
|  Plugin Version: | 2011-01-17 |
|  Change History: | <!-- versions below in reverse order -->&nbsp; |
|  2011-01-17: | TWikibug:Item6530: Doc improvements |
|  2007-05-31: | Initial version |
|  Dependencies: | None |
|  Plugin Home: | http://twiki.org/cgi-bin/view/Plugins/MetaWorkflowPlugin |
|  Feedback: | http://twiki.org/cgi-bin/view/Plugins/MetaWorkflowPluginDev |
|  Appraisal: | http://twiki.org/cgi-bin/view/Plugins/MetaWorkflowPluginAppraisal |

__Related Topics:__ Sandbox.MetaWorkflowExample, %SYSTEMWEB%.TWikiPlugins, %SYSTEMWEB%.DeveloperDocumentationCategory, %SYSTEMWEB%.AdminDocumentationCategory
