Skip to main content
Skip table of contents

CenshareNamespace

Global Variables, Functions and Directives available in 'cs.'

implements: hash
bundle: online channel standard (oc)
since 4.2.0
Global Variables, Functions and Directives available in 'cs.'

All global Variables, Functions and Directives which are injected by the FreeMarker Skin Engine, are placed in the namespace'cs'. For detailed informations about the FreeMarker language and build-in data types please consult the Freemarker Manual.

This model is made accessible by the OCFreemarkerExtensionService with the global access path 'cs'.

Request Context

cs.requestRequestModel
since 4.4.3
Access to data defined within request context.

cs.navigationNavigationStateModel
since 4.2.0
Returns the navigation state of the current page request.

cs.@<String:key> ↦ TemplateModel
since 4.2.0
Returns a model of the parameter value of the current component with the name 'key'. Should no Parameter with the name 'key' exist, undefined will be returned.

cs.componentComponentModel
since 4.2.0
Returns a model to access the component of currently executed skin.

cs.absolute(String:path)String
since 4.4.3
Convert an incomplete path into an absolute path by combining it with the servlet context path.

cs.propsPropsTemplateHashModel
since 4.8.2
Access a hash-model to store and retrieve attributes in the ComponentContext.

cs.qualify(String:url)String
since 4.2.0
Returns the qualified URL for 'url'.
This means setting the protocol, the host and the port of the current Request in the provided URL. The original URL may be absolute or relative.

cs.resource(String:relativeResourcePath)CsResourceModel
since 4.2.0
Extends the relative path resource with the current servlet path of the current page request. If the path points to a static resource in the sense of the Online Channel, a part will be added, which depends on the content of the storage item.

  • Example:
    cs.resource('resources/js/bottom.js')

Session Context

cs.sessionSessionModel
since 4.4.3
Access to data defined within session context.

Site Context

cs.siteSiteModel
since 4.4.3
Access properties and attribute for this site

Database

cs.cachedtable(String:tableName)CachedTableModel
since 4.2.0
Returns the master data table with given name 'tableName'

cs.datastoreDataStoreSessionModel
since 4.4.3
Returns the FreeMarker representation of the database session of the associated with the current page request.

cs.feature(String:featureKey, String:featureValue)FeatureModel or FeatureValueModel
since 4.2.0
Called with one parameter returns the master data of the feature whose feature key is the same as the value of 'featureKey' as FeatureModel.
If paramter 'featureValue' is given as second parameter returns the FeatureValueModel for it.
Should no corresponding feature entry exist, undefined is returned.

  • Example:
    cs.query(String:featureKey) - get the FeatureModel for 'featureKey'
    cs. query(featureKey, featureValue) - get the FeatureValueModel for 'featureKey' and 'featureValue'

cs.query(String:xpath)QueryResultModel
since 4.2.0
Performs the XPath-query specified in the parameter 'xpath' on the local database and returns the query result.

  • Example:
    cs.query("cs:asset()[@censhare:resource-key='censhare:foo']")
  • query by XPath for asset with resource key 'censhare:foo' 'query'

cs.remoteDatastoreempty
since 4.2.0
deprecated 18.3.0
No longer supported and access returns empty

cs.resolveAsset(NodeModel :node)TemplateModel
since 4.5.0
Returns the asset denoted by 'node' wrapped in his available models.
If the node element 'node' is an asset placement in a content-XML, the function returns the corresponding asset. If the asset is not available or node does not represent a valid placement, undefined is returned.

OSGI Bridge

cs.osgi(String:service, String:filter, String:wrapper)BeansWrapper.BeanModel
since 4.2.0
Generates an instance of the OSGi service wrapper class given in the argument 'wrapper' for the service defined by the parameters 'service' and filter. Optional parameter 'filter' is an OSGi service filter expression, and 'service' specifies an OSGi service ID.

Forms

The forms-directive allow for the generation of HTML forms which are linked to component parameters of a corresponding page. For this the component parameters must be provided with query bindings. The form directives correspond to the similarly-named HTML form elements and can be freely provided with attributes, with the exceptions documented below. All parameters which are not explicitly linked to fields in the form are automatically added as hidden fields. The name and IDAttributes of the form fields are automatically determined by the query binding of the component parameters.

<@cs.form ComponentStateModel:state>.../@cs.form
since 4.2.0
Creates an HTML form element. The optional attribute 'state' allows the form to be based on a component state that differs from the current component state.

<@cs.input String:type, ComponentModel:component, String:parameter, String:action>.../@cs.input
since 4.2.0
Can be used within a <@cs.form> directive to generate an HTML input element.
The attribute 'type' specifies the type of input to add and must be one of [ 'text' | 'password' | 'checkbox' | 'radio' | 'email' | 'search' | 'file' | 'hidden' | 'button' | 'submit'].
The attribute 'parameter' specifies the name of the component parameter to be bound to this element.
The optional attribute 'component' allows for reference to a component that is different from the current component.
The value attribute is automatically filled with the component parameter value.
The 'type' values 'button' and 'submit' support the attribute 'action' to specify the component action to be called up during the sending of the form.

