settings_advanced.xts 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400
  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, 2014
  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 xmlns:xts="http://developer.cognos.com/schemas/xts/" messageBase="messages/portal.xml, messages/portalRL.xml" requiredCapability="canUseAdministrationPortal">
  13. <xts:block id="formlogic_init" type="exec" mode="interpret" processor="XSLT" path="/logicsheets/formlogic_init.xslt" nodelist="env,credential,system,http"/>
  14. <!-- CM content request ==================================================================== -->
  15. <xts:block id="getContent" processor="XSLT" type="exec" mode="interpret" dependency="formlogic_init">
  16. <xts:logicsheet path="logicsheets/cm-logic.xsl"/>
  17. <xts:logicsheet path="logicsheets/buslogic.xslt"/>
  18. <xsl:stylesheet version="1.0"
  19. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  20. xmlns:cml="http://developer.cognos.com/schemas/xts/logic-sheet/xslt/cml/1/"
  21. xmlns:send="http://developer.cognos.com/schemas/xts/logic-sheet/xslt/brl/1/"
  22. xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/">
  23. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  24. <xsl:template match="/">
  25. <xts:sequence>
  26. <xts:append>
  27. <xts:transform src="transforms/CM/post-process.xslt" processor="XSLT">
  28. <send:request provider="cm" testBlock="test">
  29. <xts:transform src="transforms/CM/pre-process.xslt" processor="XSLT">
  30. <cm:query>
  31. <cm:search><xsl:value-of select="/root/env/param[@name='m_obj']"/></cm:search>
  32. <cm:properties>
  33. <cm:property name="advancedSettings"/>
  34. <cm:property name="defaultName"/>
  35. <cm:property name="permissions"/>
  36. <cm:property name="parent"/>
  37. </cm:properties>
  38. <cm:options schemaInfo="true">
  39. <cm:refProps>
  40. <cm:refProp refPropName="parent">
  41. <cm:properties>
  42. <cm:property name="advancedSettings"/>
  43. </cm:properties>
  44. </cm:refProp>
  45. </cm:refProps>
  46. </cm:options>
  47. </cm:query>
  48. </xts:transform>
  49. </send:request>
  50. </xts:transform>
  51. </xts:append>
  52. </xts:sequence>
  53. </xsl:template>
  54. </xsl:stylesheet>
  55. </xts:block>
  56. <xts:block id="replace" type="exec" mode="interpret" processor="XSLT" dependency="getContent formlogic_init" condition="/root/env/param[@name='replace']" mandatory="false">
  57. <xsl:stylesheet version="1.0"
  58. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  59. xmlns:cml="http://developer.cognos.com/schemas/xts/logic-sheet/xslt/cml/1/"
  60. xmlns:send="http://developer.cognos.com/schemas/xts/logic-sheet/xslt/brl/1/"
  61. xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/">
  62. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  63. <xsl:template match="/root">
  64. <xts:sequence>
  65. <xts:replace select="/root/*[local-name()='queryResponse']/*/*[local-name()='advancedSettings']">
  66. <xsl:choose>
  67. <xsl:when test="/root/env/param[@name='reset_advancedSettings']='1'">
  68. <xsl:apply-templates select="cm:queryResponse/*/cm:parent/*/cm:advancedSettings"/>
  69. </xsl:when>
  70. <xsl:otherwise>
  71. <xsl:apply-templates select="cm:queryResponse/*/cm:advancedSettings"/>
  72. </xsl:otherwise>
  73. </xsl:choose>
  74. </xts:replace>
  75. <xts:delete select="/root/env/param[@name='reset_advancedSettings']"/>
  76. </xts:sequence>
  77. </xsl:template>
  78. <xsl:template match="cm:advancedSettings">
  79. <xsl:copy>
  80. <xsl:copy-of select="@*[local-name() != 'acquired']"/>
  81. <xsl:attribute name="acquired">false</xsl:attribute>
  82. <xsl:copy-of select="*"/>
  83. </xsl:copy>
  84. </xsl:template>
  85. </xsl:stylesheet>
  86. </xts:block>
  87. <xts:block id="addCounter" type="exec" mode="interpret" processor="XSLT" dependency="getContent">
  88. <xsl:stylesheet version="1.0"
  89. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  90. xmlns:cml="http://developer.cognos.com/schemas/xts/logic-sheet/xslt/cml/1/"
  91. xmlns:send="http://developer.cognos.com/schemas/xts/logic-sheet/xslt/brl/1/"
  92. xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/">
  93. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  94. <xsl:variable name="elementCounter">
  95. <xsl:choose>
  96. <xsl:when test="count(/root/cm:queryResponse/*/cm:advancedSettings/cm:settings/*)+5 &gt; 20">
  97. <xsl:value-of select="count(/root/cm:queryResponse/*/cm:advancedSettings/cm:settings/*)+5"/>
  98. </xsl:when>
  99. <xsl:otherwise>
  100. <xsl:value-of select="20"/>
  101. </xsl:otherwise>
  102. </xsl:choose>
  103. </xsl:variable>
  104. <xsl:template match="/root">
  105. <xts:sequence>
  106. <xts:append>
  107. <counter>
  108. <xsl:call-template name="generateElement">
  109. <xsl:with-param name="count" select="$elementCounter"/>
  110. </xsl:call-template>
  111. </counter>
  112. </xts:append>
  113. </xts:sequence>
  114. </xsl:template>
  115. <xsl:template name="generateElement">
  116. <xsl:param name="count"/>
  117. <xsl:if test="$count != 0">
  118. <element/>
  119. <xsl:call-template name="generateElement">
  120. <xsl:with-param name="count" select="$count - 1"/>
  121. </xsl:call-template>
  122. </xsl:if>
  123. </xsl:template>
  124. </xsl:stylesheet>
  125. </xts:block>
  126. <xts:block id="format" mode="output" processor="XSLT" type="exec" dependency="getContent replace addCounter formlogic_init" mimeType="text/html">
  127. <xts:logicsheet path="logicsheets/portal.xsl"/>
  128. <xts:logicsheet path="logicsheets/presentation/dialog/templates.xsl"/>
  129. <xts:logicsheet path="logicsheets/presentation/dialog/framework.xsl"/>
  130. <xts:logicsheet path="logicsheets/presentation/layout.xsl"/>
  131. <xts:logicsheet path="logicsheets/presentation/dialog/presentation.xsl"/>
  132. <xts:logicsheet path="logicsheets/presentation/controls/framework.xsl"/>
  133. <xts:logicsheet path="logicsheets/presentation/controls/presentation.xsl"/>
  134. <xts:logicsheet path="logicsheets/formlogic.xslt"/>
  135. <xts:logicsheet path="logicsheets/validation.xslt"/>
  136. <xts:logicsheet path="logicsheets/presentation/touch_up.xslt"/>
  137. <xsl:stylesheet version="1.0"
  138. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  139. xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/"
  140. xmlns:pf="http://developer.cognos.com/schemas/xts/pf"
  141. xmlns:lyt="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/layout/"
  142. xmlns:dp="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/dialog/presentation/"
  143. xmlns:df="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/dialog/framework/"
  144. xmlns:cf="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/controls/framework/"
  145. xmlns:cp="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/controls/presentation/"
  146. xmlns:dt="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/dialog/templates/"
  147. xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt"
  148. xmlns:utml="http://developer.cognos.com/schemas/xts/logicsheet/xslt/formlogic/"
  149. exclude-result-prefixes="xsl cm pf lyt dp df cf cp utml xts xtsext">
  150. <xsl:output method="html" version="1.0" encoding="UTF-8" indent="no" omit-xml-declaration="yes"/>
  151. <!-- Global variables ======================== -->
  152. <pf:variables/>
  153. <xsl:variable name="mname" select="'actions.xts'"/>
  154. <!-- These vars are required by global templates that generate an icon and a url for a CM entry -->
  155. <xsl:variable name="back-url" select="string(key('env-param', 'backURL'))"/>
  156. <xsl:variable name="cmd-form" select="'pform'"/>
  157. <xsl:variable name="edit-form" select="'pform'"/>
  158. <!-- Object reference -->
  159. <xsl:variable name="obj-ref" select="/root/cm:queryResponse/*"/>
  160. <xsl:variable name="browserTitle">
  161. <xts:string id="IDS_ADV_TITLE"><xts:param name="objectName"><span lang="{$contentLocale}"><xsl:value-of select="key('env-param', 'm_name')"/></span></xts:param></xts:string>
  162. </xsl:variable>
  163. <!-- start the output -->
  164. <xsl:template match="/root">
  165. <xsl:variable name="has_write_permission" select="contains(concat(' ', /root/cm:queryResponse/*/cm:permissions, ' '), ' write ')"/>
  166. <xsl:text disable-output-escaping='yes'>&lt;!DOCTYPE html></xsl:text><dp:page longTitle="$browserTitle">
  167. <dp:meta>
  168. <pf:meta/><!-- Standard meta tags -->
  169. </dp:meta>
  170. <dp:script>
  171. <pf:help context="HID_ADVANCED_CMSETTINGS"/> <!-- Help system -->
  172. <!-- Define selectall and deselectall functions.-->
  173. <dt:selectDeselectAll/>
  174. <script language="javascript">
  175. function clearChecked()
  176. {
  177. var form = document.pform;
  178. for (var i = 0; i &lt; form.elements.length; i++)
  179. {
  180. if (form.elements[i].checked == true &amp;&amp; form.elements[i].name.indexOf('checkbox_') == 0)
  181. {
  182. form.elements['m_pa_n' + form.elements[i].name.substr(9)].value='';
  183. form.elements['m_pa_v' + form.elements[i].name.substr(9)].value='';
  184. form.elements[i].checked = false;
  185. }
  186. }
  187. }
  188. function validate()
  189. {
  190. <!-- make sure we clear the reset flag if the user hit the OK button -->
  191. if (document.pform.resetroot_advancedSettings)
  192. {
  193. document.pform.resetroot_advancedSettings.value = '0';
  194. }
  195. if (document.pform.reset_advancedSettings)
  196. {
  197. document.pform.reset_advancedSettings.value = '0';
  198. }
  199. return true;
  200. }
  201. </script>
  202. </dp:script>
  203. <utml:form name="pform" method="post" action="{$gateway}">
  204. <utml:read-only>
  205. <xsl:choose>
  206. <xsl:when test="not($has_write_permission)">true</xsl:when>
  207. <xsl:when test="key('env-param', 'replace') and (key('env-param', 'replace') != 'replace')">true</xsl:when>
  208. <xsl:when test="key('env-param', 'replace') and (key('env-param', 'replace') = 'replace')">false</xsl:when>
  209. <xsl:when test="key('env-param', 'reset_advancedSettings')='1'">true</xsl:when>
  210. <xsl:when test="/root/cm:queryResponse/*/cm:advancedSettings/@acquired = 'true'">true</xsl:when>
  211. <xsl:otherwise>false</xsl:otherwise>
  212. </xsl:choose>
  213. </utml:read-only>
  214. <utml:exclusion-list>
  215. <xsl:for-each select="/root/counter/*">
  216. <xsl:value-of select="concat(' m_pa_n', position(), ' ')"/>
  217. <xsl:value-of select="concat(' m_pa_v', position(), ' ')"/>
  218. </xsl:for-each>
  219. </utml:exclusion-list>
  220. <!-- dialog header -->
  221. <dp:header>
  222. <!-- header titles-->
  223. <dp:title showName="false"><xsl:copy-of select="$browserTitle"/></dp:title>
  224. <dp:description>
  225. <xts:string id="IDS_ADV_INTRO"/>
  226. </dp:description>
  227. </dp:header>
  228. <lyt:layout style="1">
  229. <lyt:section>
  230. <xsl:if test="$has_write_permission and $form-read-only = 'true'">
  231. <dp:choice>
  232. <dp:section1>
  233. <input type="checkbox" name="replace" value="replace" onclick="javascript:document.pform.submit();">
  234. <xsl:if test="not(key('env-param','reset_advancedSettings')) and (key('env-param', 'replace') = 'replace' or $obj-ref/cm:advancedSettings/@acquired = 'false')">
  235. <xsl:attribute name="checked">checked</xsl:attribute>
  236. </xsl:if>
  237. </input>
  238. </dp:section1>
  239. <dp:section2>
  240. <xts:string id="IDS_ADV_OPTION"/>
  241. </dp:section2>
  242. </dp:choice>
  243. </xsl:if>
  244. </lyt:section>
  245. <lyt:section>
  246. <xsl:choose>
  247. <xsl:when test="key('env-param','reset_advancedSettings')='1'">
  248. <xsl:apply-templates select="/root/cm:queryResponse/*/cm:parent/*/cm:advancedSettings">
  249. <xsl:with-param name="form-read-only" select="$form-read-only"/>
  250. </xsl:apply-templates>
  251. </xsl:when>
  252. <xsl:otherwise>
  253. <xsl:apply-templates select="/root/cm:queryResponse/*/cm:advancedSettings">
  254. <xsl:with-param name="form-read-only" select="$form-read-only"/>
  255. </xsl:apply-templates>
  256. </xsl:otherwise>
  257. </xsl:choose>
  258. </lyt:section>
  259. </lyt:layout>
  260. <dp:footer>
  261. <xsl:choose>
  262. <xsl:when test="$form-read-only = 'true'">
  263. <df:button df:id="IDS_CLOSE" df:style="stack-down"/>
  264. </xsl:when>
  265. <xsl:otherwise>
  266. <df:button df:id="IDS_OK" utml:validate="true" df:style="stack-down-save"/>
  267. <df:button df:id="IDS_CANCEL" df:style="stack-down"/>
  268. </xsl:otherwise>
  269. </xsl:choose>
  270. </dp:footer>
  271. </utml:form>
  272. </dp:page>
  273. </xsl:template>
  274. <xsl:template match="cm:advancedSettings">
  275. <xsl:param name="form-read-only"/>
  276. <xsl:variable name="settings" select="."/>
  277. <xsl:choose>
  278. <xsl:when test="$form-read-only = 'true'">
  279. <cp:table name="entries" iterate="/root/counter/*" width="100%">
  280. <cp:tableHeader>
  281. <cp:columnHeader width="50%" id="lbl_entries_name"><xts:string id="IDS_ADV_NAME"/></cp:columnHeader>
  282. <cp:columnHeader width="50%" id="lbl_entries_value"><xts:string id="IDS_ADV_VALUE"/></cp:columnHeader>
  283. </cp:tableHeader>
  284. <cp:tableContent>
  285. <xsl:variable name="position" select="position()"/>
  286. <cp:columnContent>
  287. <utml:input type="text" style="width:95%" aria-labelledby="lbl_entries_name">
  288. <utml:name><xsl:value-of select="concat('m_pa_n', position())"/></utml:name>
  289. <utml:value><xsl:value-of select="$settings/cm:settings/cm:setting[position()=$position]/@name"/></utml:value>
  290. </utml:input>
  291. </cp:columnContent>
  292. <cp:columnContent>
  293. <utml:input type="text" style="width:95%" aria-labelledby="lbl_entries_value">
  294. <utml:name><xsl:value-of select="concat('m_pa_v', position())"/></utml:name>
  295. <utml:value><xsl:value-of select="$settings/cm:settings/cm:setting[position()=$position]"/></utml:value>
  296. </utml:input>
  297. </cp:columnContent>
  298. </cp:tableContent>
  299. </cp:table>
  300. </xsl:when>
  301. <xsl:otherwise>
  302. <cp:table name="entries" iterate="/root/counter/*" width="100%">
  303. <cp:tableHeader>
  304. <cp:columnHeader width="16" toggleName="checkbox_" utml="utml" noLabel="true"/>
  305. <cp:columnHeader width="50%" id="lbl_entries_name"><xts:string id="IDS_ADV_NAME"/></cp:columnHeader>
  306. <cp:columnHeader width="50%" id="lbl_entries_value"><xts:string id="IDS_ADV_VALUE"/></cp:columnHeader>
  307. </cp:tableHeader>
  308. <cp:tableContent>
  309. <xsl:variable name="position" select="position()"/>
  310. <cp:columnContent>
  311. <utml:input type="checkbox">
  312. <xsl:attribute name="aria-label"><xts:string id="IDS_SELECTION_FOR_PAGER_ITEM" encode="html"><xts:param name="pagerItemName"><xsl:value-of select="$position"/></xts:param></xts:string></xsl:attribute>
  313. <utml:value>
  314. <xsl:value-of select="local-name()"/>
  315. </utml:value>
  316. <utml:name>
  317. <xsl:value-of select="concat('checkbox_', $position)"/>
  318. </utml:name>
  319. </utml:input>
  320. </cp:columnContent>
  321. <cp:columnContent>
  322. <utml:input type="text" style="width:95%" aria-labelledby="lbl_entries_name">
  323. <utml:name><xsl:value-of select="concat('m_pa_n', $position)"/></utml:name>
  324. <utml:value>
  325. <xsl:if test="key('env-param','m_obj')!='/configuration' or key('env-param','resetroot_advancedSettings') != '1'">
  326. <xsl:value-of select="$settings/cm:settings/cm:setting[position()=$position]/@name"/>
  327. </xsl:if>
  328. </utml:value>
  329. </utml:input>
  330. </cp:columnContent>
  331. <cp:columnContent>
  332. <utml:input type="text" style="width:95%" aria-labelledby="lbl_entries_value">
  333. <utml:name><xsl:value-of select="concat('m_pa_v', $position)"/></utml:name>
  334. <utml:value>
  335. <xsl:if test="key('env-param','m_obj')!='/configuration' or key('env-param','resetroot_advancedSettings') != '1'">
  336. <xsl:value-of select="$settings/cm:settings/cm:setting[position()=$position]"/>
  337. </xsl:if>
  338. </utml:value>
  339. </utml:input>
  340. </cp:columnContent>
  341. </cp:tableContent>
  342. <cp:action>
  343. <a href="javascript:clearChecked()">
  344. <xsl:text/><xts:string id="IDS_ADV_CLEAR_CHECKED"/><xsl:text/>
  345. </a>
  346. </cp:action>
  347. </cp:table>
  348. </xsl:otherwise>
  349. </xsl:choose>
  350. </xsl:template>
  351. </xsl:stylesheet>
  352. </xts:block>
  353. <!-- Debug -->
  354. <xts:block id="debug" type="exec" dependency="format" mode="output" condition=".[ /root/session/param[@name='debug'] = '1' ]" processor="XSLT" mandatory="false" mimeType="text/html" >
  355. <xts:logicsheet path="logicsheets/debuglogic.xslt"/>
  356. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:dbg="http://developer.cognos.com/schemas/xts/logicsheets/xslt/debug/" exclude-result-prefixes="dbg">
  357. <xsl:output method="html" version="1.0" encoding="UTF-8" indent="no" omit-xml-declaration="yes"/>
  358. <dbg:templates/>
  359. <xsl:template match="/">
  360. <dbg:dumpxml select="/root"/>
  361. </xsl:template>
  362. </xsl:stylesheet>
  363. </xts:block>
  364. </xts:morphlet>