Part Types in Gentics CMS

This section contains an overview over existing part types. These part types can be used to create tagtypes. Part types are the essential building blocks of tagtypes.

1 Overview

Type Id Type Name Description
1 Text Used for normal text (without HTML), which is entered using the tagfill dialog. Linebreaks will be transformed into <br> tags while rendering.
2 Text/HTML Used for text containing HTML tags, which is entered using the tagfill dialog. Linebreaks will be transformed into <br> tags while rendering, unless they occur within HTML tags or immediately follow an HTML tag. (deprecated)
3 HTML Used for text containing HTML tags, which is entered using the tagfill dialog or Aloha Editor. No conversion will be done while rendering. (deprecated)
4 URL (page) The URL (page) part type provides an element to select a page within any accessible folder.
5 Tag (global) (Deprecated)
6 URL (image) Reference an image.
8 URL (file) Reference a file.
9 Text (short) Used for short text (no linebreaks), that does not contain HTML. The tagfill dialog will contain an input field. No conversion will be done while rendering. (deprecated)
10 Text/HTML (long) Variant of the type Text/HTML with a larger textarea in the tagfill dialog. (deprecated)
11 Tag (page) Render a tag of another page. (deprecated)
13 Overview The overview part type creates and overview which can be configured using a the provided wizard. WARNING: Cannot be used together with other tag parts that are set as editable.
15 List Users can enter values (newline separated), and can choose whether to render them as ordered or unordered list. (deprecated)
16 List (unordered) Users can enter values (newline separated), which will be rendered as unordered list. (deprecated)
17 List (ordered) Users can enter values (newline separated), which will be rendered as ordered list. (deprecated)
18 Select (image-height) (Deprecated)
19 Select (image-width) (Deprecated)
20 Tag (template) Render a tag of another template. (deprecated)
21 HTML (long) Variant of HTML with a larger textarea in the tagfill dialog.
22 File (localpath) (Deprecated)
23 Table ext (Deprecated) The Table ext part type is deprecated and cannot be used with Aloha Editor.
24 Select (class) (Deprecated)
25 URL (folder) This part can be used to select a folder.
26 Java Editor (Deprecated)
27 DHTML Editor (Deprecated)
29 Select (single) This part type provides static datasources from which a user can pick a single value.
30 Select (multiple) This part type provides static datasources from which a user can pick multiple values.
31 Checkbox Part type for input of boolean value.
32 Datasource With this part type, the user can define individual datasources in the tag.
33 Velocity The velocity part type can be used to evaluate all previously generated text using the velocity markup parser.
34 Breadcrumb This part type can be used to generate breadcrumbs. (deprecated)
35 Navigation The navigation part type can be used to create a custom navigation using a velocity template. (deprecated)
36 HTML (custom form) The custom form part type can be used to create custom form elements. (deprecated)
37 Text (custom form) The custom form part type can be used to create custom form elements. (deprecated)
38 File (Upload) The file upload part type is a URL (file) part type which has an additional file upload button. (deprecated)
39 Folder (Upload) The folder upload part type is a URL (folder) part type which has an additional file upload button. (deprecated)
40 Node The node part is a drop-down menu with the nodes available to the user.
41 Form (Deprecated) The Form part lets the user select a form from the Form Generator Custom Tool. NOTE: Parts of this type can only be used in the new Editor User Interface. (deprecated)
42 CMS Form The CMS Form part lets the user select a form from the CMS. See Gentics CMS Forms for details. NOTE: Parts of this type can only be used in the new Editor User Interface.

Inline editable parts – which are transformed to editables in Aloha Editor – should only use the part types HTML or HTML (long).

2 Custom Form Part Type

As of Version 5.36, the custom form part type has been deprecated and replaced with the Custom TagProperty Editor.

The custom part type enables the implementer to create custom user interfaces that can be used by editors. The interface can be customized using javascript and stylesheets.

The custom ui template will be defined within the field which contains the html code.

Available variables:

