handleFault.xts 55 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3. Licensed Materials - Property of IBM
  4. IBM Cognos Products: ps
  5. (C) Copyright IBM Corp. 2005, 2020
  6. US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  7. -->
  8. <xts:morphlet xmlns:xts="http://developer.cognos.com/schemas/xts/" messageBase="messages/portal.xml, messages/portalRL.xml">
  9. <xts:block id="getInfo" type="exec" mode="interpret" mandatory="false" processor="XSLT">
  10. <xsl:stylesheet version="1.0"
  11. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  12. xmlns:xts="http://developer.cognos.com/schemas/xts/">
  13. <xsl:output method="xml" encoding="UTF-8" version="1.0" indent="no"/>
  14. <xsl:template match="/root">
  15. <xts:sequence>
  16. <xts:append>
  17. <mvcSettings>
  18. <xts:function name="getConfiguration">
  19. <xts:param name="MVC_remoteGateway"/>
  20. <xts:param name="MVC_remoteWebContent"/>
  21. <xts:param name="MVC_disableAutoLogOn"/>
  22. </xts:function>
  23. </mvcSettings>
  24. </xts:append>
  25. </xts:sequence>
  26. </xsl:template>
  27. </xsl:stylesheet>
  28. </xts:block>
  29. <!--
  30. ===============================================================================================
  31. Delete session cookie if this is a log in request
  32. ===============================================================================================
  33. -->
  34. <xts:block id="deleteCookies" dependency="getInfo" type="exec" mode="interpret" processor="XSLT"
  35. condition=".[ (/root/cookies/cookie[@name='cc_session'] or /root/cookies/cookie[@name='viewer_session']) and /root/command//*[local-name()='exception']/*[local-name() = 'promptInfo']/*[local-name() = 'displayObjects'] ]" mandatory="false">
  36. <xsl:stylesheet version="1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:bus="http://developer.cognos.com/schemas/bibus/3/" >
  37. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  38. <xsl:template match="/root">
  39. <xsl:variable name="cam-action" select="/root/header/*/*[local-name()='CAM']//item[name='h_CAM_action']/value"/>
  40. <xsl:variable name="setCookieVars" select="/root/output/*[local-name() = 'protocolHeader']/*[local-name() = 'param' and @name = 'setSoapHeader']//*[local-name() = 'setCookieVars']"/>
  41. <xsl:variable name="cookieVars" select="/root/output/*[local-name() = 'protocolHeader']/*[local-name() = 'param' and @name = 'setSoapHeader']//*[local-name() = 'cookieVars']"/>
  42. <!-- Reset the cc_session (when one exists in the cookieVars) in the setCookiesVars (which may need to be created when it does not exist)-->
  43. <xsl:if test="string($cam-action)!= 'generateTC'">
  44. <xts:sequence>
  45. <!-- We are about to insert delete cookie instruction(s). Make sure there is a place to do that first. -->
  46. <xsl:if test="not($setCookieVars)">
  47. <xts:append select="/root/output/*[local-name() = 'protocolHeader']/*[local-name() = 'param' and @name = 'setSoapHeader']/*[local-name() = 'Header']/*[local-name() = 'biBusHeader']/*[local-name() = 'hdrSession']">
  48. <bus:setCookieVars xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="bus:cookieVar[]"/>
  49. </xts:append>
  50. </xsl:if>
  51. <!-- Reset the cc_session -->
  52. <xsl:if test="not($setCookieVars/item[name = 'cc_session']) and $cookieVars/item[name = 'cc_session']">
  53. <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']">
  54. <item xsi:type="bus:setCookieVar">
  55. <name xsi:type="xsd:string">cc_session</name>
  56. <value xsi:type="xsd:string"></value>
  57. <maxAge xsi:type="xsd:int">-1</maxAge>
  58. </item>
  59. </xts:append>
  60. </xsl:if>
  61. <!-- Reset the viewer_session -->
  62. <xsl:if test="not($setCookieVars/item[name = 'viewer_session']) and $cookieVars/item[name = 'viewer_session']">
  63. <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']">
  64. <item xsi:type="bus:setCookieVar">
  65. <name xsi:type="xsd:string">viewer_session</name>
  66. <value xsi:type="xsd:string"></value>
  67. <maxAge xsi:type="xsd:int">-1</maxAge>
  68. </item>
  69. </xts:append>
  70. </xsl:if>
  71. </xts:sequence>
  72. </xsl:if>
  73. </xsl:template>
  74. </xsl:stylesheet>
  75. </xts:block>
  76. <xts:block id="onebox" type="exec" processor="XSLT" mandatory="false"
  77. condition=".[ /root/http/param[@name='PATH_INFO'] = '/onebox' ]">
  78. <xts:logicsheet path="logicsheets/buslogic.xslt"/>
  79. <xsl:stylesheet version="1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  80. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  81. xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt"
  82. xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
  83. xmlns:send="http://developer.cognos.com/schemas/xts/logic-sheet/xslt/brl/1/"
  84. xmlns:fault="http://developer.cognos.com/schemas/xts/portal/iFaultHandler/1/"
  85. xmlns:bus="http://developer.cognos.com/schemas/bibus/3/">
  86. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  87. <xsl:template match="/root">
  88. <xsl:if test="http/param[@name='PATH_INFO'] = '/onebox'">
  89. <xts:sequence>
  90. <xts:append select="/root/env">
  91. <param name="bypass_login">true</param>
  92. </xts:append>
  93. <xts:append select="/root/output" option="part">
  94. <xts:transform processor="XSLT" src="onebox/gen-module.xslt" faultBlock="error-part">
  95. <xts:param name="logicsheet">logicsheets/portal.xsl</xts:param>
  96. <xts:param name="messageBase">messages/portal.xml</xts:param>
  97. <xts:param name="messageBase">messages/portalRL.xml</xts:param>
  98. <xts:param name="parameter">gw=<xts:queryValue select="/root/configProps/param[@name='cps']/property[@name='gateway']"/></xts:param>
  99. <root/>
  100. </xts:transform>
  101. </xts:append>
  102. </xts:sequence>
  103. </xsl:if>
  104. </xsl:template>
  105. </xsl:stylesheet>
  106. </xts:block>
  107. <xts:block id="buildFaultInit" type="exec" dependency="deleteCookies onebox" processor="XSLT" mandatory="false">
  108. <xts:logicsheet path="logicsheets/portal.xsl"/>
  109. <xsl:stylesheet version="1.0"
  110. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  111. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  112. xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt"
  113. xmlns:xts="http://developer.cognos.com/schemas/xts/"
  114. xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
  115. xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
  116. xmlns:fault="http://developer.cognos.com/schemas/xts/portal/iFaultHandler/1/"
  117. xmlns:pf="http://developer.cognos.com/schemas/xts/pf"
  118. xmlns:bus="http://developer.cognos.com/schemas/bibus/3/"
  119. exclude-result-prefixes="SOAP-ENC SOAP-ENV xsi xsl xtsext xts pf fault bus">
  120. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  121. <xsl:variable name="mname" select="'handleFault.xts'"/>
  122. <pf:variables/>
  123. <pf:modalVariables/>
  124. <xsl:variable name="x-controller-agent" select="/root/http/param[@name='X-Controller-Agent']"/>
  125. <xsl:variable name="fault-type">
  126. <xsl:choose>
  127. <xsl:when test="boolean(/root/command//*[local-name()='exception']/*[local-name() = 'promptInfo']/*[local-name() = 'displayObjects'])">
  128. <xsl:if test="not(/root/env/param[@name='bypass_login'])">
  129. <xsl:value-of select="'login'"/>
  130. </xsl:if>
  131. </xsl:when>
  132. <xsl:otherwise>
  133. <xsl:value-of select="'error'"/>
  134. </xsl:otherwise>
  135. </xsl:choose>
  136. </xsl:variable>
  137. <xsl:variable name="cam-action" select="/root/command//*[local-name()='CAM']//item[name='h_CAM_action']/value"/>
  138. <xsl:variable name="browserTitle">
  139. <xsl:choose>
  140. <xsl:when test="$fault-type = 'login'">
  141. <xsl:choose>
  142. <xsl:when test="string($cam-action) = 'generateTC'"><xts:string id="IDS_LOGON_CREDENTIAL_TITLE"/></xsl:when>
  143. <xsl:otherwise><xts:string id="IDS_LOGON_TITLE_BROWSER"/></xsl:otherwise>
  144. </xsl:choose>
  145. </xsl:when>
  146. <xsl:otherwise>
  147. <xsl:value-of select="$product_name"/>
  148. </xsl:otherwise>
  149. </xsl:choose>
  150. </xsl:variable>
  151. <xsl:variable name="password-reset-confirmation" select="boolean(/root/command//*[local-name()='CAM']//item/name='CAMChangePwd')"/>
  152. <xsl:variable name="title">
  153. <xsl:choose>
  154. <xsl:when test="$fault-type = 'login'">
  155. <xsl:choose>
  156. <xsl:when test="string($cam-action) = 'generateTC'"><xts:string id="IDS_LOGON_CREDENTIAL_TITLE"/></xsl:when>
  157. <xsl:otherwise><xts:string id="IDS_LOGON_TITLE"/></xsl:otherwise>
  158. </xsl:choose>
  159. </xsl:when>
  160. <xsl:otherwise>
  161. <xsl:value-of select="$product_name"/>
  162. </xsl:otherwise>
  163. </xsl:choose>
  164. </xsl:variable>
  165. <!-- If the login prompt is activated as a result of an expired session, we need to hide the 'cancel' button. -->
  166. <!-- This helps prevent user from ending up in an indeterminate state -->
  167. <xsl:variable name="disallow-cancel">
  168. <!--
  169. <xsl:variable name="setCookieVars" select="/root/command/fault:handleFault/fault:fault/SOAP-ENV:Envelope/SOAP-ENV:Header/bus:biBusHeader/hdrSession/bus:setCookieVars"/>
  170. <xsl:variable name="cam_passport" select="/root/command/fault:handleFault/fault:fault/SOAP-ENV:Envelope/SOAP-ENV:Header/bus:biBusHeader/hdrSession/bus:cookieVars/item[./name = 'cam_passport']/value"/>
  171. <xsl:value-of select="($setCookieVars/item/name='cam_passport' and $setCookieVars/item/maxAge='-1') or string($cam_passport) = ''"/>
  172. -->
  173. <xsl:value-of select="false()"/>
  174. </xsl:variable>
  175. <xsl:template match="/root">
  176. <xsl:if test="$fault-type != ''">
  177. <xts:sequence>
  178. <xts:append>
  179. <xts:request protocol="FILEREAD" cache="true" target="/portal/iFaultHandler/render/map.xml"/>
  180. <xsl:call-template name="build-fault-common"/>
  181. </xts:append>
  182. </xts:sequence>
  183. </xsl:if>
  184. </xsl:template>
  185. <xsl:template name="build-fault-common">
  186. <x-controller-agent><xsl:value-of select="$x-controller-agent"/></x-controller-agent>
  187. <fault-common fault-type="{$fault-type}">
  188. <settings>
  189. <param name="gateway"><xsl:value-of select="$gateway"/></param>
  190. <param name="pathInfo"><xsl:value-of select="string(.//*[local-name()='originalRequest']//*[local-name()='environmentVars']/*[local-name()='item']/*[local-name()='name' and .='PATH_INFO']/../*[local-name()='value'])"/></param>
  191. <param name="web"><xsl:value-of select="$webRoot"/></param>
  192. <param name="locale"><xsl:value-of select="$mappedProductLocale"/></param>
  193. <param name="skin"><xsl:value-of select="$user_skin"/></param>
  194. <param name="browser"><xsl:value-of select="$browser"/></param>
  195. <param name="webcontent"><xsl:value-of select="$webcontent"/></param>
  196. <param name="app"><xsl:value-of select="$app"/></param>
  197. <param name="skin_images"><xsl:value-of select="$skin_images"/></param>
  198. <param name="isModal"><xsl:value-of select="$isModal"/></param>
  199. <param name="soapAction"><xsl:value-of select="string(.//*[local-name()='originalRequest']//*[local-name()='dispatcherTransportVars']/*[local-name()='item']/*[local-name()='name' and .='originalSOAPAction']/../*[local-name()='value'])"/></param>
  200. <xsl:copy-of select="/root/system/param[@name='custom-auth']"/>
  201. <xsl:variable name="redirect">
  202. <xsl:call-template name="specialSSOHandling"/>
  203. </xsl:variable>
  204. <xsl:if test="string($redirect) != ''">
  205. <param name="redirect"><xsl:value-of select="$redirect"/></param>
  206. </xsl:if>
  207. </settings>
  208. <presentation>
  209. <browserTitle><xsl:value-of select="$browserTitle"/></browserTitle>
  210. <title><xsl:value-of select="$title"/></title>
  211. <actions>
  212. <xsl:choose>
  213. <xsl:when test="$password-reset-confirmation">
  214. <action type="yes">
  215. <label><xts:string id="IDS_YES"/></label>
  216. <default-command>processCommand('yes')</default-command>
  217. </action>
  218. <action type="no">
  219. <label><xts:string id="IDS_NO"/></label>
  220. <default-command>processCommand('no')</default-command>
  221. </action>
  222. </xsl:when>
  223. <xsl:otherwise>
  224. <!-- Render OK button -->
  225. <action type="ok">
  226. <label><xts:string id="IDS_OK"/></label>
  227. <default-command>processCommand('ok')</default-command>
  228. </action>
  229. <!-- Render Cancel button -->
  230. <xsl:if test="$fault-type = 'login'">
  231. <xsl:if test="not($disallow-cancel = 'true')">
  232. <action type="cancel">
  233. <label><xts:string id="IDS_CANCEL"/></label>
  234. <default-command>processCommand('cancel')</default-command>
  235. </action>
  236. </xsl:if>
  237. </xsl:if>
  238. </xsl:otherwise>
  239. </xsl:choose>
  240. <!-- Render Close button -->
  241. <xsl:variable name="show-close">
  242. <xsl:choose>
  243. <xsl:when test="$fault-type = 'login'">
  244. <xsl:value-of select="$disallow-cancel != 'true'"/>
  245. </xsl:when>
  246. <xsl:otherwise>
  247. <xsl:value-of select="true()"/>
  248. </xsl:otherwise>
  249. </xsl:choose>
  250. </xsl:variable>
  251. <xsl:if test="$show-close = 'true'">
  252. <action type="close">
  253. <label><xts:string id="IDS_CLOSE"/></label>
  254. <default-command>processCommand('close')</default-command>
  255. </action>
  256. </xsl:if>
  257. <!-- Render help button -->
  258. <xsl:variable name="show-help">
  259. <xsl:variable name="s" select="concat(' ', /root/system/param[@name='ui_hide']/CC_DIALOG_HEADER_help/@show, ' ')"/>
  260. <xsl:value-of select="not(/root/system/param[@name='ui_hide']/CC_DIALOG_HEADER_help) or
  261. (/root/system/param[@name='ui_hide']/CC_DIALOG_HEADER_help[
  262. (contains($s , 'Administrators') and $isAdminUser) or
  263. (contains($s , 'QSUsers') and $hasFullQSCapability) or
  264. (contains($s , 'RSUsers') and $hasFullRSCapability) or
  265. (contains($s , 'Consumers') and $is-named='1') or
  266. (contains($s , 'Anonymous') and $is-named='0') or
  267. (key('system-param', 'ui_groups')/group[contains($s, concat(' ', @id, ' ')) and contains( key('session-param', 'uig'), concat(' ', @id, ' '))])
  268. ])"/>
  269. </xsl:variable>
  270. <xsl:if test="$show-help = 'true'">
  271. <action type="help">
  272. <label><xts:string id="IDS_HELP"/></label>
  273. <default-command>processCommand('help')</default-command>
  274. </action>
  275. </xsl:if>
  276. </actions>
  277. <scripts>
  278. <xsl:call-template name="build-scripts">
  279. <xsl:with-param name="root" select="command/fault:handleFault"/>
  280. </xsl:call-template>
  281. </scripts>
  282. <resources>
  283. <message id="IDS_PROPERTY_IBM"><xts:string id="IDS_PROPERTY_IBM"/></message>
  284. <message id="IDS_COPYRIGHT"><xts:string id="IDS_COPYRIGHT"/></message>
  285. <message id="IDS_TRADEMARK"><xts:string id="IDS_TRADEMARK"/></message>
  286. <message id="IDS_FAULT_DETAILS"><xts:string id="IDS_FAULT_DETAILS"/></message>
  287. <message id="IDS_FAULT_DIALOG_TITLE"><xts:string id="IDS_FAULT_DIALOG_TITLE"/></message>
  288. <message id="IDS_SECTION_EXPAND"><xts:string encode="javascript" id="IDS_SECTION_EXPAND"/></message>
  289. <message id="IDS_SECTION_COLLAPSE"><xts:string encode="javascript" id="IDS_SECTION_COLLAPSE"/></message>
  290. <message id="IDS_SECTION_COLLAPSE"><xts:string encode="javascript" id="IDS_SECTION_COLLAPSE"/></message>
  291. <message id="IDS_SECTION508_JUMPTOMAIN"><xts:string id="IDS_SECTION508_JUMPTOMAIN"/></message>
  292. </resources>
  293. </presentation>
  294. </fault-common>
  295. </xsl:template>
  296. <xsl:template name="build-scripts">
  297. <xsl:param name="root"/>
  298. <xsl:variable name="errURL">
  299. <xsl:variable name="errURLValue">
  300. <xsl:choose>
  301. <xsl:when test="key('env-param', 'errURL')"><xsl:value-of select="key('env-param', 'errURL')"/></xsl:when>
  302. <xsl:when test="/root/command/fault:handleFault/fault:originalRequest//item[name='errURL']">
  303. <xsl:value-of select="/root/command/fault:handleFault/fault:originalRequest//item[name='errURL']/value"/>
  304. </xsl:when>
  305. <xsl:when test="/root/command/fault:handleFault/fault:originalRequest//item[name='ui.errURL']">
  306. <xsl:value-of select="/root/command/fault:handleFault/fault:originalRequest//item[name='ui.errURL']/value"/>
  307. </xsl:when>
  308. <xsl:when test="key('env-param','ui.errURL')"><xsl:value-of select="key('env-param', 'ui.errURL')"/></xsl:when>
  309. </xsl:choose>
  310. </xsl:variable>
  311. <!--*
  312. * We have a situation where a bad url was rightly detected and rejected by CAF only winding up
  313. * being echoed back (rendered) in the error page - this potentially constitutes an XSS vulnerability.
  314. *-->
  315. <xsl:variable name="errURLValue-normalizedSpace" select="string(normalize-space($errURLValue))"/>
  316. <xsl:choose>
  317. <xsl:when test="$errURLValue-normalizedSpace = ''">
  318. <!-- empty value - will be ignored -->
  319. </xsl:when>
  320. <xsl:when test="xtsext:cafaction('issafeurl_null', $errURLValue-normalizedSpace) = 'true'">
  321. <xsl:value-of select="$errURLValue"/>
  322. </xsl:when>
  323. <xsl:otherwise>
  324. <!-- Bad url should not be echoed back in the error page. -->
  325. <!-- Blank value will revert to default behaviour in the javascript error handler -->
  326. </xsl:otherwise>
  327. </xsl:choose>
  328. </xsl:variable>
  329. <!-- set condition to form-post a error URL that's too long for GET request -->
  330. <xsl:variable name="errURLTooLong" select="string-length(string($errURL)) &gt; 2048"/>
  331. <xsl:if test="$errURLTooLong">
  332. <form name="errURLForm" method="post" action="{$gateway}">
  333. <input name="doPostURL" type="hidden">backURL</input>
  334. <input name="m" type="hidden">portal/postURL.xts</input>
  335. <input name="backURL" type="hidden"><xsl:value-of select="$errURL"/></input>
  336. </form>
  337. </xsl:if>
  338. <script language="javascript" src="{$webcontent}/{$app}/js/cookie_jar.js"/>
  339. <script language="javascript">
  340. var g_PS_sParamDelimiter = "<xsl:value-of select="xtsext:javascriptencode(string(key('system-param', 'delimiters')/@d1))"/>";
  341. var g_PS_sNameValueDelimiter = "<xsl:value-of select="xtsext:javascriptencode(string(key('system-param', 'delimiters')/@d2))"/>";
  342. var g_PS_sCookiePath = "<xsl:value-of select="xtsext:javascriptencode(string($cookie_path))"/>";
  343. var g_PS_sCookieDomain = "<xsl:value-of select="xtsext:javascriptencode(string($cookie_domain))"/>";
  344. var g_PS_sCookieSecure = "<xsl:value-of select="xtsext:javascriptencode(string($cookie_secure))"/>";
  345. var g_PS_browser = '<xsl:value-of select="$browser"/>';
  346. var g_PS_emptyHistoryThreshold = '<xsl:choose><xsl:when test="$browser = 'ie'">0</xsl:when><xsl:otherwise>1</xsl:otherwise></xsl:choose>';
  347. var g_PS_isModal = '<xsl:value-of select="$isModal"/>';
  348. var g_PS_callBackMode = '<xsl:value-of select="$callBackMode"/>';
  349. var g_PS_callBackFunctionName = '<xsl:value-of select="$callBackFunctionName"/>';
  350. var g_PS_callBackTargetJSVar = null;
  351. try {
  352. g_PS_callBackTargetJSVar = <xsl:value-of select="$callBackTargetJSVar"/>;
  353. } catch (e) {
  354. <!-- Most likely due to a same origin policy issue, so let's handle this situation a bit more gracefully (instead of just JS error!) -->
  355. <!-- Another alternative is to employ the document.domain usage -->
  356. g_PS_isModal = 'false';
  357. }
  358. var g_PS_msg_PasswordVerifyFailed = "<xts:string id="IDS_ERR_0003_PASSWORD_VERIF_FAILED" encode="javascript"/>";
  359. var g_PS_cmdOK_enabled = true;
  360. var g_PS_errURL = '<xsl:value-of select="xtsext:javascriptencode(string($errURL))"/>';
  361. var g_PS_errURLTooLong = '<xsl:value-of select="$errURLTooLong"/>';
  362. var g_PS_webContent = '<xsl:value-of select="$webcontent"/>';
  363. var g_PS_locale = "<xsl:value-of select="xtsext:javascriptencode(string($mappedProductLocale))"/>";
  364. var g_PS_isPasswordResetConfirmation = <xsl:value-of select="$password-reset-confirmation"/>;
  365. var g_PS_enablePasswordResetAction = false;
  366. <xsl:variable name="original-morphlet">
  367. <xsl:choose>
  368. <xsl:when test="/root/command/fault:handleFault/fault:originalRequest//item[name='o_m']/value">
  369. <xsl:value-of select="/root/command/fault:handleFault/fault:originalRequest//item[name='o_m']/value"/>
  370. </xsl:when>
  371. <xsl:otherwise><xsl:value-of select="/root/command/fault:handleFault/fault:originalRequest//item[name='m']/value"/></xsl:otherwise>
  372. </xsl:choose>
  373. </xsl:variable>
  374. var g_PS_isCloseMorphlet = <xsl:value-of select="contains($original-morphlet, '/close.xts')"/>;
  375. <!-- MVC -->
  376. <xsl:if test="string($mvc-remote-gateway) != '' and string($mvc-remote-webcontent) != ''">
  377. var g_PS_mvc_enabled = <xsl:value-of select="string($mvc-remote-gateway) != '' and string($mvc-remote-webcontent) != ''"/>;
  378. var g_PS_mvc_remote_gateway = '<xsl:value-of select="xtsext:javascriptencode($mvc-remote-gateway)"/>';
  379. var g_PS_mvc_disable_autologon = <xsl:value-of select="string($mvc-disable-autologon) = 'true'"/>;
  380. var sCookiePath = "<xsl:value-of select="xtsext:javascriptencode(string($cookie_path))"/>";
  381. var sCookieDomain = "<xsl:value-of select="xtsext:javascriptencode(string($cookie_domain))"/>";
  382. var sCookieSecure = "<xsl:value-of select="xtsext:javascriptencode(string($cookie_secure))"/>";
  383. delCookie("mvcpfstate");
  384. delCookie("mvcmfstate");
  385. delCookie("mvcsstate");
  386. </xsl:if>
  387. </script>
  388. <xsl:choose>
  389. <!-- Generate script and form for LOGIN fault -->
  390. <xsl:when test="$fault-type = 'login'">
  391. <script language="javascript">
  392. <!-- Insert CAM error code - picked up by the fragment controller -->
  393. <xsl:text>//&lt;!--&lt;ERROR_CODE>CAM_PASSPORT_ERROR&lt;/ERROR_CODE>--></xsl:text>
  394. </script>
  395. <script language="javascript">
  396. <xsl:variable name="verifyTextNoEcho" select="//*[local-name() = 'type' and . = 'verifytextnoecho']/../*[local-name()= 'name']"/>
  397. var g_PS_sVerifyTextNoEcho = "<xsl:value-of select="$verifyTextNoEcho"/>";
  398. <xsl:variable name="externalBack">
  399. <xsl:if test="/root/env/param[@name='BACK'] or /root/env/param[@name='back']">
  400. <xsl:value-of select="concat(string(/root/env/param[@name='BACK']),string(/root/env/param[@name='back']))"/>
  401. </xsl:if>
  402. </xsl:variable>
  403. <!-- SEC_INFO: Double javascript encode $externalBack to prevent javascript injection. -->
  404. var g_PS_externalBack = '<xsl:value-of select="xtsext:javascriptencode(xtsext:javascriptencode(string($externalBack)))"/>';
  405. </script>
  406. <script language="javascript" src="{$webcontent}/{$app}/js/faultlogin.js"></script>
  407. <script language="javascript" src="{$webcontent}/{$app}/js/mvcAuth.js"></script>
  408. <pf:help context="HID_LOG_ON"/>
  409. </xsl:when>
  410. <!-- Generate script and form for ERROR fault -->
  411. <xsl:otherwise>
  412. <script language="javascript">
  413. <xsl:variable name="isQS">
  414. <xsl:choose>
  415. <xsl:when test="(.//*[local-name()='formFieldVars']/item[*[local-name()='name'] = 'run.xslURL']/bus:value = 'qs.xsl')">
  416. <xsl:value-of select="true()"/>
  417. </xsl:when>
  418. <xsl:when test="contains(.//*[local-name()='formFieldVars']/item[*[local-name()='name'] = 'CV_jsID']/value, 'oCVQS')">
  419. <xsl:value-of select="true()"/>
  420. </xsl:when>
  421. <xsl:when test="contains(.//*[local-name()='formFieldVars']/item[name='m']/value, '/qs/')">
  422. <xsl:value-of select="true()"/>
  423. </xsl:when>
  424. <xsl:when test="(.//*[local-name()='formFieldVars']/item[*[local-name()='name'] = 'cv.id']/bus:value = 'QS')">
  425. <xsl:value-of select="true()"/>
  426. </xsl:when>
  427. <xsl:otherwise>
  428. <xsl:value-of select="false()"/>
  429. </xsl:otherwise>
  430. </xsl:choose>
  431. </xsl:variable>
  432. var g_PS_isQS = '<xsl:value-of select="$isQS"/>';
  433. </script>
  434. <script language="javascript" src="{$webcontent}/{$app}/js/faulterror.js"></script>
  435. <pf:help context=""/>
  436. </xsl:otherwise>
  437. </xsl:choose>
  438. </xsl:template>
  439. <xsl:template name="specialSSOHandling">
  440. <xsl:variable name="originalRequest" select="/root/command//*[local-name()='originalRequest']//*[local-name() = 'formFieldVars']"/>
  441. <xsl:variable name="setCookieVars" select="/root/output/*[local-name() = 'protocolHeader']/*[local-name() = 'param' and @name = 'setSoapHeader']//*[local-name() = 'setCookieVars']"/>
  442. <xsl:variable name="m_passportID" select="$originalRequest//*[local-name()='item']/*[local-name()='name' and .='m_passportID']/../*[local-name()='value']"/>
  443. <xsl:variable name="m_retryPassportID" select="$originalRequest//*[local-name()='item']/*[local-name()='name' and .='m_retryPassportID']/../*[local-name()='value']"/>
  444. <xsl:variable name="m_redirect" select="$originalRequest//*[local-name()='item']/*[local-name()='name' and .='m_redirect']/../*[local-name()='value']"/>
  445. <xsl:variable name="clearingCAMPassportCookie" select="string($setCookieVars//*[local-name()='item']/*[local-name()='name' and .='cam_passport']/../*[local-name()='value']) = '' and $setCookieVars//*[local-name()='item']/*[local-name()='name' and .='cam_passport']/../*[local-name()='maxAge'] = '-1'"/>
  446. <xsl:if test="$m_passportID != '' and $m_retryPassportID='true' and $clearingCAMPassportCookie">
  447. <xsl:variable name="re-redirect">
  448. <xsl:value-of select="$gateway"/>?<xsl:text/>
  449. <xsl:for-each select="$originalRequest//*[local-name()='item' and *[local-name()='name' and . != 'm_retryPassportID']]">
  450. <xsl:variable name="name" select="./*[local-name()='name']"/>
  451. <xsl:variable name="value" select="./*[local-name()='value']"/>
  452. <xsl:if test="position() != 1">&amp;</xsl:if>
  453. <xsl:value-of select="$name"/>=<xsl:text/>
  454. <xsl:choose>
  455. <xsl:when test="$name='m_redirect'"><xsl:value-of select="xtsext:protect(xtsext:urlencode(string($value)),'url','userData','getdata')"/></xsl:when>
  456. <xsl:otherwise>
  457. <xsl:value-of select="xtsext:urlencode($value)"/>
  458. </xsl:otherwise>
  459. </xsl:choose>
  460. </xsl:for-each>
  461. </xsl:variable>
  462. <xsl:value-of select="$re-redirect"/>
  463. </xsl:if>
  464. </xsl:template>
  465. </xsl:stylesheet>
  466. </xts:block>
  467. <xts:block id="buildLoginXML" type="exec" dependency="buildFaultInit" processor="XSLT" mandatory="false"
  468. condition=".[/root/fault-common/@fault-type='login']">
  469. <xts:logicsheet path="logicsheets/portal.xsl"/>
  470. <xsl:stylesheet version="1.0"
  471. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  472. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  473. xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt"
  474. xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
  475. xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
  476. xmlns:fault="http://developer.cognos.com/schemas/xts/portal/iFaultHandler/1/"
  477. xmlns:pf="http://developer.cognos.com/schemas/xts/pf"
  478. xmlns:bus="http://developer.cognos.com/schemas/bibus/3/"
  479. exclude-result-prefixes="SOAP-ENC SOAP-ENV xsi xsl xtsext xts pf fault bus">
  480. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  481. <xsl:variable name="mname" select="'handleFault.xts'"/>
  482. <pf:variables/>
  483. <pf:modalVariables/>
  484. <xsl:variable name="target" select="/root/target"/>
  485. <xsl:variable name="cam-action" select="/root/command//*[local-name()='CAM']//item[name='h_CAM_action']/value"/>
  486. <xsl:variable name="x-controller-agent" select="/root/x-controller-agent"/>
  487. <xsl:variable name="renderer-node" select="/root/map/*[@x-controller-agent = $x-controller-agent and contains(@fault-type,'login')] | /root/map/renderer[@name = 'default' and contains(@fault-type,'login')]"/>
  488. <xsl:template match="/root">
  489. <xts:sequence>
  490. <xts:append>
  491. <fault>
  492. <xsl:copy-of select="/root/fault-common/*"/>
  493. <xsl:apply-templates select="command/fault:handleFault/*"/>
  494. <xsl:if test="$renderer-node/@include-soapfault='true'">
  495. <SOAPFault>
  496. <xsl:copy-of select="command/fault:handleFault/*"/>
  497. </SOAPFault>
  498. </xsl:if>
  499. </fault>
  500. </xts:append>
  501. </xts:sequence>
  502. </xsl:template>
  503. <xsl:template match="SOAP-ENV:Envelope">
  504. <login>
  505. <xsl:choose>
  506. <xsl:when test="descendant::*[local-name()!='Envelope']">
  507. <xsl:copy-of select="SOAP-ENV:Header/descendant::*[local-name() = 'CAM']"/>
  508. </xsl:when>
  509. <xsl:otherwise>
  510. <!-- go to the deepest level -->
  511. <xsl:apply-templates select="descendant::*[local-name()='Envelope'][1]"/>
  512. </xsl:otherwise>
  513. </xsl:choose>
  514. </login>
  515. </xsl:template>
  516. <xsl:template match="fault:originalRequest">
  517. <!--
  518. Need to grab the "original" request params to reconstruct the original request.
  519. If the current request is an asynch (wait) request then we need to resubmit the original "run" request
  520. provided we do have the form field vars that represent the "initial" run request.
  521. Report Server is supposed to package those with the fault it generated.
  522. <root>
  523. ...
  524. <command>
  525. <fault:handleFault xmlns:fault="http://developer.cognos.com/schemas/xts/portal/iFaultHandler/1/">
  526. <fault:fault>
  527. <SOAP-ENV:Envelope>
  528. <SOAP-ENV:Header>
  529. <bus:biBusHeader>
  530. ..
  531. <hdrSession>
  532. ..
  533. <bus:formFieldVars>
  534. <item>
  535. <name xsi:type="xsd:string" xml:space="preserve">zz</name>
  536. <value xsi:type="xsd:string" xml:space="preserve">blabla</value>
  537. </item>
  538. ..
  539. </bus:formFieldVars>
  540. </hdrSession>
  541. </bus:biBusHeader>
  542. </SOAP-ENV:Header>
  543. </SOAP-ENV:Envelope>
  544. </fault:fault>
  545. <fault:originalRequest>
  546. <SOAP-ENV:Envelope>
  547. <SOAP-ENV:Header>
  548. <bus:biBusHeader>
  549. ..
  550. <hdrSession>
  551. ..
  552. <bus:formFieldVars>
  553. <item>
  554. <name xsi:type="xsd:string" xml:space="preserve">zz</name>
  555. <value xsi:type="xsd:string" xml:space="preserve">blabla</value>
  556. </item>
  557. ..
  558. </bus:formFieldVars>
  559. </hdrSession>
  560. </bus:biBusHeader>
  561. </SOAP-ENV:Header>
  562. </SOAP-ENV:Envelope>
  563. </fault:originalRequest>
  564. </fault:handleFault>
  565. </command>
  566. ...
  567. </root>
  568. -->
  569. <!-- If the request that triggered the fault contains a ui.action=wait then it must be an asynch request -->
  570. <xsl:variable name="isAsyncRequestFault" select=".//*[local-name() = 'formFieldVars']/*[local-name()='item']/*[local-name()='name' and .='ui.action']/../*[local-name()='value' and .='wait']"/>
  571. <xsl:variable name="originalRequestContextRoot">
  572. <xsl:choose>
  573. <xsl:when test=" $isAsyncRequestFault and (../fault:fault//*[local-name() = 'formFieldVars']/*)">
  574. <xsl:copy-of select="../fault:fault"/>
  575. </xsl:when>
  576. <xsl:otherwise>
  577. <xsl:copy-of select="."/>
  578. </xsl:otherwise>
  579. </xsl:choose>
  580. </xsl:variable>
  581. <xsl:variable name="form-fields">
  582. <xsl:copy-of select="$originalRequestContextRoot//*[local-name() = 'formFieldVars']"/>
  583. </xsl:variable>
  584. <request-states>
  585. <xsl:for-each select="$form-fields/bus:formFieldVars/*">
  586. <xsl:if test="not(starts-with(name, 'CAM'))">
  587. <param name="{*[local-name() = 'name']}"><xsl:value-of select="*[local-name() = 'value']"/></param>
  588. </xsl:if>
  589. </xsl:for-each>
  590. </request-states>
  591. <redirect-form>
  592. <xsl:variable name="mvalue" select="$originalRequestContextRoot//*[local-name() = 'formFieldVars']/*[local-name()='item']/*[local-name()='name' and .='m']/../*[local-name()='value']"/>
  593. <xsl:variable name="pathInfo" select="$originalRequestContextRoot//*[local-name() = 'environmentVars']/*[local-name()='item']/*[local-name()='name' and .='PATH_INFO']/../*[local-name()='value']"/>
  594. <xsl:variable name="requestMethod" select="$originalRequestContextRoot//*[local-name() = 'environmentVars']/*[local-name()='item']/*[local-name()='name' and .='REQUEST_METHOD']/../*[local-name()='value']"/>
  595. <xsl:choose>
  596. <!--
  597. Unless the original request is bound to main.xts bounce it through main.xts to clear the cam params from this login request.
  598. main.xts also need to know what method to use to redirect, so pass it along.
  599. -->
  600. <xsl:when test="not($mvalue = concat($app,'/main.xts')) and contains(string($cam-action), 'logon')">
  601. <!-- Bounce from main.xts -->
  602. <xsl:call-template name="genFormFieldsForOriginalHTTPRequest">
  603. <xsl:with-param name="formFieldVarsArray">
  604. <xsl:copy-of select="$form-fields/*"/>
  605. </xsl:with-param>
  606. <xsl:with-param name="redirectMethod" select="$requestMethod"/>
  607. <xsl:with-param name="pathInfo" select="$pathInfo"/>
  608. </xsl:call-template>
  609. </xsl:when>
  610. <xsl:otherwise>
  611. <xsl:call-template name="genFormFieldsForOriginalHTTPRequest">
  612. <xsl:with-param name="formFieldVarsArray">
  613. <xsl:copy-of select="$form-fields/*"/>
  614. </xsl:with-param>
  615. </xsl:call-template>
  616. </xsl:otherwise>
  617. </xsl:choose>
  618. </redirect-form>
  619. </xsl:template>
  620. <xsl:template name="genFormFieldsForOriginalHTTPRequest">
  621. <xsl:param name="formFieldVarsArray"/>
  622. <xsl:param name="redirectMethod" select="''"/>
  623. <xsl:param name="pathInfo" select="''"/>
  624. <xsl:choose>
  625. <!-- This is a request targeting main.xts for futher redirection. Need to tag all original request params (prefix with o_ and build an XTS request to main.xts -->
  626. <xsl:when test="$redirectMethod != ''">
  627. <xsl:variable name="m_override" select="$formFieldVarsArray/bus:formFieldVars/*[local-name()='item']/*[local-name()='name' and .='m_override']"/>
  628. <xsl:variable name="m_override_value" select="$formFieldVarsArray/bus:formFieldVars/*[local-name()='item']/*[local-name()='name' and .='m_override']/../*[local-name()='value']"/>
  629. <xsl:for-each select="$formFieldVarsArray/bus:formFieldVars/*">
  630. <xsl:if test="not(starts-with(name, 'CAM'))">
  631. <xsl:choose>
  632. <xsl:when test="$m_override">
  633. <xsl:if test="name!='m' and name!='m_override'">
  634. <input type="hidden" name="{concat('o_', *[local-name() = 'name'])}">
  635. <xsl:value-of select="*[local-name() = 'value']"/>
  636. </input>
  637. </xsl:if>
  638. </xsl:when>
  639. <xsl:otherwise>
  640. <input type="hidden" name="{concat('o_', *[local-name() = 'name'])}">
  641. <xsl:value-of select="*[local-name() = 'value']"/>
  642. </input>
  643. <xsl:if test="starts-with(name, 'md.')">
  644. <!-- if it is a modal variable, it must also be in the form with its original name -->
  645. <!-- otherwise, if it is possible that these variables won't get passed on to another request -->
  646. <input type="hidden" name="{*[local-name() = 'name']}">
  647. <xsl:value-of select="*[local-name() = 'value']"/>
  648. </input>
  649. </xsl:if>
  650. </xsl:otherwise>
  651. </xsl:choose>
  652. </xsl:if>
  653. </xsl:for-each>
  654. <xsl:if test="$m_override">
  655. <input type="hidden" name="o_m"><xsl:value-of select="$m_override_value"/></input>
  656. </xsl:if>
  657. <!-- Special Command params to main.xts -->
  658. <input type="hidden" name="m"><xsl:value-of select="$app"/>/main.xts</input>
  659. <input type="hidden" name="b_action">xts.run</input>
  660. <input type="hidden" name="m_method"><xsl:value-of select="$redirectMethod"/></input>
  661. <xsl:if test="$pathInfo != ''">
  662. <input type="hidden" name="m_pathInfo"><xsl:value-of select="$pathInfo"/></input>
  663. </xsl:if>
  664. </xsl:when>
  665. <xsl:otherwise>
  666. <xsl:for-each select="$formFieldVarsArray/bus:formFieldVars/*">
  667. <xsl:if test="not(starts-with(name, 'CAM'))">
  668. <input type="hidden" name="{*[local-name() = 'name']}">
  669. <xsl:value-of select="*[local-name() = 'value']"/>
  670. </input>
  671. </xsl:if>
  672. </xsl:for-each>
  673. </xsl:otherwise>
  674. </xsl:choose>
  675. </xsl:template>
  676. <xsl:template match="text()"/>
  677. </xsl:stylesheet>
  678. </xts:block>
  679. <xts:block id="buildErrorXML" type="exec" dependency="buildFaultInit" processor="XSLT" mandatory="false"
  680. condition=".[/root/fault-common/@fault-type='error']">
  681. <xts:logicsheet path="logicsheets/portal.xsl"/>
  682. <xsl:stylesheet version="1.0"
  683. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  684. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  685. xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt"
  686. xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
  687. xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
  688. xmlns:fault="http://developer.cognos.com/schemas/xts/portal/iFaultHandler/1/"
  689. xmlns:xos="http://developer.cognos.com/schemas/xts/output/"
  690. xmlns:pf="http://developer.cognos.com/schemas/xts/pf"
  691. xmlns:bus="http://developer.cognos.com/schemas/bibus/3/"
  692. exclude-result-prefixes="SOAP-ENC SOAP-ENV xsi xsl xtsext xts xos pf fault bus">
  693. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  694. <xsl:variable name="mname" select="'handleFault.xts'"/>
  695. <pf:variables/>
  696. <pf:modalVariables/>
  697. <xsl:variable name="x-controller-agent" select="/root/x-controller-agent"/>
  698. <xsl:variable name="renderer-node" select="/root/map/*[@x-controller-agent = $x-controller-agent and contains(@fault-type,'error')] | /root/map/renderer[@name = 'default' and contains(@fault-type,'error')]"/>
  699. <xsl:template match="/root">
  700. <xts:sequence>
  701. <xts:append>
  702. <fault>
  703. <xsl:copy-of select="/root/fault-common/*"/>
  704. <xsl:apply-templates select="command/fault:handleFault"/>
  705. <xsl:if test="$renderer-node/@include-soapfault='true'">
  706. <SOAPFault>
  707. <xsl:copy-of select="command/fault:handleFault/*"/>
  708. </SOAPFault>
  709. </xsl:if>
  710. </fault>
  711. </xts:append>
  712. </xts:sequence>
  713. </xsl:template>
  714. <xsl:template match="command/fault:handleFault">
  715. <error>
  716. <xsl:choose>
  717. <!-- First check if there's a CAM error - CAM error takes precedence over other errors -->
  718. <xsl:when test="fault:fault/SOAP-ENV:Envelope/SOAP-ENV:Header/bus:biBusHeader/*[local-name()='CAM']/exception/*">
  719. <xsl:apply-templates select="fault:fault/SOAP-ENV:Envelope/SOAP-ENV:Header/bus:biBusHeader/*[local-name()='CAM']/exception"/>
  720. </xsl:when>
  721. <xsl:when test="not(./descendant::*[local-name() = 'exception'])">
  722. <xsl:apply-templates mode="special-fault"/>
  723. </xsl:when>
  724. <xsl:otherwise><xsl:apply-templates/></xsl:otherwise>
  725. </xsl:choose>
  726. </error>
  727. </xsl:template>
  728. <xsl:template match="*[local-name() = 'Fault']" mode="special-fault">
  729. <errorCodeString>
  730. <xsl:value-of select="*[local-name() = 'faultcode']"/>
  731. </errorCodeString>
  732. <message>
  733. <xsl:value-of select="*[local-name() = 'faultstring']"/>
  734. </message>
  735. </xsl:template>
  736. <xsl:template match="*[local-name() = 'exception']">
  737. <xsl:choose>
  738. <!-- if a user does not have the detailed messages capability then all errors come back as caf type which makes the error look very cryptic even for simple errors meant for the user
  739. so handle it like a xts-udf error if there is an exception decendant -->
  740. <xsl:when test="(./errorCode = 'XTS-UDF' or ./errorCode = 'caf') and ./descendant::*[local-name() = 'exception']">
  741. <xsl:apply-templates select="./descendant::*[local-name() = 'exception'][1]"/>
  742. </xsl:when>
  743. <xsl:when test="descendant::*[local-name() != 'exception']">
  744. <!-- pass through the details to be processed later -->
  745. <xsl:variable name="message-list">
  746. <severity>
  747. <xsl:value-of select="*[local-name() = 'severity']"/>
  748. </severity>
  749. <errorCode>
  750. <xsl:value-of select="*[local-name() = 'errorCode']"/>
  751. </errorCode>
  752. <errorCodeString>
  753. <xsl:variable name="errorCodeString">
  754. <xsl:choose>
  755. <xsl:when test="count(descendant::*[local-name()='message' and not(@SOAP-ENC:arrayType)])&gt;0">
  756. <xsl:if test="contains(substring-before(string(descendant::*[local-name()='message' and not(@SOAP-ENC:arrayType)]/*[local-name()='message' or local-name()='messageString'][1]),' '),'-')"> <!-- Only treat the first word of a message as an error code if it contains a - -->
  757. <xsl:value-of select="substring-before(string(descendant::*[local-name()='message' and not(@SOAP-ENC:arrayType)]/*[local-name()='message' or local-name()='messageString'][1]),' ')"/>
  758. </xsl:if>
  759. </xsl:when>
  760. <xsl:when test="count(descendant::*[local-name()='messages']/*[local-name()='item'])&gt;0">
  761. <xsl:if test="contains(substring-before(string(descendant::*[local-name()='messages']/*[local-name()='item'][1]/*[local-name()='message' or local-name()='messageString']),' '),'-')"> <!-- Only treat the first word of a message as an error code if it contains a - -->
  762. <xsl:value-of select="substring-before(string(descendant::*[local-name()='messages']/*[local-name()='item'][1]/*[local-name()='message' or local-name()='messageString']),' ')"/>
  763. </xsl:if>
  764. </xsl:when>
  765. <xsl:when test="*[local-name() = 'promptInfo']/*[local-name() = 'captions']">
  766. <xsl:value-of select="*[local-name() = 'promptInfo']/*[local-name() = 'captions']/*"/>
  767. </xsl:when>
  768. </xsl:choose>
  769. </xsl:variable>
  770. <xsl:value-of select="$errorCodeString"/>
  771. </errorCodeString>
  772. <xsl:variable name="messages" select="descendant::*[local-name()='message' and not(@SOAP-ENC:arrayType)] | descendant::*[local-name()='messages']/*[local-name()='item']"/>
  773. <xsl:for-each select="$messages[position()=1]">
  774. <message>
  775. <xsl:choose>
  776. <xsl:when test="contains(substring-before(*[local-name()='messageString' or local-name()='message'],' '),'-')"> <!-- Only treat the first word of the first message as an error code if it contains a - -->
  777. <xsl:value-of select="substring-after(*[local-name()='messageString' or local-name()='message'],' ')"/>
  778. </xsl:when>
  779. <xsl:otherwise>
  780. <xsl:value-of select="*[local-name()='messageString' or local-name()='message']"/>
  781. </xsl:otherwise>
  782. </xsl:choose>
  783. </message>
  784. </xsl:for-each>
  785. <xsl:if test="$messages[position()>1]">
  786. <details>
  787. <xsl:for-each select="$messages[position()>1]">
  788. <xsl:value-of select="*[local-name()='messageString' or local-name()='message']"/>
  789. <xsl:text/>&#10;&#13;<xsl:text/>
  790. </xsl:for-each>
  791. </details>
  792. </xsl:if>
  793. </xsl:variable>
  794. <xsl:copy-of select="$message-list"/>
  795. </xsl:when>
  796. <xsl:otherwise>
  797. <xsl:apply-templates select="descendant::*[local-name() = 'exception'][1]"/>
  798. </xsl:otherwise>
  799. </xsl:choose>
  800. </xsl:template>
  801. <xsl:template match="text()"/>
  802. </xsl:stylesheet>
  803. </xts:block>
  804. <xts:block id="render" type="exec" mode="interpret" processor="XSLT"
  805. dependency="buildLoginXML buildErrorXML" condition=".[/root/fault-common[@fault-type!='login' or (contains(../http/param[@name='HTTP_USER_AGENT'],'IBM Cognos Mobile') and not(contains(../http/param[@name='SCRIPT_NAME'],'/bi/v1/disp'))) or (contains(../http/param[@name='HTTP_USER_AGENT'],'IBM Cognos Mobile') and contains(../http/param[@name='SCRIPT_NAME'],'/bi/v1/disp') and not(contains(../http/param[@name='HTTP_USER_AGENT'],'Pass-through Authentication')))]]" mandatory="false">
  806. <xts:logicsheet path="logicsheets/portal.xsl"/>
  807. <xsl:stylesheet version="1.0"
  808. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  809. xmlns:pf="http://developer.cognos.com/schemas/xts/pf"
  810. xmlns:xos="http://developer.cognos.com/schemas/xts/output/"
  811. xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt"
  812. xmlns:xts="http://developer.cognos.com/schemas/xts/"
  813. exclude-result-prefixes="xsl xtsext xts xos pf">
  814. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  815. <xsl:template match="/root">
  816. <xts:sequence>
  817. <xsl:variable name="fault-type" select="/root/fault-common/@fault-type"/>
  818. <xsl:variable name="x-controller-agent" select="/root/x-controller-agent"/>
  819. <xsl:variable name="renderer-node" select="/root/map/*[@x-controller-agent = $x-controller-agent and contains(@fault-type, $fault-type)] | /root/map/renderer[@name = 'default' and contains(@fault-type, $fault-type)]"/>
  820. <xsl:variable name="renderers">
  821. <!--
  822. *
  823. * Prepare the all the renderers that this renderer invokes, if any.
  824. * -->
  825. <xsl:for-each select="$renderer-node/invokes[contains(@fault-type, $fault-type)]">
  826. <xsl:variable name="called-renderer-name" select="./@renderer"/>
  827. <xsl:variable name="called-renderer-node" select="/root/map/renderer[@name = $called-renderer-name and contains(@fault-type, $fault-type)]"/>
  828. <xsl:if test="$called-renderer-node">
  829. <renderer>
  830. <stylesheet><xsl:value-of select="$called-renderer-node/@stylesheet"/></stylesheet>
  831. <mimeType><xsl:value-of select="$called-renderer-node/@output-type"/></mimeType>
  832. <output-node>
  833. <xsl:choose>
  834. <xsl:when test="string(./@output-node) != ''"><xsl:value-of select="./@output-node"/></xsl:when>
  835. <xsl:otherwise>render-output</xsl:otherwise>
  836. </xsl:choose>
  837. </output-node>
  838. <encode-type><xsl:value-of select="./@encode-type"/></encode-type>
  839. </renderer>
  840. </xsl:if>
  841. </xsl:for-each>
  842. <!--
  843. *
  844. * Prepare this renderer
  845. * -->
  846. <renderer>
  847. <stylesheet><xsl:value-of select="$renderer-node/@stylesheet"/></stylesheet>
  848. <mimeType><xsl:value-of select="$renderer-node/@output-type"/></mimeType>
  849. </renderer>
  850. </xsl:variable>
  851. <xsl:call-template name="transform">
  852. <xsl:with-param name="renderers" select="$renderers"/>
  853. <xsl:with-param name="idx" select="'1'"/>
  854. </xsl:call-template>
  855. </xts:sequence>
  856. </xsl:template>
  857. <xsl:template name="transform">
  858. <xsl:param name="renderers"/>
  859. <xsl:param name="idx"/>
  860. <xsl:variable name="current-renderer" select="$renderers/renderer[$idx]"/>
  861. <xsl:variable name="stylesheet" select="$current-renderer/stylesheet"/>
  862. <xsl:variable name="mimeType" select="$current-renderer/mimeType"/>
  863. <xsl:variable name="output-node" select="$current-renderer/output-node"/>
  864. <xsl:variable name="encode-type" select="$current-renderer/encode-type"/>
  865. <xsl:choose>
  866. <xsl:when test="$idx &lt; count($renderers/renderer)">
  867. <xts:append select="/root/fault">
  868. <xsl:element name="{$output-node}">
  869. <xsl:if test="$encode-type = 'cdata'">
  870. <xsl:text/><xsl:value-of select="'&lt;![CDATA['" disable-output-escaping="yes"/><xsl:text/>
  871. </xsl:if>
  872. <xts:transform processor="XSLT">
  873. <xsl:attribute name="mimeType"><xsl:value-of select="$mimeType"/></xsl:attribute>
  874. <xsl:attribute name="src"><xsl:value-of select="$stylesheet"/></xsl:attribute>
  875. <xts:queryNode select="/root/fault"/>
  876. </xts:transform>
  877. <xsl:if test="$encode-type = 'cdata'">
  878. <xsl:text/><xsl:value-of select="']]&gt;'" disable-output-escaping="yes"/><xsl:text/>
  879. </xsl:if>
  880. </xsl:element>
  881. </xts:append>
  882. <xsl:call-template name="transform">
  883. <xsl:with-param name="renderers" select="$renderers"/>
  884. <xsl:with-param name="idx" select="$idx + 1"/>
  885. </xsl:call-template>
  886. </xsl:when>
  887. <xsl:otherwise>
  888. <xts:append select="/root/output">
  889. <xts:transform processor="XSLT" option="part">
  890. <xsl:attribute name="mimeType"><xsl:value-of select="$mimeType"/></xsl:attribute>
  891. <xsl:attribute name="src"><xsl:value-of select="$stylesheet"/></xsl:attribute>
  892. <xts:queryNode select="/root/fault"/>
  893. </xts:transform>
  894. </xts:append>
  895. </xsl:otherwise>
  896. </xsl:choose>
  897. </xsl:template>
  898. <pf:serialize-xml/>
  899. </xsl:stylesheet>
  900. </xts:block>
  901. <xts:block id="redirectToC11Login" dependency="buildLoginXML buildErrorXML" mode="output" processor="XSLT" type="exec" condition=".[/root/fault-common[@fault-type='login' and (not(contains(../http/param[@name='HTTP_USER_AGENT'],'IBM Cognos Mobile')) or (contains(../http/param[@name='HTTP_USER_AGENT'],'IBM Cognos Mobile') and contains(../http/param[@name='HTTP_USER_AGENT'],'Pass-through Authentication') and contains(../http/param[@name='SCRIPT_NAME'],'/bi/v1/disp')))]]" mimeType="text/html" mandatory="false">
  902. <!-- portal specific information -->
  903. <xts:logicsheet path="logicsheets/portal.xsl"/>
  904. <xsl:stylesheet version="1.0"
  905. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  906. xmlns:xts="http://developer.cognos.com/schemas/xts/"
  907. xmlns:pf="http://developer.cognos.com/schemas/xts/pf"
  908. xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt"
  909. xmlns:fault="http://developer.cognos.com/schemas/xts/portal/iFaultHandler/1/"
  910. exclude-result-prefixes="xsl xts pf xtsext">
  911. <pf:variables/>
  912. <xsl:template match="/">
  913. <xsl:variable name="originalFormVariables" select="/root/command//*[local-name()='originalRequest']//*[local-name() = 'formFieldVars']"/>
  914. <xsl:variable name="environmentVariables" select="/root/command//*[local-name()='originalRequest']//*[local-name() = 'environmentVars']"/>
  915. <xsl:variable name="orig_script_name" select="$environmentVariables/*[local-name()='item']/*[local-name()='name' and .='SCRIPT_NAME']/../*[local-name()='value']"/>
  916. <xsl:variable name="orig_http_host" select="$environmentVariables/*[local-name()='item']/*[local-name()='name' and .='HTTP_HOST']/../*[local-name()='value']"/>
  917. <xsl:variable name="orig_path_info" select="$environmentVariables/*[local-name()='item']/*[local-name()='name' and .='PATH_INFO']/../*[local-name()='value']"/>
  918. <xsl:variable name="http_user_agent" select="/root/http/param[@name='HTTP_USER_AGENT']"/>
  919. <xsl:variable name="script_name" select="/root/http/param[@name='SCRIPT_NAME']"/>
  920. <xsl:variable name="encoding" select="/root/env/param[@name='encoding']"/>
  921. <xsl:variable name="backUrl">
  922. <xsl:if test="not(contains($http_user_agent,'IBM Cognos Mobile') and contains($script_name,'/bi/v1/disp'))">
  923. <xsl:value-of select="concat($orig_script_name, $orig_path_info)"/>
  924. </xsl:if>
  925. <xsl:variable name="formFieldVarItems" select="$originalFormVariables//*[local-name()='item' and* [local-name()='name']]"/>
  926. <xsl:choose>
  927. <xsl:when test="contains($http_user_agent,'IBM Cognos Mobile') and contains($script_name,'/bi/v1/disp')">
  928. <xsl:value-of select="concat($script_name, '?', 'encoding=', $encoding, '&amp;', 'm=portal%2fmain.xts')"/>
  929. </xsl:when>
  930. <xsl:otherwise>
  931. <xsl:if test="count($formFieldVarItems) > 0">
  932. <xsl:text>?</xsl:text>
  933. <xsl:for-each select="$formFieldVarItems">
  934. <xsl:variable name="name" select="./*[local-name()='name']"/>
  935. <xsl:variable name="value" select="./*[local-name()='value']"/>
  936. <xsl:variable name="urlEncoded_name" select="string(xtsext:urlencode(string($name)))"/>
  937. <xsl:variable name="urlEncoded_value" select="string(xtsext:urlencode(string($value)))"/>
  938. <xsl:if test="position() != 1">
  939. <xsl:text>&amp;</xsl:text>
  940. </xsl:if>
  941. <xsl:value-of select="$urlEncoded_name"/><xsl:text>=</xsl:text><xsl:value-of select="$urlEncoded_value"/>
  942. </xsl:for-each>
  943. </xsl:if>
  944. </xsl:otherwise>
  945. </xsl:choose>
  946. </xsl:variable>
  947. <xsl:variable name="urlEncodedBackUrl" select="string(xtsext:urlencode(string($backUrl)))"/>
  948. <!-- redirect to /bi to trigger a C11 login -->
  949. <head>
  950. <xsl:variable name="acceptedGateway" select="concat($webRoot,'/bi/v1')"/>
  951. <xsl:variable name="redirectUrl">
  952. <xsl:choose>
  953. <xsl:when test="$webRoot = '/p2pd'">
  954. <xsl:value-of select="'/bi/'"/>
  955. </xsl:when>
  956. <xsl:when test="$webRoot = '/'">
  957. <xsl:value-of select="concat($webRoot,'bi/?legacyLogin=',$urlEncodedBackUrl)"/>
  958. </xsl:when>
  959. <xsl:when test="$webRoot">
  960. <xsl:value-of select="concat($webRoot,'/bi/?legacyLogin=',$urlEncodedBackUrl)"/>
  961. </xsl:when>
  962. <xsl:otherwise>
  963. <xsl:variable name="path" select="substring-before($gateway,'/v1/disp')"/>
  964. <xsl:choose>
  965. <xsl:when test="not($path)">
  966. <xsl:value-of select="'/bi/'"/>
  967. </xsl:when>
  968. <xsl:otherwise>
  969. <xsl:value-of select="concat($path,'/?legacyLogin=',$urlEncodedBackUrl)"/>
  970. </xsl:otherwise>
  971. </xsl:choose>
  972. </xsl:otherwise>
  973. </xsl:choose>
  974. </xsl:variable>
  975. <meta http-equiv="refresh" content="0; URL={$redirectUrl}"/>
  976. </head>
  977. </xsl:template>
  978. <pf:serialize-xml/>
  979. </xsl:stylesheet>
  980. </xts:block>
  981. <!--
  982. ===============================================================================================
  983. debug - display debug information
  984. ===============================================================================================
  985. -->
  986. <xts:block id="debug" dependency="render redirectToC11Login" condition=".[ /root/session/param[@name='debug'] = '1' or /root/env/param[@name = 'd'] = '1' ]" type="exec" mode="output" processor="XSLT" mandatory="false" mimeType="text/html" >
  987. <xts:logicsheet path="logicsheets/debuglogic.xslt"/>
  988. <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">
  989. <xsl:output method="html" version="1.0" encoding="UTF-8" indent="no" omit-xml-declaration="yes"/>
  990. <xsl:template match="/">
  991. <dbg:dumpxml select="/root"/>
  992. </xsl:template>
  993. </xsl:stylesheet>
  994. </xts:block>
  995. </xts:morphlet>