settings_booleanoverride_options.xts 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289
  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, 2013
  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="serviceDefaultOptions"/>
  34. <cm:property name="overrideOptions"/>
  35. <cm:property name="permissions"/>
  36. </cm:properties>
  37. </cm:query>
  38. </xts:transform>
  39. </send:request>
  40. </xts:transform>
  41. </xts:append>
  42. </xts:sequence>
  43. </xsl:template>
  44. </xsl:stylesheet>
  45. </xts:block>
  46. <xts:block id="render" mode="output" processor="XSLT" type="exec" dependency="getContent formlogic_init" mimeType="text/html">
  47. <xts:logicsheet path="logicsheets/portal.xsl"/>
  48. <xts:logicsheet path="logicsheets/presentation/dialog/templates.xsl"/>
  49. <xts:logicsheet path="logicsheets/presentation/dialog/framework.xsl"/>
  50. <xts:logicsheet path="logicsheets/presentation/layout.xsl"/>
  51. <xts:logicsheet path="logicsheets/presentation/dialog/presentation.xsl"/>
  52. <xts:logicsheet path="logicsheets/presentation/controls/framework.xsl"/>
  53. <xts:logicsheet path="logicsheets/presentation/controls/presentation.xsl"/>
  54. <xts:logicsheet path="logicsheets/formlogic.xslt"/>
  55. <xts:logicsheet path="logicsheets/validation.xslt"/>
  56. <xts:logicsheet path="logicsheets/presentation/touch_up.xslt"/>
  57. <xsl:stylesheet version="1.0"
  58. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  59. xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/"
  60. xmlns:pf="http://developer.cognos.com/schemas/xts/pf"
  61. xmlns:lyt="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/layout/"
  62. xmlns:dp="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/dialog/presentation/"
  63. xmlns:df="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/dialog/framework/"
  64. xmlns:cf="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/controls/framework/"
  65. xmlns:cp="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/controls/presentation/"
  66. xmlns:dt="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/dialog/templates/"
  67. xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt"
  68. xmlns:utml="http://developer.cognos.com/schemas/xts/logicsheet/xslt/formlogic/"
  69. xmlns:form="http://developer.cognos.com/schemas/xts/portal/iFrmCmd/1/"
  70. exclude-result-prefixes="xsl cm pf lyt dp df cf cp utml xts xtsext">
  71. <xsl:output method="html" version="1.0" encoding="UTF-8" indent="no" omit-xml-declaration="yes"/>
  72. <!-- Global variables ======================== -->
  73. <pf:variables/>
  74. <xsl:variable name="mname" select="'actions.xts'"/>
  75. <!-- These vars are required by global templates that generate an icon and a url for a CM entry -->
  76. <xsl:variable name="back-url" select="string(key('env-param', 'backURL'))"/>
  77. <xsl:variable name="cmd-form" select="'pform'"/>
  78. <xsl:variable name="edit-form" select="'pform'"/>
  79. <!-- start the output -->
  80. <xsl:template match="/root">
  81. <xsl:variable name="booleanType">
  82. <xsl:value-of select="key('env-param', 'm_bool_type')"/>
  83. </xsl:variable>
  84. <xsl:variable name="booleanLabel">
  85. <xsl:variable name="label" select="key('env-param', 'm_bool_label')"/>
  86. <xsl:choose>
  87. <xsl:when test="$label!=''">
  88. <xsl:value-of select="$label"/>
  89. </xsl:when>
  90. <xsl:otherwise>
  91. <xsl:value-of select="$booleanType"/>
  92. </xsl:otherwise>
  93. </xsl:choose>
  94. </xsl:variable>
  95. <xsl:variable name="has_write_permission" select="contains(concat(' ', /root/cm:queryResponse/*/cm:permissions, ' '), ' write ')"/>
  96. <xsl:variable name="browserTitle">
  97. <xts:string id="IDS_BOO_TITLE"><xts:param name="type"><xsl:value-of select="$booleanLabel"/></xts:param><xts:param name="objectName"><span lang="{$contentLocale}"><xsl:value-of select="key('env-param', 'm_name')"/></span></xts:param></xts:string>
  98. </xsl:variable>
  99. <xsl:text disable-output-escaping='yes'>&lt;!DOCTYPE html></xsl:text><dp:page longTitle="$browserTitle">
  100. <dp:meta>
  101. <pf:meta/><!-- Standard meta tags -->
  102. </dp:meta>
  103. <dp:script>
  104. <pf:help context=""/> <!-- Help system -->
  105. <script language="javascript">
  106. function validate() {
  107. //Delete the CM derived inputs related to the current editor context.We'll recreate them during the js validate() based on the new values.
  108. deleteInputs('serviceDefaultOptions_');
  109. deleteInputs('overrideOptions_');
  110. deleteInputs('resetroot_optionArrayProp_');
  111. var overrideDisabled = document.getElementById("custom").checked;
  112. var boolValue = document.getElementById("always").checked || ((!document.getElementById("optBoolOverrideSelected").disabled) &amp;&amp; document.getElementById("optBoolOverrideSelected").value=='true')
  113. populateInput('serviceDefaultOptions',boolValue);
  114. if (!overrideDisabled) {
  115. populateInput('overrideOptions',boolValue);
  116. }
  117. return true;
  118. }
  119. function toggleOverride(isDisabled) {
  120. document.getElementById("optBoolOverrideSelected").disabled = isDisabled;
  121. }
  122. function createInput(name,value) {
  123. var input = document.createElement("INPUT");
  124. input.setAttribute("type","hidden");
  125. input.setAttribute("name",name);
  126. input.setAttribute("value",value);
  127. pform.appendChild(input);
  128. return input;
  129. }
  130. function deleteInputs(inputName) {
  131. var inputs = document.getElementsByName(inputName+'<xsl:value-of select="xtsext:javascriptencode($booleanType)"/>');
  132. while (inputs.length>0) {
  133. var input = inputs[inputs.length-1];
  134. input.parentNode.removeChild(input);
  135. }
  136. }
  137. function populateInput(optionType, value) {
  138. var inputName = optionType + '_<xsl:value-of select="xtsext:javascriptencode($booleanType)"/>';
  139. createInput(inputName,value);
  140. }
  141. </script>
  142. </dp:script>
  143. <utml:form name="pform" method="post" action="{$gateway}">
  144. <utml:read-only>
  145. <xsl:choose>
  146. <xsl:when test="not($has_write_permission)">true</xsl:when>
  147. <xsl:otherwise>false</xsl:otherwise>
  148. </xsl:choose>
  149. </utml:read-only>
  150. <utml:exclusion-list>
  151. <xsl:value-of select="concat($booleanType,'m_opt_bool_choice_override_selected')"/>
  152. </utml:exclusion-list>
  153. <!-- dialog header -->
  154. <dp:header>
  155. <!-- header titles-->
  156. <dp:title showName="false"><xsl:copy-of select="$browserTitle"/></dp:title>
  157. <dp:description>
  158. <label id="ctrl_{concat('m_opt_bool_',$booleanType)}_radioGroup"><xts:string id="IDS_BOO_INTRO"><xts:param name="type"><xsl:value-of select="$booleanLabel"/></xts:param><xts:param name="objectName"><xsl:value-of select="key('env-param', 'm_name')"/></xts:param></xts:string></label>
  159. </dp:description>
  160. </dp:header>
  161. <xsl:variable name="bool_overrideOptions" select="/root/env/param[@name=concat('overrideOptions_',$booleanType)]"/>
  162. <xsl:variable name="bool_serviceDefault" select="/root/env/param[@name=concat('serviceDefaultOptions_',$booleanType)]"/>
  163. <utml:radio-group name="choice">
  164. <utml:prefix><xsl:value-of select="concat('m_opt_bool_',$booleanType)"/></utml:prefix>
  165. <utml:default-value>
  166. <xsl:choose>
  167. <xsl:when test="$bool_overrideOptions = 'true'">
  168. <xsl:value-of select="'true'"/>
  169. </xsl:when>
  170. <xsl:when test="$bool_overrideOptions = 'false'">
  171. <xsl:value-of select="'false'"/>
  172. </xsl:when>
  173. <xsl:otherwise>
  174. <xsl:value-of select="'custom'"/>
  175. </xsl:otherwise>
  176. </xsl:choose>
  177. </utml:default-value>
  178. <dp:choice id="ctrl_{concat('m_opt_bool_',$booleanType)}_radioGroup">
  179. <dp:section1>
  180. <utml:input type="radio" value="false" id="never" onclick="toggleOverride(true)"/>
  181. <xsl:if test="$form-read-only = 'true'">
  182. <xsl:attribute name="disabled">true</xsl:attribute>
  183. </xsl:if>
  184. </dp:section1>
  185. <dp:section2>
  186. <label for="never"><xts:string id="IDS_BOO_SUPPORT_NEVER"/></label>
  187. </dp:section2>
  188. <dp:section1>
  189. <utml:input type="radio" value="true" id="always" onclick="toggleOverride(true)">
  190. <xsl:if test="$form-read-only = 'true'">
  191. <xsl:attribute name="disabled">true</xsl:attribute>
  192. </xsl:if>
  193. </utml:input>
  194. </dp:section1>
  195. <dp:section2>
  196. <label for="always"><xts:string id="IDS_BOO_SUPPORT_ALWAYS"/></label>
  197. </dp:section2>
  198. <dp:section1>
  199. <utml:input type="radio" value="custom" id="custom" onclick="toggleOverride(false)">
  200. <xsl:if test="$form-read-only = 'true'">
  201. <xsl:attribute name="disabled">true</xsl:attribute>
  202. </xsl:if>
  203. </utml:input>
  204. </dp:section1>
  205. <dp:section2>
  206. <label for="custom"><xts:string id="IDS_BOO_SUPPORT_DECIDE"/></label>
  207. </dp:section2>
  208. <dp:section1/>
  209. <dp:section2>
  210. <xsl:variable name="boolOverrideSelected"><xsl:value-of select="concat($booleanType,'m_opt_bool_choice_override_selected')"/></xsl:variable>
  211. <xsl:variable name="boolSelection" select="/root/env/param[@name=concat($booleanType,'m_opt_bool_choice')]"/>
  212. <label for="optBoolOverrideSelected"><xsl:text><xts:string id="IDS_BOO_DEFAULT"/></xsl:text></label>
  213. <utml:select id="optBoolOverrideSelected" style="margin-left:3px">
  214. <utml:name><xsl:value-of select="$boolOverrideSelected"/></utml:name>
  215. <xsl:if test="$form-read-only = 'true' or ($boolSelection and not($boolSelection='custom')) or (not($boolSelection) and count($bool_overrideOptions) = 1)">
  216. <xsl:attribute name="disabled">true</xsl:attribute>
  217. </xsl:if>
  218. <utml:option value="false">
  219. <xsl:if test="$bool_serviceDefault='false'">
  220. <xsl:attribute name="selected">selected</xsl:attribute>
  221. </xsl:if>
  222. <xts:string id="IDS_BOO_SUPPORT_ENABLE_NOT_SELECTED"/>
  223. </utml:option>
  224. <utml:option value="true">
  225. <xsl:if test="$bool_serviceDefault='true'">
  226. <xsl:attribute name="selected">selected</xsl:attribute>
  227. </xsl:if>
  228. <xts:string id="IDS_BOO_SUPPORT_ENABLE_SELECTED"/>
  229. </utml:option>
  230. </utml:select>
  231. </dp:section2>
  232. </dp:choice>
  233. </utml:radio-group>
  234. <dp:footer>
  235. <xsl:choose>
  236. <xsl:when test="$form-read-only = 'true'">
  237. <df:button df:id="IDS_CLOSE" df:style="stack-down"/>
  238. </xsl:when>
  239. <xsl:otherwise>
  240. <df:button df:id="IDS_OK" utml:validate="true" df:style="stack-down-save"/>
  241. <df:button df:id="IDS_CANCEL" df:style="stack-down"/>
  242. </xsl:otherwise>
  243. </xsl:choose>
  244. </dp:footer>
  245. </utml:form>
  246. </dp:page>
  247. </xsl:template>
  248. </xsl:stylesheet>
  249. </xts:block>
  250. <!-- Debug -->
  251. <xts:block id="debug" type="exec" dependency="render" mode="output" condition=".[ /root/session/param[@name='debug'] = '1' ]" processor="XSLT" mandatory="false" mimeType="text/html" >
  252. <xts:logicsheet path="logicsheets/debuglogic.xslt"/>
  253. <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">
  254. <xsl:output method="html" version="1.0" encoding="UTF-8" indent="no" omit-xml-declaration="yes"/>
  255. <dbg:templates/>
  256. <xsl:template match="/">
  257. <dbg:dumpxml select="/root"/>
  258. </xsl:template>
  259. </xsl:stylesheet>
  260. </xts:block>
  261. </xts:morphlet>