HOME COMMUNITY BLOG

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Tooltip Transformation

The transformation for a tooltip needs to return a special structure for rendering rich formatted data.

Code Block
titleTooltip Transformation Example
linenumberstrue
languagexml
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
	xmlns:AS="http://schema.advantages.cz/AsapFunctions"
	xmlns:date="http://exslt.org/dates-and-times" exclude-result-prefixes="AS date">

	<xsl:template match="ROOT">
		<xsl:apply-templates select="BusinessPartner"/>
	</xsl:template>

	<xsl:template match="BusinessPartner">
		<tooltip title="{@NameLine1}">
			<cell type="grid" x="0" y="1" height="1" width="1" color="#4C4C4C">
				<row>
					<col percentWidth="100">&lt;font size="14"&gt;&lt;b&gt;<xsl:call-template name="link">
						<xsl:with-param name="url" select="concat('event://lookup/08d82ef5-df38-48d6-a276-ee5b7f027bd6?value=', Id)"/>
						<xsl:with-param name="text" select="@NameLine1"/>
						<xsl:with-param name="useLinkFormat" select="'false'"/></xsl:call-template>&lt;/b&gt;&lt;/font&gt;</col>
				</row>
			</cell>
			<cell type="grid" x="0" y="0" height="1" width="1">
				<xsl:if test="string(@refBusinessPartnerCategoryId)">
					<row>
						<col percentWidth="30">Kategorie</col>
						<col>&lt;b&gt;<xsl:value-of select="AS:LookupValue('2634a1d5-3ad6-4357-8001-a289c6376aa2', @refBusinessPartnerCategoryId)"/>&lt;/b&gt;</col>
					</row>
				</xsl:if>

				<xsl:if test="string(@LegalRegistrationCode)">
					<row>
						<col percentWidth="30">IÈO</col>
						<col percentWidth="70">&lt;b&gt;<xsl:value-of select="@LegalRegistrationCode"/>&lt;/b&gt;</col>
					</row>
				</xsl:if>

				<xsl:if test="string(@JobTitle)">
					<row>
						<col percentWidth="30">Pozice</col>
						<col percentWidth="70">&lt;b&gt;<xsl:value-of select="@JobTitle"/>&lt;/b&gt;</col>
					</row>
				</xsl:if>

				<xsl:if test="string(@TaxIdentificationCode)">
					<row>
						<col percentWidth="30">DIÈ</col>
						<col percentWidth="70">&lt;b&gt;<xsl:value-of select="@TaxIdentificationCode"/>&lt;/b&gt;</col>
					</row>
				</xsl:if>
			</cell>

			<xsl:if test="count(BusinessPartnerCommunicationChannel) > 0">
				<cell type="text" x="0" y="1" height="1" width="1"/>
				<cell type="grid" x="0" y="3" height="1" width="1" verticalGap="2">
					<xsl:for-each select="BusinessPartnerCommunicationChannel">
						<xsl:sort select="AS:LookupValue('f9e1beba-17c6-40d0-b3dc-c40d23632eaa', @refBusinessPartnerCommunicationChannelTypeId)"/>

						<xsl:variable name="deviceId" select="AS:LookupValue('299c7880-8506-4488-b116-833af0ee8f78', @refBusinessPartnerCommunicationChannelTypeId)"/>

						<row>
							<col width="5"/>
							<col width="23" 
								type="image"><xsl:attribute name="src"><xsl:choose>
									<xsl:when test="$deviceId = AS:GetConstant('BusinessPartnerCommunicationDeviceType_Post')">contact_type_postal.png</xsl:when>
									<xsl:when test="$deviceId = AS:GetConstant('BusinessPartnerCommunicationDeviceType_Web')">contact_type_web.png</xsl:when>
									<xsl:when test="$deviceId = AS:GetConstant('BusinessPartnerCommunicationDeviceType_Phone')">contact_type_phone.png</xsl:when>
									<xsl:when test="$deviceId = AS:GetConstant('BusinessPartnerCommunicationDeviceType_Email')">contact_type_email.png</xsl:when>
									<xsl:when test="$deviceId = AS:GetConstant('BusinessPartnerCommunicationDeviceType_IM')">contact_type_im.png</xsl:when>
									<xsl:when test="$deviceId = AS:GetConstant('BusinessPartnerCommunicationDeviceType_LogisticsShipping')">contact_type_shipping.png</xsl:when>
									<xsl:when test="$deviceId = AS:GetConstant('BusinessPartnerCommunicationDeviceType_Fax')">contact_type_fax.png</xsl:when>
									<xsl:otherwise>contact_type_email.png</xsl:otherwise>
								</xsl:choose></xsl:attribute><xsl:value-of select="AS:LookupValue('f9e1beba-17c6-40d0-b3dc-c40d23632eaa', @refBusinessPartnerCommunicationChannelTypeId)"/></col>
							<col><xsl:choose>
									<xsl:when test="$deviceId = AS:GetConstant('BusinessPartnerCommunicationDeviceType_Post')"><xsl:value-of select="@CompleteAddress"/></xsl:when>
									<xsl:when test="$deviceId = AS:GetConstant('BusinessPartnerCommunicationDeviceType_Web')"><xsl:call-template name="link">
											<xsl:with-param name="url" select="@Text"/>
											<xsl:with-param name="text" select="@Text"/></xsl:call-template>
									</xsl:when>
									<xsl:otherwise><xsl:value-of select="@Text"/></xsl:otherwise>
								</xsl:choose></col>
						</row>
					</xsl:for-each>
				</cell>
			</xsl:if>

			<xsl:if test="AS:IsInRole('FRM_Partner_CommunicationOverview')">
				<xsl:variable name="lastStatus" select="AS:LookupValue('5106df86-2099-4517-bf57-98350778eb86', Id)"/>
				
				<xsl:if test="string($lastStatus)">
					<cell type="text" x="0" y="5" height="1" width="1"/>
					<cell type="text" x="0" y="6" height="1" width="1">&lt;i&gt;<xsl:value-of select="$lastStatus"/>&lt;/i&gt;</cell>
					<cell type="text" x="0" y="4" height="1" width="1"><xsl:call-template name="link">
													<xsl:with-param name="url" select="concat('event://menu/e7741bdc-1565-4678-9fa5-f072ac663f4e?businessPartnerId=', Id)"/>
													<xsl:with-param name="text" select="'více...'"/></xsl:call-template></cell>
				</xsl:if>
			</xsl:if>
		</tooltip>
	</xsl:template>

	<xsl:template name="link">
		<xsl:param name="url"/>
		<xsl:param name="text"/>
		<xsl:param name="useLinkFormat" select="'true'"/>

		<xsl:variable name="finalUrl">
			<xsl:choose>
				<xsl:when test="contains($url, '://')">
					<xsl:value-of select="$url"/>
				</xsl:when>
				<xsl:otherwise>
					<xsl:value-of select="concat('http://', $url)"/>
				</xsl:otherwise>
			</xsl:choose>
		</xsl:variable>&lt;font <xsl:if test="$useLinkFormat = 'true'">color="#0000FF"</xsl:if>&gt;&lt;a href=&quot;<xsl:value-of select="$finalUrl"/>&quot;&gt;<xsl:if test="$useLinkFormat = 'true'">&lt;u&gt;</xsl:if><xsl:value-of select="$text"/><xsl:if test="$useLinkFormat = 'true'">&lt;/u&gt;</xsl:if>&lt;/a&gt;&lt;/font&gt;</xsl:template>
