123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!--
- Licensed Materials - Property of IBM
- IBM Cognos Products: cpscrn
- (C) Copyright IBM Corp. 2005, 2011
- 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).
- -->
- <!-- $Header: //cps4/main/src/cps/templates/cps4/portlets/portal-admin/portlet-impl/import/getMarkup.xts#23 $ -->
- <!-- $DateTime: 2005/05/17 21:27:31 $ -->
- <!-- $Change: 11554 $ -->
- <xts:morphlet version="1.0" xmlns:xts="http://developer.cognos.com/schemas/xts/">
- <!--
- Nav Tree Portlet
- -->
- <xts:block id="response" type="exec" mode="interpret" processor="XSLT">
- <xts:logicsheet path="/cps4/common/logicsheets/soaplogic.xslt"/>
- <xsl:stylesheet version="1.0"
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns:wsrp="urn:oasis:names:tc:wsrp:v1:types"
- xmlns:mx="http://developer.cognos.com/schemas/cps/wsrp/extensions/1/"
- xmlns:nav="http://developer.cognos.com/schemas/cps/navigation/1/"
- xmlns:soap="http://developer.cognos.com/schemas/cps/logic/soap"
- xmlns:cps="http://developer.cognos.com/schemas/cps/asm/objects/1/"
- xmlns:xos="http://developer.cognos.com/schemas/xts/output/"
- xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt"
- xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
- exclude-result-prefixes="xtsext soap SOAP-ENV wsrp mx nav cps xos">
- <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
- <xsl:key name="env-param" match="/root/env/param" use="@name"/>
- <xsl:key name="http-param" match="/root/http/param" use="@name"/>
- <xsl:variable name="host">
- <xsl:choose>
- <xsl:when test="contains(key('http-param', 'SERVER_PROTOCOL'), 'HTTPS')">
- <xsl:value-of select="'https://'"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="'http://'"/>
- </xsl:otherwise>
- </xsl:choose>
- <xsl:value-of select="key('http-param', 'SERVER_NAME')"/>
- </xsl:variable>
- <xsl:variable name="script-name" select="key('http-param', 'SCRIPT_NAME')"/>
- <xsl:variable name="path-info" select="key('http-param', 'PATH_INFO')"/>
- <xsl:variable name="request-url" select="concat($host, $script-name, $path-info)"/>
- <xsl:variable name="resource-url" select="concat($host, $script-name, '?b_action=xts.run&m=portal/mypages/page_resource.xts')"/>
- <xsl:variable name="frag-id" select="key('env-param', 'frag-id')"/>
- <xsl:variable name="frag-state" select="key('env-param', 'frag-state')"/>
- <xsl:variable name="frag-pagemode" select="key('env-param', 'frag-pagemode')"/>
- <xsl:variable name="frag-agent" select="key('env-param', 'frag-agent')"/>
- <!-- parameters not to be passed into assembler call -->
- <xsl:variable name="params-excluded" select="' encoding frag-id frag-state '"/>
- <xsl:variable name="interaction-params" select="/root/env/param[not(contains($params-excluded, concat(' ', @name, ' ')))]"/>
-
- <xsl:variable name="frag-view">/fragments/treefrag/view.xslt</xsl:variable>
- <!--xsl:variable name="nav-service">interface://crn/nav</xsl:variable-->
- <xsl:variable name="endpoint" select="key('env-param', 'endpoint')"/>
- <xsl:variable name="nav-service">
- <xsl:choose>
- <xsl:when test="$endpoint">
- <xsl:value-of select="$endpoint"/>
- </xsl:when>
- <xsl:otherwise>interface://nav</xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:variable name="root-container" select="key('env-param', 'root')"/>
- <xsl:variable name="container-id" select="key('env-param', 'container')"/>
- <xsl:variable name="container-margin" select="key('env-param', 'margin')"/>
- <xsl:template match="/">
- <xts:sequence>
- <xts:append select="/root/output">
- <xos:part>
- <xos:entityHeader>
- <xos:param name="Content-type">text/xml</xos:param>
- </xos:entityHeader>
- <xos:entityBody>
- <fragment xmlns="http://developer.cognos.com/fragments/1/">
- <info>
- <title>Tree Fragment</title>
- </info>
- <meta>
- <customProperties name="endpoint">
- <label xml:lang="en">Endpoint of INav Web service</label>
- <hint xml:lang="en">This is a Web service endpoint that implements the IBM Cognos INav interface.</hint>
- </customProperties>
- </meta>
- <xsl:call-template name="markup">
- <xsl:with-param name="id" select="$container-id"/>
- <xsl:with-param name="transform" select="$frag-view"/>
- </xsl:call-template>
- </fragment>
- </xos:entityBody>
- </xos:part>
- </xts:append>
- </xts:sequence>
- </xsl:template>
- <xsl:template name="navigational-state">
- <xsl:param name="params"/>
- <wsrp:navigationalState>
- <xsl:variable name="markup">
- <xsl:for-each select="$params">
- <xsl:value-of select="concat('<param name="', @name, '">', xtsext:xmlencode(wsrp:value), '</param>')"/>
- </xsl:for-each>
- </xsl:variable>
- <xsl:value-of select="xtsext:validator('prepare','treefrag',xtsext:base64encode($markup, true()))"/>
- </wsrp:navigationalState>
- </xsl:template>
- <xsl:template name="markup">
- <xsl:param name="id"/>
- <xsl:param name="transform"/>
- <markup>
- <mimeType>
- <xsl:text>text/html</xsl:text>
- </mimeType>
- <markupString>
- <xts:transform name="XMLEncode" option="content">
- <xts:transform name="XSLT" src="{ $transform }">
- <xts:param name="messageBase">/cps4/producer/messages/cpsproducermsgs.xml</xts:param>
- <root>
- <userAgent>
- <xsl:value-of select="$frag-agent"/>
- </userAgent>
- <xts:queryNode select="/root/env"/>
- <navresult>
- <xsl:call-template name="get-container">
- <xsl:with-param name="id">
- <xsl:choose>
- <xsl:when test="$container-id">
- <xsl:value-of select="$container-id"/>
- </xsl:when>
- <xsl:when test="$root-container">
- <xsl:value-of select="$root-container"/>
- </xsl:when>
- <xsl:otherwise>rootDefault</xsl:otherwise>
- </xsl:choose>
- </xsl:with-param>
- </xsl:call-template>
- </navresult>
- </root>
- </xts:transform>
- </xts:transform>
- </markupString>
- <requiresRewriting>true</requiresRewriting>
- </markup>
- </xsl:template>
- <xsl:template name="get-container">
- <xsl:param name="id"/>
- <!-- soap:request provider="NAV" faultBlock="requestFault" -->
- <soap:request protocol="SOAP" target="{ $nav-service }" faultBlock="requestFault">
- <nav:getContainer>
- <nav:id>
- <xsl:value-of select="$id"/>
- </nav:id>
- <nav:childObjects>all</nav:childObjects>
- <nav:property name="parentId"/>
- <nav:property name="fullPath"/>
- <nav:property name="hasChildren"/>
- <nav:property name="screenTip"/>
- <nav:property name="icons"/>
- <nav:property name="default:backUrl">false</nav:property>
- <nav:property name="status"/>
- <nav:property name="newState"/>
- <nav:property name="readState"/>
- <nav:property name="action"/>
- <nav:property name="actionsURL"/>
- <!-- nav:sort order="ascending">name</nav:sort -->
- </nav:getContainer>
- </soap:request>
- </xsl:template>
- <xsl:template name="get-actions">
- <xsl:param name="id"/>
- <!-- soap:request provider="NAV" faultBlock="requestFault" -->
- <soap:request protocol="SOAP" target="{ $nav-service }" faultBlock="requestFault">
- <nav:getItem>
- <nav:id>
- <xsl:value-of select="$id"/>
- </nav:id>
- <nav:property name="action"/>
- <nav:property name="actionsURL"/>
- </nav:getItem>
- </soap:request>
- </xsl:template>
- </xsl:stylesheet>
- </xts:block>
- <xts:block id="requestFault" type="fault" processor="XSLT">
- <xsl:stylesheet version="1.0"
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
- <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
- <xsl:template match="/">
- <xsl:variable name="xts-fault" select="/root/fault/xts:exception[last()]"/>
- <xsl:variable name="code" select="$xts-fault/xts:exceptionCode"/>
- <xsl:variable name="prefix" select="substring-before( string( $code ), ':' )"/>
- <xsl:variable name="local-code" select="substring-after( string( $code ), ':' )"/>
-
- <xsl:choose>
- <xsl:when test="($prefix = 'nav') and ($local-code = 'InvalidCredentials')">
- <error type="invalidCookie">
- <message>
- <xsl:value-of select="$xts-fault/xts:exceptionMsg"/>
- </message>
- </error>
- </xsl:when>
- <xsl:otherwise>
- <xsl:copy-of select="/root/fault"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
- </xsl:stylesheet>
- </xts:block>
- </xts:morphlet>
|