123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!--
- Copyright (C) 2008 Cognos Incorporated. All rights reserved.
- Cognos (R) is a trademark of Cognos Incorporated.
- -->
- <xts:morphlet xmlns:xts="http://developer.cognos.com/schemas/xts/">
- <!-- = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = -->
- <xts:block id="openNavTree" type="exec" mode="interpret" processor="XSLT"
- xmlns:pf="http://developer.cognos.com/schemas/xts/pf" >
- <!-- This block requests NavigationTree from chosen TM1 server for the first time.
- This request is expected to fail with HTTP 302 (Found) and the same location as given.
- It also returns one to many cookies that are required in subsequent requests.
- -->
- <xts:logicsheet path="logicsheets/portal.xsl"/>
- <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:bus="http://developer.cognos.com/schemas/bibus/3/" xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt" exclude-result-prefixes="xts xtsext xsl pf bus">
- <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
- <pf:variables/>
- <xsl:variable name="timeout" select="'200'"/>
- <xsl:template match="/">
- <xts:sequence>
- <xts:update select="/root/openNavTree">
- <openNavTree>
- <xts:request protocol="GET" faultBlock="handleNavTreeFault" protocolHeader="true" >
- <xsl:attribute name="href">
- <xsl:choose>
- <xsl:when test="key('env-param','TM1WebURL')">
- <xsl:value-of select="key('env-param','TM1WebURL')"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:choose>
- <xsl:when test="key('env-param','https') and key('env-param','https') != '0' ">
- <xsl:text>https://</xsl:text>
- </xsl:when>
- <xsl:otherwise>
- <xsl:text>http://</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- <xsl:value-of select="key('env-param','TM1WebHost')"/>
- </xsl:otherwise>
- </xsl:choose>
- <xsl:choose>
- <xsl:when test="key('env-param','ASPSessionId') and key('env-param','ASPSessionId') != '' ">
- <xsl:text>/</xsl:text>
- <xsl:value-of select="key('env-param','TM1WebVirtualDirectory')"/>
- <xsl:text>/TM1WebNavigationTreeXml.aspx</xsl:text>
- </xsl:when>
- <xsl:otherwise>
-
- <xsl:text>/</xsl:text>
- <xsl:value-of select="key('env-param','TM1WebVirtualDirectory')"/>
- <xsl:text>/TM1WebMain.aspx</xsl:text>
- <xsl:text>?action=OpenObject&type=NavigationTree&ContentType=xml</xsl:text>
- <xsl:text>&AdminHost=</xsl:text>
- <xsl:value-of select="key('env-param','TM1Host')"/>
- <xsl:text>&TM1Server=</xsl:text>
- <xsl:value-of select="key('env-param','TM1DataServer')"/>
- <xsl:choose>
- <xsl:when test="key('env-param','TM1username') and key('env-param','TM1username') != '' ">
- <xsl:text>&username=</xsl:text>
- <xsl:value-of select="key('env-param','TM1username')"/>
- <xsl:text>&password=</xsl:text>
- <xsl:value-of select="key('env-param','TM1pass')"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:text>&cam_passport=</xsl:text>
- <xsl:value-of select="xtsext:urlencode($passport)"/>
- </xsl:otherwise>
- </xsl:choose>
- <xsl:choose>
- <xsl:when test="key('env-param','TM1Toolbar') and key('env-param','TM1Toolbar') != '' ">
- <xsl:text>&TM1Toolbar=</xsl:text>
- <xsl:value-of select="key('env-param','TM1Toolbar')"/>
- </xsl:when>
- </xsl:choose>
- <xsl:choose>
- <xsl:when test="key('env-param','ASPSessionId') and key('env-param','ASPSessionId') != '' ">
- <xsl:text>&ASPSessionId=</xsl:text>
- <xsl:value-of select="key('env-param','ASPSessionId')"/>
- </xsl:when>
- </xsl:choose>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:attribute>
- <xsl:if test="$timeout">
- <xts:param name="timeout">
- <xsl:value-of select="number($timeout) * 1000 "/>
- </xts:param>
- </xsl:if>
- <xsl:choose>
- <xsl:when test="key('env-param','ASPSessionId') and key('env-param','ASPSessionId') != '' ">
- <xts:param name="header">
- <xsl:value-of select="concat('Cookie=',key('env-param','ASPSessionId'))"/>
- </xts:param>
- </xsl:when>
- </xsl:choose>
- </xts:request>
- </openNavTree>
- </xts:update>
- </xts:sequence>
- </xsl:template>
- </xsl:stylesheet>
- </xts:block>
- <!-- = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = -->
- <xts:block id="openNavTreeAgain" type="exec" mode="interpret" processor="XSLT" dependency="openNavTree" condition=".[/root/openNavTree/xos:status/xos:param[@name='statusCode'] != '200']" mandatory="false"
- xmlns:pf="http://developer.cognos.com/schemas/xts/pf" >
- <!-- This block makes the same NavigationTree request as in previous block
- The difference is that this request sends the cookies returned in the previous request.
- This request also returns HTTP 302 (Found), but no cookies and a different location for the desired navigation tree.
- -->
- <xts:logicsheet path="logicsheets/portal.xsl"/>
- <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:bus="http://developer.cognos.com/schemas/bibus/3/" xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt" xmlns:xos="http://developer.cognos.com/schemas/xts/output/" exclude-result-prefixes="xts xtsext xsl pf bus xos">
- <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
- <pf:variables/>
- <xsl:variable name="timeout" select="'200'"/>
- <xsl:template match="/">
- <xts:sequence>
- <xts:update select="/root/openNavTreeAgain">
- <openNavTreeAgain>
- <xts:request protocol="GET" faultBlock="handleNavTreeFault" protocolHeader="true" >
- <xsl:attribute name="href">
- <xsl:choose>
- <xsl:when test="key('env-param','TM1WebURL')">
- <xsl:value-of select="key('env-param','TM1WebURL')"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:choose>
- <xsl:when test="key('env-param','https') and key('env-param','https') != '0' ">
- <xsl:text>https://</xsl:text>
- </xsl:when>
- <xsl:otherwise>
- <xsl:text>http://</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- <xsl:value-of select="key('env-param','TM1WebHost')"/>
- </xsl:otherwise>
- </xsl:choose>
- <!-- Copy the location from the first request, as returned in the HTTP header -->
- <xsl:value-of select="/root/openNavTree/xos:protocolHeader/xos:param[@name='Location']"/>
-
- </xsl:attribute>
- <xsl:if test="$timeout">
- <xts:param name="timeout">
- <xsl:value-of select="number($timeout) * 1000 "/>
- </xts:param>
- </xsl:if>
- <!-- Here's where the cookies get sent -->
- <xsl:for-each select="/root/openNavTree/xos:protocolHeader/xos:param[@name='Set-Cookie']">
- <!-- For each cookie returned in previous request -->
- <xts:param name="header">
- <xsl:value-of select="concat('Cookie=',text())"/>
- </xts:param>
- </xsl:for-each>
- </xts:request>
- </openNavTreeAgain>
- </xts:update>
- </xts:sequence>
- </xsl:template>
- </xsl:stylesheet>
- </xts:block> <!-- = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = -->
- <xts:block id="getNavTree" type="exec" mode="interpret" processor="XSLT" dependency="openNavTreeAgain" condition=".[/root/openNavTree/xos:status/xos:param[@name='statusCode'] != '200' and /root/openNavTree/xos:status/xos:param[@name='statusCode'] != '200']" mandatory="false"
- xmlns:pf="http://developer.cognos.com/schemas/xts/pf" >
- <!-- This block finally opens the NavigationTree requested in the previous blocks.
- This request sends the cookies returned in the first request and the location returned in the second request.
- This request returns HTTP 200 (OK) and the desired navigation tree XML.
- -->
- <xts:logicsheet path="logicsheets/portal.xsl"/>
- <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:bus="http://developer.cognos.com/schemas/bibus/3/" xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt" xmlns:xos="http://developer.cognos.com/schemas/xts/output/" exclude-result-prefixes="xts xtsext xsl pf bus xos">
- <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
- <pf:variables/>
- <xsl:variable name="timeout" select="'200'"/>
- <xsl:template match="/">
- <xts:sequence>
- <xts:update select="/root/tm1Web">
- <tm1Web><navTree>
- <xts:request protocol="GET" faultBlock="handleNavTreeFault" protocolHeader="true" >
- <xsl:attribute name="href">
- <xsl:choose>
- <xsl:when test="key('env-param','TM1WebURL')">
- <xsl:value-of select="key('env-param','TM1WebURL')"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:choose>
- <xsl:when test="key('env-param','https') and key('env-param','https') != '0' ">
- <xsl:text>https://</xsl:text>
- </xsl:when>
- <xsl:otherwise>
- <xsl:text>http://</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- <xsl:value-of select="key('env-param','TM1WebHost')"/>
- </xsl:otherwise>
- </xsl:choose>
- <!-- Copy the location from the second request, as returned in the HTTP header -->
- <xsl:value-of select="/root/openNavTreeAgain/xos:protocolHeader/xos:param[@name='Location']"/>
- </xsl:attribute>
- <xsl:if test="$timeout">
- <xts:param name="timeout">
- <xsl:value-of select="number($timeout) * 1000 "/>
- </xts:param>
- </xsl:if>
- <!-- Here's where the cookies get sent -->
- <xsl:for-each select="/root/openNavTree/xos:protocolHeader/xos:param[@name='Set-Cookie']">
- <!-- For each cookie returned in first request -->
- <xts:param name="header">
- <xsl:value-of select="concat('Cookie=',text())"/>
- </xts:param>
- </xsl:for-each>
- </xts:request>
- </navTree></tm1Web>
- </xts:update>
- </xts:sequence>
- </xsl:template>
- </xsl:stylesheet>
- </xts:block>
-
- <xts:block id="transformNavTreeContent" type="exec" mode="interpret" processor="XSLT" dependency="getNavTree" xmlns:pf="http://developer.cognos.com/schemas/xts/pf">
- <xts:logicsheet path="logicsheets/portal.xsl"/>
- <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:bus="http://developer.cognos.com/schemas/bibus/3/" xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt" xmlns:xos="http://developer.cognos.com/schemas/xts/output/" exclude-result-prefixes="xts xtsext xsl pf bus xos">
- <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
- <pf:variables/>
- <xsl:template match="/root">
- <xts:sequence>
- <xts:append select="/root/output">
- <xts:transform processor="XSLT" src="/tm1/PRE102/serverContentTransform.xslt" option="part" mimeType="application/atom+xml">
- <xts:param name="messageBase">/messages/tm1buxmsgs.xml</xts:param>
- <root>
- <xsl:if test="key('env-param', 'Id') != ''">
- <Id>
- <xsl:value-of select="key('env-param','Id')"/>
- </Id>
- </xsl:if>
- <xsl:if test="key('env-param', 'TM1WebHost') != ''">
- <TM1WebURL>
- <xsl:choose>
- <xsl:when test="key('env-param','https') and key('env-param','https') != '0' ">
- <xsl:text>https://</xsl:text>
- </xsl:when>
- <xsl:otherwise>
- <xsl:text>http://</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
-
- <xsl:value-of select="xtsext:urlencode(key('env-param','TM1WebHost'))"/>
- </TM1WebURL>
- </xsl:if>
- <xsl:if test="key('env-param', 'TM1WebURL') != ''">
- <TM1WebURL>
- <xsl:value-of select="xtsext:urlencode(key('env-param','TM1WebURL'))"/>
- </TM1WebURL>
- </xsl:if>
- <xsl:if test="key('env-param', 'TM1WebVirtualDirectory') != ''">
- <TM1WebVirtualDirectory>
- <xsl:value-of select="xtsext:urlencode(key('env-param','TM1WebVirtualDirectory'))"/>
- </TM1WebVirtualDirectory>
- </xsl:if>
- <xsl:if test="key('env-param', 'TM1Host') != ''">
- <TM1Host>
- <xsl:value-of select="key('env-param','TM1Host')"/>
- </TM1Host>
- </xsl:if>
- <xsl:if test="key('env-param', 'TM1DataServer') != ''">
- <TM1DataServer>
- <xsl:value-of select="xtsext:urlencode(key('env-param','TM1DataServer'))"/>
- </TM1DataServer>
- </xsl:if>
- <xsl:if test="key('env-param', 'TM1username') != ''">
- <TM1username>
- <xsl:value-of select="key('env-param','TM1username')"/>
- </TM1username>
- </xsl:if>
- <xsl:if test="key('env-param', 'TM1pass') != ''">
- <TM1pass>
- <xsl:value-of select="key('env-param','TM1pass')"/>
- </TM1pass>
- </xsl:if>
- <xsl:if test="key('env-param', 'TM1Toolbar') != ''">
- <TM1Toolbar>
- <xsl:value-of select="key('env-param','TM1Toolbar')"/>
- </TM1Toolbar>
- </xsl:if>
- <xsl:if test="key('env-param', 'ASPSessionId') != ''">
- <ASPSessionId>
- <xsl:value-of select="key('env-param','ASPSessionId')"/>
- </ASPSessionId>
- </xsl:if>
- <!-- Here's where the cookies get sent -->
- <xsl:for-each select="/root/openNavTree/xos:protocolHeader/xos:param[@name='Set-Cookie']">
- <!-- For each cookie returned in previous request -->
- <ASPSessionId>
- <xsl:value-of select="xtsext:urlencode(text())"/>
- </ASPSessionId>
- </xsl:for-each>
- <GatewayURL>
- <xsl:value-of select="$gateway"/>
- </GatewayURL>
- <WebRootURL>
- <xsl:value-of select="$webRoot"/>
- </WebRootURL>
- <xsl:copy-of select="/root/openNavTree/NavigationTree"/>
- <xsl:copy-of select="/root/openNavTreeAgain/NavigationTree"/>
- <xsl:copy-of select="/root/tm1Web/navTree/NavigationTree"/>
- </root>
- </xts:transform>
- </xts:append>
- </xts:sequence>
- </xsl:template>
- </xsl:stylesheet>
- </xts:block>
- <!-- = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = -->
- <xts:block id="handleNavTreeFault" type="fault" processor="XSLT">
- <xsl:stylesheet version="1.0"
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns:xtse="http://developer.cognos.com/schemas/xts/error/1/">
- <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
- <xsl:template match="/">
- <xtse:error>
- <xsl:for-each select="/root/fault/xts:exception[not(starts-with(xts:exceptionCode, 'java'))]">
- <xtse:message>
- <xsl:value-of select="xts:exceptionMsg"/>
- </xtse:message>
- <xtse:detail>
- <xsl:for-each select="xts:exceptionDetail">
- <xsl:call-template name="copyTree"/>
- </xsl:for-each>
- </xtse:detail>
- </xsl:for-each>
- </xtse:error>
- </xsl:template>
- <xsl:template name="copyTree">
- <xsl:param name="nodes" select="."/>
- <xsl:for-each select="$nodes">
- <xsl:copy>
- <xsl:for-each select="@*">
- <xsl:copy/>
- </xsl:for-each>
- <xsl:call-template name="copyTree">
- <xsl:with-param name="nodes" select="*|text()|comment()"/>
- </xsl:call-template>
- </xsl:copy>
- </xsl:for-each>
- </xsl:template>
- </xsl:stylesheet>
- </xts:block>
- </xts:morphlet>
|