gen-links.xts 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3. Licensed Materials - Property of IBM
  4. IBM Cognos Products: HTS
  5. (C) Copyright IBM Corp. 2005, 2010
  6. US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  7. -->
  8. <xts:morphlet version="1.0" xmlns:xts="http://developer.cognos.com/schemas/xts/" messageBase="messages/portal.xml, messages/portalRL.xml">
  9. <xts:block id="createSystemElement" type="exec" processor="XSLT">
  10. <xsl:stylesheet version="1.0"
  11. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  12. xmlns:bus="http://developer.cognos.com/schemas/bibus/3/"
  13. xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt"
  14. exclude-result-prefixes="bus xtsext">
  15. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  16. <xsl:template match="/">
  17. <xts:sequence>
  18. <xts:append select="/root">
  19. <xts:request protocol="FILEREAD" cache="true" faultBlock="requestFault" target="./portal/system.xml"/>
  20. </xts:append>
  21. </xts:sequence>
  22. </xsl:template>
  23. </xsl:stylesheet>
  24. </xts:block>
  25. <!-- Handle errors which occur when reading the system XML file. Provide default values. -->
  26. <xts:block id="requestFault" type="fault" processor="XML" nodelist="">
  27. <system>
  28. <param name="delimiters" d1="|" d2=":"/>
  29. <param name="COGNOSHome">b_action=xts.run&amp;m=portal/main.xts</param>
  30. </system>
  31. </xts:block>
  32. <!-- Build the missing session element from the cc_session and CRN cookies, and the missing http element from the bus header. This is done so that common variables will work. -->
  33. <xts:block id="createMissingElements" dependency="createSystemElement" type="exec" processor="XSLT">
  34. <xsl:stylesheet version="1.0"
  35. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  36. xmlns:bus="http://developer.cognos.com/schemas/bibus/3/"
  37. xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt"
  38. exclude-result-prefixes="bus xtsext">
  39. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  40. <xsl:template match="/">
  41. <xts:sequence>
  42. <xts:append select="/root">
  43. <xsl:variable name="CRNValue">
  44. <xsl:choose>
  45. <xsl:when test="string(/root/cookies/cookie[@name='CRN']) != ''">
  46. <xsl:value-of select="string(/root/cookies/cookie[@name='CRN'])"/>
  47. </xsl:when>
  48. <xsl:otherwise> <!-- No CRN cookie found. Use the setCookieVars value if it exists. -->
  49. <xsl:value-of select="string(/root/*[local-name()='biBusHeader']/*[local-name()='hdrSession']/*[local-name()='setCookieVars']/item[name = 'CRN']/value)"/>
  50. </xsl:otherwise>
  51. </xsl:choose>
  52. </xsl:variable>
  53. <session>
  54. <xsl:if test="(string(/root/cookies/cookie[@name='cc_session']) != '') or ($CRNValue != '')">
  55. <xts:transform name="XMLDecode">
  56. <xsl:value-of select="xtsext:decodeCCSession(string(/root/cookies/cookie[@name='cc_session']),/root/system/param[@name='delimiters']/@d1,/root/system/param[@name='delimiters']/@d2)"/>
  57. <xsl:value-of select="xtsext:decodeCRNCookie($CRNValue)"/>
  58. </xts:transform>
  59. </xsl:if>
  60. <!-- construct the session user capability cache -->
  61. <xsl:if test="/root/*[local-name()='biBusHeader']/*[local-name()='userCapabilityCache']">
  62. <param name="capabilities" type="CRN">
  63. <xsl:for-each select="/root/*[local-name()='biBusHeader']/*[local-name()='userCapabilityCache']/*[local-name()='userCapabilities']/*[local-name()='item']">
  64. <xsl:variable name="capability" select="."/>
  65. <xsl:if test="string($capability) != ''">
  66. <xsl:element name="{$capability}"/>
  67. </xsl:if>
  68. </xsl:for-each>
  69. </param>
  70. </xsl:if>
  71. </session>
  72. <http>
  73. <xsl:for-each select="/root/*[local-name()='biBusHeader']/*[local-name()='hdrSession']/*[local-name()='environmentVars']/item">
  74. <param>
  75. <xsl:attribute name="name">
  76. <xsl:value-of select="name/."/>
  77. </xsl:attribute>
  78. <xsl:value-of select="value/."/>
  79. </param>
  80. </xsl:for-each>
  81. </http>
  82. <header>
  83. <xsl:copy-of select="/root/*[local-name()='biBusHeader']"/>
  84. </header>
  85. </xts:append>
  86. <xts:delete select="/root/*[local-name()='biBusHeader']"/>
  87. </xts:sequence>
  88. </xsl:template>
  89. </xsl:stylesheet>
  90. </xts:block>
  91. <xts:block xmlns:xts="http://developer.cognos.com/schemas/xts/" id="getContent" processor="XSLT" type="exec" dependency="createMissingElements" condition=".[count(/root/input[@name='dep']/queryResponse/*[local-name()='manualTask']/*[local-name()='linksList']/*[local-name()='link']) &gt; 0]" mandatory="false">
  92. <xts:logicsheet path="logicsheets/cm-logic.xsl"/>
  93. <xts:logicsheet path="logicsheets/buslogic.xslt"/>
  94. <xts:logicsheet path="logicsheets/portal.xsl"/>
  95. <xsl:stylesheet
  96. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  97. xmlns:pf="http://developer.cognos.com/schemas/xts/pf"
  98. xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt"
  99. xmlns:cml="http://developer.cognos.com/schemas/xts/logic-sheet/xslt/cml/1/"
  100. xmlns:send="http://developer.cognos.com/schemas/xts/logic-sheet/xslt/brl/1/"
  101. xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/" version="1.0"
  102. exclude-result-prefixes="xsl pf xtsext cml send cm">
  103. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  104. <pf:variables/>
  105. <xsl:template match="/">
  106. <xts:sequence>
  107. <xts:append>
  108. <xts:transform src="transforms/CM/post-process.xslt" processor="XSLT">
  109. <send:request provider="cm">
  110. <xts:transform src="transforms/CM/pre-process.xslt" processor="XSLT">
  111. <cm:query xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/">
  112. <cm:requests>
  113. <xsl:for-each select="/root/input[@name='dep']/queryResponse/*[local-name()='manualTask']/*[local-name()='linksList']/*[local-name()='link']">
  114. <xsl:variable name="storeId">
  115. <xsl:text>storeID('</xsl:text>
  116. <xsl:value-of select="./*[local-name()='id']"/>
  117. <xsl:text>')</xsl:text>
  118. </xsl:variable>
  119. <cm:query>
  120. <cm:search><xsl:value-of select="$storeId"/></cm:search>
  121. <cm:properties>
  122. <cm:property name="defaultName"/>
  123. <cm:property name="uri"/>
  124. <cm:property name="iconURI"/>
  125. <cm:property name="objectClass"/>
  126. <cm:property name="base"/>
  127. <cm:property name="searchPath"/>
  128. <cm:property name="defaultOutputFormat"/>
  129. <cm:property name="mostRecentEventList"/>
  130. <cm:property name="storeID"/>
  131. </cm:properties>
  132. <cm:options schemaInfo="true">
  133. <cm:refProps>
  134. <!-- Get base info for reportView/agentDefinitionView objects -->
  135. <cm:refProp refPropName="base">
  136. <cm:properties>
  137. <cm:property name="searchPath"/>
  138. <cm:property name="permissions"/>
  139. <cm:property name="defaultPortalAction"/>
  140. <cm:property name="defaultOutputFormat"/>
  141. <cm:property name="mostRecentEventList"/>
  142. </cm:properties>
  143. </cm:refProp>
  144. </cm:refProps>
  145. </cm:options>
  146. </cm:query>
  147. </xsl:for-each>
  148. </cm:requests>
  149. </cm:query>
  150. </xts:transform>
  151. </send:request>
  152. </xts:transform>
  153. </xts:append>
  154. </xts:sequence>
  155. </xsl:template>
  156. </xsl:stylesheet>
  157. </xts:block>
  158. <!-- replace the most recent event list search path with its store id. The universal viewer only accepts store ids-->
  159. <xts:block xmlns:xts="http://developer.cognos.com/schemas/xts/" id="agentDefinitionViewQuery" processor="XSLT" type="exec" dependency="getContent" condition=".[count(/root/*[local-name()='queryResponse']/*[local-name()='queryReply']/*[local-name()='agentDefinitionView']/*[local-name()='mostRecentEventList'][not(./@nil)]) &gt; 0]" mandatory="false">
  160. <xts:logicsheet path="logicsheets/cm-logic.xsl"/>
  161. <xts:logicsheet path="logicsheets/buslogic.xslt"/>
  162. <xts:logicsheet path="logicsheets/portal.xsl"/>
  163. <xsl:stylesheet
  164. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  165. xmlns:pf="http://developer.cognos.com/schemas/xts/pf"
  166. xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt"
  167. xmlns:cml="http://developer.cognos.com/schemas/xts/logic-sheet/xslt/cml/1/"
  168. xmlns:send="http://developer.cognos.com/schemas/xts/logic-sheet/xslt/brl/1/"
  169. xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/"
  170. version="1.0"
  171. exclude-result-prefixes="xsl pf xtsext cml send cm">
  172. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  173. <pf:variables/>
  174. <xsl:template match="/">
  175. <xts:sequence>
  176. <xts:append>
  177. <agentDefinitionViewQuery>
  178. <xts:transform src="transforms/CM/post-process.xslt" processor="XSLT">
  179. <send:request provider="cm">
  180. <xts:transform src="transforms/CM/pre-process.xslt" processor="XSLT">
  181. <cm:query xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/">
  182. <cm:requests>
  183. <xsl:for-each select="/root/*[local-name()='queryResponse']/*[local-name()='queryReply']/*[local-name()='agentDefinitionView']/*[local-name()='mostRecentEventList'][not(./@nil)]">
  184. <cm:query>
  185. <cm:search><xsl:value-of select="."/></cm:search>
  186. <cm:properties>
  187. <cm:property name="storeID"/>
  188. </cm:properties>
  189. </cm:query>
  190. </xsl:for-each>
  191. </cm:requests>
  192. </cm:query>
  193. </xts:transform>
  194. </send:request>
  195. </xts:transform>
  196. <!-- store the keys so that we can map back to the correct agentDefinitionView element -->
  197. <keys>
  198. <xsl:for-each select="/root/*[local-name()='queryResponse']/*[local-name()='queryReply']/*[local-name()='agentDefinitionView']/*[local-name()='mostRecentEventList'][not(./@nil)]/../*[local-name()='storeID']">
  199. <storeID><xsl:value-of select="."/></storeID>
  200. </xsl:for-each>
  201. </keys>
  202. </agentDefinitionViewQuery>
  203. </xts:append>
  204. </xts:sequence>
  205. </xsl:template>
  206. </xsl:stylesheet>
  207. </xts:block>
  208. <!-- replace the most recent event list search path with its store id. The universal viewer only accepts store ids-->
  209. <xts:block xmlns:xts="http://developer.cognos.com/schemas/xts/" id="eventListQuery" processor="XSLT" type="exec" dependency="agentDefinitionViewQuery" condition=".[count(/root/*[local-name()='queryResponse']/*[local-name()='queryReply']/*[local-name()='agentDefinition']/*[local-name()='mostRecentEventList'][not(./@nil)]) &gt; 0]" mandatory="false">
  210. <xts:logicsheet path="logicsheets/cm-logic.xsl"/>
  211. <xts:logicsheet path="logicsheets/buslogic.xslt"/>
  212. <xts:logicsheet path="logicsheets/portal.xsl"/>
  213. <xsl:stylesheet
  214. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  215. xmlns:pf="http://developer.cognos.com/schemas/xts/pf"
  216. xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt"
  217. xmlns:cml="http://developer.cognos.com/schemas/xts/logic-sheet/xslt/cml/1/"
  218. xmlns:send="http://developer.cognos.com/schemas/xts/logic-sheet/xslt/brl/1/"
  219. xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/" version="1.0"
  220. exclude-result-prefixes="xsl pf xtsext cml send cm">
  221. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  222. <pf:variables/>
  223. <xsl:template match="/">
  224. <xts:sequence>
  225. <xts:append>
  226. <eventListQuery>
  227. <xts:transform src="transforms/CM/post-process.xslt" processor="XSLT">
  228. <send:request provider="cm">
  229. <xts:transform src="transforms/CM/pre-process.xslt" processor="XSLT">
  230. <cm:query xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/">
  231. <cm:requests>
  232. <xsl:for-each select="/root/*[local-name()='queryResponse']/*[local-name()='queryReply']/*[local-name()='agentDefinition']/*[local-name()='mostRecentEventList'][not(./@nil)]">
  233. <cm:query>
  234. <cm:search><xsl:value-of select="."/></cm:search>
  235. <cm:properties>
  236. <cm:property name="searchPath"/>
  237. <cm:property name="storeID"/>
  238. </cm:properties>
  239. </cm:query>
  240. </xsl:for-each>
  241. </cm:requests>
  242. </cm:query>
  243. </xts:transform>
  244. </send:request>
  245. </xts:transform>
  246. <!-- store the keys so that we can map back to the correct agentDefinition -->
  247. <keys>
  248. <xsl:for-each select="/root/*[local-name()='queryResponse']/*[local-name()='queryReply']/*[local-name()='agentDefinition']/*[local-name()='mostRecentEventList'][not(./@nil)]/../*[local-name()='storeID']">
  249. <storeID><xsl:value-of select="."/></storeID>
  250. </xsl:for-each>
  251. </keys>
  252. </eventListQuery>
  253. </xts:append>
  254. </xts:sequence>
  255. </xsl:template>
  256. </xsl:stylesheet>
  257. </xts:block>
  258. <!-- replace the most recent event list search path with its store id. The universal viewer only accepts store ids-->
  259. <xts:block xmlns:xts="http://developer.cognos.com/schemas/xts/" id="updateEventLists" processor="XSLT" type="exec" dependency="eventListQuery" condition=".[count(/root/*[local-name()='queryResponse']/*[local-name()='queryReply']/*[local-name()='agentDefinition']/*[local-name()='mostRecentEventList'][not(./@nil)]) &gt; 0]" mandatory="false">
  260. <xts:logicsheet path="logicsheets/cm-logic.xsl"/>
  261. <xts:logicsheet path="logicsheets/buslogic.xslt"/>
  262. <xts:logicsheet path="logicsheets/portal.xsl"/>
  263. <xsl:stylesheet
  264. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  265. xmlns:pf="http://developer.cognos.com/schemas/xts/pf"
  266. xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt"
  267. xmlns:cml="http://developer.cognos.com/schemas/xts/logic-sheet/xslt/cml/1/"
  268. xmlns:send="http://developer.cognos.com/schemas/xts/logic-sheet/xslt/brl/1/"
  269. xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/" version="1.0"
  270. exclude-result-prefixes="xsl pf xtsext cml send cm">
  271. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  272. <pf:variables/>
  273. <xsl:template match="/">
  274. <xts:sequence>
  275. <!-- update agents by replacing the event list searchpath with the storeid-->
  276. <xsl:for-each select="/root/*[local-name()='eventListQuery']/*[local-name()='keys']/*[local-name()='storeID']">
  277. <xsl:variable name="pos"><xsl:value-of select="position()"/></xsl:variable>
  278. <xsl:variable name="agentStoreId">
  279. <xsl:value-of select="."/>
  280. </xsl:variable>
  281. <xsl:variable name="eventListStoreId">
  282. <xsl:value-of select="/root/*[local-name()='eventListQuery']/*[local-name()='queryResponse']/*[local-name()='queryReply'][$pos=position()]/*[local-name()='output']/*[local-name()='storeID']"/>
  283. </xsl:variable>
  284. <xts:replace select="/root/*[local-name()='queryResponse']/*[local-name()='queryReply']/*[local-name()='agentDefinition']/*[local-name()='mostRecentEventList'][../*[local-name()='storeID']='{$agentStoreId}']">
  285. <mostRecentEventList><xsl:value-of select="$eventListStoreId"/></mostRecentEventList>
  286. </xts:replace>
  287. </xsl:for-each>
  288. <!-- update agent views by replacing the event list searchpath with the storeid-->
  289. <xsl:for-each select="/root/*[local-name()='agentDefinitionViewQuery']/*[local-name()='keys']/*[local-name()='storeID']">
  290. <xsl:variable name="pos"><xsl:value-of select="position()"/></xsl:variable>
  291. <xsl:variable name="agentStoreId">
  292. <xsl:value-of select="."/>
  293. </xsl:variable>
  294. <xsl:variable name="eventListStoreId">
  295. <xsl:value-of select="/root/*[local-name()='agentDefinitionViewQuery']/*[local-name()='queryResponse']/*[local-name()='queryReply'][$pos=position()]/*[local-name()='output']/*[local-name()='storeID']"/>
  296. </xsl:variable>
  297. <xts:replace select="/root/*[local-name()='queryResponse']/*[local-name()='queryReply']/*[local-name()='agentDefinitionView']/*[local-name()='mostRecentEventList'][../*[local-name()='storeID']='{$agentStoreId}']">
  298. <mostRecentEventList><xsl:value-of select="$eventListStoreId"/></mostRecentEventList>
  299. </xts:replace>
  300. </xsl:for-each>
  301. </xts:sequence>
  302. </xsl:template>
  303. </xsl:stylesheet>
  304. </xts:block>
  305. <!-- Generate the header in XML form -->
  306. <xts:block id="response" type="exec" mode="interpret" dependency="updateEventLists" processor="XSLT" condition=".[count(/root/*[local-name()='queryResponse']/*[local-name()='queryReply']/*) &gt; 0]" mandatory="false">
  307. <xts:logicsheet path="logicsheets/portal.xsl"/>
  308. <xsl:stylesheet version="1.0"
  309. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  310. xmlns:xos="http://developer.cognos.com/schemas/xts/output/"
  311. xmlns:pf="http://developer.cognos.com/schemas/xts/pf"
  312. xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt"
  313. xmlns:encodingUtils="com.cognos.portal.utils.EncodingUtils"
  314. xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/"
  315. exclude-result-prefixes="xsl xos pf xtsext encodingUtils cm">
  316. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  317. <pf:variables/>
  318. <pf:gen-icon/>
  319. <xsl:template match="/">
  320. <xts:sequence>
  321. <xts:delete select="/root/*[local-name()='eventListQuery']"/>
  322. <xts:append select="/root/output">
  323. <xos:part xmlns:xos="http://developer.cognos.com/schemas/xts/output/">
  324. <xos:entityHeader>
  325. <xos:param name="Content-Type">text/xml; charset=UTF-8</xos:param>
  326. </xos:entityHeader>
  327. <xos:entityBody>
  328. <response>
  329. <logic>
  330. <xsl:for-each select="/root/*[local-name()='queryResponse']/*[local-name()='queryReply']/*">
  331. <xsl:variable name="storeId"><xsl:value-of select="./*[local-name()='storeID']"/></xsl:variable>
  332. <xsl:variable name="linkObjectClass">
  333. <xsl:value-of select="./*[local-name()='objectClass']"/>
  334. </xsl:variable>
  335. <outputInfo>
  336. <xsl:attribute name="id">
  337. <xsl:choose>
  338. <xsl:when test="./*[local-name()='mostRecentEventList']!=''"><xsl:value-of select="./*[local-name()='mostRecentEventList']"/></xsl:when>
  339. <xsl:when test="./*[local-name()='mostRecentEventList']=''"></xsl:when>
  340. <xsl:otherwise><xsl:value-of select="$storeId"/></xsl:otherwise>
  341. </xsl:choose>
  342. </xsl:attribute>
  343. <name><xsl:value-of select="//*[local-name()='linksList']/*[local-name()='link']/*[local-name()='id'][.=$storeId]/../*[local-name()='display']"/></name>
  344. <format/>
  345. <locale/>
  346. <objectClass><xsl:value-of select="$linkObjectClass"/></objectClass>
  347. <xsl:variable name="tooltip" select="xtsext:javascriptencode(string(./*[local-name()='defaultName']))"/>
  348. <xsl:call-template name="gen-icon">
  349. <!-- for a watch rule notification, the object class is 'documentContent'. Tell gen-icon to create a report icon -->
  350. <xsl:with-param name="class">
  351. <xsl:choose>
  352. <xsl:when test="$linkObjectClass='documentContent'">report</xsl:when>
  353. <xsl:otherwise><xsl:value-of select="$linkObjectClass"/></xsl:otherwise>
  354. </xsl:choose>
  355. </xsl:with-param>
  356. <xsl:with-param name="showAction" select="false()"/>
  357. <xsl:with-param name="tooltipOverride" select="$tooltip"/>
  358. </xsl:call-template>
  359. </outputInfo>
  360. </xsl:for-each>
  361. </logic>
  362. </response>
  363. </xos:entityBody>
  364. </xos:part>
  365. </xts:append>
  366. </xts:sequence>
  367. </xsl:template>
  368. </xsl:stylesheet>
  369. </xts:block>
  370. </xts:morphlet>