Technical documentation - Widgets
This article describes how to configure Widgets.
This configuration is available in version 5.1 and later.
Overview
Widgets is a method to include custom texts and external content on a presentation. It is also possible to access selected data from a Widget and include it in the Widget.
Configuration
Widgets are configured PresentationSettings section of profile.config.
<PresentationSettings>
<Presentation id="start" template="index" class="start">
<Trigger label="start"/>
<!-- Display a welcome text with user's first name on start page. -->
<Widget display="body" class="start-widget" text="Welcome to Service Parts {0}!" />
</Presentation>
</PresentationSettings>
Attributes
Widgets have the same attributes as most settings, display, class etc, see Technical documentation - Presentation settings in version 5. Widget specific options are:
Options | Usage | Values |
---|---|---|
text | A key text which will be displayed in the widget. It may contain parameters which are inserted at {0}, {1}, etc. | Key text or text. |
text-param-0, text-param-1, text-param2, … | A parameter will fetch its data from the system by accessing data. | See below for how to access data |
url | An url. The url may contain parameters within {0}, {1}, etc. | URL |
url-mode | How URL is displayed, as a clickable link, or as content. Default is just as a link | iframe |
url-param-0, url-param-1, url-param-2, … | A parameter will fetch its data from the system by accessing data. | See below for how to access data |
url-target | Use | blank |
Data
Data objects can be accessed
Data object | Content/comment |
---|---|
Name | Current presentation’s name in selected UI language |
Identity | Current presentation’s identity |
User.FirstName / LastName | User's first or last name |
User.Addresses[0].Name / Address / City / Zip / Country | User’s first address ([0]) per field. |
|
|
Examples
Some Widget examples with corresponding configuration.
<Presentation template="index">
<Trigger label="start"/>
<Widget display="body" text="My name is {0} {1}. I live in {2}" text-param-0=".User.FirstName" text-param-1=".User.LastName" text-param-2=".User.Addresses[0].City" url-mode="iframe" url="https://maps.google.com/maps?q={0}%20{1}%20{2}&t=&z=13&ie=UTF8&iwloc=&output=embed" url-param-0=".User.Addresses[0].Name" url-param-1=".User.Addresses[0].City" url-param-2=".User.Addresses[0].Country"/>
<Widget display="body" text="Mail me at {0}" url="mailto:{0}" text-param-0=".User.Email" url-param-0=".User.Email"/>
<Widget display="body" text="This is an text widget."/>
<Widget display="body" text="This is an text widget. The part assembly have the name {0}." text-param-0="Name"/>
<Widget display="body" text="This is an anchor widget. Click to navigate to google." url="http://www.google.com"/>
<Widget display="body" text="This is an anchor widget. Click to open google in a new with search predefined." url-target="blank" url="https://www.google.com/search?q={0}+{1}" url-param-0="Identity" url-param-1="Name"/>
<Widget display="body expanded" label="This is an iframe widget." url-mode="iframe" url="http://www.signifikant.se"/>
</Presentation>