123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337 |
- <!--
- Licensed Materials - Property of IBM
- IBM Cognos Products: Viewer
- (C) Copyright IBM Corp. 2001, 2011
- US Government Users Restricted Rights - Use, duplication or
- disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
- -->
- <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xts="http://developer.cognos.com/schemas/xts/" xmlns:nav="http://developer.cognos.com/schemas/cps/navigation/1/" xmlns:encodingUtils="com.cognos.portal.utils.EncodingUtils">
- <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="customs" select="/root/customs/param"/>
- <xsl:variable name="interactions" select="/root/interactions/param"/>
- <xsl:template name="buildVariable">
- <xsl:param name="name" select="."/>
- <xsl:choose>
- <xsl:when test="$interactions[@name = concat('p_',$name)]">
- <xsl:value-of select="$interactions[@name = concat('p_',$name)]"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$customs[@name = $name]"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
- <xsl:template match="/">
- <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="fragWindowState" select="/root/controllerParams/param[@name='frag-windowState']"/>
- <xsl:variable name="fragEvent" select="/root/controllerParams/param[@name='frag-event']"/>
- <xsl:variable name="config" select="/root/input[@name='configurationResponse']/config/param[@name='contentLocales']"/>
- <response>
- <xsl:choose>
- <xsl:when test="$fragMode='edit' and $formAction = 'save'">
- <customs>
- <xsl:for-each select="$custProps">
- <xsl:choose>
- <xsl:when test="@name = 'title'">
- <xsl:variable name="cpName" select="@name"/>
- <param name="{$cpName}">
- <xsl:for-each select="$config/locale">
- <xsl:variable name="lid" select="@id"/>
- <xsl:for-each select="/root/interactions/param[@name = concat($cpName,'-',$lid)]">
- <xsl:if test="not(contains(string(/root/interactions/param[@name='removeLang']),concat($lid,';')))">
- <value xml:lang="{$lid}">
- <xsl:value-of select="string(.)"/>
- </value>
- </xsl:if>
- </xsl:for-each>
- </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>
- </state>
- </xsl:when>
- <xsl:when test="$fragMode='edit' 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>
- <fragment>
- <xsl:variable name="objectName">
- <xsl:value-of select="$interactions[@name='object-name']"/>
- </xsl:variable>
- <xsl:variable name="reportSpec">
- <xsl:value-of select="$interactions[@name='ui.spec']"/>
- </xsl:variable>
- <xsl:variable name="reportpart_id">
- <xsl:value-of select="$interactions[@name='reportpart_id']"/>
- </xsl:variable>
- <xsl:variable name="containerApp">
- <xsl:value-of select="$interactions[@name='cv.containerApp']"/>
- </xsl:variable>
- <xsl:variable name="titleSelection">
- <xsl:choose>
- <xsl:when test="$interactions[@name='formaction'] = 'save'">
- <xsl:value-of select="$interactions[@name='viewerTitleOptions']"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$customs[@name='viewerTitleOptions']"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:variable name="promptOption">
- <xsl:call-template name="buildVariable">
- <xsl:with-param name="name">promptOption</xsl:with-param>
- </xsl:call-template>
- </xsl:variable>
- <xsl:variable name="reportLaunchOption">
- <xsl:call-template name="buildVariable">
- <xsl:with-param name="name">reportLaunchOption</xsl:with-param>
- </xsl:call-template>
- </xsl:variable>
- <xsl:variable name="reportLaunchSubOption">
- <xsl:call-template name="buildVariable">
- <xsl:with-param name="name">reportLaunchSubOption</xsl:with-param>
- </xsl:call-template>
- </xsl:variable>
- <xsl:variable name="reportAction">
- <xsl:value-of select="$interactions[@name = 'p_reportAction']"/>
- </xsl:variable>
- <xsl:choose>
- <xsl:when test="(not ($fragMode = 'edit') or ($formAction = 'save'))">
- <xsl:variable name="selectionId">
- <xsl:choose>
- <xsl:when test="$interactions[@name='obj_id'] and $interactions[@name = 'obj_id'] != ''">
- <xsl:value-of select="$interactions[@name='obj_id']"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$customs[@name='navSelectionId']"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:variable name="viewerToolbarMaximizeMode">
- <xsl:call-template name="buildVariable">
- <xsl:with-param name="name">viewerToolbarMaximizeMode</xsl:with-param>
- </xsl:call-template>
- </xsl:variable>
- <xsl:variable name="viewerToolbarNormalMode">
- <xsl:call-template name="buildVariable">
- <xsl:with-param name="name">viewerToolbarNormalMode</xsl:with-param>
- </xsl:call-template>
- </xsl:variable>
- <xsl:variable name="sharePromptValues">
- <xsl:call-template name="buildVariable">
- <xsl:with-param name="name">sharePromptValues</xsl:with-param>
- </xsl:call-template>
- </xsl:variable>
- <xsl:variable name="matchOnParameterNameOnly">
- <xsl:call-template name="buildVariable">
- <xsl:with-param name="name">matchOnParameterNameOnly</xsl:with-param>
- </xsl:call-template>
- </xsl:variable>
- <xsl:variable name="usePromptChannel">
- <xsl:call-template name="buildVariable">
- <xsl:with-param name="name">usePromptChannel</xsl:with-param>
- </xsl:call-template>
- </xsl:variable>
- <xsl:variable name="promptEventChannel">
- <xsl:call-template name="buildVariable">
- <xsl:with-param name="name">promptEventChannel</xsl:with-param>
- </xsl:call-template>
- </xsl:variable>
- <xsl:variable name="shareDrillEvents">
- <xsl:call-template name="buildVariable">
- <xsl:with-param name="name">shareDrillEvents</xsl:with-param>
- </xsl:call-template>
- </xsl:variable>
- <xsl:variable name="useDrillChannel">
- <xsl:call-template name="buildVariable">
- <xsl:with-param name="name">useDrillChannel</xsl:with-param>
- </xsl:call-template>
- </xsl:variable>
- <xsl:variable name="drillChannel">
- <xsl:call-template name="buildVariable">
- <xsl:with-param name="name">drillChannel</xsl:with-param>
- </xsl:call-template>
- </xsl:variable>
- <xsl:variable name="shareAuthoredDrillEvents">
- <xsl:call-template name="buildVariable">
- <xsl:with-param name="name">shareAuthoredDrillEvents</xsl:with-param>
- </xsl:call-template>
- </xsl:variable>
- <xsl:variable name="authoredDrillChannel">
- <xsl:call-template name="buildVariable">
- <xsl:with-param name="name">authoredDrillChannel</xsl:with-param>
- </xsl:call-template>
- </xsl:variable>
- <xsl:variable name="transientSpecification">
- <xsl:call-template name="buildVariable">
- <xsl:with-param name="name">transientSpecification</xsl:with-param>
- </xsl:call-template>
- </xsl:variable>
- <xsl:variable name="href">
- <xsl:choose>
- <xsl:when test="$selectionId != ''">
- <xsl:text>/rv/</xsl:text>
- <xsl:value-of select="$selectionId"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:text>/rv</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- <xsl:text>?</xsl:text>
- <xsl:choose>
- <xsl:when test="$promptOption='true'">
- <xsl:text>&run.prompt=true</xsl:text>
- </xsl:when>
- <xsl:when test="$promptOption='false'">
- <xsl:text>&run.prompt=false</xsl:text>
- </xsl:when>
- <xsl:when test="$promptOption='hide'">
- <xsl:text>&fragment.waitForPromptValues=true</xsl:text>
- </xsl:when>
- </xsl:choose>
- <xsl:choose>
- <xsl:when test="$reportSpec != ''">
- <xsl:text>&ui.action=runSpecification</xsl:text>
- </xsl:when>
- <xsl:when test="$reportAction = 'run'">
- <xsl:text>&ui.action=run</xsl:text>
- </xsl:when>
- <xsl:when test="$reportLaunchOption = 'runIcon'">
- <xsl:text>&ui.action=runIcon</xsl:text>
- </xsl:when>
- <xsl:when test="$reportLaunchOption = 'output' and $reportLaunchSubOption = 'runIcon'">
- <xsl:text>&ui.action=output&ui.subaction=runIcon</xsl:text>
- </xsl:when>
- <xsl:when test="$reportLaunchOption != ''">
- <xsl:text>&ui.action=</xsl:text>
- <xsl:value-of select="$reportLaunchOption"/>
- </xsl:when>
- </xsl:choose>
- <xsl:if test="$reportSpec != ''">
- <xsl:text>&ui.spec=</xsl:text>
- <xsl:value-of select="encodingUtils:urlencode(string($reportSpec), string('UTF-8'), true())"/>
- </xsl:if>
- <xsl:if test="$reportpart_id != ''">
- <xsl:text>&reportpart_id=</xsl:text>
- <xsl:value-of select="encodingUtils:urlencode(string($reportpart_id), string('UTF-8'), true())"/>
- </xsl:if>
- <xsl:if test="$containerApp != ''">
- <xsl:text>&cv.containerApp=</xsl:text>
- <xsl:value-of select="$containerApp"/>
- </xsl:if>
- <xsl:choose>
- <xsl:when test="$viewerToolbarNormalMode = 'showNormal' and $viewerToolbarMaximizeMode = 'showMaximize'">
- <xsl:text>&fragment.toolbarProperties=show</xsl:text>
- </xsl:when>
- <xsl:when test="$viewerToolbarNormalMode = 'showNormal'">
- <xsl:text>&fragment.toolbarProperties=showNormal</xsl:text>
- </xsl:when>
- <xsl:when test="$viewerToolbarMaximizeMode = 'showMaximize'">
- <xsl:text>&fragment.toolbarProperties=showMaximized</xsl:text>
- </xsl:when>
- <xsl:otherwise>
- <xsl:text>&fragment.toolbarProperties=hidden</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- <xsl:if test="$fragMode = 'preview'">
- <xsl:text>&run.data=previewWithNoData</xsl:text>
- </xsl:if>
- <xsl:if test="$sharePromptValues='true'">
- <xsl:text>&fragment.sharePromptValues=true</xsl:text>
- <xsl:text>&cv.transientSpec=</xsl:text>
- <xsl:value-of select="$transientSpecification"/>
- <xsl:if test="$usePromptChannel='true' and string($promptEventChannel) != ''">
- <xsl:text>&fragment.promptChannel=</xsl:text>
- <xsl:value-of select="encodingUtils:urlencode(string($promptEventChannel), string('UTF-8'), true())"/>
- </xsl:if>
- <xsl:text>&fragment.matchOnParameterNameOnly=</xsl:text>
- <xsl:choose>
- <xsl:when test="$matchOnParameterNameOnly='true'"><xsl:text>true</xsl:text></xsl:when>
- <xsl:otherwise><xsl:text>false</xsl:text></xsl:otherwise>
- </xsl:choose>
- </xsl:if>
- <xsl:if test="$shareDrillEvents='true'">
- <xsl:text>&fragment.shareDrillEvents=true</xsl:text>
- <xsl:if test="$useDrillChannel='true' and string($drillChannel) != ''">
- <xsl:text>&fragment.drillChannel=</xsl:text>
- <xsl:value-of select="encodingUtils:urlencode(string($drillChannel), string('UTF-8'), true())"/>
- </xsl:if>
- </xsl:if>
- <xsl:if test="$shareAuthoredDrillEvents='true'">
- <xsl:text>&fragment.shareAuthoredDrillEvents=true</xsl:text>
- <xsl:text>&fragment.authoredDrillChannel=</xsl:text>
- <xsl:value-of select="encodingUtils:urlencode(string($authoredDrillChannel), string('UTF-8'), true())"/>
- </xsl:if>
- <xsl:text>&cv.header=false</xsl:text>
- <xsl:if test="$interactions[@name='viewer-height']!=''">
- <xsl:text>&fragment.height=</xsl:text>
- <xsl:value-of select="$interactions[@name='viewer-height']"/>
- </xsl:if>
- <xsl:if test="$fragEvent != ''">
- <xsl:text>&frag-event=</xsl:text><xsl:value-of select="$fragEvent"/>
- </xsl:if>
- <xsl:text>&asynch.secondaryWaitThreshold=10</xsl:text>
- <xsl:if test="$selectionId = '' and $reportSpec = ''">
- <xsl:text>&ui.action=noOp&fragment.outputHint=showProgress</xsl:text>
- </xsl:if>
- </xsl:variable>
- <subfragment id="rvCanvas" href="{$href}">
- <params>
- <param name="frag-channel"/>
- <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>
- </params>
- </subfragment>
- </xsl:when>
- </xsl:choose>
- <xsl:if test="/root/controllerParams/param[@name='frag-mode']='edit' and /root/interactions/param[@name='formaction'] = 'save'">
- <newMode>view</newMode>
- </xsl:if>
- <xsl:if test="($titleSelection = 'entryName') and ($objectName != '') ">
- <preferredTitle>
- <xsl:value-of select="$objectName"/>
- </preferredTitle>
- </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>
|