</xsl:stylesheet>

<tooltip>

Tooltip is the root element of the tooltip information.

Code Block
title<Tooltip> Example
languagexml
<tooltip title="{@NameLine1}">

Attributes

titleIf you want the tooltip to be docked in a sidebar (for record level tooltips) you can specify a title that will be displayed in the header of the section.

Possible subelements:

  • <cell>

<cell>

Cell defines a section inside the tooltip. A tooltip can contain one or more cells. Cells are of different types.

Code Block
title<Cell> Example
languagexml
<cell type="grid" x="0" y="1" height="1" width="1" color="#4C4C4C">

Attributes

type

Type of the cell. Possible values are:

  • grid
  • text
  • image
xColumn number
yRow number
heightNumber of rows
widthNumber of columns
verticalGapGap between columns
colorBackground color of the cell
srcUrl pointing to the image location in case that type="image".

Possible subelements:

  • <cell>
  • <row>
  • HTML markup if type="text"

<row>

In case you need to put data into tabular format, you can create <row> elements. The cell type needs to be grid.

Possible subelements:

  • <col>

<col>

Each grid row can be split into cells defined by the <col> element.

Attributes

width

Width of the column in pixels.

percentWidthWidth of the column in percents.

Possible subelements:

  • HTML markup

HTML markup

ORIGAM supports a small subset of HTML. The following HTML tags are supported:

