Generic models

These models are used across components and portlets.

ObjectReferenceModel

This object contains a single reference to an external object (value list, dimension, etc).

Property Description Type
label The label value of the reference object String
objectId The object id of the references object Number
objectGuid The object guid of the referenced object String
externalKey The external_key specified for the attribute behind the field String
<default> When used directly, this object evaluates to the “label” property. String

ComponentModel

This object contains information about the currently execution component (the ContentViewer).

Property Description Type
id Name of the component as it is known on the client side (in the web browser). Use this for ajax-based api calls on the component. String

Example:

function refreshThisComponent() {
   iKnowBase.PageEngine.reloadComponent ('${component.id}');
}

ContextModel

The ContextModel-object contains general information related to an execution context. Use this object to find information about current time and current user.

Example:

<p>
This information was last refreshed on ${context.datetime}
</p>
Property Description Type
user Information about the executing user, either a logged on user or the guest user applicable to the request UserModel
domain Information about the domain applicable to the request DomainModel
date Current date Date
time Current time Time
datetime Current date and time Datetime
millis Number of milliseconds since 1.1.1970 Number
request Information about the current request RequestModel
language iKnowBase language code for the current context. String
isDevelopmentMode Flag indicating whether development mode is enabled or not Boolean
isServeExpandedResources Flag indicating whether resources should be served expanded (without compression) Boolean

UserModel

The UserModel-object contains information about the executing user, either a logged on user or the guest user applicable to the request.

Property Description Type
isLoggedOn Whether the current user is logged on, or is a public user Number
isAdmin Whether the current user has administrator access Number
id Numeric user id for the user Number
username Username (loginname) for the user String
token UserToken for secure authentication without logging in, for ajax-based processing. UserTokenModel
socialAuthentication Information regarding the active social user authentication (if used). SocialAuthenticationModel

UserTokenModel

The UserTokenModel-object contains a token for secure authentication without logging in, for ajax-based processing.

Property Description Type
name Name of the URL-parameter for the token String
value Token value String

SocialAuthenticationModel

The SocialAuthenticationModel-object contains information regarding the users profile from the external social provider. Only applicable if social connection is used for authentication.

Property Description Type
providerId The id of the provider the connection is associated with. String
userDisplayName A display name for the connection. Contents dependent of the provider. String
userProfileUrl A link to the provider’s user profile page. String
userImageUrl An image visualizing the connection. String
userId The id of the provider user this connection is connected to. String

DomainMode

The DomainModel-object contains information about the domain applicable to the current request.

Property Description Type
objectId The object ID of the domain Number
objectGuid The object guid of the domain String
label The label of the domain String
name The name of the domain, typically HOST.PORT String
ikbViewerPath The path to the ikbViewer module, without a trailing slash String
pageEnginePath The path to the page engine, without a trailing slash/ikbViewer String
contentServerPath The path to the content server, without a trailing slash String
resourcePath The path to the resource directory, without a trailing slash String
ikbStudioPath The path to the development studio, without a trailing slash String

RequestModel

This object contains parameters available to the component.

Property Description Type
pageurl URL for the page currently running. String
servername Name of server where the viewer is running (part of pageurl) String
serverport Port number of server where the viewer is running (part of pageurl) String
parameters Parameters sent to the request. ParametersModel
<name> Value of URL-parameter (shortcut to parameter.name). String

The properties username, referencepath and guid were earlier available in this model. They have been deprecated.

ParametersModel

This object contains information about request parameters from the current HTTP-request. The model supports several of the basic FreeMarker model types:

Property Description Type
<name> Value of URL-parameter (shortcut to parameter.name). ParameterModel, String

ParameterModel

This model contains all values for a given parameter. The model supports several of the basic FreeMarker model types:

TextMapModel

This model object contains language specific texts defined with various iKnowBase objects. The model object is a compound object. First is the actual TextMapModel, which enables you to find a TextString based on a user defined key. Next is the TextStringModel, which decides which definition of the string to use, for example the one stored with a Page or the one stored with a Template.

You may use only the TextMapModel object (as in @${viewer.strings.contactEmail}), which will then search for the string in any of the available locations. You may also specify the location “any” for the same purpose (as in @${viewer.strings.contactEmail.any}). If you want complete control of the string location, specify it directly (as in @${viewer.strings.contactEmail.template}).

The locations available vary from portlet to portlet. See the definition of the portlet object for description of which locations apply to that portlet.

TextMapModel

Property Description Type
<name> Text string definition. TextStringModel

TextStringModel

Property Description Type
page The value of the text with the given name, as specified on the page. String
template The value of the text with the given name, as specified on the template. String
style The value of the text with the given name, as specified on the presentation style. String
viewer The value of the text with the given name, as specified on the viewer. String
domain The value of the text with the given name, as specified on the domain. String
any Return any string, from any of the available locations (properties). String
<default> Value from one of style, viewer and domain, if present; otherwise null. String

Examples:

<!-- The text specified in the "contactEmail" string, in any available location. -->
${viewer.strings.contactEmail}
<!-- The text specified in the "contactEmail" string, in any available location. -->
${viewer.strings.contactEmail.any}
<!-- The text specified in the "contactEmail" string, on the template only -->
${viewer.strings.contactEmail.template}
<!-- The freemarker default value operator does not work without a location -->
${viewer.strings.contactEmail!"default-email@example.com"}
<!-- The freemarker default value operator works only when specifying a location -->
${viewer.strings.contactEmail.any!"default-email@example.com"}
${viewer.strings.contactEmail.template!"default-email@example.com"}

LoadXML macro

Use this macro to load XML from a specified URL, for further processing using FreeMarker.

Parameter Description Type
name Name of variable you want to create, where the XML will be loaded into String
url URL where the specified XML resides String
timeout Optional timeout in milliseconds. If no timeout is specified, a default value of 60 seconds will be used.. The timeout applies to each of the connect and read phases independently. Number

Examples:

<@ikb.loadXML 'myxml' 'http://www.example.com/xmlfeed' />
<#list ikb.myxml.entries as entry>
    ${entry.title}
</#list>
<@ikb.loadXML 'myxml' 'http://www.example.com/xmlfeed' 2000 />
<#if ikb.myxml! == "">
   No data was returned; possibly timeout
</#if>

LoadURL macro

Use this macro to load arbitrary text from a specified URL, for further processing using FreeMarker.

Parameter Description Type
name Name of variable you want to create, where the content will be loaded into String
url URL where the specified content resides String
timeout Optional timeout in milliseconds. The timeout applies to each of the connect and read phases independently Number

Example:

<@ikb.loadURL 'myurl' 'http://my.domain.com/htmlfeed '/>
<div>
    ${ikb.myurl}
</div>

AssignDate macro

Use this macro for simple date arithmetic, where you start with a certain date and then add a duration.

Parameter Description Type
name Name of variable you want to create, where the content will be loaded into String
base Base date Datetime
increment Increment in milliseconds Number

Example:

<@ikb.assignDate 'dueWarning' viewer.logic.currentDate 259200000 />
<div>
    ${ikb.dueWarning}
</div>