Variable Description
<nodefieldname> The name of the field
<nodevalue> The value of the html entity
<nodetextvalue> The original value
<nodename> The name of the tag part
<nodekeyword> The keyname of the tag part
<nodesid> The session id of the user
<nodeuserid> The user id of the user
<nodecontext> The context in which the tag fill dialog was opened. (“template”, “content” für Seiten, “tagtype” oder “object”)
<proxyprefix> The configured proxy prefix. This may be empty when using backend mode
<stagprefix> The configured stag prefix. (By default: ‘/.Node/’)

For technical reasons, the customform is currently not rendered in the context of its tagtype. That means that you can’t directly access other parts in the same Tag without specifiying the tagname (e.g. in the page). However you can use Javascript to access other parts with their class name in the tagfill dialog dynamically.

Additionally typical node properties can also be used when the feature ‘customform_resolve_nodetags’ was enabled (e.g. <node TAGNAME>)

The option “inline editable” is without any effect. TIP: A guide which explains how to include CSS and JS libraries can be found here

The demo cms project contains the following examples of the custom form tag part type:

  • TinyMCE-Editor: This Tag includes the TinyMCE WYSIWYG-Editor.
  • HTML Customform Example: This example contains just a custom form field.
  • Text Customform Example: The same example like “HTML Customform Example”. In this case the “Text (custom form)” is used.
  • [Formular] limitierte Eingabe: An inputfield that can just accept a specified amount of characters.

Special class names can be used to access the custom form elements. The name contains “cnTagPart_PARTKEYWORD”. Example: The inputfield of the part with the keyword text has the class cnTagPart_text. For the part type “URL (page)” there will be a “cnTagPart__PARTKEYWORD_internal” and a “cnTagPart__PARTKEYWORD_external” class set.

3 Velocity Part Type

An example for this tag part type can be found within the demo server in the folder “Demo-CMS-Projekt/Home/Node Tags”.

  • Parameter “template”
  • Type: HTML lang
  • Content: The Velocity Template Code that should be rendered by the visible Velocity Part Type.
  • Parameter “macros”:
  • Type: HTML lang
  • Content: VTL Macros which can be used within the implementation.

Example Velocity Tagtyp:

  • Part 1: Typ Velocity, Keyword vtl, Visible
  • Part 2: Typ HTML lang, Keyword template, Not visible
  • Part 3: Typ HTML lang, Keyword macros, Not visible

Errors within the velocity implementation will be diplayed within the Gentics CMS im “error stream”.

Use always the .toString() method when comparing two tags within a #if() command.

Example:

 
#if( $cms.page.object.myprop.toString() == "test" )
  • Parameter “startfolder”
  • Type: URL (folder)
  • Content: The start folder of the breadcrumb.
  • Parameter “template”
  • Type: HTML (long)
  • Content: The Velocity-Template of the navigation.
  • Parameter “disable_activepage”
  • Type: Checkbox
  • Content: False if the current page should be linked in the breadcrumb.
  • Parameter “tagname_hidden”
  • Type: Text (short)
  • Content: Name of the object property that is used to hide objects wihtin the navigation.
  • Parameter “disable_fallback”
  • Type: Datasource
  • Content:
    • 0 is used for language fallbacks to the default language,
    • 1 or. “yes” to end breadcrumb path if no page in the current language exists,
    • 2 or. “skip” to skip non exisiting pages in the current language.
  • Parameter “tagname_startpage”
  • Type: Text (short)
  • Content: Name of the object property that is used for the startpage of a folder.
  • Parameter “disable_hidden”
  • Type: Checkbox
  • Content: True when hidden objects should be displayed within the navigation.

4.1 Velocity Variables

VLT Description
$bc.path An array that contains all folders for the breadcrumb navigation.
$bc.disableactivepage True, when the current page should not be linked.
$nav in $bc.path An navigation object within the breadcrumb
$nav.level The level of the navigation. (0 = start folder)
$nav.object The object that is contained within the navigation object
$nav.object.object.objectproperty_name Access to the object property ‘objectproperty_name’ of the given object
$nav.name I18n name of the navigation object
$nav.startpage The start page of this navigation object. The object is related to the active language. Please note that this property directly links to the page object within the navigation object. Pages that are offline will still provide an .url property. Add a check using $nav.startpage.online to verify that the page is online.
$nav.hidden True, when the navigation object should not be displayed within the navigation.

