123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864 |
- <?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.
- -->
- <!--
- Interface:
- startwel present if this is the start of your session. The welcome page will be shown if enabled
- m_launchRS launches reportStudio. This property takes precedence over startwel.
- This morphlet used to direct the navigation in CognosConnection. Using the parameters above, the welcome page can be show or lauch report studio or do a go home operation.
- A go home operation is specified by not specifying any parameters to main.xts.
- If startwel is specified but the welcome page is disabled then a go home operation is done
- -->
- <xts:morphlet xmlns:xts="http://developer.cognos.com/schemas/xts/" xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/" messageBase="messages/portal.xml, messages/portalRL.xml">
- <!-- Allows the caller to override the productLocale and contentLocale used by CRN -->
- <!-- ================================================================= -->
- <xts:block id="modifyLocales" type="exec" mode="interpret" processor="XSLT" condition=".[/root/env/param[@name = 'm_productLocale'] or /root/env/param[@name = 'm_contentLocale']]" mandatory="false">
- <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:bus="http://developer.cognos.com/schemas/bibus/3/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" exclude-result-prefixes="bus SOAP-ENV SOAP-ENC xts">
- <xsl:template match="/">
- <xts:sequence>
- <xsl:variable name="xpath">
- <xsl:text>@name='CRN'</xsl:text>
- <xsl:if test="(/root/session/param[@name='cl'] != /root/env/param[@name='m_contentLocale']) or not(/root/session/param[@name='cl'])">
- <xsl:text> or @name='cc_session'</xsl:text>
- </xsl:if>
- </xsl:variable>
- <!-- get ride of potentially out of date cookie... -->
- <xts:delete select="/root/header/*[local-name() = 'biBusHeader']/*[local-name() = 'hdrSession']/*[local-name()='cookieVars']/item[{$xpath}]"/>
- <xts:delete select="/root/cookies/cookie[{$xpath}]"/>
- <!--
- A new CRN cookie is generated when not all user preferences are passed in, so by only specifying contentLocale and productLocale (and leaving out
- things like TimeZone, a response from CM will include a Set-Cookie with a new CRN cookie that contains the productLocale and/or contentLocale
- that we want to use.
- -->
- <xts:delete select="/root/header/*[local-name() = 'biBusHeader']/*[local-name() = 'userPreferenceVars']"/>
- <xts:append select="/root/header/*[local-name() = 'biBusHeader']">
- <bus:userPreferenceVars xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="bus:userPreferenceVar[]">
- <xsl:if test="/root/env/param[@name = 'm_productLocale']">
- <item>
- <name xsi:type="xsd:string">productLocale</name>
- <value xsi:type="xsd:string">
- <xsl:value-of select="/root/env/param[@name = 'm_productLocale']"/>
- </value>
- </item>
- </xsl:if>
- <xsl:if test="/root/env/param[@name = 'm_contentLocale']">
- <item>
- <name xsi:type="xsd:string">contentLocale</name>
- <value xsi:type="xsd:string">
- <xsl:value-of select="/root/env/param[@name = 'm_contentLocale']"/>
- </value>
- </item>
- </xsl:if>
- </bus:userPreferenceVars>
- </xts:append>
- </xts:sequence>
- </xsl:template>
- </xsl:stylesheet>
- </xts:block>
- <xts:block id="setAS_TICKET" dependency="response" type="exec" mode="interpret" processor="XSLT" condition=".[/root/env/param[@name = 'm_asTicket']]" mandatory="false">
- <xsl:stylesheet version="1.0"
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns:bus="http://developer.cognos.com/schemas/bibus/2/"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt"
- exclude-result-prefixes="bus xts xtsext">
- <xsl:template match="/" >
- <xts:sequence>
- <xts:append select="/root/output/*[local-name() = 'protocolHeader']/*[local-name() = 'param' and @name = 'setSoapHeader']/*[local-name() = 'Header']/*[local-name() = 'biBusHeader']/*[local-name() = 'hdrSession']/*[local-name() = 'setCookieVars']">
- <item xsi:type="bus:setCookieVar" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <name xsi:type="xsd:string">AS_TICKET</name>
- <value xsi:type="xsd:string">
- <xsl:value-of select="xtsext:urldecode(string(/root/env/param[@name = 'm_asTicket']))"/>
- </value>
- <maxAge xsi:type="xsd:int">0</maxAge>
- <path xsi:type="xsd:string">/</path>
- </item>
- </xts:append>
- </xts:sequence>
- </xsl:template>
- </xsl:stylesheet>
- </xts:block>
- <!-- ======================================================== -->
- <!-- Session Management -->
- <!-- ======================================================== -->
- <!-- Reads session-sensitive info from CM -->
- <xts:block processor="XSLT" type="exec" mandatory="false" dependency="modifyLocales"
- id="refreshSession"
- path="portal/cc/read_session.xml"
- condition=".[
- (string(/root/cookies/cookie[@name = 'cc_session']) = '' and not(/root/setCookies/cookie[@name='cam_passport' and string(@maxAge) = '-1']))
- or /root/env/param[@name='m_reload']
- or /root/env/param[@name='m_root'] ]">
- <xts:logicsheet path="logicsheets/cm-logic.xsl"/>
- <xts:logicsheet path="logicsheets/buslogic.xslt"/>
- </xts:block>
- <!-- Update the <session> element for this request. -->
- <xts:block id="buildSession" path="portal/session.xml" dependency="refreshSession" processor="XSLT" type="exec"
- condition=".[
- /root/newSession
- or /root/env/param[@name='ui']
- or /root/env/param[@name='d']
- or /root/env/param[starts-with(@name,'m_s_')]
- or /root/env/param[@name = 'resetSort'] ]"
- mandatory="false"/>
- <!-- Save changes to the state info in a cookie -->
- <xts:block mode="interpret" processor="XSLT" type="exec"
- id="setSession"
- path="portal/set_session.xml"
- dependency="buildSession getAccountOptions"
- condition=".[/root/updateSession or /root/deleteCookies]"
- mandatory="false"/>
- <!-- Retrieve the account options if refreshSession did not run -->
- <xts:block id="getAccountOptions" mode="interpret" processor="XSLT" type="exec" dependency="refreshSession" condition=".[not(/root/newSession or /root/setCookies/cookie[@name='cam_passport' and string(@maxAge) = '-1'])]" mandatory="false">
- <xts:logicsheet path="logicsheets/cm-logic.xsl"/>
- <xts:logicsheet path="logicsheets/buslogic.xslt"/>
- <xsl:stylesheet version="1.0"
- xmlns:xts="http://developer.cognos.com/schemas/xts/"
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns:send="http://developer.cognos.com/schemas/xts/logic-sheet/xslt/brl/1/"
- xmlns:bus="http://developer.cognos.com/schemas/bibus/3/"
- xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/" exclude-result-prefixes="xts send bus">
- <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
- <xsl:template match="root">
- <xts:sequence>
- <xts:append>
- <accountOptions>
- <xts:transform src="transforms/CM/post-process.xslt" processor="XSLT">
- <send:request provider="cm">
- <xts:transform src="transforms/CM/pre-process.xslt" processor="XSLT">
- <cm:query xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/">
- <!-- Get account options -->
- <cm:search>~</cm:search>
- <cm:properties>
- <cm:property name="options"/>
- </cm:properties>
- </cm:query>
- </xts:transform>
- </send:request>
- </xts:transform>
- </accountOptions>
- </xts:append>
- </xts:sequence>
- </xsl:template>
- </xsl:stylesheet>
- </xts:block>
- <xts:block id="getConfigInfo" mode="interpret"
- processor="XSLT" type="exec" dependency="" mandatory="false">
- <xts:logicsheet path="logicsheets/portal.xsl"/>
- <xsl:stylesheet version="1.0"
- xmlns:xts="http://developer.cognos.com/schemas/xts/"
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns:send="http://developer.cognos.com/schemas/xts/logic-sheet/xslt/brl/1/"
- xmlns:bus="http://developer.cognos.com/schemas/bibus/3/"
- xmlns:pf="http://developer.cognos.com/schemas/xts/pf"
- xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/" exclude-result-prefixes="xts send bus">
- <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
- <xsl:template match="root">
- <xts:sequence>
- <xsl:if test="/root/cookies/cookie[@name='mvc'] and not(/root/env/param[@name='mvc_homeredirect'])">
- <xts:append>
- <mvcSettings>
- <xts:function name="getConfiguration">
- <xts:param name="MVC_gateway"/> <!-- N gateway -->
- </xts:function>
- </mvcSettings>
- </xts:append>
- </xsl:if>
- <xts:append>
- <generalConfigSettings>
- <xts:function name="getConfiguration">
- <xts:param name="portal.launchBusinessInsightChromeless"/>
- </xts:function>
- </generalConfigSettings>
- </xts:append>
- </xts:sequence>
- </xsl:template>
- </xsl:stylesheet>
- </xts:block>
- <!--
- ===============================================================================================
- Determine what page is required and redirect to the appropriate location
- ===============================================================================================
- -->
- <xts:block
- id="redirectionLogic"
- dependency="setSession getConfigInfo"
- mode="interpret"
- processor="XSLT"
- type="exec"
- mimeType="text/html"
- mandatory="true">
- <xts:logicsheet path="logicsheets/portal.xsl"/>
- <xsl:stylesheet version="1.0"
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns:xts="http://developer.cognos.com/schemas/xts/"
- xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt"
- xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/"
- xmlns:pf="http://developer.cognos.com/schemas/xts/pf"
- xmlns:xos="http://developer.cognos.com/schemas/xts/output/"
- exclude-result-prefixes="xtsext cm xts pf">
- <pf:variables/>
- <pf:CustomWelcomeURL/>
- <xsl:variable name="ICSoftwareWelcomeURL">
- <xsl:value-of select="$gateway"/>?b_action=xts.run&m=portal/welcome/welcome.xts<xsl:text/>
- </xsl:variable>
- <xsl:variable name="isHomeAPI" select="/root/env/param[@name='homeAPI']"/>
- <xsl:variable name="isLaunchBusinessInsightChromeless" select="string(/root/generalConfigSettings/configuration/property[@name='portal.launchBusinessInsightChromeless']) = 'true'"/>
- <xsl:template match="/root">
- <xsl:choose>
- <!-- calling home api -->
- <xsl:when test="$isHomeAPI">
- <xsl:call-template name="executeHomeRequest"/>
- </xsl:when>
- <!-- Redirect to another URL -->
- <xsl:when test="string(/root/env/param[@name='m_redirect']) != '' ">
- <xsl:call-template name="redirect">
- <xsl:with-param name="url" select="/root/env/param[@name='m_redirect']"/>
- <xsl:with-param name="windowMode">
- <xsl:choose>
- <xsl:when test="/root/env/param[@name='m_redirect_uitool'] = 'DashboardConsole'">
- <xsl:choose>
- <xsl:when test="$isLaunchBusinessInsightChromeless">openChromelessWindow</xsl:when>
- <xsl:otherwise>openChromedWindow</xsl:otherwise>
- </xsl:choose>
- </xsl:when>
- <xsl:when test="/root/env/param[@name='m_redirect_windowmode']='1'">openChromedWindow</xsl:when>
- <xsl:when test="/root/env/param[@name='m_redirect_windowmode']='2'">openChromelessWindow</xsl:when>
- <xsl:otherwise>openSameWindow</xsl:otherwise>
- </xsl:choose>
- </xsl:with-param>
- </xsl:call-template>
- </xsl:when>
- <!-- Re-invoke an original request after authentication -->
- <xsl:when test="/root/env/param[@name='m_method'] or /root/env/param[@name='m_pathInfo'] or /root/env/param[starts-with(@name, 'o_')]">
- <xsl:call-template name="executeInternalRedirection"/>
- </xsl:when>
- <!-- Statup C8 with Welcome page -->
- <xsl:when test="(string(/root/env/param[@name='startwel']) != '' and key('session-param', 'showWelcomePage') = 'true') ">
- <xsl:choose>
- <xsl:when test="not($welcomeURLOverride) or $hasCustomWelcomeURL">
- <!-- xsl:call-template name="executeWelcomeRequest"/-->
- <xsl:call-template name="redirect">
- <xsl:with-param name="url" select="'/bi'"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <xsl:call-template name="executeHomeRequest"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:when>
- <!-- Perform a go home command -->
- <xsl:otherwise>
- <xsl:call-template name="executeHomeRequest"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
- <!-- Handle a Welcome Command -->
- <xsl:template name="executeWelcomeRequest">
- <xsl:variable name="welcomeURL">
- <xsl:choose>
- <xsl:when test="$hasCustomWelcomeURL">
- <xsl:value-of select="$customWelcomeURL"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$ICSoftwareWelcomeURL"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:call-template name="redirect">
- <xsl:with-param name="url" select="$welcomeURL"/>
- </xsl:call-template>
- </xsl:template>
- <!-- Handle a Home Command -->
- <xsl:template name="executeHomeRequest">
- <xsl:variable name="rawCMHomeURL">
- <xsl:call-template name="buildBasicHomeQueryString"/>
- </xsl:variable>
- <xsl:variable name="gatewayTarget">
- <xsl:value-of select="$gateway"/>
- </xsl:variable>
- <xsl:variable name="sanitizedHomeURL">
- <xsl:choose>
- <xsl:when test="starts-with($rawCMHomeURL , 'http://' ) or starts-with($rawCMHomeURL , 'https://' )">
- <xsl:choose>
- <xsl:when test="xtsext:cafaction('issafeurl_null', normalize-space($rawCMHomeURL)) = 'true'">
- <xsl:value-of select="$rawCMHomeURL"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:text>error:INVALID_HOME_DOMAIN_NAME</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="concat( $gatewayTarget, '?', xtsext:protect((string($rawCMHomeURL)),'url','url','getdata') ) "/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <!-- if no ui.tool it will behave as if caller is within CC world, CC CMM etc -->
- <xsl:variable name="sourceComponent" select="/root/env/param[@name='ui.tool']"/>
- <xsl:variable name="isDCHome" select="contains($rawCMHomeURL,'ui.tool=DashboardConsole')"/>
- <xsl:variable name="windowMode">
- <xsl:call-template name="genWindowMode">
- <xsl:with-param name="sourceComponent" select="$sourceComponent"/>
- <xsl:with-param name="isDCHome" select="$isDCHome"/>
- </xsl:call-template>
- </xsl:variable>
- <xsl:choose>
- <xsl:when test="$isHomeAPI">
- <xsl:choose>
- <xsl:when test="$sanitizedHomeURL != '' and not(starts-with($sanitizedHomeURL , 'error'))">
- <xsl:call-template name="setupHomeAPI">
- <xsl:with-param name="url" select="$sanitizedHomeURL"/>
- <xsl:with-param name="windowMode" select="$windowMode"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:otherwise>
- <xsl:call-template name="homeAPIError">
- <xsl:with-param name="errorMessage">
- <xts:string id="IDS_PAGE_INVALID_HOME_DOMAIN"><xts:param name="badURL"> <xsl:value-of select="$rawCMHomeURL"/> </xts:param></xts:string>
- </xsl:with-param>
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:when>
- <xsl:when test="$sanitizedHomeURL != '' and not(starts-with($sanitizedHomeURL , 'error'))">
- <xsl:call-template name="redirect">
- <xsl:with-param name="url" select="$sanitizedHomeURL"/>
- <xsl:with-param name="windowMode" select="$windowMode"/>
- </xsl:call-template>
- </xsl:when>
- <xsl:when test="starts-with($sanitizedHomeURL , 'error')">
- <xsl:call-template name="printError">
- <xsl:with-param name="errorMessage">
- <xts:string id="IDS_PAGE_INVALID_HOME_DOMAIN"><xts:param name="badURL"> <xsl:value-of select="$rawCMHomeURL"/> </xts:param></xts:string>
- </xsl:with-param>
- </xsl:call-template>
- </xsl:when>
- </xsl:choose>
- </xsl:template>
- <!-- Build basic home query string as read from CM -->
- <xsl:template name="buildBasicHomeQueryString">
- <!-- MVC -->
- <xsl:variable name="mvc-redirectToN" select="/root/cookies/cookie[@name='mvc'] and not(/root/session/param[@name='mvcsys'] = 'n')"/>
- <xsl:variable name="mvc-gateway" select="/root/mvcSettings/configuration/property[@name='MVC_gateway']"/>
- <xsl:variable name="defaultquery"><xsl:value-of select="string(/root/system/param[@name='CCHome'])"/></xsl:variable>
- <xsl:variable name="homequery">
- <xsl:choose>
- <xsl:when test="/root/accountOptions">
- <xsl:value-of select="string(/root/accountOptions/cm:queryResponse/cm:account/options/value/item[name='homePage']/value)"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="string(/root/newSession/cm:queryResponse/cm:queryReply[3]/cm:account/options/value/item[name='homePage']/value)"/>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:variable name="param-sep">
- <xsl:choose>
- <xsl:when test="$homequery != '' and not(/root/env/param[@name='gohome']) and contains(string($homequery), '://') and not(contains(string($homequery), '?'))">
- <xsl:text>?</xsl:text>
- </xsl:when>
- <xsl:otherwise>
- <xsl:text>&</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:choose>
- <!-- MVC -->
- <!-- Detect and redirect to the N side home iff user is in mvc environment -->
- <xsl:when test="$mvc-redirectToN and not(/root/env/param[@name='mvc_homeredirect']) and string($mvc-gateway) != ''">
- <xsl:value-of select="$mvc-gateway"/>?<xsl:text/>
- <xsl:text>b_action=xts.run&m=portal/main.xts&mvc_homeredirect=true</xsl:text>
- </xsl:when>
- <xsl:when test="$homequery != '' and not(/root/env/param[@name='gohome'])">
- <xsl:value-of select="$homequery"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$defaultquery"/>
- </xsl:otherwise>
- </xsl:choose>
- <!-- add this here to indicate that we are invoking home command -->
- <xsl:value-of select="$param-sep"/>
- <xsl:text>gohome=</xsl:text>
- </xsl:template>
- <!-- Handle Recovery from Authentication Faults -->
- <xsl:template name="executeInternalRedirection">
- <xsl:choose>
- <!-- Handle POST-style redirection -->
- <xsl:when test="translate(string(env/param[@name = 'm_method']),'POST', 'post') = 'post'">
- <xts:sequence>
- <xts:append select="/root">
- <redirectForm action="{concat($gateway,env/param[@name='m_pathInfo'])}">
- <xsl:for-each select="env/param[starts-with(@name, 'o_')]">
- <input name="{substring-after(@name, 'o_')}" type="hidden">
- <value><xsl:value-of select="."/></value>
- </input>
- </xsl:for-each>
- </redirectForm>
- </xts:append>
- </xts:sequence>
- </xsl:when>
- <!-- Handle GET-style redirection -->
- <xsl:otherwise>
- <xsl:variable name="redirect-url">
- <xsl:value-of select="$gateway"/><xsl:value-of select="env/param[@name='m_pathInfo']"/><xsl:text/>
- <xsl:if test="count(env/param[starts-with(@name, 'o_')]) > 0">
- <xsl:text>?</xsl:text>
- <xsl:for-each select="env/param[starts-with(@name, 'o_')]">
- <xsl:if test="position() != 1">
- <xsl:text/>&<xsl:text/>
- </xsl:if>
- <xsl:value-of select="substring-after(@name, 'o_')"/>=<xsl:value-of select="xtsext:protect(xtsext:urlencode(string(.)),'url',concat('NAME',substring-after(@name, 'o_')),'getdata')"/>
- </xsl:for-each>
- </xsl:if>
- </xsl:variable>
- <!-- TODO: Check for long URL before executing a GET -->
- <xsl:call-template name="redirect">
- <xsl:with-param name="url" select="$redirect-url"/>
- </xsl:call-template>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:template>
- <xsl:template name="redirect">
- <xsl:param name="url"/>
- <xsl:param name="windowMode" select="'openSameWindow'"/>
- <xts:sequence>
- <xts:append select="/root">
- <redirectURL windowMode="{$windowMode}">
- <xsl:value-of select="$url"/>
- </redirectURL>
- </xts:append>
- <xsl:if test="$windowMode = 'openChromedWindow' or $windowMode = 'openChromelessWindow'">
- <xts:append select="/root">
- <back-url>
- <xsl:choose>
- <xsl:when test="string(env/param[@name='backURL']) != ''">
- <xsl:value-of select="string(env/param[@name='backURL'])"/>
- </xsl:when>
- <xsl:when test="string(env/param[@name='ui.backURL']) != ''">
- <xsl:value-of select="string(env/param[@name='ui.backURL'])"/>
- </xsl:when>
- <xsl:otherwise>
- <xsl:value-of select="$ICSoftwareWelcomeURL"/>
- </xsl:otherwise>
- </xsl:choose>
- </back-url>
- </xts:append>
- </xsl:if>
- </xts:sequence>
- </xsl:template>
- <xsl:template name="setupHomeAPI">
- <xsl:param name="url"/>
- <xsl:param name="windowMode" select="'chrome'"/>
- <!-- Process the window mode so that it fits the home api -->
- <xsl:variable name="openHomeIn">
- <xsl:choose>
- <xsl:when test="$windowMode= 'openChromedWindow' or $windowMode= 'openChromelessWindow'">openNewWindow</xsl:when>
- <xsl:otherwise>openSameWindow</xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <!-- need to fix up the windowMode to send the proper paramater -->
- <xsl:variable name="windowModeParam">
- <xsl:choose>
- <xsl:when test="contains($windowMode,'Chromeless')">chromeless</xsl:when>
- <xsl:otherwise>chrome</xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <xsl:variable name="windowProp">
- <xsl:choose>
- <xsl:when test="$windowMode='openChromedWindow' or $windowMode='openSameChromedWindow'"><xsl:text>location=yes,menubar=yes,resizable=yes,scrollbars=yes,status=yes,titlebar=yes,toolbar=yes,directories=yes</xsl:text></xsl:when>
- <xsl:when test="$windowMode='openChromelessWindow' or $windowMode='openSameChromelessWindow'"><xsl:text>location=no,menubar=no,resizable=yes,scrollbars=no,status=no,toolbar=no,directories=no</xsl:text></xsl:when>
- </xsl:choose>
- </xsl:variable>
- <xts:sequence>
- <xts:append select="/root">
- <homeInfo>
- <openHomeIn><xsl:value-of select="$openHomeIn"/></openHomeIn>
- <windowMode><xsl:value-of select="$windowModeParam"/></windowMode>
- <windowProp><xsl:value-of select="$windowProp"/></windowProp>
- <url><xsl:value-of select="$url"/></url>
- </homeInfo>
- </xts:append>
- </xts:sequence>
- </xsl:template>
- <xsl:template name="homeAPIError">
- <xsl:param name="errorMessage" select="''"/>
- <xts:sequence>
- <xts:append select="/root">
- <homeInfo>
- <error><xsl:value-of select="$errorMessage"/></error>
- </homeInfo>
- </xts:append>
- </xts:sequence>
- </xsl:template>
- <!-- The Home behaviour is the same whether the HomeApi is called or not but for Home API need to parse into separate parameters
- so we will add whether it is chrome or chromeless here so we only calculate it once.
- This does not effect the non-API because it only checks chrome/chromeless for new windows since same window
- honours it's mode -->
- <xsl:template name="genWindowMode">
- <xsl:param name="sourceComponent" select="''"/>
- <xsl:param name="isDCHome" select="''"/>
- <xsl:choose>
- <!-- caller is dc (bux) -->
- <xsl:when test="$sourceComponent='DashboardConsole'">
- <xsl:choose>
- <!-- dc is home, window can be chrome or chromeless does not matter -->
- <xsl:when test="$isDCHome">
- <xsl:choose>
- <!-- dc is chrome so can open in same window -->
- <xsl:when test="not($isLaunchBusinessInsightChromeless)">openSameChromedWindow</xsl:when>
- <xsl:otherwise>openSameChromelessWindow</xsl:otherwise>
- </xsl:choose>
- </xsl:when>
- <!-- home is within CC world -->
- <xsl:otherwise>
- <xsl:choose>
- <!-- dc is chrome so can open in same window -->
- <xsl:when test="not($isLaunchBusinessInsightChromeless)">openSameChromedWindow</xsl:when>
- <!-- chromeless is set so open in new chromed window -->
- <xsl:otherwise>openChromedWindow</xsl:otherwise>
- </xsl:choose>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:when>
- <!-- caller is within CC world -->
- <xsl:when test="not($sourceComponent='DashboardConsole')">
- <xsl:choose>
- <!-- home is within CC world -->
- <xsl:when test="not($isDCHome)">openSameChromedWindow</xsl:when>
- <xsl:otherwise>
- <!-- Home is dc (bux) -->
- <xsl:choose>
- <!-- dc is chrome ok to open in same window -->
- <xsl:when test="not($isLaunchBusinessInsightChromeless)">openSameChromedWindow</xsl:when>
- <!-- chromeless is set -->
- <xsl:otherwise>openChromelessWindow</xsl:otherwise>
- </xsl:choose>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:when>
- </xsl:choose>
- </xsl:template>
- <xsl:template name="printError">
- <xsl:param name="errorMessage"/>
- <xts:sequence>
- <xts:append select="/root">
- <redirectionError>
- <xsl:value-of select="$errorMessage"/>
- </redirectionError>
- </xts:append>
- </xts:sequence>
- </xsl:template>
- </xsl:stylesheet>
- </xts:block>
- <xts:block
- id="response"
- dependency="redirectionLogic"
- mode="output"
- processor="XSLT"
- condition=".[not(/root/env/param[@name='homeAPI'])]"
- type="exec"
- mimeType="text/html"
- mandatory="false">
- <xts:logicsheet path="logicsheets/portal.xsl"/>
- <xsl:stylesheet version="1.0"
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns:xts="http://developer.cognos.com/schemas/xts/"
- xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt"
- xmlns:pf="http://developer.cognos.com/schemas/xts/pf"
- xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/"
- exclude-result-prefixes="xtsext xts pf cm">
- <pf:variables/>
- <xsl:template match="/root">
- <xsl:variable name="windowMode" select="string(/root/redirectURL/@windowMode)"/>
- <xsl:variable name="back-url" select="/root/back-url"/>
- <xsl:variable name="redirect-url" select="string(/root/redirectURL)"/>
- <html lang="{/root/session/param[@name='productLocale']}">
- <head>
- <title><xts:string id="IDS_COGNOS_REPORTS"/></title>
- <meta http-equiv="expires" content="0"/>
- <!-- MVC Housekeeping ... -->
- <xsl:if test="$mvc-N-enabled">
- <script language="javascript" src="{$webcontent}/{$app}/js/cookie_jar.js"/>
- <script language="javascript">
- var sCookiePath = "<xsl:value-of select="xtsext:javascriptencode(string($cookie_path))"/>";
- var sCookieDomain = "<xsl:value-of select="xtsext:javascriptencode(string($cookie_domain))"/>";
- var sCookieSecure = "<xsl:value-of select="xtsext:javascriptencode(string($cookie_secure))"/>";
- delCookie("mvcpfstate");
- delCookie("mvcmfstate");
- delCookie("mvcsstate");
- </script>
- </xsl:if>
- <xsl:if test="$redirect-url !='' ">
- <xsl:choose>
- <!-- Redirect URL requires a new window to be opened. This happens when home requires a new browser chrome state -->
- <xsl:when test="$windowMode = 'openChromedWindow' or $windowMode = 'openChromelessWindow'">
- <xsl:variable name="windowProperties">
- <xsl:choose>
- <xsl:when test="$windowMode = 'openChromedWindow'">
- <xsl:text>location=yes,menubar=yes,resizable=yes,scrollbars=yes,status=yes,titlebar=yes,toolbar=yes,directories=yes</xsl:text>
- </xsl:when>
- <xsl:otherwise>
- <xsl:text>location=no,menubar=no,resizable=yes,scrollbars=no,status=no,toolbar=no,directories=no</xsl:text>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:variable>
- <script language="javascript">
- var backURL = '<xsl:value-of select="xtsext:javascriptencode($back-url)"/>';
- function doOnload()
- {
- if (!newWindow())
- showPopUpWarning();
- else
- returnToPreviousView();
- }
- <!-- Try and open a new window and return a handle to it to determine if it opened successfully -->
- function newWindow()
- {
- var windowProperties = '<xsl:value-of select="$windowProperties"/>';
- var windowURL = '<xsl:value-of select="xtsext:javascriptencode($redirect-url)"/>';
- var windowHandle = window.open(windowURL,"_blank", windowProperties);
- return windowHandle;
- }
- function retryWindowOpen()
- {
- var launchWindow = newWindow();
- returnToPreviousView();
- }
- function returnToPreviousView()
- {
- if (backURL != '')
- window.location.href = backURL;
- else
- {
- showInfoPage();
- hidePopUpWarning();
- }
- }
- function showPopUpWarning()
- {
- if (document.getElementById('popUpWarning'))
- document.getElementById('popUpWarning').style.display = 'block';
- }
- function hidePopUpWarning()
- {
- if (document.getElementById('popUpWarning'))
- document.getElementById('popUpWarning').style.display = 'none';
- }
- function showInfoPage()
- {
- if (document.getElementById('infoPage'))
- document.getElementById('infoPage').style.display = 'block';
- }
- </script>
- </xsl:when>
- <xsl:otherwise>
- <xsl:choose>
- <!-- execute JS-style redirection via "official" JS context -->
- <xsl:when test="starts-with($redirect-url,'javascript:') or /root/env/param[@name = 'm_passportID']">
- <script language="javascript">
- window.location.href = "<xsl:value-of select="xtsext:javascriptencode(string($redirect-url))"/>";
- </script>
- </xsl:when>
- <!-- execute other redirection -->
- <xsl:otherwise>
- <!--
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- COGCQ00234767 - Content Expiration doesn't work when accessing main portal.
- Remove the use of meta tag http-equiv="refresh" since the Content Expiration setting is ignored.
- Use the window .replace javascript function, since it behaves like the "refresh" in that the url is
- not placed in the browsers history.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -->
- <script language="javascript">
- window.location.replace("<xsl:value-of select="xtsext:javascriptencode(string($redirect-url))"/>");
- </script>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:if>
- </head>
- <body bgcolor="#ffffff" onload="if (window.doOnload) doOnload()">
- <!-- POST-style redirection -->
- <xsl:if test="/root/redirectForm">
- <form name="pform" method="post" action="{@action}">
- <xsl:for-each select="/root/redirectForm/*">
- <input>
- <xsl:copy-of select="@*"/>
- <xsl:attribute name="value"><xsl:value-of select="./value"/></xsl:attribute>
- </input>
- </xsl:for-each>
- </form>
- <script language="javascript">document.pform.submit();</script>
- </xsl:if>
- <xsl:variable name="style" select="'font-family: Tahoma; font-size: 90%; color: #666699; padding: 50px; text-align: center;'"/>
- <!-- Opening a new window -->
- <xsl:if test="$windowMode = 'openChromedWindow' or $windowMode = 'openChromelessWindow'">
- <xsl:if test="$back-url = ''">
- <div id="infoPage" style="{$style} margin-top:100px; margin-left:100px; display:none;">
- <xsl:variable name="closeLink">
- <a href="javascript:window.close()"><xts:string id="IDS_WARN_CLOSE_THIS_PAGE_closeHyperlink"/></a>
- </xsl:variable>
- <xts:string id="IDS_WARN_CLOSE_THIS_PAGE">
- <xts:param name="closeHyperlink"><xsl:copy-of select="$closeLink"/></xts:param>
- </xts:string>
- </div>
- </xsl:if>
- <!-- Place holder to display warnings about pop-up blockers -->
- <div id="popUpWarning" style="{$style} display:none;">
- <xsl:variable name="homeLink">
- <a href="javascript:retryWindowOpen()"><xts:string id="IDS_PAGE_MENU_HOME"/></a>
- </xsl:variable>
- <xts:string id="IDS_WARN_POPUP_BLOCKER_HOME">
- <xts:param name="homeHyperlink"><xsl:copy-of select="$homeLink"/></xts:param>
- </xts:string>
- </div>
- </xsl:if>
- <!-- Display error -->
- <xsl:if test="/root/redirectionError">
- <div style="{$style}">
- <xsl:value-of select="/root/redirectionError"/>
- </div>
- </xsl:if>
- </body>
- </html>
- </xsl:template>
- </xsl:stylesheet>
- </xts:block>
- <xts:block id="responseHomeAPI" type="exec" mode="output" dependency="redirectionLogic" processor="XSLT" condition=".[/root/env/param[@name='homeAPI']]" mandatory="false" mimeType="application/javascript" contentId="responseHomeAPI" partId="part1">
- <xts:logicsheet path="logicsheets/portal.xsl"/>
- <xsl:stylesheet version="1.0" xmlns:pf="http://developer.cognos.com/schemas/xts/pf" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt" xmlns:xos="http://developer.cognos.com/schemas/xts/output/" xmlns:xts="http://developer.cognos.com/schemas/xts/" exclude-result-prefixes="xts xtsext">
- <xsl:output method="html" encoding="utf-8" indent="no"/>
- <xsl:template match="/">
- <xsl:choose>
- <xsl:when test="/root/homeInfo/openHomeIn">
- <xsl:text/>({ "home": {
- "openHomeIn":"<xsl:value-of select="xtsext:javascriptencode(string(/root/homeInfo/openHomeIn))"/>",
- "windowMode":"<xsl:value-of select="xtsext:javascriptencode(string(/root/homeInfo/windowMode))"/>",
- "windowProp":"<xsl:value-of select="xtsext:javascriptencode(string(/root/homeInfo/windowProp))"/>",
- "url":"<xsl:value-of select="xtsext:javascriptencode(string(/root/homeInfo/url))" disable-output-escaping="yes" />"}<xsl:text/>
- })<xsl:text/>
- </xsl:when>
- <xsl:when test="/root/homeInfo/error">
- <xsl:text/>({ "home": {
- "error":"<xsl:value-of select="xtsext:javascriptencode(string(/root/homeInfo/error))"/>"}<xsl:text/>
- })<xsl:text/>
- </xsl:when>
- </xsl:choose>
- </xsl:template>
- </xsl:stylesheet>
- </xts:block>
- <!-- Debug -->
- <!-- ============================================================================= -->
- <xts:block id="debug" dependency="response" condition=".[/root/env/param[@name='d'] = '1' or /root/session/param[@name='debug'] = '1']" type="exec" mode="output" processor="XSLT" mandatory="false" mimeType="text/html">
- <xts:logicsheet path="logicsheets/debuglogic.xslt"/>
- <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:dbg="http://developer.cognos.com/schemas/xts/logicsheets/xslt/debug/" exclude-result-prefixes="dbg">
- <xsl:output method="html" version="1.0" encoding="UTF-8" indent="no" omit-xml-declaration="yes"/>
- <dbg:templates/>
- <xsl:template match="/">
- <dbg:dumpxml select="/root"/>
- </xsl:template>
- </xsl:stylesheet>
- </xts:block>
- </xts:morphlet>
|