Manual:Extension/Workflows/Activity/SetTemplateParams: Difference between revisions

(Created page with "==<span class="mw-headline">Description</span>== The ''EditWikiPage'' activity appends content to an existing wiki page. {| class="wikitable" style="" ! colspan="2" style="ba...")
 
No edit summary
Line 1: Line 1:
==<span class="mw-headline">Description</span>==
==<span class="mw-headline">Description</span>==
The ''EditWikiPage'' activity appends content to an existing wiki page.  
<span style="color: rgb(4, 30, 73)">The ''SetTemplateParams'' activity allows automatic setting of template parameters on a page.</span>
 
* Templates are accessed by the order of appearance on the page.
* Non-existing templates are counted as links, so they do not count in this list.
* Params inside the template can be specified by their name, or the index in case of non-named params. Index for non-named params starts at 1 (not 0!), as to be consistent with how template params are accessed in the template itself.
* Nested templates are not supported as of now.
 
{| class="wikitable" style=""
{| class="wikitable" style=""
! colspan="2" style="background-color:rgb(234, 236, 240);text-align:center;" |'''Short profile'''
! colspan="2" style="background-color:rgb(234, 236, 240);text-align:center;" |'''Short profile'''
|-
|-
| style="" |Name
| style="" |Name
| style="" |EditWikiPage
| style="" |SetTemplateParams
|-
|-
| style="" |Async
| style="" |Async
Line 14: Line 20:
|-
|-
|BPMN Extension Element "wf:type"
|BPMN Extension Element "wf:type"
|<code>edit_page</code>
|<code>set_template_param</code>
|}
|}<!-- https://github.com/wikimedia/mediawiki-extensions-Workflows/blob/master/doc/Activity/SetTemplateParams.MD -->


==<span class="mw-headline">Properties</span>==
==<span class="mw-headline">Properties</span>==


=== Input properties ===
=== Input properties ===
Each input property can provide a default value if no other value is set by the workflow.
{| class="wikitable" style="width:100%;"
{| class="wikitable" style="width:100%;"
! style="background-color:rgb(234, 236, 240);text-align:center;" |Name of property
! style="background-color:rgb(234, 236, 240);text-align:center;" |Name of property
Line 30: Line 35:
| style="" |<code>title</code>
| style="" |<code>title</code>
|<nowiki>-</nowiki>
|<nowiki>-</nowiki>
| style="" |Name of the wiki page that will be edited by this activity.
| style="" |Name of the wiki page that includes the template(s).
|
|
| style="" |string
| style="" |string
Line 36: Line 41:
|<code>user</code>
|<code>user</code>
|  -
|  -
|Name of user that will be shown as making the edit.
|Name of user that will be shown as revision user.
|Default value: ''MediaWiki default''
|
|string
|string
|-
|-
|<code>content</code>
|<code>template-index</code>
|  -
|Index of the template on page (starting from 0).
|
|int
|-
|<code>template-param</code>
|  -
|  -
|Content that will be added to the wiki page.
|Param to modify. Can be a string in case of named params, or a number, in case of non-named params (starting from 1, accessor for the param)
|
|
|string
| rowspan="2" |int, string
|-
|-
|<code>mode</code>
|<code>value</code>
|  -
|  -
|How the content is added to the wiki page.  
|New parameter value to set.
|
|
* ''append:'' Content is added at the end of the page.
* ''replace:'' Content replaces all existing page content.
* ''prepend:'' Content is added at the beginning of the page.
|string
|-
|-
|<code>minor</code>
|<code>minor</code>
|  -
|  -
|The edit will be marked as ''major'' or ''minor'' revision.
|<span style="color: rgb(4, 30, 73)">The edit will be marked as</span> ''major'' <span style="color: rgb(4, 30, 73)">or</span> ''minor'' <span style="color: rgb(4, 30, 73)">revision.</span>
|
|
* ''1'' (=minor revision)
*''1'' (=minor revision)
* ''0'' (=major revision)
*''0'' (=major revision)
|int
|int
|}
|}
Line 84: Line 91:
== Example ==
== Example ==
<syntaxhighlight lang="xml">
<syntaxhighlight lang="xml">
<bpmn:task id="Activity_18egh9o" name="Edit page">
<bpmn:task id="EditTemplate" name="Edit template">
    <bpmn:extensionElements>
<bpmn:extensionElements>
<wf:type>edit_page</wf:type>
<wf:type>set_template_param</wf:type>
</bpmn:extensionElements>
</bpmn:extensionElements>
<bpmn:property name="title" default="Some page" validation="required"/>
<bpmn:property name="title" default="DummyPage" validation="required,existing-title"/>
<bpmn:property name="user" default="Mediawiki default" validation="existing-user"/>
<bpmn:property name="user" default="WikiSysop" validation="existing-user"/>
<bpmn:property name="content" default="This is my test at editing"/>
<!-- Index of the template on page (starting from 0) -->
<bpmn:property name="mode" default="append"/> <!-- ALlowed: append, replace, prepend -->
<bpmn:property name="template-index" default="2"/>
<bpmn:property name="minor" default="1"/>
<!-- Param to modify. Can be a string in case of named params, or a number, in case of non-named params (starting from 1, accessor for the param) -->
<bpmn:property name="template-param" default="1"/>
<!-- New value to set -->
<bpmn:property name="value" default="Super edited param"/>
<bpmn:property name="minor" default="0"/>
 
<!-- Output properties -->
<!-- Output properties -->
<bpmn:property name="revisionId"/>
<bpmn:property name="revisionId"/>
<bpmn:property name="timestamp"/>
<bpmn:property name="timestamp"/>
  <bpmn:incoming>Flow_1qh6vpl</bpmn:incoming>
  <bpmn:outgoing>Flow_0if1kyp</bpmn:outgoing>
</bpmn:task>
</bpmn:task>
</syntaxhighlight>
</syntaxhighlight>

Revision as of 11:34, 18 January 2023

Description

The SetTemplateParams activity allows automatic setting of template parameters on a page.

  • Templates are accessed by the order of appearance on the page.
  • Non-existing templates are counted as links, so they do not count in this list.
  • Params inside the template can be specified by their name, or the index in case of non-named params. Index for non-named params starts at 1 (not 0!), as to be consistent with how template params are accessed in the template itself.
  • Nested templates are not supported as of now.
Short profile
Name SetTemplateParams
Async Yes
BPMN type bpmn:Task
BPMN Extension Element "wf:type" set_template_param

Properties

Input properties

Name of property Source Description Possible values Type
title - Name of the wiki page that includes the template(s). string
user - Name of user that will be shown as revision user. string
template-index - Index of the template on page (starting from 0). int
template-param - Param to modify. Can be a string in case of named params, or a number, in case of non-named params (starting from 1, accessor for the param) int, string
value - New parameter value to set.
minor - The edit will be marked as major or minor revision.
  • 1 (=minor revision)
  • 0 (=major revision)
int

Output properties

Name of property Source Description Type
revisionId - The revision ID of the edited page. string
timestamp - The revision time of the edited page. timestamp

Example

<bpmn:task id="EditTemplate" name="Edit template">
	<bpmn:extensionElements>
		<wf:type>set_template_param</wf:type>
	</bpmn:extensionElements>
	<bpmn:property name="title" default="DummyPage" validation="required,existing-title"/>
	<bpmn:property name="user" default="WikiSysop" validation="existing-user"/>
	<!-- Index of the template on page (starting from 0) -->
	<bpmn:property name="template-index" default="2"/>
	<!-- Param to modify. Can be a string in case of named params, or a number, in case of non-named params (starting from 1, accessor for the param) -->
	<bpmn:property name="template-param" default="1"/>
	<!-- New value to set -->
	<bpmn:property name="value" default="Super edited param"/>
	<bpmn:property name="minor" default="0"/>

	<!-- Output properties -->
	<bpmn:property name="revisionId"/>
	<bpmn:property name="timestamp"/>
  <bpmn:incoming>Flow_1qh6vpl</bpmn:incoming>
  <bpmn:outgoing>Flow_0if1kyp</bpmn:outgoing>

</bpmn:task>




To submit feedback about this documentation, visit our community forum.

No categories assignedEdit

Discussions