Difference between revisions of "Property Groups definition"

From OpenKM Documentation
Jump to: navigation, search
(Created page with '{{TOCright}} __TOC__ {{Advice|'''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 la…')
 
 
(24 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 
{{TOCright}} __TOC__
 
{{TOCright}} __TOC__
  
{{Advice|'''New feature in OpenKM 4.1'''}}
+
Sometimes you want to add more information to a document, for example, you may want to add an internal code to the document for organization purposes and a description. OpenKM uses two files to describe this metadata: '''PropertyGroups.cnd''' and '''PropertyGroups.xml'''. The first one describes the properties to be added to the document node. This definition is used by Jackrabbit to retrieve and set these values. The second one is used by OpenKM to render the values described in the previous file.
  
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:
+
{{Note|
'''PropertyGroups.cnd''' and '''PropertyGroups.xml'''.  
+
* For '''OpenKM 6.4.8 Professional''' the property groups DTD is '''[http://www.openkm.com/dtd/property-groups-2.3.dtd property-groups-2.3.dtd]'''.
 +
* For '''OpenKM 6.2.17 Professional''' the property groups DTD is '''[http://www.openkm.com/dtd/property-groups-2.2.dtd property-groups-2.2.dtd]'''.
 +
* For '''OpenKM 6.2''' the property groups DTD is '''[http://www.openkm.com/dtd/property-groups-2.1.dtd property-groups-2.1.dtd]'''.
 +
* For '''OpenKM 6.1''' the property groups DTD is '''[http://www.openkm.com/dtd/property-groups-2.1.dtd property-groups-2.1.dtd]'''.
 +
* For '''OpenKM 6.0''' the property groups DTD is '''[http://www.openkm.com/dtd/property-groups-2.0.dtd property-groups-2.0.dtd]'''.
 +
* For '''OpenKM 5.1''' the property groups DTD is '''[http://www.openkm.com/dtd/property-groups-2.0.dtd property-groups-2.0.dtd]'''.
 +
* For '''OpenKM 5.0''' the property groups DTD is '''[http://www.openkm.com/dtd/property-groups-1.1.dtd property-groups-1.1.dtd]'''.
 +
* For '''OpenKM 4.1''' the property groups DTD is '''[http://www.openkm.com/dtd/property-groups-1.0.dtd property-groups-1.0.dtd]'''.}}
  
 +
See this sample:
  
See this sample:
+
{{Note|Starting from OpenKM 6.1 you don't need this CND file and only the XML definition is needed. For OpenKM 5.1 (and previous released) you need another Property Group definition file called '''PropertyGroups.cnd''':
  
'''PropertyGroups.cnd'''
 
 
<source lang="text">
 
<source lang="text">
 
<okm = 'http://www.openkm.org/1.0'>
 
<okm = 'http://www.openkm.org/1.0'>
Line 16: Line 23:
  
 
[okg:consulting] mixin
 
[okg:consulting] mixin
- okp:consulting.name (string) = '' autocreated
+
- okp:consulting.code (string) = '' autocreated
 
- okp:consulting.comment (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
 
 
</source>
 
</source>
 +
}}
  
 
'''PropertyGroups.xml'''
 
'''PropertyGroups.xml'''
 
<source lang="xml">
 
<source lang="xml">
 
<?xml version="1.0" encoding="UTF-8"?>
 
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE property-groups PUBLIC "-//OpenKM//DTD Property Groups 1.0//EN"
+
<!DOCTYPE property-groups PUBLIC "-//OpenKM//DTD Property Groups 2.1//EN"
                                 "http://www.openkm.com/dtd/property-groups-1.0.dtd">
+
                                 "http://www.openkm.com/dtd/property-groups-2.1.dtd">
 
<property-groups>
 
<property-groups>
 
   <property-group label="Consulting" name="okg:consulting">
 
   <property-group label="Consulting" name="okg:consulting">
     <input label="Name" type="text" name="okp:consulting.name" value="Joel" />
+
     <input label="Code" type="text" name="okp:consulting.code" />
     <textarea label="Comment" name="okp:consulting.comment" value=""/>
+
     <textarea label="Comment" name="okp:consulting.comment" />
  </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-group>
 
</property-groups>
 
</property-groups>
 
</source>
 
</source>
  
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.
+
Here we can see an XML which describes the "Consulting" property group with a couple of properties. In the description, we can see an INPUT where the user should type an internal code and a comment which describes the document content.
  
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:
+
As you can see in the XML DOCTYPE, there is a formal definition at http://www.openkm.com/dtd/property-groups-2.1.dtd.
  
=== Input ===
+
{{Note|If your OpenKM server can't access to Internet, you can download this DTD and copy to a convenient place at you server. Remember to update your PropertyGroups.xml with the TDT location.
Used to enter free form text:
+
<source lang="xml">
 
+
<!DOCTYPE property-groups PUBLIC "-//OpenKM//DTD Property Groups 2.0//EN"
* '''label''': The text which describes the component. '''Required'''.
+
                                "file:///path/to/property-groups-2.0.dtd">
* '''name''': This value is used to access the value typed by the user. '''Required'''.
+
</source>}}
* '''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'''.
+
But let's see which components it can handle:
* '''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 ===
+
* checkbox
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.
+
* input
 +
* iframe
 +
* select
 +
* separator
 +
* suggestbox
 +
* text
 +
* textarea
  
* '''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 ====
+
See [[Form Element description]] for a detailed definition of every form element. These form elements have also an additional property called "readonly" with can be used to make a property not modifiable by the user.
* '''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".
 
  
[[Category: User Guide]]
+
[[Category: Installation Guide]]

Latest revision as of 16:49, 24 January 2014

Sometimes you want to add more information to a document, for example, you may want to add an internal code to the document for organization purposes and a description. OpenKM uses two files to describe this metadata: PropertyGroups.cnd and PropertyGroups.xml. The first one describes the properties to be added to the document node. This definition is used by Jackrabbit to retrieve and set these values. The second one is used by OpenKM to render the values described in the previous file.


Nota clasica.png

See this sample:


Nota clasica.png Starting from OpenKM 6.1 you don't need this CND file and only the XML definition is needed. For OpenKM 5.1 (and previous released) you need another Property Group definition file called 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.code (string) = '' autocreated
- okp:consulting.comment (string) = '' autocreated

PropertyGroups.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE property-groups PUBLIC "-//OpenKM//DTD Property Groups 2.1//EN"
                                 "http://www.openkm.com/dtd/property-groups-2.1.dtd">
<property-groups>
  <property-group label="Consulting" name="okg:consulting">
    <input label="Code" type="text" name="okp:consulting.code" />
    <textarea label="Comment" name="okp:consulting.comment" />
  </property-group>
</property-groups>

Here we can see an XML which describes the "Consulting" property group with a couple of properties. In the description, we can see an INPUT where the user should type an internal code and a comment which describes the document content.

As you can see in the XML DOCTYPE, there is a formal definition at http://www.openkm.com/dtd/property-groups-2.1.dtd.


Nota clasica.png If your OpenKM server can't access to Internet, you can download this DTD and copy to a convenient place at you server. Remember to update your PropertyGroups.xml with the TDT location.
<!DOCTYPE property-groups PUBLIC "-//OpenKM//DTD Property Groups 2.0//EN"
                                 "file:///path/to/property-groups-2.0.dtd">

But let's see which components it can handle:

  • checkbox
  • input
  • iframe
  • select
  • separator
  • suggestbox
  • text
  • textarea


See Form Element description for a detailed definition of every form element. These form elements have also an additional property called "readonly" with can be used to make a property not modifiable by the user.