Skip to main content
Skip table of contents

censhare metadata directives - SysAdmin

To display asset data on an asset page, censhare Web provides the Properties (aka metadata) widget. The Properties widget uses the censhare metadata directives to retrieve and output data. This article introduces the key concept and usage of the <cs-metadata-row/> directive. For a comprehensive list of all metadata directives, see the article Metadata Directives in the censhare Development guide.

Context

Asset properties can be displayed on an asset page. For this purpose, censhare provides the Properties widget.

Prerequisites

The requirement for working with metadata directives in censhare Web are correctly setup features in the Master data of the censhare Admin Client. To use the censhare metadata directives and write the respective templates, you have to be familiar with the censhare data model as well as with XML and HTML editing.

Introduction

The metadata directives retrieve asset data and create an output of these data in the Properties widget on an asset page. for more information, see the Properties widget configuration.

The censhare metadata directives are XML elements that retrieve data from an asset and render an output that is configured in attributes of the element. To configure the widget, you have to create a template that uses the censhare metadata directives.

For a simple Properties widget configuration, use the <cs-metadata-row/> directive.

Key concepts

The configuration of content display and edit dialog is written in standard HTML and CSS. censhare provides specific CSS classes for styling. In addition, censhare UI directives are used to reference asset metadata (the properties to be displayed and edited in the widget). The censhare UI directives can be enriched with parameters that allow you to control the output. The following section introduces the <cs-metadata-row/> directive. There are more directives available for specific UI controls and configurations. In order to configure these, see the censhare Developer guide.

cs-metadata-row

To configure the <cs-metadata-row/> directive in a Properties widget, the property to be displayed/edited must be referenced. Additionally, you can add a mapping that renders either the default UI control for the selected value type or overwrites it with another UI control parameter. The configuration can have additional attributes (see table below) that control how the directive is rendered.

The optional parameters unit/unit set, language, and color that are configured in the feature definition are rendered automatically. The same goes for child features if they are configured in the feature definition in the censhare Admin Client.


Attribute

Mandatory

Description

property

yes

This attribute references the feature to be displayed or edited in the widget. The value is built following the pattern: "asset.traits.TRAIT.PROPERTY". Replace TRAIT by the trait key and PROPERTY by the property key of the feature to get a unique identifier. Remember that traits must be added to the dialog asset, otherwise, nothing is shown in the widget and the dialog.

read

no

If this attribute is set, the property is rendered in read-only mode. The attribute has no value. This attribute must be set in the display configuration. In the dialog configuration, use the "disabled" attribute instead.

row-label

no

This attribute overwrites the feature name.

disabled

no

This attribute is similar to the "read" attribute and renders the property in read-only mode. Other than in "read" mode, it renders the respective input field but users cannot enter or edit anything. For consistency reasons, we recommend using this attribute in the dialog configuration instead of the "read" attribute.

required

no

Not in "read" mode. With this attribute, censhare renders a mandatory field. The field is highlighted in the dialog and the OK button is disabled unless the user enters or selects a value.

translate-prefix

no

Only in "read" mode. This attribute can be used for standard keys. For these keys localizations are available in the "~work/runtime-web/../csMainFrame" directory. The attribute maps the value to these keys so that they are displayed in the language selected for the user interface.

filter

no

Only in "read" mode. This attribute applies the defined filter to display conditional values.

hide-root

no

Not to be set in "read" mode. This attribute hides the root node of hierarchical value lists. With other value types, this attribute will be ignored.

multilines

no

Deprecated. Only for string values. Not in "read" mode. This attribute renders a text area input field with the number of lines given in the value of the parameter (for example: multilines="3"). This attribute is deprecated and will be removed in future releases. Instead, use the UI control parameter in the feature definition instead. This renders an extendable 10-line text area.

inline

no

Deprecated. Use the

For more information see this article [LINK:3989181]

directive instead.


validate-selected

no

To enable validation of value list items, set to "true". If "true, load-optins-by-domain and/or load-optins-by-domain2 must be set as well.

load-optins-by-domain

no

To enable validation of value list items for the Main domain, set to "asset.traits.domain.domain.value[0].value". The validate-selected attribute must be "true".

load-options-by-domain2

no

To enable validation of value list items for the Second domain, set to "asset.traits.domain.domain2.value[0].value". The validate-selected attribute must be "true".


The cs-metadata-row directive supports more attributes than listed above, for instance "asset-id", "direction", "relation-type" and "multivalue". These are not used in the context of the Properties widget, but in asset relation metadata dialogs.

Dialog validation

The dialog validation checks, if the first and/or second domain of a value corresponds to the first and or second domain of the current asset. If an asset is moved to another domain, invalid properties values are highlighted in the Edit properties dialog. The asset can still be saved with the invalid values, but users get notified every time they edit the properties of an asset.

Dialog validation can be configured in Value list and Hierarchical value list features, and for Dynamic value lists. The domains of the value list items must be added to the value list items:

  • In Value lists: In the censhare Admin Client, create a list item and set the main domain and/or second domain for this item.

  • In Hierarchical value lists: In the censhare Admin Client, create a list item and set the parent item, main domain and/or second domain for this item.

  • In Dynamic value lists: Set the main domain and/or second domain in the assets that are assigned to the Value list. For more information, see Dynamic value lists.



(1) Invalid fields are only shown in the Edit properties dialog, not in the Widget.

(2) The dialog validation does not work with inline editing, feature inheritance, and editing of multiple assets.


Result

The templates you created with the <cs-metadata-row/> directive shows the respective asset data if you set up the template in a Properties widget.


JavaScript errors detected

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

If this problem persists, please contact our support.