Anchor tagThe <a> tag creates a hypertext link and supports the following attributes:
  • target: Specifies the name of the target window where you load the page. Options include _self_blank_parent, and _top. The _self option specifies the current frame in the current window, _blank specifies a new window, _parent specifies the parent of the current frame, and _top specifies the top-level frame in the current window. 
  • href: Specifies a URL or a link event.The URL can be either absolute or relative to the location of the SWF file that is loading the page. An example of an absolute reference to a URL is http://www.origam.com; an example of a relative reference is /index.html. Absolute URLs must be prefixed with http://; otherwise, ORIGAM treats them as relative URLs. You can use the link event to cause the link to execute an ORIGAM function instead of opening a URL. To specify a link event, use the event scheme instead of the http scheme in your href attribute. An example is href="event:myText" instead of href="http://myURL"; when the user clicks a hypertext link that contains the event scheme, the text field dispatches a link TextEvent with its text property set to "myText". See below for the list of link functions.
Bold tagThe <b> tag renders text as bold. A bold typeface must be available for the font used.
Break tagThe <br> tag creates a line break in the text field. Set the text field to be a multiline text field to use this tag.
Font tagThe <font> tag specifies a font or list of fonts to display the text.The font tag supports the following attributes:
  • color: Only hexadecimal color (#FFFFFF) values are supported. 
  • face: Specifies the name of the font to use. As shown in the following example, you can specify a list of comma-delimited font names, in which case ORIGAM selects the first available font. If the specified font is not installed on the local computer system or isn't embedded ORIGAM selects a substitute font. 
  • size: Specifies the size of the font. You can use absolute pixel sizes, such as 16 or 18, or relative point sizes, such as +2 or -4. 
Image tagThe <img> tag lets you embed external image files (JPEG, GIF, PNG), SWF files, and movie clips inside text fields. Text automatically flows around images you embed in text fields. You must set the text field to be multiline to wrap text around an image. 

The <img> tag supports the following attributes: 

  • src: Specifies the URL to an image or SWF file, or the linkage identifier for a movie clip symbol in the library. This attribute is required; all other attributes are optional. External files (JPEG, GIF, PNG, and SWF files) do not show until they are downloaded completely. 
  • width: The width of the image, SWF file, or movie clip being inserted, in pixels. 
  • height: The height of the image, SWF file, or movie clip being inserted, in pixels. 
  • align: Specifies the horizontal alignment of the embedded image within the text field. Valid values are left and right. The default value is left
  • hspace: Specifies the amount of horizontal space that surrounds the image where no text appears. The default value is 8. 
  • vspace: Specifies the amount of vertical space that surrounds the image where no text appears. The default value is 8.

ORIGAM displays media embedded in a text field at full size. To specify the dimensions of the media you are embedding, use the <img> tag height and width attributes. 

In general, an image embedded in a text field appears on the line following the <img> tag. However, when the <img> tag is the first character in the text field, the image appears on the first line of the text field. 

Italic tagThe <i> tag displays the tagged text in italics. An italic typeface must be available for the font used.
List item tagThe <li> tag places a bullet in front of the text that it encloses. Note: Because ORIGAM dos not recognize ordered and unordered list tags (<ol> and <ul>, it does not modify how your list is rendered. All lists are unordered and all list items use bullets.
Paragraph tagThe <p> tag creates a new paragraph. The text field must be set to be a multiline text field to use this tag. The <p> tag supports the following attributes:
  • align: Specifies alignment of text within the paragraph; valid values are leftrightjustify, and center.
Text format tag

The <textformat> tag lets you use a subset of paragraph formatting properties within text fields, including line leading, indentation, margins, and tab stops. You can combine <textformat> tags with the built-in HTML tags. 

The <textformat> tag has the following attributes: 

  • blockindent: Specifies the block indentation in points.
  • indent: Specifies the indentation from the left margin to the first character in the paragraph. Both positive and negative numbers are acceptable. 
  • leading: Specifies the amount of leading (vertical space) between lines. Both positive and negative numbers are acceptable. 
  • leftmargin: Specifies the left margin of the paragraph, in points. 
  • rightmargin: Specifies the right margin of the paragraph, in points.
  • tabstops: Specifies custom tab stops as an array of non-negative integers.
Underline tagThe <u> tag underlines the tagged text.

ORIGAM supports the following HTML entities:

&lt; < (less than)
&gt; > (greater than)
&amp; & (ampersand)
&quot; " (double quotes)
&apos; ' (apostrophe, single quote)

has to result in an HTML that will be embedded within the tooltip. Any HTML tags can be used.

Links To Menu

You can create a link to execute your ORIGAM application menu items more easily. To do this you haver to make use of lookups which have existing menu bindings already. All you need to know is a lookup id and the value. The system will automatically launch the correct menu item when user clicks on the link.

Code Block
titleSyntax
languagexml
event://lookup/{lookupId}?value={recordId}

In reality you would craft the following part of your transformation:

Code Block
titleExample
languagexml
concat('event://lookup/08d82ef5-df38-48d6-a276-ee5b7f027bd6?value=', Id)

need to create a Hashtag Category.