4. GenticsContentModule

4.1. Introduction

Display content, stored in the GenticsContentRepository, published by Gentics Content.Node. Supports dynamic lists and some user interaction.

4.2. Details

Contents based on templates of type CSS, JS or XML are rendered fullscreen automatically.

4.3. Parameters

Table 5.4.  Portlet parameters for GenticsContentModule

NameTypeDefaultDescription
contentidString(either contentid or filename required)Id of the content to initially load.
filenameString(either contentid or filename required)Filename of the content to load initially (if no contentid is set)
pub_dirString/Publish directory of the content to load initially (if a filename, but no contentid is set)
node_idIntegerNULLId of the node, from which the initial content shall be taken (if a filename, but no contentid is set). The default value NULL means that the node_id is not used to find the content.
datasourceString(required)Id of the datasource to use, must be of type Gentics .Node ContentRepository.
ruleStringtrueRule to determine whether the content can be viewed or not. Is also derived to plist items.
maxwidthnameStringmaxwidthName of the parameter passed to the module to spezify the width of the resized image(
maxheightnameStringmaxheightName of the parameter passed to the module to spezify the height of the resized image
imagetypenameStringautoName of the parameter passed to the module to spezify the image type.
maxallowedwidthInteger16384Maximal allowed with in pixel for resizing images. Maximal allowed width.
maxallowedheightInteger16384Maximal allowed height in pixel for resizing images. Maximal allowed height.
templateEngineBooleanfalsewhether to use TemplateEngine2
editPageString The ML code to use for developer's editmode.
template_nopermString The ML code to use if a requested page was forbidden by rule.
prefixstaticurlsString  By setting this parameter all static URLs made from PLinks to files or images contained in the contentrepository will be prefixed with the string provided.
ruleactionsNode 

<actions> node to define pluggable actions that determine whether the user has permission to render the current content. There must exist at least one action with id permission that returns TRUE or FALSE in a return variable named permission . The content object will be available as data.object in the pluggable actions. For further details on pluggable actions, see Section 2.2.8, “Pluggable Actions” .

languagemanagementBooleanfalse With this setting, the language management for the GenticsContentModule can be switched on. See “Language Management” (Section 4.10) for details.
languageString 

Current content language, when languagemanagement is used.

languagefallbackList of Strings 

Space separated list of language codes to be used for language fallback, when languagemanagement is used, but the current content is not available in the desired language.

pathlinksBooleanfalse

When this parameter is set to true , the generated “PLinks” (Section 4.6) will contain pathinformation (pub_dir and filename and eventually node_id) instead of the contentid. This can be used to create bookmarkable urls for the GenticsContentModule.

For this feature to work correctly, it is necessary, that the pathinformation (pub_dir, filename, node_id) is really published to the content repository.

nodeidinpathlinksBooleantrue

This parameter is only interpreted, when the parameter pathlinks is set to true . By setting this to false , inclusion of the node_id into the generated “PLinks” (Section 4.6) can be disabled. Note that when the node_id is not used to identify the linked content object, the link may not unique, when content objects from multiple nodes are all contained in the same content repository.

contentChangeCheckingBooleanfalse Flag to switch on/off automatic checking for content changes. When switched on, the shown content is frequently checked for changes and refreshed, if necessary.
contentChangeCheckingIntervalInteger60Interval in seconds, in which the shown content is checked for modifications, when the parameter contentChangeChecking is true.
secretString By setting a secret, the Image Resize Validation is switched on. See “Image Resize Validation” (Section 16) for details.

4.4. Properties

Table 5.5.  Portlet Properties for GenticsContentModule

VariableTypeDescription
forbiddenBooleanWhether the content was forbidden by the rule parameter.
renderedcontentStringThe currently rendered content.
contentidStringThe currently rendered contentid
*StringAll other content properties in the ContentRepository, as defined in Gentics Content.Node's tagmap.

4.5. Events of the GenticsContentModule

Table 5.6. Events of the GenticsContentModule

NameDescriptionEvent properties
onSelectThis event is triggered every time a contentlink is requested.
NameDescription
contentidThe contentid if the linktarget, which was requested. May also be accessed using the portal property event.properties.contentid
onContentNotFound

This event is triggered in one of the following cases:

  • The content with the initially configured contentid does not exist.
  • The content with the initially configured node_id, pub_dir and filename does not exist.
  • A non-existent content was requested (via an action url) by contentid or node_id/pub_dir/filename.
  • A non-existent content should be set (e.g. in a reaction) by setting the parameter "contentid" to the portlet.

NameDescription
contentid The contentid of the non-existent content (if content was requested/configured by contentid).
node_id The node_id which was requested/configured (if content was requested/configured by node_id/pub_dir/filename).
pub_dir The pub_dir which was requested/configured (if content was requested/configured by node_id/pub_dir/filename).
filename The filename which was requested/configured (if content was requested/configured by node_id/pub_dir/filename).

4.6. PLinks

This portlet renders <plink>s either because it is configured as “PLink Processor” (Section 8.2.9) or automatically for <plink>s contained in the rendered content. When a user clicks the <plink>, an onSelect event is thrown for the plink processing portlet. Any further activity (e.g. rendering the target content) has to be implemented as reaction to this onSelect event. For details on reactions, see Section 11.1.3, “PNodes”.

The <plink>s rendered in the content shown in the GenticsContentModule will automatically be XML escaped, when the mimetype of the content is either text/html or text/xml . For all other mimetype s (e.g. text/js or text/css ), the <plink>s will NOT be XML escaped.

XML escaped URLs with have the characters & , < , > , ' and " be replaced by their entities &amp; , &lt; , &gt; , &#039; and &#034; respectively.

[Note]Note
Note that just by placing <plink>s and configuring a “PLink Processor” (Section 8.2.9), this processor will NOT automatically display the pages linked to by clicked <plink>s. You will always need a reaction that forces the clicked page to be displayed.

4.7. Image resizing

Images can also be dislplayed by this portlet. Whenever an image is to be processed it is possible to resize to image to a custom size as followd (if parameternames are default). If one of the parameters of height or width is not spezified the image is processed proportional.

<plink id="10008.12345">&p.maxwidth=500&p.maxheight=200&p.imagetype=png

Resized images are chached using the portal's internal cache (see Section 10, “Cache”).

4.8. Custom actions

This module offers custom actions to enable interaction between the user and the portal through links. Similar to plinks, paction placeholders in the content are transformed to dynamic portallinks:

<a href="<paction [customactionvalue]>">Click this action!</a>

The customaction is stored into the portal after the click and can be used in the whole portal through the moduleproperty "customaction" until it is changed or the portalsession is ended. A customaction can be also generated manually for POSTs:

<form method="POST">
<input type=hidden name="am" value="PCP">
<input type=hidden name="p.action" value="custom">
<select name="p.customaction">
<option value="[customactionvalue]">
</select>
<input type="submit">
</form>

4.9. Plists

Plists are used to display dynmic content lists.

Example 5.2. Syntax Plists

<plist id="...">
      <pagelinkunselected></pagelinkunselected>
      <pagelinkselected></pagelinkselected>
      <pagelinkseperator></pagelinkseperator>
      <listtemplate></listtemplate>
      <pagesize></pagesize>
      <start></start>
      <limit></limit>
      <pagebarleftsize></pagebarleftsize>
      <pagebarrightsize></pagebarrightsize>
      <pagelinkellipsis></pagelinkellipsis>
      <showfirstpage> </showfirstpage>
      <showlastpage> </showlastpage>
      <sortby> </sortby>
      <sortorder> </sortorder>
      <emptyresult></emptyresult>
      <filterrule></filterrule>
      <template></template>
</plist>

Table 5.7. Settings Plists

NameTypeDefaultDescription
idString Id of the plist, must be unique in the scope of the content, required for usage of paging
pagelinkunselectedString Template of the page link for unselected pages. Supports variables of the pagelink template (see below)
pagelinkselectedString Template of the page link for the selected page. Supports variables of the pagelink template (see below)
pagelinkseperatorString Template for the separator between pagelinks to neighbouring pages
listtemplateString Template for the list, when paging is active. Supports variables <insert plist> and <insert pagebar> (see below)
pagesizeInteger number of elements shown on each page, optional (defaults to "no paging")
startInteger Number of the first shown element, optional (defaults to 0)
limitInteger Maximum number of elements shown in the plist
pagebarleftsizeInteger maximum number of pagelinks shown to the left of the selected page (excluding the first page). Optional, defaults to -1 (all pages shown)
pagebarrightsizeInteger maximum number of pagelinks shown to the right of the selected page (excluding the last page). Optional, defaults to -1 (all pages shown)
pagelinkellipsisString String to be shown when pagelinks are omitted due to pagebar limitations. Optional, defaults to " … "
showfirstpageBoolean Flag, whether the link to the first page is always shown. Optional, defaults to true.
showlastpageBoolean Flag, whether the link to the last page is always shown. Optional, defaults to true.
sortbyString Attribute name for sorting of elements
sortorderString Sortorder (asc or desc)
emptyresultString String to be shown when no elements found. Optional, defaults to empty string
filterruleString Rule for filtering the elements shown in the plist
templateString Template for display of one element (row) in the plist. Supports <insertlist>s shown below. All attributes of the shown contentobject can be accessed by <insert>

Table 5.8. Template Variables for Rowtemplate

NameTypeDescription
nrIntegerNumber of the element on the page, starting with 1

The Rowtemplate variables are provided through <insertlist *> tags, in the template parameter.

Table 5.9. Template Variables for Listtemplate

NameTypeDescription
plistStringfilled with the plist (exclusive paging)
pagebarStringfilled with the pagebar

The Listtemplate variables are provided through <insert *> tags, in the listtemplate parameter.

Table 5.10. Template Variables for Pagelink

NameTypeDescription
startIntegerNumber of the first element shown on this page
endIntegerNumber of the last element shown on this page
pageIntegerNumber of thuis page
pageurlStringurl to switch onto this page

The Pagelink variables are provided through <insert *> tags, in the pagelinkunselected and pagelinkselected parameter.

4.10. Language Management

The optional language management can be used to automatically display the selected content in the clients language, when available. It also supports fallback to other languages in a specified order.

The language management can be switched on by setting the pnode parameter languagemanagement . When it is switched on and the GenticsContentModule should render a page, it tries to find a better suitable one by following this algorithm:

  1. Determine the desired content language (by reading the pnode parameter language ).

  2. Get the attribute contentid_[languagecode] (where [languagecode] is the desired language) from the content object that shall be rendered. When the attribute links to the content object in the desired language, render that object and finish.

  3. When the content object was not found in the desired language, do the step above with the languages optionally defined in the pnode parameter languagefallback and render the content in the first language found.

  4. When the content was not found in any of the specified languages, simply render the given content object, no matter what language it is in.

The language of the GenticsContentModule can be set to the current portal language by configuring the pnode-parameter like this:

<pnode ...>
  <parameters>
    <parameter name="language"><pobject>portal.language.id</pobject></parameter>
    ...
  </parameters>
</pnode>