123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382 |
- <?xml version="1.0" encoding="UTF-8"?>
- <!--
- Licensed Materials - Property of IBM
- IBM Cognos Products: ps
- (C) Copyright IBM Corp. 2005, 2019
- 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).
- -->
- <xts:morphlet version="1.0" messageBase="messages/portal.xml, messages/portalRL.xml" xmlns:xts="http://developer.cognos.com/schemas/xts/">
- <!--
- security - if (somehow) we got here without a passport, return an empty response.
- -->
- <xts:block id="security" processor="XML" type="exec" mode="interpret" mandatory="false"
- condition=".[ string(/root/credential/param/*/CAMPassport/id) = '' ]">
- <xts:sequence faultSelect="/root/output">
- <xts:append select="/root/output" option="part" faultBlock="error-part">
- <xts:transform processor="XSLT" src="onebox/gen-module.xslt" faultBlock="error-part">
- <xts:param name="logicsheet">logicsheets/portal.xsl</xts:param>
- <xts:param name="messageBase">messages/portal.xml</xts:param>
- <xts:param name="messageBase">messages/portalRL.xml</xts:param>
- <xts:param name="parameter">gw=<xts:queryValue select="/root/configProps/param[@name='cps']/property[@name='gateway']"/></xts:param>
- <root/>
- </xts:transform>
- </xts:append>
- </xts:sequence>
- </xts:block>
-
- <!--
- ===============================================================================================
- config - read in the map table if there is one.
- - also read in the capabilities for the user.
- ===============================================================================================
- -->
- <xts:block id="config" processor="XML" type="exec" mode="interpret" mandatory="false" dependency="security"
- condition=".[ string(/root/credential/param/*/CAMPassport/id) != '' ]">
- <xts:sequence>
- <xts:append faultBlock="ignore">
- <xts:request name="FILEREAD" target="onebox/map.xml" faultBlock="ignore" cache="false"/>
- </xts:append>
- </xts:sequence>
- <xts:sequence>
- <xts:append>
- <capabilities>
- <xts:request href="bus://cm" protocol="BUS" outputHeader="true" faultBlock="ignore"
- soapAction="http://www.ibm.com/xmlns/prod/cognos/contentManagerService/201904/">
- <SOAP-ENV:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
- xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
- xmlns:bus="http://developer.cognos.com/schemas/bibus/3/">
- <SOAP-ENV:Header>
- <xts:queryNode select="/root/header/*[local-name()='biBusHeader']"/>
- </SOAP-ENV:Header>
- <SOAP-ENV:Body>
- <bus:query>
- <search xsi:type="xsd:string">~~</search>
- <properties xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="cm:propEnum[]">
- <item xsi:type="cm:propEnum">userCapabilities</item>
- </properties>
- </bus:query>
- </SOAP-ENV:Body>
- </SOAP-ENV:Envelope>
- </xts:request>
- </capabilities>
- </xts:append>
- </xts:sequence>
- </xts:block>
-
- <!--
- ===============================================================================================
- getObjects - get object class names
- ===============================================================================================
- -->
- <xts:block id="classNames" type="exec" mode="input" processor="XML" path="/portal/uiExtensions.xml"
- condition=".[ string(/root/credential/param/*/CAMPassport/id) != '' ]">
- <xts:logicsheet path="/logicsheets/uiobjects/uiobjects_names.xslt"/>
- </xts:block>
- <!--
- ===============================================================================================
- request - do the work
- ===============================================================================================
- -->
- <xts:block id="request" processor="XSLT" type="exec" mode="interpret" dependency="config classNames"
- condition=".[ string(/root/credential/param/*/CAMPassport/id) != '' ]">
- <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns:xos="http://developer.cognos.com/schemas/xts/output/"
- xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt"
- xmlns:string="java:java.lang.String"
- xmlns:bus="http://developer.cognos.com/schemas/bibus/3/"
- xmlns:nav="http://developer.cognos.com/schemas/cps/navigation/1/"
- xmlns:xsd="http://www.w3.org/2001/XMLSchema"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
- xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
- exclude-result-prefixes="xos xtsext string bus nav xsd xsi SOAP-ENC SOAP-ENV xts">
-
- <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:key name="system-param" match="/root/system/param" use="@name"/>
- <xsl:variable name="userCanUseIndexSearch" select="string(/root/configProps/param[@name='cc']/property[@name='portal.disableindexsearch']) != 'true' and
- string(/root/configProps/param[@name='cc']/property[@name='edition']) != 'mid-market'"/>
-
- <xsl:variable name="cm-cache-value">
- <xsl:if test="key('system-param', 'http-cache') = 'true' and key('http-param', 'CACHE-CONTROL') != 'no-cache'">
- <xsl:value-of select="key('http-param', 'IF-NONE-MATCH')"/>
- </xsl:if>
- </xsl:variable>
-
- <xsl:variable name="gw">
- <xsl:value-of select="/root/configProps/param[@name='cps']/property[@name='gateway']"/>
- </xsl:variable>
-
- <xsl:variable name="wc">
- <xsl:value-of select="substring-before(/root/configProps/param[@name='cps']/property[@name='gateway'], '/cgi-bin')"/>
- </xsl:variable>
- <xsl:variable name="url-prefix">
- <xsl:value-of select="$gw"/>
- <xsl:value-of select="xtsext:substringBeforeLast(key('http-param', 'PATH_INFO'), '/')"/>
- </xsl:variable>
-
- <xsl:variable name="matches"
- select="/root/onebox/module[@oneboxName=key('env-param', 'oneboxName')]/mapEntries/mapEntry/path[
- ../@provider = 'cm' and
- string:matches( string:new( key('env-param', 'query') ), ../regex )]"/>
- <xsl:variable name="cmm-matches"
- select="/root/onebox/module[@oneboxName=key('env-param', 'oneboxName')]/mapEntries/mapEntry[
- @provider = 'mm' and
- string:matches( string:new( key('env-param', 'query') ), regex )]"/>
- <xsl:variable name="path">
- <xsl:for-each select="$matches">
- <xsl:if test="position() > 1">
- <xsl:text/> | <xsl:text/>
- </xsl:if>
- <xsl:text/>defaultOutput(<xsl:text/>
- <xsl:value-of select="."/>
- <xsl:text/>)<xsl:text/>
- <xsl:if test="@type = 'image'">
- <xsl:text/>/graphic<xsl:text/>
- </xsl:if>
- </xsl:for-each>
- </xsl:variable>
-
- <xsl:variable name="nav-path">
- <xsl:for-each select="$matches">
- <xsl:if test="position() > 1">
- <xsl:text/> | <xsl:text/>
- </xsl:if>
- <xsl:value-of select="."/>
- </xsl:for-each>
- </xsl:variable>
-
- <xsl:template match="/">
- <xts:sequence faultSelect="/root/output">
- <xts:append select="/root/output" faultBlock="error-part">
- <xts:transform processor="XSLT" src="onebox/gen-module.xslt" faultBlock="error-part">
- <xts:param name="logicsheet">logicsheets/portal.xsl</xts:param>
- <xts:param name="messageBase">messages/portal.xml</xts:param>
- <xts:param name="messageBase">messages/portalRL.xml</xts:param>
- <xts:param name="parameter">gw=<xsl:value-of select="$gw"/></xts:param>
- <!-- Just in case we get XHTML, we need to define these entities -->
- <xsl:text disable-output-escaping="yes">
- <!DOCTYPE blah [
- <!ENTITY nbsp "&#160;">
- <!ENTITY nl "&#10;">
- <!ENTITY copy "&#169;">
- ]>
- </xsl:text>
- <root>
- <canuseindexsearch><xsl:value-of select="$userCanUseIndexSearch"/></canuseindexsearch>
- <xsl:choose>
- <xsl:when test=" $path != '' ">
- <!-- we got a match to one of the regex's for CM content -->
- <xts:transform src="onebox/get-output.xslt" processor="XSLT" faultBlock="error">
- <xts:request href="bus://cm" protocol="BUS" outputHeader="true" faultBlock="error"
- soapAction="http://www.ibm.com/xmlns/prod/cognos/contentManagerService/201904/">
- <SOAP-ENV:Envelope >
- <SOAP-ENV:Header>
- <xsl:copy-of select="/root/header/bus:biBusHeader"/>
- </SOAP-ENV:Header>
- <SOAP-ENV:Body>
- <bus:query>
- <requests xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="cm:queryRequest[]">
- <item xsi:type="cm:queryRequest">
- <search xsi:type="xsd:string">
- <xsl:value-of select="$nav-path"/>
- </search>
- <properties xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="cm:propEnum[]">
- <item xsi:type="cm:propEnum">defaultName</item>
- <item xsi:type="cm:propEnum">storeID</item>
- <item xsi:type="cm:propEnum">searchPath</item>
- </properties>
- </item>
- <item xsi:type="cm:queryRequest">
- <search xsi:type="xsd:string">
- <xsl:value-of select="$path"/>
- </search>
- <properties xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="cm:propEnum[]">
- <item xsi:type="cm:propEnum">storeID</item>
- <item xsi:type="cm:propEnum">format</item>
- <item xsi:type="cm:propEnum">dataType</item>
- <item xsi:type="cm:propEnum">data</item>
- <item xsi:type="cm:propEnum">dataSize</item>
- </properties>
- </item>
- </requests>
- </bus:query>
- </SOAP-ENV:Body>
- </SOAP-ENV:Envelope>
- </xts:request>
- </xts:transform>
- </xsl:when>
- <xsl:otherwise>
- <xsl:choose>
- <xsl:when test="$cmm-matches">
- <!-- got a match to a regex for CMM content -->
- <metrics>
- <packagePath><xsl:value-of select="$cmm-matches/path"/></packagePath>
- <xts:request protocol="GET" faultBlock="error">
- <xsl:attribute name="href">
- <xsl:choose>
- <xsl:when test="string($cmm-matches/url) != ''">
- <xsl:value-of select="$cmm-matches/url"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="/root/configProps/param[@name='cps']/property[@name='internalDispatcher']"/>
- <xsl:text/>?b_action=mms.run&path=/controller&pid=ob_server<xsl:text/>
- </xsl:otherwise>
- </xsl:choose>
- <xsl:text/>&ui.packageName=<xsl:value-of select="$cmm-matches/path"/>
- <xsl:text/>&query=<xsl:value-of select="xtsext:urlencode(key('env-param', 'query'))"/>
- <xsl:text/>&lang=<xsl:value-of select="xtsext:urlencode(key('env-param', 'lang'))"/>
- </xsl:attribute>
- <xts:param name="timeout">10000</xts:param>
- <xts:param name="header">Cookie=cam_passport=<xsl:value-of select="string(/root/cookies/cookie[@name='cam_passport'])"/>
- </xts:param>
- </xts:request>
- </metrics>
- </xsl:when>
- <xsl:otherwise>
- <!-- Just do a search. -->
- <xsl:choose>
- <xsl:when test="$userCanUseIndexSearch">
- <xsl:variable name="cs-doc">
- <cs:document xmlns:cs="http://developer.cognos.com/schemas/cs/">
- <cs:request>
- <cs:searchQuery>
- <cs:terms><xsl:value-of select="key('env-param', 'query')"/></cs:terms>
- <cs:requestParameters>
- <cs:searchType>standard</cs:searchType>
- <cs:pageSize>4</cs:pageSize>
- <cs:includeSearchQuery>false</cs:includeSearchQuery>
- <cs:includeSearchConversation>true</cs:includeSearchConversation>
- <cs:includeSecurityContext>false</cs:includeSecurityContext>
- <cs:typeList/>
- </cs:requestParameters>
- </cs:searchQuery>
- </cs:request>
- </cs:document>
- </xsl:variable>
- <burgundy>
- <xts:transform src="onebox/get-output.xslt" processor="XSLT" faultBlock="error">
- <xts:request href="bus://dispatcher" protocol="BUS" soapAction="indexSearchService" responseEnvelope="false" outputHeader="true" faultBlock="error">
- <SOAP-ENV:Envelope xmlns:bus="http://developer.cognos.com/schemas/bibus/3/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema">
- <SOAP-ENV:Header>
- <xsl:copy-of select="/root/header/bus:biBusHeader"/>
- </SOAP-ENV:Header>
- <SOAP-ENV:Body>
- <ns:runSpecification xmlns:ns="http://developer.cognos.com/schemas/indexSearchService/1/">
- <specification xsi:type="bus:indexSearchServiceSpecification">
- <value xsi:type="bus:specification">
- <xts:transform name="XMLEncode">
- <xsl:copy-of select="$cs-doc"/>
- </xts:transform>
- </value>
- </specification>
- <options xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="bus:option[3]">
- <item xsi:type="bus:asynchOptionInt">
- <name xsi:type="bus:asynchOptionEnum">primaryWaitThreshold</name>
- <value xsi:type="xsd:int">10000</value>
- </item>
- <item xsi:type="bus:asynchOptionInt">
- <name xsi:type="bus:asynchOptionEnum">secondaryWaitThreshold</name>
- <value xsi:type="xsd:int">10000</value>
- </item>
- </options>
- </ns:runSpecification>
- </SOAP-ENV:Body>
- </SOAP-ENV:Envelope>
- </xts:request>
- </xts:transform>
- </burgundy>
- </xsl:when>
- <xsl:otherwise>
- <xts:request href="bus://dispatcher" protocol="NAV" outputHeader="true" faultBlock="error">
- <SOAP-ENV:Envelope >
- <SOAP-ENV:Header>
- <xsl:copy-of select="/root/header/bus:biBusHeader"/>
- </SOAP-ENV:Header>
- <SOAP-ENV:Body>
- <nav:search>
- <nav:validateTag fault="true"/>
- <nav:string><xsl:value-of select="key('env-param', 'query')"/></nav:string>
- <nav:skipObjects>0</nav:skipObjects>
- <nav:maxObjects>4</nav:maxObjects>
- <nav:param name="backUrl">false</nav:param>
- <nav:property name="actionsURL"/>
- <nav:property name="description"/>
- <nav:param name="gatewayURL"><xsl:value-of select="$gw"/></nav:param>
- </nav:search>
- </SOAP-ENV:Body>
- </SOAP-ENV:Envelope>
- </xts:request>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:otherwise>
- </xsl:choose>
- <xts:queryNode select="/root/http | /root/header | /root/system | /root/env | /root/onebox | /root/configProps | /root/objectClass | /root/credential | /root/debug"/>
- </root>
- </xts:transform>
- </xts:append>
- </xts:sequence>
- </xsl:template>
-
- </xsl:stylesheet>
- </xts:block>
-
- <xts:block id="ignore" processor="XML" type="fault">
- <ignore/>
- </xts:block>
-
- <xts:block id="error" processor="XSLT" type="fault">
- <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" exclude-result-prefixes="xsl">
- <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
- <xsl:template match="/">
- <error>
- <xsl:copy-of select="/root/fault"/>
- </error>
- </xsl:template>
- </xsl:stylesheet>
- </xts:block>
- <xts:block id="error-part" processor="XSLT" type="fault">
- <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" exclude-result-prefixes="xsl">
- <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
- <xsl:template match="/root">
- <xos:part xmlns:xos="http://developer.cognos.com/schemas/xts/output/">
- <xos:entityHeader>
- <xos:param name="Content-Type">text/xml;charset=utf-8</xos:param>
- </xos:entityHeader>
- <xos:entityBody>
- <OneBoxResults>
- <MODULE_RESULT resultCode="lookupFailure">
- <Diagnostics>
- <xsl:value-of select="concat(fault//messageString[1], fault//xts:exceptionMsg)"/>
- </Diagnostics>
- </MODULE_RESULT>
- </OneBoxResults>
- </xos:entityBody>
- </xos:part>
- </xsl:template>
- </xsl:stylesheet>
- </xts:block>
-
- </xts:morphlet>
|