buildDimbar.xts 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3. Licensed Materials - Property of IBM
  4. BI and PM: qs
  5. (C) Copyright IBM Corp. 2001, 2017
  6. US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  7. -->
  8. <!--
  9. Copyright (C) 2008 Cognos ULC, an IBM Company. All rights reserved.
  10. Cognos (R) is a trademark of Cognos ULC, (formerly Cognos Incorporated).
  11. -->
  12. <xts:morphlet resolverBase="prompting" xmlns:xts="http://developer.cognos.com/schemas/xts/" messageBase="messages/QSRVUITextPL.xml,messages/portal.xml,messages/portalRL.xml">
  13. <xts:block id="getDimensions" mode="interpret" processor="XSLT" type="exec" mandatory="false">
  14. <xts:logicsheet path="logicsheets/buslogic.xslt"/>
  15. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt">
  16. <xsl:key name="env-param" match="/root/env/param" use="@name"/>
  17. <xsl:output method="xml" version="1.0" encoding="UTF-8"/>
  18. <xsl:variable name="authoringLocale">
  19. <xsl:choose>
  20. <xsl:when test="/root/env/param[@name='el']!=''">
  21. <xsl:value-of select="/root/env/param[@name='el']"/>
  22. </xsl:when>
  23. <xsl:otherwise>
  24. <xsl:value-of select="/root/env/param[@name='cl']"/>
  25. </xsl:otherwise>
  26. </xsl:choose>
  27. </xsl:variable>
  28. <xsl:template match="/">
  29. <xts:sequence>
  30. <xts:append>
  31. <xts:request asText="true" href="bus://dispatcher" protocol="BUS" soapAction="http://www.ibm.com/xmlns/prod/cognos/reportService/201404/.session" faultBlock="faultHandler" responseEnvelope="false" outputHeader="true">
  32. <SOAP-ENV:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema">
  33. <SOAP-ENV:Header>
  34. <bus:biBusHeader xsi:type="bus:biBusHeader" xmlns:bus="http://developer.cognos.com/schemas/bibus/3/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  35. <xsl:if test="key('env-param','m_tracking')!=''">
  36. <!-- use the round-tripped tracking information -->
  37. <bus:tracking>
  38. <xsl:value-of select="xtsext:web64decode(xtsext:cafaction('sign_unwrap', string(key('env-param','m_tracking'))), true())" disable-output-escaping="yes"/>
  39. </bus:tracking>
  40. </xsl:if>
  41. <xsl:if test="key('env-param','ui.routingServerGroup')!=''">
  42. <bus:routing>
  43. <routingServerGroup>
  44. <xsl:value-of select="key('env-param','ui.routingServerGroup')"/>
  45. </routingServerGroup>
  46. </bus:routing>
  47. </xsl:if>
  48. <!-- We don't want to copy the tracking info in this case because we want a separate conversation for the metadata -->
  49. <xsl:apply-templates select="/root/header/bus:biBusHeader/*[local-name()!='tracking']"/>
  50. </bus:biBusHeader>
  51. </SOAP-ENV:Header>
  52. <SOAP-ENV:Body>
  53. <runSpecification xmlns="http://developer.cognos.com/schemas/reportService/1">
  54. <bus:specification xsi:type="bus:reportServiceMetadataSpecification" xmlns:bus="http://developer.cognos.com/schemas/bibus/3/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  55. <bus:value xsi:type="bus:specification">&lt;metadataRequest connection=&quot;<xsl:value-of select="xtsext:xmlencode(string(/root/env/param[@name='model']))"/>&quot;&gt;
  56. &lt;Metadata authoringLocale=&quot;<xsl:value-of select="$authoringLocale"/>&quot; xml:lang=&quot;<xsl:value-of select="/root/env/param[@name='pl']"/>&quot; Depth=&quot;&quot; _enumLabels=&quot;1&quot; no_collections=&quot;1&quot; start_atPath=&quot;&quot;&gt;
  57. &lt;Properties&gt;
  58. &lt;Property name="*/@name"/&gt;
  59. &lt;Property name="*/@_ref"/&gt;
  60. &lt;Property name="*/@usage"/&gt;
  61. &lt;Property name="*/@description"/&gt;
  62. &lt;Property name="*/@screenTip"/&gt;
  63. &lt;Property name="hierarchy/@parentChild"/&gt;
  64. &lt;Property name="measure/@regularAggregate"/&gt;
  65. &lt;Property name="./folder"/&gt;
  66. &lt;Property name="./dimension"/&gt;
  67. &lt;Property name="dimension/@type"/&gt;
  68. &lt;Property name="./hierarchy"/&gt;
  69. &lt;Property name="./level"/&gt;
  70. &lt;Property name="./measure"/&gt;
  71. &lt;Property name="./measureFolder"/&gt;
  72. &lt;Property name="level/member"/&gt;
  73. &lt;Property name="level/@_RootMembers"/&gt;
  74. &lt;Property name="/@modelSearchPath"/&gt;
  75. &lt;/Properties&gt;
  76. &lt;/Metadata&gt;
  77. &lt;/metadataRequest&gt;
  78. </bus:value>
  79. </bus:specification>
  80. <bus:parameterValues xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="bus:parameterValue[]" xmlns:bus="http://developer.cognos.com/schemas/bibus/3/"/>
  81. <bus:options xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="bus:option[]" xmlns:bus="http://developer.cognos.com/schemas/bibus/3/">
  82. <item xsi:type="bus:runOptionString">
  83. <bus:name xsi:type="bus:runOptionEnum">promptFormat</bus:name>
  84. <bus:value xsi:type="xsd:string">HTML</bus:value>
  85. </item>
  86. <item xsi:type="bus:runOptionBoolean">
  87. <bus:name xsi:type="bus:runOptionEnum">prompt</bus:name>
  88. <bus:value xsi:type="xsd:boolean">false</bus:value>
  89. </item>
  90. <item xsi:type="bus:asynchOptionInt">
  91. <bus:name xsi:type="bus:asynchOptionEnum">primaryWaitThreshold</bus:name>
  92. <bus:value xsi:type="xsd:int">0</bus:value>
  93. </item>
  94. </bus:options>
  95. </runSpecification>
  96. </SOAP-ENV:Body>
  97. </SOAP-ENV:Envelope>
  98. </xts:request>
  99. </xts:append>
  100. </xts:sequence>
  101. </xsl:template>
  102. <!-- used to copy the bus header stuff - see "apply-templates" above. -->
  103. <xsl:template match="*">
  104. <xsl:copy>
  105. <xsl:copy-of select="@*"/>
  106. <xsl:apply-templates/>
  107. </xsl:copy>
  108. </xsl:template>
  109. </xsl:stylesheet>
  110. </xts:block>
  111. <xts:block id="appendDimensions" mode="interpret" processor="XSLT" type="exec" dependency="getDimensions" mandatory="false">
  112. <xts:logicsheet path="logicsheets/buslogic.xslt"/>
  113. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:send="http://developer.cognos.com/schemas/xts/logic-sheet/xslt/brl/1/" xmlns:cml="http://developer.cognos.com/schemas/xts/logic-sheet/xslt/cml/1/" xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt" xmlns:cm="http://developer.cognos.com/schemas/cm/1/" xmlns:SOAP-ENV="http://www.w3.org/2001/09/soap-envelope" xmlns:pf="http://developer.cognos.com/schemas/xts/pf" xmlns:bus="http://developer.cognos.com/schemas/bibus/3/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xos="http://developer.cognos.com/schemas/xts/output/">
  114. <xsl:key name="env-param" match="/root/env/param" use="@name"/>
  115. <xsl:output method="xml" version="1.0" encoding="UTF-8"/>
  116. <xsl:template match="/root">
  117. <xts:sequence>
  118. <xts:append select="/root">
  119. <dimensions>
  120. <xsl:choose>
  121. <xsl:when test="contains(./*[local-name() = 'runSpecificationResponse']/bus:result/bus:details/item/bus:metadata, '&lt;?xml')">
  122. <xsl:value-of select="substring-after(./*[local-name() = 'runSpecificationResponse']/bus:result/bus:details/item/bus:metadata, '?&gt;')" disable-output-escaping="yes"/>
  123. </xsl:when>
  124. <xsl:otherwise>
  125. <xsl:value-of select="./*[local-name() = 'runSpecificationResponse']/bus:result/bus:details/item/bus:metadata" disable-output-escaping="yes"/>
  126. </xsl:otherwise>
  127. </xsl:choose>
  128. </dimensions>
  129. </xts:append>
  130. <xts:append select="/root">
  131. <RootMemberResponse/>
  132. </xts:append>
  133. </xts:sequence>
  134. </xsl:template>
  135. </xsl:stylesheet>
  136. </xts:block>
  137. <xts:block id="format" type="exec" mode="output" processor="XSLT" mimeType="text/html" dependency="appendDimensions">
  138. <!-- get the debug logic sheet -->
  139. <xts:logicsheet path="logicsheets/debuglogic.xslt"/>
  140. <xts:logicsheet path="logicsheets/portal.xsl"/>
  141. <!-- apply the form logic -->
  142. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xts="http://developer.cognos.com/schemas/xts/" xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt" xmlns:dbg="http://developer.cognos.com/schemas/xts/logicsheets/xslt/debug/" xmlns:bus="http://developer.cognos.com/schemas/bibus/3/" xmlns:pf="http://developer.cognos.com/schemas/xts/pf" exclude-result-prefixes="xsl xts dbg xtsext bus pf">
  143. <xsl:output method="text" version="1.0" encoding="UTF-8" indent="no"/>
  144. <pf:variables/>
  145. <!-- start the output -->
  146. <xsl:template match="/root">
  147. var dimBarItem;
  148. var dimBarItemDropDown;
  149. <xsl:for-each select="/*[local-name()='root']/*[local-name()='dimensions']/ResponseRoot/folder/*[local-name()='dimension']">
  150. <xsl:choose>
  151. <xsl:when test="./@type='measure'">
  152. dimBarItem = new CMenuItem(gQsDimbar, '<xsl:value-of select="./@name"/>', '', '',gMenuItemStyle, '<xsl:value-of select="$webRoot"/>', '<xsl:value-of select="$skin_root"/>');
  153. dimBarItemDropDown = dimBarItem.createDropDownMenu(gDimbarStyle);
  154. <xsl:variable name="dimIdx"><xsl:value-of select="position()-1"/></xsl:variable>
  155. <xsl:for-each select="./measure">
  156. dimBarItem = new CMenuItem(dimBarItemDropDown, '<xsl:value-of select="./@name"/>', 'slicer(\'MEASURES\',\'none\',\'none\',\'<xsl:value-of select="./@_ref"/>\',\'<xsl:value-of select="./@name"/>\', \'<xsl:value-of select="$dimIdx"/>\')', '',gMenuItemStyle, '<xsl:value-of select="$webRoot"/>', '<xsl:value-of select="$skin_root"/>');
  157. </xsl:for-each>
  158. </xsl:when>
  159. <xsl:otherwise>
  160. dimBarItem = new CMenuItem(gQsDimbar, '<xsl:value-of select="./hierarchy/@name"/>', '', '',gMenuItemStyle, '<xsl:value-of select="$webRoot"/>', '<xsl:value-of select="$skin_root"/>');
  161. dimBarItemDropDown = dimBarItem.createDropDownMenu(gDimbarStyle);
  162. var dimbarItemId<xsl:value-of select="position()-1"/> = dimBarItem.getId();
  163. dimBarItemDropDown.registerCallback(function test<xsl:value-of select="position()-1"/>(){loadDimBarItem(dimbarItemId<xsl:value-of select="position()-1"/>,'<xsl:value-of select="position()-1"/>','<xsl:value-of select="./hierarchy/@name"/>','<xsl:value-of select="./hierarchy/level[2]/@_ref"/>');});
  164. gQsDimbar.add(gToolbarSeperator);
  165. </xsl:otherwise>
  166. </xsl:choose>
  167. </xsl:for-each>
  168. gQsDimbar.draw();
  169. </xsl:template>
  170. </xsl:stylesheet>
  171. </xts:block>
  172. <xts:block id="faultHandler" type="fault" processor="XSLT">
  173. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" exclude-result-prefixes="xsl">
  174. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  175. <xsl:template match="/">
  176. <xsl:choose>
  177. <xsl:when test="//*[local-name()='CAM']/*[local-name()='exception']//*[local-name()='promptInfo'] or contains(//*[local-name()='exception']/*[local-name()='message']/*[local-name()='messageString'], 'QE-DEF-0313')">
  178. <logonFault>timeout</logonFault>
  179. </xsl:when>
  180. <xsl:otherwise>
  181. <soapFault>
  182. <xsl:copy>
  183. <xsl:copy-of select="/root/fault"/>
  184. </xsl:copy>
  185. </soapFault>
  186. </xsl:otherwise>
  187. </xsl:choose>
  188. </xsl:template>
  189. <xsl:template match="text()"/>
  190. </xsl:stylesheet>
  191. </xts:block>
  192. </xts:morphlet>