selectValuesRequest.xts 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3. Licensed Materials - Property of IBM
  4. IBM Cognos Products: AGS
  5. (C) Copyright IBM Corp. 2005, 2017
  6. US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  7. -->
  8. <xts:morphlet resolverBase="prompting" xmlns:xts="http://developer.cognos.com/schemas/xts/" messageBase="messages/portal.xml" requiredCapability="canUseEventStudio">
  9. <!--
  10. ===============================================================================================
  11. Pull the report spec out into the DOM
  12. ===============================================================================================
  13. -->
  14. <xts:block id="buildSpecification" processor="XSLT" type="exec">
  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:template match="/">
  17. <xts:sequence>
  18. <xts:append>
  19. <specification>
  20. <xsl:choose>
  21. <xsl:when test="/root/env/param[@name='memberRequest'] and /root/env/param[@name='memberRequest'] = '2'">
  22. &lt;metadataRequest connection=&quot;<xsl:value-of select="xtsext:xmlencode(string(/root/env/param[@name='model']))"/>&quot;&gt;
  23. &lt;Metadata authoringLocale=&quot;<xsl:value-of select="/root/env/param[@name='el']"/>&quot; xml:lang=&quot;<xsl:value-of select="/root/env/param[@name='pl']"/>&quot; Depth=&quot;2&quot; start_atPath=&quot;<xsl:value-of select="xtsext:xmlencode(string(/root/env/param[@name='startAtPath']))"/>&quot; ResultStart=&quot;<xsl:value-of select="/root/env/param[@name='start_pos']"/>&quot; ResultCount=&quot;21&quot;&gt;
  24. &lt;Properties&gt;
  25. &lt;Property name=&quot;./dimension&quot;/&gt;
  26. &lt;Property name=&quot;./hierarchy&quot;/&gt;
  27. &lt;Property name=&quot;./level&quot;/&gt;
  28. &lt;Property name=&quot;./member&quot;/&gt;
  29. &lt;Property name=&quot;./folder&quot;/&gt;
  30. &lt;Property name=&quot;./@_RootMembers&quot;/&gt;
  31. &lt;Property name=&quot;*/@name&quot;/&gt;
  32. &lt;Property name=&quot;*/@_path&quot;/&gt;
  33. &lt;Property name=&quot;*/@_ref&quot;/&gt;
  34. &lt;Property name=&quot;*/@memberUniqueName&quot;/&gt;
  35. &lt;Property name=&quot;*/@memberCaption&quot;/&gt;
  36. &lt;Property name=&quot;*/@levelUniqueName&quot;/&gt;
  37. &lt;Property name=&quot;*/@levelNumber&quot;/&gt;
  38. &lt;Property name=&quot;*/@levelLabel&quot;/&gt;
  39. &lt;Property name=&quot;*/@parentUniqueName&quot;/&gt;
  40. &lt;Property name=&quot;*/@currencyCode&quot;/&gt;
  41. &lt;/Properties&gt;
  42. <!-- build the filter if there is one -->
  43. <xsl:if test="/root/env/param[@name='filter'] and not(/root/env/param[@name='filter'] = '')">
  44. &lt;Constraints&gt;
  45. <xsl:choose>
  46. <xsl:when test="/root/env/param[@name='filter_type'] = 'equals' ">
  47. &lt;Constraint Condition=&quot;[@memberCaption=&apos;<xsl:value-of select="/root/env/param[@name='filter']"/>&apos;]&quot; CaseSensitive=&quot;false&quot;/&gt;
  48. </xsl:when>
  49. <xsl:otherwise>
  50. &lt;Constraint Condition=&quot;[<xsl:value-of select="/root/env/param[@name='filter_type']"/>(@memberCaption,&apos;<xsl:value-of select="/root/env/param[@name='filter']"/>&apos;)]&quot; CaseSensitive=&quot;false&quot;/&gt;
  51. </xsl:otherwise>
  52. </xsl:choose>
  53. &lt;/Constraints&gt;
  54. </xsl:if>
  55. &lt;/Metadata&gt;
  56. &lt;/metadataRequest&gt;
  57. </xsl:when>
  58. <xsl:otherwise>
  59. <!-- get the expression locale -->
  60. <xsl:variable name="el">
  61. <xsl:value-of select="/root/env/param[@name='el']"/>
  62. </xsl:variable>
  63. <xsl:variable name="di1" select="xtsext:xmlencode(string(/root/env/param[@name='queryRef']))"/>
  64. <xsl:variable name="qi1">
  65. <xsl:choose>
  66. <xsl:when test="/root/env/param[@name='memberRequest']='1'">
  67. <xsl:text>caption([</xsl:text>
  68. <xsl:value-of select="$di1"/>
  69. <xsl:text>])</xsl:text>
  70. </xsl:when>
  71. <xsl:otherwise>
  72. <xsl:text>[</xsl:text>
  73. <xsl:value-of select="$di1"/>
  74. <xsl:text>]</xsl:text>
  75. </xsl:otherwise>
  76. </xsl:choose>
  77. </xsl:variable>
  78. &lt;report expressionLocale=&quot;<xsl:value-of select="$el"/>&quot; xmlns=&quot;http://developer.cognos.com/schemas/report/14.0/&quot;&gt;
  79. &lt;modelPath&gt;<xsl:value-of select="xtsext:xmlencode(string(/root/env/param[@name='model']))"/>&lt;/modelPath&gt;
  80. &lt;XMLAttributes&gt;
  81. &lt;XMLAttribute name='contextItemFormat' value='XMLFormat'/&gt;
  82. &lt;/XMLAttributes&gt;
  83. &lt;queries&gt;
  84. &lt;query name=&quot;q1&quot;&gt;
  85. &lt;source&gt;
  86. &lt;model/&gt;
  87. &lt;/source&gt;
  88. &lt;selection&gt;
  89. <!-- send in the data items, these have already been encoded-->
  90. <xsl:if test="/root/env/param[@name='queryItems']">
  91. <xsl:value-of select="/root/env/param[@name='queryItems']"/>
  92. </xsl:if>
  93. &lt;/selection&gt;
  94. <!-- build the filter if there is one -->
  95. <xsl:if test="/root/env/param[@name='filter'] and not(/root/env/param[@name='filter'] = '')">
  96. <xsl:variable name="filter">
  97. <xsl:choose>
  98. <xsl:when test="/root/env/param[@name='filter_type'] = 'contains' ">
  99. <!-- [di1] CONTAINS &apos;Jame&apos; -->
  100. <xsl:value-of select="$qi1"/>
  101. <xsl:text> CONTAINS '</xsl:text>
  102. <xsl:value-of select="xtsext:xmlencode(string(/root/env/param[@name='filter']))"/>
  103. <xsl:text>'</xsl:text>
  104. </xsl:when>
  105. <xsl:when test="/root/env/param[@name='filter_type'] = 'starts-with' ">
  106. <!-- [di1] STARTS WITH &apos;Jame&apos; -->
  107. <xsl:value-of select="$qi1"/>
  108. <xsl:text> STARTS WITH '</xsl:text>
  109. <xsl:value-of select="xtsext:xmlencode(string(/root/env/param[@name='filter']))"/>
  110. <xsl:text>'</xsl:text>
  111. </xsl:when>
  112. <xsl:when test="/root/env/param[@name='filter_type'] = 'equals' ">
  113. <!-- [di1] = &apos;Jame&apos; -->
  114. <xsl:value-of select="$qi1"/>
  115. <xsl:text> = '</xsl:text>
  116. <xsl:value-of select="xtsext:xmlencode(string(/root/env/param[@name='filter']))"/>
  117. <xsl:text>'</xsl:text>
  118. </xsl:when>
  119. </xsl:choose>
  120. </xsl:variable>
  121. &lt;detailFilters&gt;
  122. &lt;detailFilter use=&quot;required&quot; postAutoAggregation=&quot;false&quot;&gt;
  123. &lt;filterExpression&gt;<xsl:value-of select="$filter"/>&lt;/filterExpression&gt;
  124. &lt;/detailFilter&gt;
  125. &lt;/detailFilters&gt;
  126. </xsl:if>
  127. &lt;/query&gt;
  128. &lt;/queries&gt;
  129. &lt;layouts&gt;
  130. &lt;layout&gt;
  131. &lt;defaultDataFormats&gt;
  132. &lt;numberFormat useGrouping=&quot;false&quot;/&gt;
  133. &lt;currencyFormat useGrouping=&quot;false&quot; currencySymbol=&quot;&quot;/&gt;
  134. &lt;dateFormat dateSeparator=&quot;-&quot; displayOrder=&quot;YMD&quot; showEra=&quot;false&quot; showYears=&quot;showCentury&quot; showMonths=&quot;2-digits&quot; showWeekday=&quot;false&quot; showDays=&quot;2-digits&quot;/&gt;
  135. &lt;timeFormat timeSeparator=&quot;:&quot; showAmPm=&quot;false&quot; showTimeZone=&quot;false&quot; showHours=&quot;2-digits&quot; showMinutes=&quot;2-digits&quot; showSeconds=&quot;2-digits&quot; showMilliseconds=&quot;3-digits&quot; decimalDelimiter=&quot;.&quot;/&gt;
  136. &lt;dateTimeFormat dateSeparator=&quot;-&quot; displayOrder=&quot;YMD&quot; showEra=&quot;false&quot; showYears=&quot;showCentury&quot; showMonths=&quot;2-digits&quot; showWeekday=&quot;false&quot; showDays=&quot;2-digits&quot; timeSeparator=&quot;:&quot; showAmPm=&quot;false&quot; showTimeZone=&quot;false&quot; showHours=&quot;2-digits&quot; showMinutes=&quot;2-digits&quot; showSeconds=&quot;2-digits&quot; showMilliseconds=&quot;3-digits&quot; decimalDelimiter=&quot;.&quot;/&gt;
  137. &lt;intervalFormat dateSeparator=&quot;-&quot; showYears=&quot;false&quot; showMonths=&quot;false&quot; showDays=&quot;true&quot; timeSeparator=&quot;:&quot; showHours=&quot;2-digits&quot; showMinutes=&quot;2-digits&quot; showSeconds=&quot;2-digits&quot; showMilliseconds=&quot;3-digits&quot; decimalSize=&quot;3&quot; decimalDelimiter=&quot;.&quot; sign=&quot;-&quot; useTrailingSign=&quot;false&quot; useGrouping=&quot;false&quot; units=&quot;time&quot; whenZero=&quot;000 00:00:00.000&quot;/&gt;
  138. &lt;/defaultDataFormats&gt;
  139. &lt;reportPages&gt;
  140. &lt;page name=&quot;p1&quot;&gt;
  141. &lt;style&gt;&lt;defaultStyles&gt;&lt;defaultStyle refStyle="pg"/&gt;&lt;/defaultStyles&gt;&lt;/style&gt;
  142. &lt;pageBody &gt;
  143. &lt;style&gt;&lt;defaultStyles&gt;&lt;defaultStyle refStyle="pb"/&gt;&lt;/defaultStyles&gt;&lt;/style&gt;
  144. &lt;contents&gt;
  145. &lt;list refQuery=&quot;q1&quot; rowsPerPage=&quot;23&quot;&gt;
  146. &lt;style&gt;&lt;defaultStyles&gt;&lt;defaultStyle refStyle="ls"/&gt;&lt;/defaultStyles&gt;&lt;/style&gt;
  147. &lt;listColumns&gt;
  148. &lt;listColumn&gt;
  149. &lt;listColumnTitle &gt;
  150. &lt;style&gt;&lt;defaultStyles&gt;&lt;defaultStyle refStyle="lt"/&gt;&lt;/defaultStyles&gt;&lt;/style&gt;
  151. &lt;contents/&gt;
  152. &lt;/listColumnTitle&gt;
  153. &lt;listColumnBody &gt;
  154. &lt;style&gt;&lt;defaultStyles&gt;&lt;defaultStyle refStyle="lc"/&gt;&lt;/defaultStyles&gt;&lt;/style&gt;
  155. &lt;contents&gt;
  156. &lt;textItem&gt;
  157. &lt;dataSource&gt;
  158. &lt;dataItemValue refDataItem=&quot;<xsl:value-of select="$di1"/>&quot;/&gt;
  159. &lt;/dataSource&gt;
  160. &lt;/textItem&gt;
  161. &lt;/contents&gt;
  162. &lt;/listColumnBody&gt;
  163. &lt;/listColumn&gt;
  164. &lt;/listColumns&gt;
  165. <xsl:choose>
  166. <xsl:when test="/root/env/param[@name='sort']!='none'">
  167. &lt;listGroups&gt;
  168. &lt;listGroup refDataItem=&quot;<xsl:value-of select="$di1"/>&quot;&gt;
  169. &lt;sortList&gt;
  170. &lt;sortItem refDataItem=&quot;<xsl:value-of select="$di1"/>&quot; sortOrder=&quot;<xsl:value-of select="/root/env/param[@name='sort']"/>&quot;/&gt;
  171. &lt;/sortList&gt;
  172. &lt;/listGroup&gt;
  173. &lt;/listGroups&gt;
  174. </xsl:when>
  175. <xsl:otherwise>
  176. &lt;listGroups&gt;
  177. &lt;listGroup refDataItem=&quot;<xsl:value-of select="$di1"/>&quot;/&gt;
  178. &lt;/listGroups&gt;
  179. </xsl:otherwise>
  180. </xsl:choose>
  181. &lt;/list&gt;
  182. &lt;/contents&gt;
  183. &lt;/pageBody&gt;
  184. &lt;/page&gt;
  185. &lt;/reportPages&gt;
  186. &lt;/layout&gt;
  187. &lt;/layouts&gt;
  188. &lt;/report&gt;
  189. </xsl:otherwise>
  190. </xsl:choose>
  191. </specification>
  192. </xts:append>
  193. </xts:sequence>
  194. </xsl:template>
  195. </xsl:stylesheet>
  196. </xts:block>
  197. <!-- call the getExternalRequest to see if the request came from the /ext entry point -->
  198. <xts:block id="getExternalRequest" dependency="buildSpecification" processor="XSLT" type="exec">
  199. <xts:logicsheet path="logicsheets/portal.xsl"/>
  200. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt" xmlns:pf="http://developer.cognos.com/schemas/xts/pf" exclude-result-prefixes="pf">
  201. <pf:variables/>
  202. <xsl:template match="/">
  203. <xts:sequence>
  204. <xts:append>
  205. <externalRequest>
  206. <xts:function name="getRequestExternal" xmlns:xts="http://developer.cognos.com/schemas/xts/">
  207. <xts:param name="passport">
  208. <xsl:value-of select="$passport"/>
  209. </xts:param>
  210. <xts:param name="secureState">
  211. <xsl:value-of select="/root/header/*[local-name()='biBusHeader']/*[local-name()='CAF']/*[local-name()='secureState']"/>
  212. </xts:param>
  213. </xts:function>
  214. </externalRequest>
  215. </xts:append>
  216. </xts:sequence>
  217. </xsl:template>
  218. </xsl:stylesheet>
  219. </xts:block>
  220. <!-- depending on the output of the getExternalRequest request - sign the request -->
  221. <xts:block id="signSpecification" dependency="getExternalRequest" processor="XSLT" type="exec">
  222. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt">
  223. <xsl:template match="/">
  224. <xts:sequence>
  225. <xts:append>
  226. <signedSpec>
  227. <xsl:choose>
  228. <xsl:when test="/root/getRequestExternalResponse">
  229. <xts:function name="signReportSpec" xmlns:xts="http://developer.cognos.com/schemas/xts/">
  230. <xts:param name="source">
  231. <xsl:value-of select="/root/specification"/>
  232. </xts:param>
  233. </xts:function>
  234. </xsl:when>
  235. <xsl:otherwise>
  236. <xsl:value-of select="/root/specification"/>
  237. </xsl:otherwise>
  238. </xsl:choose>
  239. </signedSpec>
  240. </xts:append>
  241. </xts:sequence>
  242. </xsl:template>
  243. </xsl:stylesheet>
  244. </xts:block>
  245. <!-- build the output we want with the signed request -->
  246. <xts:block id="makeRequest" dependency="signSpecification" mode="output" mimeType="text/xml" processor="XSLT" type="exec">
  247. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt">
  248. <xsl:output method="xml" version="1.0" encoding="UTF-8"/>
  249. <!-- build the metadata request -->
  250. <xsl:template match="/">
  251. <xsl:call-template name="buildSpec"/>
  252. </xsl:template>
  253. <xsl:template name="buildSpec">
  254. <bus:value xsi:type="bus:specification" xmlns:bus="http://developer.cognos.com/schemas/bibus/3/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  255. <xsl:value-of select="/root/signedSpec"/>
  256. </bus:value>
  257. </xsl:template>
  258. </xsl:stylesheet>
  259. </xts:block>
  260. </xts:morphlet>