123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205 |
- <?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" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xos="http://developer.cognos.com/schemas/xts/output/" exclude-result-prefixes="xts xtsext xsl pf bus xos soapenv xsd xsi">
- <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:value-of select="key('env-param','TM1WebURL')"/>
- <xsl:text>/</xsl:text>
- <xsl:value-of select="key('env-param','TM1WebVirtualDirectory')"/>
- <xsl:text>/services/TM1Service?method=getApplicationsTree</xsl:text>
- <xsl:text>&sessionToken=</xsl:text>
- <xsl:value-of select="key('env-param','sessionToken')"/>
- </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/openNavTree1/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>
- <xsl:choose>
- <xsl:when test="key('env-param','JSESSIONID') and key('env-param','JSESSIONID') != '' ">
- <xts:param name="header">
- <xsl:value-of select="concat('Cookie=',key('env-param','JSESSIONID'))"/>
- </xts:param>
- </xsl:when>
- </xsl:choose>
- </xts:request>
- </openNavTree>
- </xts:update>
- </xts:sequence>
- </xsl:template>
- </xsl:stylesheet>
- </xts:block>
- <xts:block id="transformNavTreeContent" type="exec" mode="interpret" processor="XSLT" dependency="openNavTree" 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/" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" exclude-result-prefixes="xts xtsext xsl pf bus xos xsd xsi soapenv">
- <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/102RP2/getApplicationNodesTransform.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', 'FilterPackages') != ''">
- <FilterPackages>
- <xsl:value-of select="xtsext:urlencode(key('env-param','FilterPackages'))"/>
- </FilterPackages>
- </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', 'JSESSIONID') != ''">
- <JSESSIONID>
- <xsl:value-of select="key('env-param','JSESSIONID')"/>
- </JSESSIONID>
- </xsl:if>
- <xsl:if test="key('env-param', 'sessionToken') != ''">
- <sessionToken>
- <xsl:value-of select="key('env-param','sessionToken')"/>
- </sessionToken>
- </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 -->
- <JSESSIONID>
- <xsl:value-of select="xtsext:urlencode(text())"/>
- </JSESSIONID>
- </xsl:for-each>
- <GatewayURL>
- <xsl:value-of select="$gateway"/>
- </GatewayURL>
- <WebRootURL>
- <xsl:value-of select="$webRoot"/>
- </WebRootURL>
- <TM1FolderName>
- <xsl:text>Applications</xsl:text>
- </TM1FolderName>
- <TM1pass2>
- <xsl:text>id0</xsl:text>
- </TM1pass2>
- <xsl:copy-of select="/root/openNavTree/soapenv:Envelope/soapenv:Body"/>
- </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>
|