Tag Parts: |. Part Type|. Name|. Keyword |_. Changeable|. Required|. Hidden|. inline editable | | Breadcrumb | bc | bc | no | no | no | no | | HTML (long) | template | template | no | no | yes | no | | URL (folder) | startfolder | startfolder | no | no | yes | no |

Example: breadcrumb

#*
render all folder startpages in the path to our current location in an orderd list
i.e.
<ol>
    <li><a href="_URL_TO_FIRST_FOLDER_STARTPAGE_">_NAME_OF_FIRST_FOLDER_STARTPAGE_</a></li>
    <li><a href="_URL_TO_SECOMD_FOLDER_STARTPAGE_">_NAME_OF_SECOMD_FOLDER_STARTPAGE_</a></li>
    <li>_NAME_OF_CURRENT_PAGE</li>
</ol>
*#
<ol>#*
    *##foreach($nav in $bc.path)#*
        ## if not the current page
        *##if( ! $nav.startpage.equals($cms.page) )#*
            ## render a link to the startpages of the folders in the path
            *#<li><a href="$!{nav.startpage.url}">$!{nav.object.name}</a></li>#*
        *##else#*
            ## to finish up render the pagename of the current page
            *#<li class="active">$!{cms.page.name}</li>#*
        *##end#*
    *##end##
</ol>##

An example can be found within the demo server folder “Demo-CMS-Projekt/Home/Navigation”.

  • Parameter “startfolder”
    • Type: URL (folder)
    • Content: The startfolder of the navigation.
  • Parameter “template”
    • Type: HTML (long)
    • Content: The velocity template of the navigation.
  • Parameter “sortby”
    • Type: Text (short)
    • Content: Name of the object property which should be used to sort the elements. (e.g. object.name).
  • Parameter “sortorder”
    • Type: Datasource (ASC, DESC)
    • Content: Sortorder (ascending of descending)
  • Parameter “tagname_sort”
    • Type: Text (short)
    • Content: Name of the object property that is used to display a special sortorder. (Format: “sortorder;sortby”)
  • Parameter “tagname_hidden”
    • Type: Text (short)
    • Content: Name of the object property that should be used to hide the navigation. By default the object property “navhidden” will be used.
  • Parameter “objects”
    • Type: Select (multiple)
    • Content: List of all objects that should be displayed within the navigation (Pages, Folders, Images, Files). By default you should use the following template for the multiselect datasource: "<ds value>,"
  • Parameter “disable_hidden”
    • Type: Checkbox
    • Content: True, if hidden objects should be displayed within the navigation. All hidden objects will not be shown by default. (See “tagname_hidden”).
  • Parameter “sitemap”
    • Type: Checkbox
    • Content: True, if a sitemap should be displayed (All folders will be flapped open)

5.1 Velocity Variables

Variable Description
$nav.object The current element of the navigation
$nav.level The level of the current object (0 = Start folder)
$nav.hasItems() True, if the navigation element contains subelements.
$nav.open True, if the element is flapped open.
$nav.relativenr Position of the element relativ to the parent element
$nav.relativecount Count of all child element of the parent element.
$nav.absolutenr Absolute position of the element over all elements that have been displayed already.
$nav.childrencount Count of all child elements of this element.
$nav.inpath True, if this element is included within the path of the currently displayed page.
$nav.currentpage Wahr, falls dieses Element die aktuell angezeigte Seite ist
$nav.subtree Renders the subtree (all child elements) of this navigation element.

Please refere to the list of meta properties for examples and more detailed explanations.

6 Custom Part Type Implementations

Custom part types can be created using the AbstractExtensiblePartType class.

To use extensible parttypes you need to insert a row into the type table of the cms database. Please note that once the row has been inserted, any changes to the row, such as updating the class name, require a tomcat restart (the part type information is cached internally).

To avoid id conflicts please calculate your personal id range for now:

  • Take the 1st 4 characters of one of the customers cms license keys.
  • Convert them from hex to dec.
  • Multiply by 1000. this is the lowest allowed id.
  • Add 999. thid is the highest allowed id.
  • E.g: license key is A2B4-xxxx-xxxx…
  • HEX a2b4 is 41652 in decimal.
  • Your personal id range is 41652000 – 41652999.