Initial version is now uploaded. Enjoy!
--
Peter Thoeny - 2015-04-02
I added a number of additional features:
- New "upload" if-action
- New "setformfield" then-action to update a form field of a target topic
- New "touch" then-action to edit & save a target topic
- Expand tokens $children, $children(n), $children(n CID-*), $parents, $parents(n), $parent, $parents(n) in target
- Possible to specify a comma-space list of topics as the target
- Improved developer docs
Let me know if you have some additional needs.
Let us know how you use this plugin to automate your workflow!
--
Peter Thoeny - 2015-04-07
Idea for enhancement:
- In the source column, allow conditions, such as "if form field X changed", or "if URL parameter Y is Z", etc.
- Expand TWiki variables such as CALCULATE in source column and target column to dynamically define content?
- New "view" if-action for topic view. Useful? This can be very noisy, and could impact performance.
- New "change" if-action to take action if a form field of a source topic changed. This is difficult to implement.
- New "register" if-action to take action on user registration.
- New "email" then-action to send an e-mail based on a template.
- New "update" then-action to update topic text with a search/replace regular expression rule, such as Target:
Web.SomeTopic/$replace("from", "to")
- New "rename" then-action to rename a target topic.
- New "copy" then-action to copy (duplicate) a target topic.
- New "delete" then-action to delete a target topic.
- New "redirect" then-action to redirect to a target topic or URL.
What else?
--
Peter Thoeny - 2015-04-07
Here are specific use cases at two client TWiki sites:
1. TWiki applications requirements management:
The requirements are arranged in a tree hierarchy. Each requirement has a "Status" field.
Need: If a status field at a higher level is updated, all status fields of dependent requirements need to be updated recursively.
Solution: If-then-action rule to update children topic's Status field:
If |
Source |
Then |
Target |
Comment |
save |
WCKE.WRqm* |
setformfield |
$children(32 WRqm*)/$formfield(Status) = $formfield(Status) |
This updates all children's Status form field to the current topic's Status form field value |
2. TWiki applications for parts management:
The parts database has 20K parts. A form with an autoselect parts field is too slow if done with a dynamic query on all parts. To get the required performance, a PartsData topic is created to cache the parts data. The topic has a dynamic query that generates the
JSON object needed for autocomplete, and stores it in a persistent
SET variable with
remember="1"
using
SetGetPlugin. A named section in PartsData can be used to GET the persistent variable.
Need: Update the JSON object so that it remains in sync whenever a part topic is updated.
Solution: On save of a part topic, do a topic view on PartsData to refresh the JSON object. The topic view is done asynchronously (e.g. non-blocking) so that the topic save is not slowed down. If-then-action rule:
If |
Source |
Then |
Target |
Comment |
save |
Parts.PID-* |
viewdaemon |
Parts.PartsData |
This does a non-blocking view on the parts data topic to update the JSON object in the persistent SET variable |
--
Peter Thoeny - 2015-04-07
I enhanced the plugin:
- Support conditions for Source topics (by expanding TWiki Variables). Useful to dynamically decide if action should be taken or not. Such as:
- "if 'Review Date' form field is older than 12 month, set 'Needs Review' form field",
- "if URL parameter Y is Z, do action...", etc.
- Prevent recursive if-then-actions, e.g. a save action does not trigger another save action.
The "Target" does not yet expand TWiki Variables.
--
Peter Thoeny - 2015-04-08
The "Target" does now expand TWiki Variables as well.
In addition, the
target = expression
in a
setformfield
then-action, the expression can be any value, and does not need to be of form
$formfield(...)
.
--
Peter Thoeny - 2015-04-09
I enhanced the plugin again:
- The Source field in the If-Then-Action Rules Table can be a Web.TopicName, or a list of topics.
- New "register" if-action on successful user registration.
- New "email" then-action to send an e-mail based on a template.
--
Peter Thoeny - 2015-04-15
I enhanced the plugin again:
- New "view" if-action on topic view.
- Check access permission in "setformfield" and "touch" then-actions.
- Ability to disable if-actions and then-actions in configure.
--
Peter Thoeny - 2015-04-16
I enhanced the plugin again:
- Add
ifthenaction
log entries in TWiki logs.
- Small code change; doc fixes.
--
Peter Thoeny - 2015-04-21
I enhanced the plugin again:
- New "action" if-action, triggered by %IFTHEN{action}% variable.
- Updated diagram.
--
Peter Thoeny - 2015-05-03