Each document type is represented by a node type in the JCR. Therefore, to create a new document type, you have to add a new node type. There are two ways to do this: through XML configuration files, or through the administration portlet.

To learn more about how to use the administration portlet, refer to the Administration Guide.

Otherwise, you can create a new document type by configuring the file /nodetypes-configuration.xml in your extension.

<nodeType name="exo:newnodetype" isMixin="true" hasOrderableChildNodes="false" primaryItemName=""> <supertypes>
<supertype>exo:article</supertype>
</supertypes>
<propertyDefinitions>
<propertyDefinition name="text" requiredType="String" autoCreated="true" mandatory="true" onParentVersion="COPY"
protected="false" multiple="false">
<valueConstraints/>
</propertyDefinition>
<propertyDefinition name="date" requiredType="Date" autoCreated="false" mandatory="true" onParentVersion="COPY"
protected="false" multiple="false">
<valueConstraints/>
</propertyDefinition>

</propertyDefinitions>
</nodeType>

By defining a supertype, you can reuse other node types and extend them with more properties (just like inheritance in Object Oriented Programming).

Dialogs are Groovy Templates that generate forms by mixing static HTML fragments and Groovy calls to the components responsible for building the UI at runtime. As a result, you will get a simple but powerful syntax.

By placing interceptors in your template, you will be able to execute a Groovy script just before and just after saving the node. Pre-save interceptors are mostly used to validate input values and their overall meaning while the post-save interceptor can be used to do some manipulations or references for the newly created node, such as binding it with a forum discussion or wiki space.

To place interceptors, use the following fragment:

Interceptor Groovy scripts are managed in the 'Manage Script' section in the ECM admin portlet. They must implement the CmsScript interface. Pre-save interceptors obtain input values within the context:

Whereas the post-save interceptor are passed the path of the saved node in the context:

In the next code sample, each argument is composed of a set of keys and values. The order of arguments are not important and only the key matters. That example defines a field with the id as "hiddenField2", which will generate a hidden field. The value of this field will be automatically set to UTF-8 and no visible field will be printed on the form.

Once the form has been saved, the date value will be saved under the relative JCR path ./exo:image/jcr:lastModified.

In many cases, the previous solution with static options is not good enough and one would like to have the select box checked dynamically. That is what we provide thanks to the introduction of a Groovy script as shown in the code fragment below.

The script itself implements the CMS Script interface and the cast is done to get the select box object as shown in the script code which fills the select box with the existing JCR workspaces.

A widget can have multiple values if you add the argument "multiValues=true" to the directive.

Manage template service

The Template service enables you to create dialogs and view templates for each node type registered. Each node type may have many dialogs and view templates. The template will be used when creating or viewing nodes.

.../webapps/portal/WEB-INF/conf/ecm/ecm-templates-configuration.xml

As usual, one can register a plugin inside the service. This plugin initializes default dialogs and views template of any node type as nt:file, exo:article, exo:workflowAction, exo:sendMailAction, and more.

With init-parameters as:

<init-params>
	<value-param>
		<name>autoCreateInNewRepository</name>
		<value>true</value>
	</value-param>
	<value-param>
		<name>storedLocation</name>
		<value>war:/conf/ecm/artifacts/templates</value>
	</value-param>
	<value-param>
		<name>repository</name>
		<value>repository</value>
	</value-param>	        
  <object-param>
	<name>template.configuration</name>
	<description>configuration for the localtion of templates to inject in jcr</description>
	<object type="org.exoplatform.services.cms.templates.impl.TemplateConfig">            	
	  <field  name="nodeTypes">
		<collection type="java.util.ArrayList">               
		  <value>
			<object type="org.exoplatform.services.cms.templates.impl.TemplateConfig$NodeType">
			  <field  name="nodetypeName"><string>exo:article</string></field>
			  <field  name="documentTemplate"><boolean>true</boolean></field>
			  <field  name="label"><string>Article</string></field>
			  <field  name="referencedView">
				<collection type="java.util.ArrayList">
				  <value>
					<object type="org.exoplatform.services.cms.templates.impl.TemplateConfig$Template">             
					  <field name="templateFile"><string>/article/views/view1.gtmpl</string></field>
					  <field name="roles"><string>*</string></field>                
					</object>                               
				  </value>  
				</collection>
			  </field>                  
			  <field  name="referencedDialog">
				<collection type="java.util.ArrayList">
				  <value>
					<object type="org.exoplatform.services.cms.templates.impl.TemplateConfig$Template">             
					  <field name="templateFile"><string>/article/dialogs/dialog1.gtmpl</string></field>
					  <field name="roles"><string>*</string></field>                
					</object>                                                   
				  </value>  
				</collection>
			  </field>                                    
			</object>
		  </value>                  
		</collection>
	  </field>
	</object>
  </object-param>
</init-params>    

Taxonomy is a particular classification arranged in a hierarchical structure. Taxonomy trees in eXo Platform will help you organize your content into categories.

When you create a new taxonomy tree, you will add a pre-configured exo:action (exo:scriptAction or exo:businessProcessAction) to the root node of the taxonomy tree. This action is triggered when a new document is added anywhere in the taxonomy tree. The default action moves the document to the physical storage location and replaces the document in the taxonomy tree with a symlink of type exo:taxonomyLink that points to it. The physical storage location is defined by a workspace name, a path and the current date and time.

Like adding document types, taxonomy trees can be managed through the Administration portlet, or by adding XML files.

To configure taxonomy trees by adding configuration files in the /webapp/WEB-INF/conf/acme-portal/wcm/taxonomy/ directory, create a new file called $taxonomyName-taxonomies-configuration.xml. For example, if the name of your taxonomy tree is "acme", the file should be named acme-taxonomies-configuration.xml.

You can view the file here: $PLF-HOME/samples/acme-website/webapp/src/main/webapp/WEB-INF/conf/acme-portal/wcm/taxonomy/acme-taxonomies-configuration.xml.

As you can see, the value-params enable you to define the repository, workspace, name of the tree and its JCR path. You can then configure permissions for each group of users in the portal, and the triggered action when a new document is added to the taxonomy tree. Finally, you can describe the structure and names of the categories inside your taxonomy tree.