<@cs.button ComponentModel:component, String:action>.../@cs.button
since 4.2.0
Can be used within a <@cs.form> directive to generate an HTML button element.
The Attribute 'action' specifies the name of the component action to be called up during the sending of the form.
The optional attribute 'component' allows for reference to a component that is different from the current component.

<@cs.textarea ComponentModel:component, String:parameter>.../@cs.textarea
since 4.2.0
Can be used within a <@cs.form> directive to generate an HTML textarea element.
The attribute 'parameter' specifies the name of the component parameter to be bound to this element.
The optional attribute 'component' allows for reference to a component that is different from the current component. The textarea's value attribute is automatically filled with the component parameter value.

<@cs.label ComponentModel:component, String:parameter>.../@cs.label
since 4.3.0
Can be used within a <@cs.form> directive to generate an HTML label element with automatically generated attributes.
The attribute 'component' is optional.

<@cs.select ComponentModel:component, String:parameter>.../@cs.select
since 4.2.0
Can be used within a <@cs.form> directive to generate an HTML select element.
The attribute 'parameter' specifies the name of the component parameter to be bound to this element.
The optional attribute 'component' allows for reference to a component that is different from the current component. The select's value attribute is automatically filled with the component parameter value.

<@cs.option String:value>.../@cs.option
since 4.2.0
Can be used within a <@cs.form> directive to generate an HTML option element.
The selected attribute is automatically determined, depending on the setting of the 'value' attribute.

Collections

cs.newHashBuilder()HashBuilderModel
since 4.6.0
Returns a builder to generate and populate a hash-model.

cs.newSequenceBuilder()SequenceBuilderModel
since 4.6.0
Returns a builder to generate and populate a sequence-model.

Miscellaneous

cs.debugDebugNamespace
since 5.2.0
Returns a model with utils for developers.

cs.min(Number:n1, Number:n..., Number:nm)Number:q
since 4.2.0
Returns the minmum of the given values n1..nm, where m > 0 must be true.

  • Example:
    cs.min(2,9,16,-4, 3) ↦ -4 - return '-4' as the minimum of given values

cs.max(Number:n1, Number:n..., Number:nm)Number:q
since 4.2.0
Returns the maximum of the given values n1..nm, where m > 0 must be true.

  • Example:
    cs.max(4,9,16,-4, 3) ↦ 16 - return '16' as the maximum of given values

cs.random()Number
since 4.2.0
Return a new pseudo-random floating point number in the half open interval [0,1) with double precision.

  • Example:
    cs.random() ↦ 0.12345
  • Example:
    cs.random() ↦ 0.12345

<@cs.snippet String:mimetype, String:encoding, Boolean:wrapresponse>.../@cs.snippet
since 4.8.0
Marks part of skin, to be adressable in a SnippetRequest. In a SnippetRequest only the correspending part will be rendered.
Mostly used for AJAX requests. Content can always be rendered, or differentiate using 'isSnippetRequest'

cs.isSnippetRequest()Boolean
since 4.8.0
Indicates whether the current request is a SnippetRequest.

cs.hash(Object:scalar, String:method)String
since 4.5.5
Returns the hexadecimally coded hash of the string representation of the object 'scalar'. The hash function is selected by optional parameter 'method'. The permissible values of 'method' are 'sha1' and 'md5'.

<@cs.log String:level>.../@cs.log
since 4.3.1
Redirects the output of the embedded FreeMarker code to the logging system. The optional Parameter 'level' allows a Java logging level to be specified. If 'level' is not set, log level INFO is used.

cs.parseXml(String:xml)NodeModel
since 4.6.2
Converts the string representation of an XML document into the corresponding FreeMarker XML model.
If the parameter xml contains no valid textual representation of an XML Document, undefined will be returned.

cs.permitted(TemplateModel:object)Boolean
since 4.3.1
Indicates whether the current user has read access to the passed object. The determination of the right takes place over the Online Channel rights management system.

cs.statistics(String:instanceId)StatisticsServiceModel
since 4.6.0
Access statistic data-point operations.The parameter 'instanceId' indicates the osgi service id.

cs.toJsonMl(NodeModel:node)String
since 4.4.3
Converts the XML node into a canonical JSON.

cs.translate(Locale:lang, String:key, String:default, String:scalar1, String:scalar..., String:scalarm)String
since 4.4.0
Returns from the translation system the localized string for the key 'key' and the optional Locale 'lang' (default: FreeMarker standard locale).
First the value of the key is sought in the translation system. If the key does not exist 'default' is used.
Before being returned, the string is formatted using the Java formatting rules using the optional parameters arg1 ... argm.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.