response.xslt 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361
  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, 2015
  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. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  13. xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/"
  14. xmlns:xts="http://developer.cognos.com/schemas/xts/"
  15. xmlns:rdb="http://developer.cognos.com/schemas/xts/rdb/"
  16. xmlns:utml="http://developer.cognos.com/schemas/xts/logicsheet/xslt/formlogic/"
  17. xmlns:dp="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/dialog/presentation/"
  18. xmlns:out="dummy-uri">
  19. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  20. <xsl:namespace-alias stylesheet-prefix="out" result-prefix="xsl"/>
  21. <xsl:template match="rdb:pageTitle">
  22. <out:choose>
  23. <out:when test="key('env-param','from_schedule_tool') = 'true'">
  24. <xts:string id="IDS_OTHERRUN_ONCE_TITLE">
  25. <xts:param name="objectName">
  26. <span lang="{'{$contentLocale}'}"><out:value-of select="xtsext:enforceBTD(key('env-param', 'm_name'), $baseTextDirection, $productLocale, boolean($isBidiEnabled='true'))"/></span>
  27. </xts:param>
  28. </xts:string>
  29. </out:when>
  30. <out:otherwise>
  31. <xsl:choose>
  32. <xsl:when test="@mode='advanced'">
  33. <xts:string id="IDS_OTHERRUN_ADVANCED_TITLE">
  34. <xts:param name="objectName">
  35. <span lang="{'{$contentLocale}'}"><out:value-of select="xtsext:enforceBTD(key('env-param', 'm_name'), $baseTextDirection, $productLocale, boolean($isBidiEnabled='true'))"/></span>
  36. </xts:param>
  37. </xts:string>
  38. </xsl:when>
  39. <xsl:otherwise>
  40. <xts:string id="IDS_OTHERRUN_TITLE">
  41. <xts:param name="objectName">
  42. <span lang="{'{$contentLocale}'}"><out:value-of select="xtsext:enforceBTD(key('env-param', 'm_name'), $baseTextDirection, $productLocale, boolean($isBidiEnabled='true'))"/></span>
  43. </xts:param>
  44. </xts:string>
  45. </xsl:otherwise>
  46. </xsl:choose>
  47. </out:otherwise>
  48. </out:choose>
  49. </xsl:template>
  50. <xsl:template match="rdb:checkCredential">
  51. <out:choose>
  52. <out:when test="$the-credential">
  53. <input type="hidden" name="m_sp_credential">
  54. <out:attribute name="value"><out:value-of select="$the-credential/cm:searchPath"/></out:attribute>
  55. </input>
  56. </out:when>
  57. <out:otherwise>
  58. <input type="hidden" name="h_CAM_action" value=""/>
  59. </out:otherwise>
  60. </out:choose>
  61. </xsl:template>
  62. <xsl:template match="rdb:description">
  63. <out:variable name="shortVersion">
  64. <xsl:copy-of select="shortVersion/node()"/>
  65. </out:variable>
  66. <out:choose>
  67. <out:when test="key('env-param','from_schedule_tool') = 'true'">
  68. <out:choose>
  69. <out:when test="$shortVersion = 'true'">
  70. <xts:string id="IDS_RUN_ONCE_RUNNABLE_INTRO_SHORT"/>
  71. </out:when>
  72. <out:otherwise>
  73. <xts:string id="IDS_RUN_ONCE_RUNNABLE_INTRO"/>
  74. </out:otherwise>
  75. </out:choose>
  76. </out:when>
  77. <out:otherwise>
  78. <out:variable name="className">
  79. <xsl:copy-of select="className/node()"/>
  80. </out:variable>
  81. <xts:string id="IDS_RUN_WITH_OPTIONS_CLASS_INTRO"><xts:param name="className"><out:value-of select="$className"/></xts:param></xts:string>
  82. </out:otherwise>
  83. </out:choose>
  84. </xsl:template>
  85. <xsl:template match="rdb:viewOrBackground">
  86. <!-- Run now or in the background -->
  87. <dp:choice title="IDS_TIME_AND_DELIVERY_RUN_LABEL" id="runType_radioGroup">
  88. <utml:radio-group name="runType">
  89. <utml:default-value>view</utml:default-value>
  90. <dp:section1>
  91. <utml:input type="radio" name="runType" value="view" onclick="updateRunType();updateOptionType();" id="ctrl_runType_view"/>
  92. </dp:section1>
  93. <dp:section2 for="ctrl_runType_view"><xts:string id="IDS_TIME_AND_DELIVERY_VIEW_REPORT"/></dp:section2>
  94. <dp:section1>
  95. <utml:input type="radio" name="runType" value="background" onclick="updateRunType();updateOptionType();" id="ctrl_runType_background">
  96. </utml:input>
  97. </dp:section1>
  98. <dp:section2 for="ctrl_runType_background"><xts:string id="IDS_TIME_AND_DELIVERY_BACKGROUND_RUN"/></dp:section2>
  99. <dp:section3>
  100. <dp:choice>
  101. <xsl:call-template name="rdb:nowOrLaterControls"/>
  102. </dp:choice>
  103. </dp:section3>
  104. </utml:radio-group>
  105. </dp:choice>
  106. </xsl:template>
  107. <xsl:template match="rdb:nowOrLater" name="rdb:nowOrLater">
  108. <!-- Run now or in the background -->
  109. <dp:choice title="IDS_TIME_RUN_LABEL" id="lbl_nowOrLaterRadioGroup">
  110. <xsl:call-template name="rdb:nowOrLaterControls"/>
  111. </dp:choice>
  112. </xsl:template>
  113. <xsl:template name="rdb:nowOrLaterControls">
  114. <out:choose>
  115. <out:when test="$userCanUseSched">
  116. <out:variable name="runDate" select="key('env-param','p_runDate')"/>
  117. <out:variable name="runTime" select="key('env-param','p_runTime')"/>
  118. <utml:radio-group name="backgroundRun">
  119. <utml:default-value>now</utml:default-value>
  120. <dp:section1>
  121. <utml:input id="id_backgroundRun_now" type="radio" name="backgroundRun" value="now"/>
  122. </dp:section1>
  123. <dp:section2 for="id_backgroundRun_now">
  124. <div> <xts:string id="IDS_TIME_AND_DELIVERY_NOW"/>
  125. </div>
  126. </dp:section2>
  127. <dp:section1>
  128. <utml:input id="id_backgroundRun_later" type="radio" name="backgroundRun" value="later"/>
  129. </dp:section1>
  130. <dp:section2 for="id_backgroundRun_later">
  131. <div>
  132. <xts:string id="IDS_TIME_AND_DELIVERY_LATER"/>
  133. </div>
  134. </dp:section2>
  135. </utml:radio-group>
  136. <dp:section3>
  137. <dp:list>
  138. <dp:section>
  139. <dp:field width="200">
  140. <!-- Render a select date prompt-->
  141. <out:call-template name="getSelectDate">
  142. <out:with-param name="promptLocale" select="$contentLocale"/>
  143. <out:with-param name="promptTimeZone" select="$timeZone"/>
  144. <out:with-param name="promptFormName" select="'pform'"/>
  145. <out:with-param name="promptRequired" select="'false'"/>
  146. <out:with-param name="promptStartOfWeek" select="'Sunday'"/>
  147. <out:with-param name="promptCalendar" select="'Gregorian'"/>
  148. <out:with-param name="promptParameter" select="'runDate'"/>
  149. <out:with-param name="promptSelectDateUI" select="'editBox'"/>
  150. <out:with-param name="promptInputOrder" select="'YMD'"/>
  151. <out:with-param name="promptDefaultDate" select="$runDate"/>
  152. <out:with-param name="promptDateTime" select="'false'"/>
  153. <out:with-param name="promptMultiSelect" select="'false'"/>
  154. <out:with-param name="promptId" select="'dateFrom'"/>
  155. <out:with-param name="promptBrowserMode" select="$promptBrowserMode"/>
  156. <out:with-param name="suppressDisabled" select="'true'"/>
  157. <out:with-param name="promptSelectUI" select="'editBox'"/>
  158. </out:call-template>
  159. </dp:field>
  160. </dp:section>
  161. </dp:list>
  162. <dp:list>
  163. <dp:section>
  164. <dp:field>
  165. <out:call-template name="getSelectTime">
  166. <out:with-param name="promptLocale" select="$contentLocale"/>
  167. <out:with-param name="promptFormName" select="'pform'"/>
  168. <out:with-param name="promptRequired" select="'false'"/>
  169. <out:with-param name="promptDefaultValue" select="$runTime"/>
  170. <out:with-param name="promptParameter" select="'runTime'"/>
  171. <out:with-param name="promptShowSeconds" select="'false'"/>
  172. <out:with-param name="promptInline" select="'false'"/>
  173. <out:with-param name="promptTimeZone" select="$timeZone"/>
  174. <out:with-param name="promptHourFormat" select="'hh'"/>
  175. <out:with-param name="promptMinuteFormat" select="'mm'"/>
  176. <out:with-param name="promptSecondFormat" select="'ss'"/>
  177. <out:with-param name="promptMode" select="@mode"/>
  178. <out:with-param name="promptMultiSelect" select="'false'"/>
  179. <out:with-param name="promptId" select="'timeFrom'"/>
  180. <out:with-param name="suppressDisabled" select="'true'"/>
  181. <out:with-param name="promptBrowserMode" select="$promptBrowserMode"/>
  182. <out:with-param name="promptSelectUI" select="'editBox'"/>
  183. </out:call-template>
  184. </dp:field>
  185. </dp:section>
  186. </dp:list>
  187. </dp:section3>
  188. </out:when>
  189. <out:otherwise>
  190. <utml:input type="hidden" name="backgroundRun" value="now"/>
  191. <dp:section1><xts:string id="IDS_TIME_AND_DELIVERY_NOW"/></dp:section1>
  192. </out:otherwise>
  193. </out:choose>
  194. </xsl:template>
  195. <xsl:template match="rdb:interactiveJavaScript">
  196. function launchPP8Viewer(format)
  197. {
  198. var locale;
  199. if (document.getElementById('outputLocaleDropDown')) {
  200. locale = document.getElementById('outputLocaleDropDown').value;
  201. }
  202. else {
  203. locale = '<out:value-of select="xtsext:javascriptencode($contentLocale)"/>'
  204. }
  205. var sPromptForValuesChecked;
  206. if (document.pform.m_pp8ro_prompt.checked)
  207. sPromptForValuesChecked = 'true';
  208. else
  209. sPromptForValuesChecked = 'false';
  210. cognosLaunch('ui.gateway', '<out:value-of select="xtsext:javascriptencode(string($gateway))"/>', 'ui.tool', 'PowerplayStudio','ui.object', '<out:value-of select="xtsext:javascriptencode(string(/root/env/param[@name='m_obj']))"/>', 'ui.backURL', '<out:value-of select="xtsext:javascriptencode(string(/root/env/param[@name='backURL']))"/>', 'ui.la', '<out:value-of select="xtsext:javascriptencode($productLocale)"/>', 'ui.lo', locale, 'ui.crnp', sPromptForValuesChecked, 'ui.crnfrm', format, 'ui.action', 'run', 'ui.access', <out:text/>
  211. <out:choose>
  212. <out:when test="$userCanUsePPS or $has_execute_permission">'<out:value-of select="xtsext:cafaction( concat('sign_wrap_setpassportid_', $passport), xtsext:web64encode(string('execute'), true()))"/>'</out:when>
  213. <out:otherwise>'<out:value-of select="xtsext:cafaction( concat('sign_wrap_setpassportid_', $passport), xtsext:web64encode(string('noexec'), true()))"/>'</out:otherwise>
  214. </out:choose>
  215. <out:text/>);
  216. }
  217. function launchViewer(format)
  218. {
  219. var GATEWAYPARAM="ui.gateway";
  220. var frm = document.pform;
  221. var formElement = document.createElement("form");
  222. formElement.setAttribute("name","xtslaunch");
  223. formElement.setAttribute("method","POST");
  224. formElement.setAttribute("target","_self");
  225. formElement.setAttribute("action", '<out:value-of select="$gateway"/>');
  226. createHiddenInput(formElement, 'b_action', 'cognosViewer');
  227. <!-- should the user be promted -->
  228. var sPrompt;
  229. if (frm.m_ro_prompt.checked)
  230. sPrompt = 'true';
  231. else
  232. sPrompt = 'false';
  233. var recordingEnabled;
  234. <xsl:choose>
  235. <xsl:when test="@advanced='true'">
  236. if ( frm.m_ro_recordingEnabled.checked )
  237. recordingEnabled = frm.m_ro_recordingEnabled.value;
  238. else
  239. recordingEnabled = 'false';
  240. </xsl:when>
  241. <xsl:otherwise>
  242. recordingEnabled = 'false';
  243. </xsl:otherwise>
  244. </xsl:choose>
  245. var locale = '';
  246. if (document.getElementById('outputLocaleDropDown')) {
  247. locale = document.getElementById('outputLocaleDropDown').value;
  248. }
  249. var a11y = '';
  250. if (document.getElementById('m_go_accessibilityFeatures')) {
  251. a11y = document.getElementById('m_go_accessibilityFeatures').checked;
  252. createHiddenInput(formElement, 'system.<out:value-of select="xtsext:javascriptencode('http://developer.cognos.com/ceba/constants/systemOptionEnum#accessibilityFeatures')"/>',a11y);
  253. }
  254. createHiddenInput(formElement, 'ui.gateway', '<out:value-of select="xtsext:javascriptencode($gateway)"/>');
  255. createHiddenInput(formElement, 'ui.action', 'run');
  256. createHiddenInput(formElement, 'ui.object', '<out:value-of select="xtsext:javascriptencode(string(/root/env/param[@name='m_obj']))"/>');
  257. createHiddenInput(formElement, 'run.outputFormat', format);
  258. createHiddenInput(formElement, 'run.outputLocale', locale);
  259. createHiddenInput(formElement, 'run.prompt', sPrompt);
  260. <out:if test="key('system-param', 'useReportLocaleInRVUI') = 'true'">
  261. createHiddenInput(formElement, 'lang', locale);
  262. </out:if>
  263. <!-- this next one is passed to the viewer so that it can call back to this page on "Run again" -->
  264. createHiddenInput(formElement, 'ui.name', '<out:value-of select="xtsext:javascriptencode(string(/root/env/param[@name='m_name']))"/>');
  265. createHiddenInput(formElement, 'ui.backURL', '<out:value-of select="xtsext:javascriptencode(string(/root/env/param[@name='backURL']))"/>');
  266. createHiddenInput(formElement, 'ui.runOptions', 'true');
  267. <!-- this test for recording set to true can be removed once
  268. report server supports the recordingEnabled run option. -->
  269. if ( recordingEnabled == "true" ) {
  270. createHiddenInput(formElement, 'run.recordingEnabled', recordingEnabled);
  271. }
  272. <!-- For PDF format add page definition selection and page orientation option. -->
  273. <xsl:if test="@advanced='true'">
  274. if (format == "PDF")
  275. {
  276. <!-- page definition -->
  277. if ( frm.m_ro_outputPageDefinition &amp;&amp; frm.m_ro_outputPageDefinition.value != "default")
  278. {
  279. createHiddenInput(formElement, 'run.outputPageDefinition', frm.m_ro_outputPageDefinition.value);
  280. }
  281. <!-- page orientation -->
  282. if (frm.m_ro_outputPageOrientation &amp;&amp; frm.m_ro_outputPageOrientation.value != 'default')
  283. {
  284. createHiddenInput(formElement, 'run.outputPageOrientation', frm.m_ro_outputPageOrientation.value);
  285. }
  286. }
  287. <!-- For HTML format, add selected No. of rows. -->
  288. if (format == "HTML") {
  289. if (frm.view_verticalElements) {
  290. createHiddenInput(formElement, 'run.verticalElements', frm.view_verticalElements[frm.view_verticalElements.selectedIndex].value);
  291. }
  292. <!-- always need to send the selection based interactivity when HTML is selected (true OR false) -->
  293. if (document.getElementById('view_selectionBasedFeatures')) {
  294. createHiddenInput(formElement, 'run.selectionBasedFeatures', document.getElementById('view_selectionBasedFeatures').checked);
  295. }
  296. }
  297. </xsl:if>
  298. <!-- we need to build an errURL so if an error occurs in the cognos viewer, the user is returned to
  299. the run with options when he hits OK on the error dialog -->
  300. <!-- NOTE: Currently always pointing to the basic run with options dialog because of the limit in URL size -->
  301. <out:variable name="errURL">
  302. <out:value-of select="$gateway"/>?b_action=xts.run&amp;m=<out:value-of select="$app"/>/runWithOptions/report.xts&amp;m_obj=<out:value-of select="xtsext:protect(xtsext:urlencode(string(/root/env/param[@name = 'm_obj'])),'url','url','getdata')"/>&amp;m_class=<out:value-of select="xtsext:protect(xtsext:urlencode(string(/root/env/param[@name = 'm_class'])),'url','url','getdata')"/>&amp;m_name=<out:value-of select="xtsext:protect(xtsext:urlencode(string(/root/env/param[@name = 'm_name'])),'url','url','getdata')"/>&amp;backURL=<out:value-of select="xtsext:protect(xtsext:urlencode(string(/root/env/param[@name = 'backURL'])),'url','url','getdata')"/>
  303. </out:variable>
  304. sErrURL = "<out:value-of select="xtsext:javascriptencode(string($errURL))"/>";
  305. <!-- only append the outputLocale, format and prompt info if the backURL is not javascript -->
  306. <out:if test="not(starts-with(key('env-param','backURL'), 'javascript:'))">
  307. sErrURL = sErrURL +
  308. '%26m_ro_outputLocale=' + locale +
  309. '%26format=' + format +
  310. '%26m_ro_prompt=' + sPrompt;
  311. </out:if>
  312. createHiddenInput(formElement, 'errURL', sErrURL);
  313. document.body.appendChild(formElement);
  314. formElement.submit();
  315. document.body.removeChild(formElement);
  316. formElement = null;
  317. }
  318. </xsl:template>
  319. <!-- Engine transform - this just ensures that everything not undeerstood by this logicheet gets copied over -->
  320. <xsl:template match="*|@*|text()|processing-instruction()">
  321. <xsl:copy>
  322. <xsl:apply-templates select="*|@*|text()|processing-instruction()"/>
  323. </xsl:copy>
  324. </xsl:template>
  325. </xsl:stylesheet>