remote.xts 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3. Licensed Materials - Property of IBM
  4. IBM Cognos Products: cpscrn
  5. (C) Copyright IBM Corp. 2005, 2013
  6. US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  7. -->
  8. <!-- $Header: //cpscrn/main/templates/cps4/portlets/sdk/portlet-impl/remote/remote.xts#1 $ -->
  9. <!-- $DateTime: 2008/10/22 11:12:04 $ -->
  10. <!-- $Change: 25109 $ -->
  11. <xts:morphlet version="1.0" xmlns:xts="http://developer.cognos.com/schemas/xts/">
  12. <xts:block id="checkPassport" processor="XSLT" type="exec">
  13. <xts:logicsheet path="/cps4/common/logicsheets/soaplogic.xslt"/>
  14. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:soap="http://developer.cognos.com/schemas/cps/logic/soap">
  15. <xsl:output method="html" version="1.0" encoding="UTF-8" indent="no"/>
  16. <xsl:template match="/">
  17. <xts:sequence>
  18. <xts:discard>
  19. <soap:request provider="cm">
  20. <bus:query xmlns:bus="http://developer.cognos.com/schemas/bibus/3/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  21. <search>~</search>
  22. <properties xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="bus:propEnum[1]">
  23. <item xsi:type="bus:propEnum">storeID</item>
  24. </properties>
  25. <options xsi:type="bus:queryOptions">
  26. <schemaInfo xsi:type="xsd:boolean">false</schemaInfo>
  27. </options>
  28. </bus:query>
  29. </soap:request>
  30. </xts:discard>
  31. </xts:sequence>
  32. </xsl:template>
  33. </xsl:stylesheet>
  34. </xts:block>
  35. <xts:block id="preload" dependency="checkPassport" mode="interpret" processor="XSLT" type="exec">
  36. <xts:logicsheet path="/cps4/producer/logicsheets/cps-portlet.xslt"/>
  37. <xsl:stylesheet version="1.0" xmlns:portlet="http://developer.cognos.com/schemas/cps/logic/portlet/1/" xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt" xmlns:wsrp="urn:oasis:names:tc:wsrp:v1:types" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
  38. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  39. <xsl:template match="/">
  40. <portlet:if-mode name="wsrp:edit|cps:config">
  41. <xts:sequence>
  42. <xts:append select="/root">
  43. <xts:request protocol="GET" target="{/root/configProps/param[@name='cps']/property[@name = 'gateway']}/portlet/applications" cache="false">
  44. <xts:param name="header">
  45. <xsl:text>Cookie=</xsl:text>
  46. <xsl:for-each select="/root/cookies/cookie[not(@name='JSESSIONID')]">
  47. <xsl:value-of select="@name"/>=<xsl:value-of select="."/>
  48. <xsl:if test="position() != last()">
  49. <xsl:text>; </xsl:text>
  50. </xsl:if>
  51. </xsl:for-each>
  52. </xts:param>
  53. </xts:request>
  54. </xts:append>
  55. </xts:sequence>
  56. </portlet:if-mode>
  57. <portlet:if-mode name="wsrp:view|wsrp:preview">
  58. <xts:sequence>
  59. <portlet:property name="apppath" select="'app.path'"/>
  60. <xts:append select="/root">
  61. <xts:request protocol="GET" target="{/root/configProps/param[@name='cps']/property[@name = 'gateway']}/portlet/applications/{$apppath}" cache="false">
  62. <xts:param name="header">
  63. <xsl:text>Cookie=</xsl:text>
  64. <xsl:for-each select="/root/cookies/cookie[not(@name='JSESSIONID')]">
  65. <xsl:value-of select="@name"/>=<xsl:value-of select="."/>
  66. <xsl:if test="position() != last()">
  67. <xsl:text>; </xsl:text>
  68. </xsl:if>
  69. </xsl:for-each>
  70. </xts:param>
  71. </xts:request>
  72. </xts:append>
  73. </xts:sequence>
  74. </portlet:if-mode>
  75. </xsl:template>
  76. </xsl:stylesheet>
  77. </xts:block>
  78. <xts:block dependency="preload" id="request" mode="interpret" processor="XSLT" type="exec">
  79. <xts:logicsheet path="/cps4/producer/logicsheets/cps-portlet.xslt"/>
  80. <xts:logicsheet path="/cps4/producer/logicsheets/cps-ui.xslt"/>
  81. <xsl:stylesheet version="1.0" xmlns:portlet="http://developer.cognos.com/schemas/cps/logic/portlet/1/" xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt" xmlns:wsrp="urn:oasis:names:tc:wsrp:v1:types" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
  82. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  83. <xsl:template match="/">
  84. <xts:sequence>
  85. <xts:append select="/root">
  86. <temp-response/>
  87. </xts:append>
  88. <xts:append select="/root/temp-response">
  89. <portlet:portlet handle="sdk">
  90. <portlet:if-mode name="wsrp:view|wsrp:preview">
  91. <portlet:response>
  92. <portlet:content>
  93. <portlet:markup-context useCachedMarkup="'false'" mimeType="'text/html'" requiresUrlRewriting="'true'">
  94. <portlet:if-window-state name="wsrp:minimized">
  95. <portlet:markup-string/>
  96. </portlet:if-window-state>
  97. <portlet:if-window-state name="wsrp:normal|wsrp:maximized|wsrp:solo">
  98. <portlet:property name="appurl" select="'app.url'"/>
  99. <portlet:property name="features" select="'app.features'"/>
  100. <portlet:property name="appmessagefile" select="'app.messagefile'"/>
  101. <xsl:variable name="is-legacy" select="contains($features, 'legacy')"/>
  102. <xsl:variable name="url">
  103. <xsl:choose>
  104. <xsl:when test="contains($appurl, '$WEB$')">
  105. <xsl:variable name="beforeToken" select="substring-before($appurl, '$WEB$')"/>
  106. <xsl:variable name="afterToken" select="substring-after($appurl, '$WEB$')"/>
  107. <xsl:value-of select="concat(concat($beforeToken, $ui-webcontent), $afterToken)"/>
  108. </xsl:when>
  109. <xsl:when test="contains($appurl, '$CGI$')">
  110. <xsl:variable name="beforeToken" select="substring-before($appurl, '$CGI$')"/>
  111. <xsl:variable name="afterToken" select="substring-after($appurl, '$CGI$')"/>
  112. <xsl:value-of select="concat(concat($beforeToken, $ui-gateway), $afterToken)"/>
  113. </xsl:when>
  114. <xsl:otherwise>
  115. <xsl:value-of select="$appurl"/>
  116. </xsl:otherwise>
  117. </xsl:choose>
  118. </xsl:variable>
  119. <xsl:variable name="url-markers">
  120. <xsl:choose>
  121. <xsl:when test="contains($url, '[$') and contains($url, '$]')">
  122. <xsl:variable name="token" select="substring-before(substring-after($url, '[$'), '$]')"/>
  123. <xsl:variable name="beforeToken" select="substring-before($url, '[$')"/>
  124. <xsl:variable name="afterToken" select="substring-after($url, '$]')"/>
  125. <xsl:variable name="atest" select="concat('sdk_', $token)"/>
  126. <portlet:property name="token-value" select="$atest"/>
  127. <xsl:value-of select="concat(concat($beforeToken, $token-value), $afterToken)"/>
  128. </xsl:when>
  129. <xsl:otherwise>
  130. <xsl:value-of select="$url"/>
  131. </xsl:otherwise>
  132. </xsl:choose>
  133. </xsl:variable>
  134. <portlet:property name="cognos-product" select="'sdk'"/>
  135. <xsl:variable name="remote-url">
  136. <xsl:if test="$url-markers != '' and not(starts-with($url-markers, 'http://') or starts-with($url-markers, 'https://'))">
  137. <xsl:call-template name="get-host">
  138. <xsl:with-param name="url" select="$cognos-product"/>
  139. </xsl:call-template>
  140. </xsl:if>
  141. <xsl:value-of select="$url-markers"/>
  142. </xsl:variable>
  143. <xsl:variable name="consumer-escape" select="$portlet-registration-params[@name = 'consumerEscape']"/>
  144. <xsl:if test="$remote-url and not($remote-url = '')">
  145. <xsl:choose>
  146. <xsl:when test="$is-legacy">
  147. <xsl:variable name="cps_jsessionid" select="$portlet-navigational-params[@name = 'cps_jsessionid']"/>
  148. <xsl:variable name="jsessionid">
  149. <xsl:if test="$cps_jsessionid">
  150. <xsl:text>;jsessionid=</xsl:text>
  151. <xsl:value-of select="$cps_jsessionid"/>
  152. </xsl:if>
  153. </xsl:variable>
  154. <xsl:variable name="full-url">
  155. <xsl:choose>
  156. <xsl:when test="contains($remote-url, '?')">
  157. <xsl:value-of select="substring-before($remote-url, '?')"/>
  158. <xsl:value-of select="$jsessionid"/>
  159. <xsl:text>?</xsl:text>
  160. <xsl:value-of select="substring-after($remote-url, '?')"/>
  161. <xsl:text>&amp;</xsl:text>
  162. </xsl:when>
  163. <xsl:otherwise>
  164. <xsl:value-of select="$remote-url"/>
  165. <xsl:value-of select="$jsessionid"/>
  166. <xsl:text>?</xsl:text>
  167. </xsl:otherwise>
  168. </xsl:choose>
  169. <xsl:for-each select="$portlet-navigational-params[not(starts-with(@name, 'edit_') or starts-with(@name, 'p_') or starts-with(@name, 'tmp_') or starts-with(@name, 'stack_'))]">
  170. <xsl:value-of select="@name"/>
  171. <xsl:text>=</xsl:text>
  172. <xsl:value-of select="xtsext:urlencode(string(.))"/>
  173. <xsl:text>&amp;</xsl:text>
  174. </xsl:for-each>
  175. <xsl:for-each select="$portlet-state-params[starts-with( @name, 'sdk_' )]">
  176. <xsl:variable name="param-name" select="substring-after( @name, 'sdk_' )"/>
  177. <!--
  178. navigationalState overrides portletState sdk variables
  179. -->
  180. <xsl:if test="not($portlet-navigational-params[string(@name) = string($param-name)])">
  181. <xsl:value-of select="$param-name"/>
  182. <xsl:text>=</xsl:text>
  183. <xsl:value-of select="xtsext:urlencode(string(.))"/>
  184. <xsl:text>&amp;</xsl:text>
  185. </xsl:if>
  186. </xsl:for-each>
  187. <xsl:text>cognos_product=</xsl:text>
  188. <xsl:value-of select="$cognos-product"/>
  189. <xsl:text>&amp;namespacePrefix=</xsl:text>
  190. <xsl:value-of select="$portlet-op/wsrp:runtimeContext/wsrp:namespacePrefix"/>
  191. <xsl:if test="$consumer-escape != ''">
  192. <xsl:text>&amp;consumerEscape=</xsl:text>
  193. <xsl:value-of select="$consumer-escape"/>
  194. </xsl:if>
  195. </xsl:variable>
  196. <xsl:if test="$full-url != ''">
  197. <portlet:markup-string>
  198. <xts:request protocol="POST" target="{ $full-url }" faultBlock="requestFault" protocolHeader="true" protocolHeaderSelect="/root/temp-response">
  199. <xts:param name="internalRequest">true</xts:param>
  200. <xsl:if test="$portlet-markups/wsrp:locales">
  201. <xts:param name="header">
  202. <xsl:text>Accept-Language=</xsl:text>
  203. <xsl:value-of select="$portlet-markups/wsrp:locales[1]"/>
  204. </xts:param>
  205. </xsl:if>
  206. <xts:param name="header">
  207. <xsl:text>Cookie=</xsl:text>
  208. <xsl:for-each select="/root/cookies/cookie[not(@name='JSESSIONID')]">
  209. <xsl:value-of select="@name"/>=<xsl:value-of select="."/>
  210. <xsl:if test="position() != last()">
  211. <xsl:text>; </xsl:text>
  212. </xsl:if>
  213. </xsl:for-each>
  214. </xts:param>
  215. </xts:request>
  216. <xsl:if test="$portlet-mode = 'wsrp:preview'">
  217. <portlet:markup-preview/>
  218. </xsl:if>
  219. </portlet:markup-string>
  220. </xsl:if>
  221. </xsl:when>
  222. <xsl:otherwise>
  223. <portlet:markup-string>
  224. <xsl:call-template name="retrieve-portable-markup">
  225. <xsl:with-param name="remote-url" select="$remote-url"/>
  226. <xsl:with-param name="features" select="$features"/>
  227. <xsl:with-param name="messagefile" select="$appmessagefile"/>
  228. </xsl:call-template>
  229. </portlet:markup-string>
  230. </xsl:otherwise>
  231. </xsl:choose>
  232. </xsl:if>
  233. <xsl:if test="string($remote-url) = ''">
  234. <portlet:markup-transform name="XSLT" src="'/cps4/producer/wsrp-impl/transforms/display-nocontent.xslt'">
  235. <portlet:logicsheet>/cps4/producer/logicsheets/cps-ui.xslt</portlet:logicsheet>
  236. <portlet:messageBase>/cps4/producer/messages/cpsproducermsgs.xml</portlet:messageBase>
  237. <portlet:source/>
  238. </portlet:markup-transform>
  239. </xsl:if>
  240. </portlet:if-window-state>
  241. </portlet:markup-context>
  242. </portlet:content>
  243. </portlet:response>
  244. </portlet:if-mode>
  245. <portlet:if-mode name="wsrp:edit|cps:config">
  246. <portlet:response>
  247. <portlet:content>
  248. <portlet:markup-context mimeType="'text/html'" requiresUrlRewriting="'true'">
  249. <xsl:variable name="is-about" select="contains( $portlet-navigational-params[@name = 'edit_mode'], 'about' )"/>
  250. <xsl:choose>
  251. <xsl:when test="$is-about">
  252. <portlet:markup-transform name="XSLT" src="/cps4/producer/wsrp-impl/transforms/display-about.xslt">
  253. <portlet:logicsheet>/cps4/producer/logicsheets/cps-ui.xslt</portlet:logicsheet>
  254. <portlet:logicsheet>/cps4/producer/logicsheets/cps-formlogic.xslt</portlet:logicsheet>
  255. <portlet:messageBase>/cps4/producer/messages/cpsproducermsgs.xml</portlet:messageBase>
  256. <portlet:messageBase>/cps4/portlets/sdk/messages/cpssdkmsgs.xml</portlet:messageBase>
  257. <portlet:source>
  258. <portlet:get-version/>
  259. <xsl:variable name="nav-titles" select="$portlet-navigational-params[starts-with( @name, 'p_title_' ) and .!='']"/>
  260. <xsl:variable name="state-titles" select="$portlet-state-params[starts-with( @name, 'title_' ) and .!='']"/>
  261. <portlet:title-locale selectState1="$nav-titles" selectState2="$state-titles"/>
  262. </portlet:source>
  263. </portlet:markup-transform>
  264. </xsl:when>
  265. <xsl:otherwise>
  266. <xsl:variable name="messagefile-list">
  267. <xsl:for-each select="/root/applications/application">
  268. <xsl:if test="messagefile !=''">
  269. <xsl:if test="position() != 1">
  270. <xsl:text>,</xsl:text>
  271. </xsl:if>
  272. <xsl:value-of select="messagefile"/>
  273. </xsl:if>
  274. </xsl:for-each>
  275. </xsl:variable>
  276. <portlet:markup-string>
  277. <xsl:call-template name="retrieve-portable-markup">
  278. <xsl:with-param name="remote-url" select="concat($ui-webcontent, '/cps4/portlets/appeditor/appeditor.html')"/>
  279. <xsl:with-param name="messagefile" select="$messagefile-list"/>
  280. </xsl:call-template>
  281. </portlet:markup-string>
  282. </xsl:otherwise>
  283. </xsl:choose>
  284. </portlet:markup-context>
  285. </portlet:content>
  286. </portlet:response>
  287. </portlet:if-mode>
  288. <portlet:if-mode name="wsrp:help">
  289. <portlet:response>
  290. <portlet:content>
  291. <portlet:markup-context mimeType="'text/html'" requiresUrlRewriting="'false'">
  292. <portlet:markup-help/>
  293. </portlet:markup-context>
  294. </portlet:content>
  295. </portlet:response>
  296. </portlet:if-mode>
  297. </portlet:portlet>
  298. </xts:append>
  299. </xts:sequence>
  300. </xsl:template>
  301. <xsl:template name="retrieve-portable-markup">
  302. <xsl:param name="remote-url"/>
  303. <xsl:param name="scope" select="'CognosConnect'"/>
  304. <xsl:param name="features" select="''"/>
  305. <xsl:param name="messagefile"/>
  306. <xsl:param name="rewrite-functions" select="'false'"/>
  307. <xsl:variable name="userprefquery">
  308. <xsl:for-each select="$portlet-user-preferences/item">
  309. <xsl:value-of select="xtsext:urlencode(string(name))"/>
  310. <xsl:text>=</xsl:text>
  311. <xsl:value-of select="xtsext:urlencode(string(value))"/>
  312. <xsl:if test="position() != last()">
  313. <xsl:text>&amp;</xsl:text>
  314. </xsl:if>
  315. </xsl:for-each>
  316. </xsl:variable>
  317. <xsl:variable name="portletsettingsquery">
  318. <xsl:for-each select="$portlet-state-params">
  319. <xsl:value-of select="xtsext:urlencode(string(@name))"/>
  320. <xsl:text>=</xsl:text>
  321. <xsl:value-of select="xtsext:urlencode(string(.))"/>
  322. <xsl:if test="position() != last()">
  323. <xsl:text>&amp;</xsl:text>
  324. </xsl:if>
  325. </xsl:for-each>
  326. </xsl:variable>
  327. <xsl:variable name="portalagent">
  328. <xsl:value-of select="$portlet-op/wsrp:markupParams/wsrp:extensions/*[local-name()='portalContext']/*[local-name()='portalAgent']"/>
  329. </xsl:variable>
  330. <xsl:variable name="cssmappingquery">
  331. <xsl:for-each select="/root/applications/application/cssmapping/portalagent[@name = $portalagent]/css">
  332. <xsl:value-of select="@name"/>
  333. <xsl:text>=</xsl:text>
  334. <xsl:value-of select="@mapsto"/>
  335. <xsl:if test="position() != last()">
  336. <xsl:text>&amp;</xsl:text>
  337. </xsl:if>
  338. </xsl:for-each>
  339. </xsl:variable>
  340. <xsl:variable name="eventspublished">
  341. <xsl:for-each select="/root/applications/application/communication/publishes/event">
  342. <xsl:text>"</xsl:text>
  343. <xsl:value-of select="xtsext:javascriptencode(string(@name))"/>
  344. <xsl:text>"</xsl:text>
  345. <xsl:if test="position() != last()">
  346. <xsl:text>,</xsl:text>
  347. </xsl:if>
  348. </xsl:for-each>
  349. </xsl:variable>
  350. <xsl:variable name="eventslistenedfor">
  351. <xsl:for-each select="/root/applications/application/communication/listensfor/event">
  352. <xsl:text>"</xsl:text>
  353. <xsl:value-of select="xtsext:javascriptencode(string(@name))"/>
  354. <xsl:text>"</xsl:text>
  355. <xsl:if test="position() != last()">
  356. <xsl:text>,</xsl:text>
  357. </xsl:if>
  358. </xsl:for-each>
  359. </xsl:variable>
  360. <xsl:variable name="campassportcookie">
  361. <xsl:for-each select="/root/cookies/cookie[@name='cam_passport']">
  362. <xsl:value-of select="xtsext:javascriptencode(string(.))"/>
  363. </xsl:for-each>
  364. </xsl:variable>
  365. <xsl:variable name="navstatequery">
  366. <xsl:for-each select="$portlet-op/wsrp:markupParams/wsrp:navigationalState/param">
  367. <xsl:value-of select="xtsext:urlencode(string(@name))"/>
  368. <xsl:text>=</xsl:text>
  369. <xsl:value-of select="xtsext:urlencode(string(.))"/>
  370. <xsl:if test="position() != last()">
  371. <xsl:text>&amp;</xsl:text>
  372. </xsl:if>
  373. </xsl:for-each>
  374. </xsl:variable>
  375. <xts:transform name="CPSWEB"
  376. scope="{$scope}"
  377. namespacePrefix="{$portlet-op/wsrp:runtimeContext/wsrp:namespacePrefix}"
  378. webcontent="{$ui-webcontent}"
  379. gateway="{$ui-gateway}"
  380. remoteUrl = "{$remote-url}"
  381. userPreferencesQuery = "{$userprefquery}"
  382. applicationSettingsQuery = "{$portletsettingsquery}"
  383. navigationStateQuery = "{$navstatequery}"
  384. cssMappingQuery = "{$cssmappingquery}"
  385. events = "{'{'}listen:[{$eventslistenedfor}],publish:[{$eventspublished}]{'}'}"
  386. camPassport = "{$campassportcookie}"
  387. features = "{$features}"
  388. messagefile = "{$messagefile}"
  389. portalAgent = "{$portalagent}"
  390. rewriteFunctions="{$rewrite-functions}">
  391. <xsl:choose>
  392. <xsl:when test="contains($features, 'server')">
  393. <!-- Build the URL here-->
  394. <xsl:variable name="remote-url-query">
  395. <xsl:choose>
  396. <xsl:when test="contains($remote-url, '?')">
  397. <xsl:value-of select="concat($remote-url,'&amp;', $userprefquery,'&amp;', $portletsettingsquery,'&amp;', $navstatequery)"/>
  398. </xsl:when>
  399. <xsl:otherwise>
  400. <xsl:value-of select="concat($remote-url,'?',$userprefquery,'&amp;', $portletsettingsquery,'&amp;', $navstatequery)"/>
  401. </xsl:otherwise>
  402. </xsl:choose>
  403. </xsl:variable>
  404. <xts:request protocol="POST" target="{ $remote-url-query }" faultBlock="requestFault">
  405. <xsl:call-template name="insert-headers"/>
  406. <xts:param name="header">
  407. <xsl:text>CPS-Gateway=</xsl:text>
  408. <xsl:value-of select="$ui-gateway"/>
  409. </xts:param>
  410. <xts:param name="header">
  411. <xsl:text>CPS-Webcontent=</xsl:text>
  412. <xsl:value-of select="$ui-webcontent"/>
  413. </xts:param>
  414. </xts:request>
  415. </xsl:when>
  416. <xsl:otherwise>
  417. <xts:request protocol="GET" target="{ $remote-url }" faultBlock="requestFault">
  418. <xsl:call-template name="insert-headers"/>
  419. </xts:request>
  420. </xsl:otherwise>
  421. </xsl:choose>
  422. </xts:transform>
  423. </xsl:template>
  424. <xsl:template name="insert-headers">
  425. <xts:param name="internalRequest">true</xts:param>
  426. <xsl:if test="$portlet-markups/wsrp:locales">
  427. <xts:param name="header">
  428. <xsl:text>Accept-Language=</xsl:text>
  429. <xsl:value-of select="$portlet-markups/wsrp:locales[1]"/>
  430. </xts:param>
  431. </xsl:if>
  432. <xts:param name="header">
  433. <xsl:text>Cookie=</xsl:text>
  434. <xsl:for-each select="/root/cookies/cookie[not(@name='JSESSIONID')]">
  435. <xsl:value-of select="@name"/>=<xsl:value-of select="."/>
  436. <xsl:if test="position() != last()">
  437. <xsl:text>; </xsl:text>
  438. </xsl:if>
  439. </xsl:for-each>
  440. </xts:param>
  441. </xsl:template>
  442. <xsl:template name="get-content">
  443. <xsl:param name="apps"/>
  444. <xts:transform name="XSLT" src="/cps4/portlets/sdk/portlet-impl/transforms/app2cps.xslt">
  445. <root>
  446. <summaryOnly>true</summaryOnly>
  447. <xsl:call-template name="get-request">
  448. <xsl:with-param name="apps" select="$apps"/>
  449. </xsl:call-template>
  450. </root>
  451. </xts:transform>
  452. </xsl:template>
  453. <xsl:template name="get-request">
  454. <xsl:param name="apps"/>
  455. <xsl:choose>
  456. <xsl:when test="starts-with($apps,'http://') or starts-with($apps,'https://')">
  457. <xts:request protocol="GET" target="{ $apps }" faultBlock="applicationsFileFault">
  458. <xts:param name="internalRequest">true</xts:param>
  459. </xts:request>
  460. </xsl:when>
  461. <xsl:otherwise>
  462. <xts:request protocol="FILEREAD" target="{$apps}"/>
  463. </xsl:otherwise>
  464. </xsl:choose>
  465. </xsl:template>
  466. <xsl:template name="get-app">
  467. <xsl:param name="apps"/>
  468. <xsl:param name="alias"/>
  469. <xts:transform name="XSLT" src="/cps4/portlets/sdk/portlet-impl/transforms/app2cps.xslt">
  470. <root>
  471. <applicationName>
  472. <xsl:value-of select="string( $alias)"/>
  473. </applicationName>
  474. <xsl:call-template name="get-request">
  475. <xsl:with-param name="apps" select="$apps"/>
  476. </xsl:call-template>
  477. </root>
  478. </xts:transform>
  479. </xsl:template>
  480. <xsl:template name="get-host">
  481. <xsl:param name="url"/>
  482. <xsl:choose>
  483. <xsl:when test="$url != ''">
  484. <xsl:variable name="protocol" select="substring-before($url, '://')"/>
  485. <xsl:variable name="host" select="substring-before(substring-after($url, '://'), '/')"/>
  486. <xsl:value-of select="concat($protocol, '://')"/>
  487. <xsl:value-of select="$host"/>
  488. </xsl:when>
  489. <xsl:otherwise>
  490. <xsl:value-of select="'http://'"/>
  491. <xsl:value-of select="/root/serverInfo/param[@name = 'HTTP_HOST']"/>
  492. </xsl:otherwise>
  493. </xsl:choose>
  494. </xsl:template>
  495. </xsl:stylesheet>
  496. </xts:block>
  497. <xts:block dependency="request" id="response" mode="interpret" processor="XSLT" type="exec">
  498. <xts:logicsheet path="/cps4/producer/logicsheets/cps-portlet.xslt"/>
  499. <xsl:stylesheet version="1.0" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:portlet="http://developer.cognos.com/schemas/cps/logic/portlet/1/" xmlns:wsrp="urn:oasis:names:tc:wsrp:v1:types" xmlns:xos="http://developer.cognos.com/schemas/xts/output/" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt">
  500. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  501. <xsl:template match="/">
  502. <xsl:variable name="originalPassportID">
  503. <xsl:choose>
  504. <xsl:when test="/root/credential/param[@name='CAM']/*[local-name() ='CAM']/*[local-name() = 'CAMPassport']/*[local-name() = 'id']">
  505. <xsl:value-of select="/root/credential/param[@name='CAM']/*[local-name() ='CAM']/*[local-name() = 'CAMPassport']/*[local-name() = 'id']"/>
  506. </xsl:when>
  507. <xsl:when test="/root/header/*[local-name() = 'biBusHeader']/*[local-name()= 'CAM']/CAMPassport/id">
  508. <xsl:value-of select="/root/header/*[local-name() = 'biBusHeader']/*[local-name()= 'CAM']/CAMPassport/id"/>
  509. </xsl:when>
  510. <xsl:otherwise>
  511. <xsl:value-of select="xtsext:camcookie_action('getPassportID', string(/root/cookies/cookie[@name='cam_passport']))"/>
  512. </xsl:otherwise>
  513. </xsl:choose>
  514. </xsl:variable>
  515. <xsl:variable name="newPassportID">
  516. <xsl:call-template name="getCamPassportCookie"/>
  517. </xsl:variable>
  518. <portlet:soap-response>
  519. <xsl:choose>
  520. <xsl:when test="$newPassportID != '' and $newPassportID != $originalPassportID">
  521. <SOAP-ENV:Fault xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsrp="urn:oasis:names:tc:wsrp:v1:types">
  522. <faultcode xmlns:wsrp="urn:oasis:names:tc:wsrp:v1:types" wsrp:dummy="">wsrp:InvalidCookie</faultcode>
  523. <faultstring>The producer environment has timed out. The consumer needs to initialize the cookies again.</faultstring>
  524. <detail>
  525. <wsrp:InvalidCookie/>
  526. </detail>
  527. </SOAP-ENV:Fault>
  528. </xsl:when>
  529. <xsl:otherwise>
  530. <xsl:copy-of select="/root/temp-response/*[local-name()='getMarkupResponse']"/>
  531. </xsl:otherwise>
  532. </xsl:choose>
  533. </portlet:soap-response>
  534. </xsl:template>
  535. <xsl:template name="getCamPassportCookie">
  536. <xsl:for-each select="/root/temp-response/xos:protocolHeader/xos:param[@name = 'Set-Cookie']">
  537. <xsl:variable name="cookieName" select="substring-before(., '=')"/>
  538. <xsl:if test="$cookieName = 'cam_passport'">
  539. <xsl:variable name="value" select="substring-after(., '=')"/>
  540. <xsl:choose>
  541. <xsl:when test="contains($value, ';')">
  542. <xsl:value-of select="substring-before($value, ';')"/>
  543. </xsl:when>
  544. <xsl:otherwise>
  545. <xsl:value-of select="$value"/>
  546. </xsl:otherwise>
  547. </xsl:choose>
  548. </xsl:if>
  549. </xsl:for-each>
  550. </xsl:template>
  551. </xsl:stylesheet>
  552. </xts:block>
  553. <xts:block id="requestFault" processor="XSLT" type="fault">
  554. <xsl:stylesheet version="1.0" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:bus="http://developer.cognos.com/schemas/bibus/2/" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  555. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  556. <xsl:template match="/">
  557. <xsl:variable name="xts-fault" select="/root/fault/xts:exception[last()]"/>
  558. <xsl:variable name="http-response" select="$xts-fault/xts:exceptionDetail/httpResponse"/>
  559. <fault>
  560. <xsl:choose>
  561. <xsl:when test="$http-response">
  562. <xsl:copy-of select="$xts-fault/xts:exceptionCode"/>
  563. <xsl:copy-of select="$xts-fault/xts:exceptionMsg"/>
  564. <xts:exceptionDetail>
  565. <httpResponse>
  566. <xsl:copy-of select="$http-response/code"/>
  567. <xsl:copy-of select="$http-response/message"/>
  568. </httpResponse>
  569. </xts:exceptionDetail>
  570. </xsl:when>
  571. <xsl:otherwise>
  572. <xsl:copy-of select="/root/fault/*"/>
  573. </xsl:otherwise>
  574. </xsl:choose>
  575. </fault>
  576. </xsl:template>
  577. </xsl:stylesheet>
  578. </xts:block>
  579. <!--
  580. This fault block is used to handle the error when we can't read the application.xml
  581. file The error is appended to the input and handled later in the listapps.xslt stylesheet.
  582. -->
  583. <xts:block id="applicationsFileFault" processor="XSLT" type="fault">
  584. <xsl:stylesheet version="1.0" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:bus="http://developer.cognos.com/schemas/bibus/2/" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  585. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  586. <xsl:template match="/">
  587. <xsl:variable name="xts-fault" select="/root/fault/xts:exception[last()]"/>
  588. <xsl:variable name="http-response" select="$xts-fault/xts:exceptionDetail/httpResponse"/>
  589. <application-file-error>
  590. <xsl:choose>
  591. <xsl:when test="$http-response">
  592. <xsl:copy-of select="$xts-fault/xts:exceptionCode"/>
  593. <xsl:copy-of select="$xts-fault/xts:exceptionMsg"/>
  594. <xts:exceptionDetail>
  595. <httpResponse>
  596. <xsl:copy-of select="$http-response/code"/>
  597. <xsl:copy-of select="$http-response/message"/>
  598. </httpResponse>
  599. </xts:exceptionDetail>
  600. </xsl:when>
  601. <xsl:otherwise>
  602. <xsl:copy-of select="/root/fault/*"/>
  603. </xsl:otherwise>
  604. </xsl:choose>
  605. </application-file-error>
  606. </xsl:template>
  607. </xsl:stylesheet>
  608. </xts:block>
  609. </xts:morphlet>
  610. <!-- This file was formated by XML Formatter (Cognos Inc.) on Aug 17, 2005 2:36:24 PM -->