Property Groups definition
Contents |
New feature in OpenKM 4.1 |
Sometimes you want to add more information to a document, for example, if the document is about a programming language you want to specify the language. OpenKM uses two files to describe this metadata: PropertyGroups.cnd and PropertyGroups.xml.
See this sample:
PropertyGroups.cnd
<okm = 'http://www.openkm.org/1.0'>
<okg = 'http://www.openkm.org/group/1.0'>
<okp = 'http://www.openkm.org/group/property/1.0'>
[okg:consulting] mixin
- okp:consulting.name (string) = '' autocreated
- okp:consulting.comment (string) = '' autocreated
[okg:technology] mixin
- okp:technology.language (string) = '' autocreated
- okp:technology.comment (string) = '' autocreated
- okp:technology.description (string) = '' autocreated
PropertyGroups.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE property-groups PUBLIC "-//OpenKM//DTD Property Groups 1.0//EN"
"http://www.openkm.com/dtd/property-groups-1.0.dtd">
<property-groups>
<property-group label="Consulting" name="okg:consulting">
<input label="Name" type="text" name="okp:consulting.name" value="Joel" />
<textarea label="Comment" name="okp:consulting.comment" value=""/>
</property-group>
<property-group label="Technology" name="okg:technology">
<select label="Language" name="okp:technology.language" type="simple">
<option label="Java" value="java" selected="true" />
<option label="Python" value="python" />
<option label="PHP" value="php" />
</select>
<input label="Comment" name="okp:technology.comment" value="10"/>
<textarea label="Description" name="okp:technology.description" value=""/>
</property-group>
</property-groups>
Here we can see an XML which describes the components related to a task called "MyTask". This means that when when workflow is executing the "MyTask" task, it need the user who is assigned this task to enter some information to continue. In the description, we can see an INPUT where the user should type an amount.
As you can see in the XML DOCTYPE, there is a formal definition at http://www.openkm.com/dtd/property-groups-1.0.dtd. But let's see which components it can handle:
Input
Used to enter free form text:
- label: The text which describes the component. Required.
- name: This value is used to access the value typed by the user. Required.
- value: Here you can specify a default value for this component.
- width: The width of the component. Defaults to browser default HTML input width.
- height: The height of the component. Defaults to browser default HTML input height.
TextArea
Similar to Input but for bigger text:
- label: The text which describes the component. Required.
- name: This value is used to access the value typed by the user. Required.
- value: Here you can specify a default value for this component.
- width: The width of the component. Defaults to 300px.
- height: The height of the component. Defaults to 100px.
Select
In this case, the value can be selected from a list of predefined one. Every select component can contain an arbitrary number of options bigged than one.
- label: The text which describes the component. Required.
- name: This value is used to access the value selected by the user. Required.
- type: Actually can be only "simple". Simple means that only one option can be selected at a time. Defaults to "simple".
- width: The width of the component. Defaults to browser default HTML select width.
- height: The height of the component. Defaults to browser default HTML select height.
Option
- label: The text which describes the component. Required.
- value: This is the value of the option to be selected. Required.
- selected: Can be "true" or "false". Indicates if the option is selected by default or not. Defaults to "false".