123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!--
- Licensed Materials - Property of IBM
- IBM Cognos Products: cpscrn
- (C) Copyright IBM Corp. 2005, 2013
- US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
- -->
- <!--
- Copyright (C) 2008 Cognos ULC, an IBM Company. All rights reserved.
- Cognos (R) is a trademark of Cognos ULC, (formerly Cognos Incorporated).
- -->
- <xsl:stylesheet version="1.0"
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns:xts="http://developer.cognos.com/schemas/xts/"
- xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt"
- xmlns:nav="http://developer.cognos.com/schemas/cps/navigation/1/">
- <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
- <xsl:key name="interParamList" match="/root/interactions/param" use="@name"/>
- <xsl:variable name="config" select="/root/input[@name='configurationResponse']/config/param[@name='contentLocales']"/>
- <xsl:template match="/">
- <xsl:variable name="controller-params" select="/root/controllerParams/param"/>
- <xsl:variable name="customs" select="/root/customs/param"/>
- <xsl:variable name="interactions" select="/root/interactions/param"/>
- <xsl:variable name="transients" select="/root/transients/param"/>
- <xsl:variable name="constRemoveHead" select="'remove-'"/>
- <xsl:variable name="constRemoveTail" select="'form-remove'"/>
- <xsl:variable name="lenRemoveTail" select="string-length($constRemoveTail)-1"/>
- <xsl:variable name="custProps" select="/root/fragment/meta/customProperties"/>
- <xsl:variable name="formAction" select="/root/interactions/param[@name='formaction']"/>
- <xsl:variable name="fragMode" select="/root/controllerParams/param[@name='frag-mode']"/>
- <xsl:variable name="is-edit-mode" select="$fragMode='edit' or $fragMode='config'"/>
- <xsl:variable name="fragWindowState" select="/root/controllerParams/param[@name='frag-windowState']"/>
- <xsl:variable name="navItemResponse" select="/root/init/objectResponse/nav:getItemResponse"/>
-
- <response>
- <xsl:choose>
- <xsl:when test="$is-edit-mode and $formAction = 'save'">
- <customs>
- <xsl:for-each select="$custProps">
- <xsl:choose>
- <xsl:when test="@name = 'title'">
- <param name="title">
- <xsl:for-each select="$config/locale">
- <xsl:variable name="lid" select="@id"/>
- <xsl:if test="$interactions[@name = concat('title-',$lid)]">
- <xsl:if test="not(contains(string(/root/interactions/param[@name='removeLang']),concat($lid,';')))">
- <value xml:lang="{$lid}">
- <xsl:value-of select="$interactions[@name = concat('title-',$lid)]"/>
- </value>
- </xsl:if>
- </xsl:if>
- </xsl:for-each>
- </param>
- </xsl:when>
- <xsl:otherwise>
- <param name="{@name}">
- <xsl:value-of select="key('interParamList', concat('p_', @name))"/>
- </param>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:for-each>
- </customs>
- <state/>
- </xsl:when>
- <xsl:when test="$is-edit-mode and $formAction = 'objectSelect'">
- <state>
- <xsl:for-each select="$custProps">
- <xsl:choose>
- <xsl:when test="@name = 'title'">
- <xsl:for-each select="$interactions[starts-with(@name,'title-')]">
- <xsl:copy-of select="."/>
- </xsl:for-each>
- </xsl:when>
- <xsl:otherwise>
- <param name="{@name}">
- <xsl:value-of select="key('interParamList', concat('p_', @name))"/>
- </param>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:for-each>
- </state>
- </xsl:when>
- </xsl:choose>
-
-
- <xsl:variable name="delayExecutionSetting">
- <xsl:choose>
- <xsl:when test="$formAction = 'save' and $is-edit-mode">
- <xsl:value-of select="$interactions[@name='p_delayExecution']"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$customs[@name='delayExecution']"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
-
- <!--
- We delay the exection when:
- the delayExecution setting is enabled and the getContent parameter does not exist
- -->
- <xsl:variable name="delayExecution" select="$delayExecutionSetting = 'true' and not($interactions[@name='getContent']) "/>
-
- <fragment>
- <!-- We will only add a sub-fragment if we are not in edit mode or exiting the edit mode.-->
- <xsl:variable name="objectName">
- <xsl:if test="$navItemResponse != ''">
- <xsl:value-of select="$navItemResponse/*/nav:name"/>
- </xsl:if>
- </xsl:variable>
- <xsl:if test=" not($delayExecution) and (not ($is-edit-mode) or ($formAction = 'save') )">
- <xsl:variable name="selectionId">
- <xsl:choose>
- <xsl:when test="$transients[@name='display_id'] and $transients[@name = 'display_id'] != ''">
- <xsl:value-of select="$transients[@name='display_id']"/>
- </xsl:when>
- <xsl:when test="$formAction = 'save' and $is-edit-mode">
- <xsl:value-of select="$interactions[@name='p_navSelectionId']"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$customs[@name='navSelectionId']"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:variable name="dlgCustomParams">
- <xsl:choose>
- <xsl:when test="$formAction = 'save' and $is-edit-mode">
- <xsl:value-of select="$interactions[@name='p_dialogCustomizations']"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$customs[@name='dialogCustomizations']"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:variable name="viewerHeight">
- <xsl:choose>
- <xsl:when test="$formAction = 'save' and $is-edit-mode">
- <xsl:value-of select="$interactions[@name='p_viewerFragmentHeight']"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$customs[@name='viewerFragmentHeight']"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:variable name="channel">
- <xsl:choose>
- <xsl:when test="$formAction = 'save' and $is-edit-mode">
- <xsl:value-of select="$interactions[@name='p_channel']"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$customs[@name='channel']"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
-
- <!--
- Use the selected objects's defaultPortalAction setting iff:
- - there is no prior customization done on the viewer
- - the target viewer does NOT already have a selected entry
- - the target object is being selected at runtime (e.g.: in a Navigator with channel setup)
- - the default action is 'run' (otherwise, leave it up to the viewer's default)
- -->
- <xsl:variable name="useDefaultPortalAction" select="$dlgCustomParams = '' and string($transients[@name='display_id']) != '' and string($customs[@name='navSelectionId']) = '' and $navItemResponse/*/nav:defaultPortalAction = 'run'"/>
-
- <xsl:if test="$selectionId != ''">
- <xsl:variable name="href">
- <xsl:choose>
- <xsl:when test="$navItemResponse/nav:item/nav:type = 'package' and $navItemResponse/nav:item/nav:subType = 'adaptiveAnalytics' ">
- <xsl:text>/AApackage/</xsl:text>
- </xsl:when>
- <xsl:when test="$navItemResponse/nav:shortcut">
- <xsl:text>/shortcut/</xsl:text>
- <xsl:value-of select="$navItemResponse/nav:shortcut/*/nav:type"/>
- <xsl:text>/</xsl:text>
- </xsl:when>
- <xsl:when test="$navItemResponse/*/nav:type != '' ">
- <xsl:text>/</xsl:text>
- <xsl:value-of select="$navItemResponse/*/nav:type"/>
- <xsl:text>/</xsl:text>
- </xsl:when>
- <xsl:otherwise>
- <xsl:text>/cm/</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- <xsl:value-of select="$selectionId"/>
- <xsl:if test="$navItemResponse/nav:shortcut">
- <!-- if it's a shortcut , we need to include the id of the target -->
- <xsl:text>/</xsl:text>
- <xsl:value-of select="$navItemResponse/nav:shortcut/*/nav:internalId"/>
- </xsl:if>
- <xsl:if test="$dlgCustomParams != ''">
- <xsl:text>?</xsl:text>
- <xsl:value-of select="$dlgCustomParams"/>
- </xsl:if>
- </xsl:variable>
- <subfragment id="frame1{$selectionId}" href="{$href}">
- <params>
- <param name="frag-windowState">
- <xsl:choose>
- <xsl:when test="$fragWindowState">
- <xsl:value-of select="$fragWindowState"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:text>normal</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- </param>
- <xsl:if test="$formAction = 'save'">
- <param name="frag-event">
- <xsl:text>name=fragment.customization.changed</xsl:text>
- </param>
- </xsl:if>
- <xsl:if test="$fragMode = 'preview'">
- <param name="frag-mode">
- <xsl:value-of select="$fragMode"/>
- </param>
- </xsl:if>
- <xsl:variable name="calculated-height">
- <xsl:choose>
- <xsl:when test="(string($viewerHeight) != '')">
- <xsl:value-of select="$viewerHeight"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:text>365</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <param name="viewer-height">
- <xsl:value-of select="$calculated-height"/>
- </param>
- <param name="cpscp_display_height">100%</param>
- <param name="output-height">100%</param>
- <param name="object-name">
- <xsl:value-of select="$objectName"/>
- </param>
- <param name="frag-channel">
- <xsl:value-of select="$channel"/>
- </param>
-
- <xsl:if test="$useDefaultPortalAction">
- <param name="p_reportLaunchOption">
- <xsl:value-of select="$navItemResponse/*/nav:defaultPortalAction"/>
- </param>
- </xsl:if>
- </params>
- </subfragment>
- </xsl:if>
- </xsl:if>
- <xsl:variable name="titleSelection">
- <xsl:choose>
- <xsl:when test="$formAction = 'save' and $is-edit-mode">
- <xsl:value-of select="$interactions[@name='p_viewerTitleOptions']"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$customs[@name='viewerTitleOptions']"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:choose>
- <xsl:when test="$is-edit-mode and not($formAction = 'save')">
- <preferredTitle/>
- </xsl:when>
- <xsl:when test="($titleSelection = 'entryName') and ($objectName != '') ">
- <preferredTitle>
- <xsl:value-of select="$objectName"/>
- </preferredTitle>
- </xsl:when>
- </xsl:choose>
- <xsl:variable name="errorResponse" select="/root/init/objectResponse/error/*"/>
- <xsl:if test="$errorResponse != ''">
- <error>
- <code>
- <xsl:value-of select="$errorResponse/xts:exceptionCode"/>
- </code>
- <message>
- <xsl:value-of select="$errorResponse/xts:exceptionMsg"/>
- </message>
- <details>
- <xsl:value-of select="$errorResponse/xts:exceptionDetail"/>
- </details>
- </error>
- </xsl:if>
- <xsl:if test="$is-edit-mode and $formAction = 'save'">
- <newMode>view</newMode>
- </xsl:if>
- </fragment>
- </response>
- </xsl:template>
-
- <xsl:template match="param" mode="state">
- <xsl:if test="/root/input[@name='stateParams']/stateParams/param/@name=current()/@name">
- <xsl:copy-of select="."/>
- </xsl:if>
- </xsl:template>
- </xsl:stylesheet>
|