
h1. User-Defined Document Types



h1. Create a Node Type

Do following steps to create a new node type :

1\. Go to *ECM Administration* -> *Type of Content* -> *Manage Node Type*.

2. Click the *Add* button to show the form to create a new node type.

3. Select a name space for the node. (A namespace is like a prefix of a node).

4. Enter the name for the node in 'Node type name'. This field is required.

5. Select a value for the *Is mixin type* field.

* True:	this node is mixin type.
* False:this node is not mixin type.

6. Select a value for the *Orderable child nodes* field:

* True:	child nodes are ordered.
* False:child node are not ordered.

7. Enter a value for the *Primary item name* field.

8. *Super types*: click to add more parent node.

9. Property definitions: list all definition names of the *Property* tab.

10. Child node definitions: list all definition names of the *Child node* tab.

11\. Click the *Save* button to accept adding a new node type or click the *Save draft* button to save this node type as draft

h1. Create a Template

Each created node needs to have a form to enter data for their properties (called dialog template) and to display the existing values (called view template). Following guides to create a new template:

1\. Go to *ECM Administration* -> *Content Presentation* -> *Manage Templates*.

2. Click the *Add* button on the *Manage Templates* form to open the *Add new template* form.

3. Select the type of the template that you want to add by clicking in the *Name* field.

4. Add a label for this template in the *Label* field.

5. Check /uncheck *Document Template* if this template is for document or not.

6. Select permissions for this template.

7. Select the *Dialog* tab and enter a value into the *Dialog content* field.

8. Select the *View* tab and enter values into the *View content* field.

9. Click the *Save* button to accept adding a new template.

h1. Use the JCR FE to create the Document

After creating new document templates, users will use in File Explore, do as follows:

1\. Go to *ECM Administration* -> *File Explorer*.

2. Select any drive.

3. Select the *Action* tab and click the *Add Document* icon (or right click on the right pane and select 'Add Document') to open a form to add a document.

4. Select the type of document that you have just created in ECM Administration.

5. Put values in fields.

6. Click the *Save* button.

<h3> *How to do create new node type with one text property and one date property, using XML configuration files ?* </h3>
(edit in webapps/portal/WEB-INF/conf/dms/nodetypes-ecm.xml file)
{code}
<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>

{code}
<br>
<h3> *How to create new template using XML configuration files ?* </h3>
(edit in webapps/portal/WEB-INF/conf/dms/dms-templates-configuration.xml file)
{code}

 <value>
     <object type="org.exoplatform.services.cms.templates.impl.TemplateConfig$NodeType">
        <field  name="nodetypeName"><string>exo:newnodetype</string></field>
        <field  name="documentTemplate"><boolean>true</boolean></field>


        <field  name="label"><string>AAAAA</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>/fornewnodetype/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>/fornewnodetype/dialogs/dialog1.gtmpl</string>
                     </field>
                     <field name="roles"><string>*</string></field>
                  </object>
                </value>
            </collection>
        </field>
      </object>
   </value>

{code}


