properties_capabilities.xts 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378
  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/" xmlns:cml="http://developer.cognos.com/schemas/xts/logic-sheet/xslt/cml/1/" xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/" messageBase="messages/portal.xml, messages/portalRL.xml">
  13. <!--
  14. ===============================================================================================
  15. formlogic_init
  16. Standard form logic initialization
  17. ===============================================================================================
  18. -->
  19. <xts:block id="formlogic_init" type="exec" mode="interpret" processor="XSLT" path="/logicsheets/formlogic_init.xslt" nodelist="env,credential,system,http"/>
  20. <!-- Load object-specific property tabs map ============================================================== -->
  21. <xts:block id="getTabs" type="exec" mode="interpret" processor="XML" path="/portal/uiobjects_tabs.xml"/>
  22. <!--
  23. ================================================================================
  24. get_content
  25. Retrieve the object details from Content Manager.
  26. ================================================================================
  27. -->
  28. <xts:block id="get_content" processor="XSLT" type="exec" mode="interpret">
  29. <xts:logicsheet path="logicsheets/buslogic.xslt"/>
  30. <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:xtsext="xalan://com.cognos.xts.ext.XTSExt">
  31. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  32. <xsl:key name="env-param" match="/root/env/param" use="@name"/>
  33. <xsl:template match="/">
  34. <xts:sequence>
  35. <xts:append>
  36. <xts:transform src="transforms/CM/post-process.xslt" processor="XSLT">
  37. <send:request provider="cm">
  38. <xts:transform src="transforms/CM/pre-process.xslt" processor="XSLT">
  39. <query xmlns="http://developer.cognos.com/schemas/xts-cm/1/">
  40. <search>
  41. <xsl:value-of select="key('env-param','m_obj')"/>
  42. <xsl:text>[permission('setPolicy')]</xsl:text>
  43. </search>
  44. <properties>
  45. <cm:property name="permissions"/>
  46. <cm:property name="storeID"/>
  47. <cm:property name="userCapabilityPolicies"/>
  48. <xsl:if test="/root/env/param[@name='m_class'] = 'package'">
  49. <cm:property name="userInterfaces"/>
  50. </xsl:if>
  51. </properties>
  52. <options schemaInfo="true"/>
  53. </query>
  54. </xts:transform>
  55. </send:request>
  56. </xts:transform>
  57. </xts:append>
  58. </xts:sequence>
  59. </xsl:template>
  60. </xsl:stylesheet>
  61. </xts:block>
  62. <!--
  63. ================================================================================
  64. render_page
  65. Render the HTML page.
  66. ================================================================================
  67. -->
  68. <xts:block id="render_page" mode="output" processor="XSLT" type="exec" mimeType="text/html" dependency="get_content formlogic_init getTabs">
  69. <!-- portal specific information -->
  70. <xts:logicsheet path="logicsheets/portal.xsl"/>
  71. <!-- get the presentation theme -->
  72. <xts:logicsheet path="logicsheets/presentation/dialog/framework.xsl"/>
  73. <xts:logicsheet path="logicsheets/presentation/layout.xsl"/>
  74. <xts:logicsheet path="logicsheets/presentation/dialog/presentation.xsl"/>
  75. <xts:logicsheet path="logicsheets/presentation/dialog/confirm.xslt"/>
  76. <xts:logicsheet path="logicsheets/presentation/controls/framework.xsl"/>
  77. <xts:logicsheet path="logicsheets/presentation/controls/presentation.xsl"/>
  78. <!-- apply the form logic -->
  79. <xts:logicsheet path="logicsheets/formlogic.xslt"/>
  80. <xts:logicsheet path="logicsheets/validation.xslt"/> <xts:logicsheet path="logicsheets/presentation/touch_up.xslt"/>
  81. <xsl:stylesheet version="1.0"
  82. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  83. xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/"
  84. xmlns:pf="http://developer.cognos.com/schemas/xts/pf"
  85. xmlns:lyt="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/layout/"
  86. xmlns:dp="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/dialog/presentation/"
  87. xmlns:df="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/dialog/framework/"
  88. xmlns:dc="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/dialog/confirm/1/"
  89. xmlns:utml="http://developer.cognos.com/schemas/xts/logicsheet/xslt/formlogic/"
  90. xmlns:cf="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/controls/framework/"
  91. xmlns:cp="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/controls/presentation/"
  92. xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt" exclude-result-prefixes="xts cml xsl cm pf df dp dc lyt utml cp cf xtsext">
  93. <xsl:output method="html" version="1.0" encoding="UTF-8" indent="no" omit-xml-declaration="yes"/>
  94. <!-- current file name -->
  95. <xsl:variable name="mname" select="'properties_capabilities.xts'"/>
  96. <!-- add any theme variables -->
  97. <pf:variables/>
  98. <xsl:variable name="object" select="/root/cm:queryResponse/*"/>
  99. <!-- start the output -->
  100. <xsl:template match="/root">
  101. <!-- get passed in parameters -->
  102. <xsl:variable name="canWrite" select="contains(concat(' ',$object/cm:permissions,' '),' write ')"/>
  103. <xsl:variable name="canSetPolicy" select="contains(concat(' ', $object/cm:permissions, ' '), ' setPolicy ')"/>
  104. <xsl:variable name="showOKCancel" select="$canWrite or $canSetPolicy"/>
  105. <xsl:variable name="browserTitle">
  106. <xts:string id="IDS_PROPERTIES_TITLE">
  107. <xts:param name="objectName">
  108. <span lang="{$contentLocale}"><xsl:value-of select="xtsext:enforceBTD(/root/env/param[@name='m_name'], $baseTextDirection, $productLocale, boolean($isBidiEnabled='true'))"/></span>
  109. </xts:param>
  110. </xts:string>
  111. </xsl:variable>
  112. <xsl:text disable-output-escaping='yes'>&lt;!DOCTYPE html></xsl:text><dp:page longTitle="$browserTitle">
  113. <dp:meta>
  114. <!-- Standard meta tags -->
  115. <pf:meta/>
  116. </dp:meta>
  117. <dp:script>
  118. <!-- Help system -->
  119. <pf:help context="HID_PACKAGE_CAPABILITIES"/>
  120. <xsl:if test="$canWrite">
  121. <script language="JavaScript">
  122. function confirmCancel()
  123. {
  124. var confirmationRequired = false;
  125. var form = document.pform;
  126. var isDirty = com.cognos.admin.publicParam.states["CAPABILITY_EDITOR"].isDirty;
  127. if (!isDirty) {
  128. var isAcquired = <xsl:value-of select="$object/cm:userCapabilityPolicies/@acquired"/>;
  129. isDirty = isAcquired != com.cognos.admin.publicParam.states["CAPABILITY_EDITOR"].acquired;
  130. }
  131. if (isDirty == true) {
  132. confirmationRequired = true;
  133. }
  134. else {
  135. for (var i = 0; i &lt; form.length; i++) {
  136. if (form.elements[i] &amp;&amp; form.elements[i].name &amp;&amp; form.elements[i].name.indexOf(&apos;changed_&apos;) == 0 &amp;&amp; form.elements[i].value &amp;&amp; form.elements[i].value == &apos;1&apos;) {
  137. confirmationRequired = true;
  138. break;
  139. }
  140. }
  141. }
  142. if (confirmationRequired == true)
  143. {
  144. return window.confirm("<xts:string id="IDS_PROP_CANCEL_CONFIRM" encode="javascript"/>");
  145. }
  146. else
  147. {
  148. return true;
  149. }
  150. }
  151. </script>
  152. <script language="javascript" src="{$webcontent}/{$app}/js/utilities.js"/>
  153. </xsl:if>
  154. </dp:script>
  155. <utml:form name="pform" method="post" action="{$gateway}">
  156. <utml:read-only>
  157. <xsl:choose>
  158. <xsl:when test="$canWrite">false</xsl:when>
  159. <xsl:otherwise>true</xsl:otherwise>
  160. </xsl:choose>
  161. </utml:read-only>
  162. <!--
  163. this defines the form command operation to be performed when all the collected properties are submitted.
  164. -->
  165. <utml:input type="hidden" name="ifrmcmd" value="save" utml:update="false"/>
  166. <!-- dialog header -->
  167. <dp:header useBackURL="not($showOKCancel)">
  168. <!-- header titles-->
  169. <dp:title>
  170. <xsl:copy-of select="$browserTitle"/>
  171. </dp:title>
  172. </dp:header>
  173. <!-- property tabs -->
  174. <df:propertiesTabs select="capabilities">
  175. <df:hasSetPolicy>
  176. <xsl:value-of select="$canSetPolicy"/>
  177. </df:hasSetPolicy>
  178. </df:propertiesTabs>
  179. <xsl:call-template name="create-fragment-UI">
  180. <xsl:with-param name="form-read-only" select="$form-read-only"/>
  181. </xsl:call-template>
  182. <dp:footer>
  183. <xsl:choose>
  184. <xsl:when test="$showOKCancel">
  185. <df:button df:id="IDS_OK" utml:validate="true" df:style="submit"/>
  186. <xsl:choose>
  187. <xsl:when test="key('env-param', 'ps_nav_stack') and not(key('env-param', 'ps_nav_stack') = '') ">
  188. <df:button df:id="IDS_CANCEL" df:style="stack-down" onclick="{$dc-confirm-cancel}"/>
  189. </xsl:when>
  190. <xsl:otherwise>
  191. <df:button df:id="IDS_CANCEL" df:style="back-url" onclick="{$dc-confirm-cancel}"/>
  192. </xsl:otherwise>
  193. </xsl:choose>
  194. </xsl:when>
  195. <xsl:otherwise>
  196. <df:button df:id="IDS_CLOSE" df:style="back-url"/>
  197. </xsl:otherwise>
  198. </xsl:choose>
  199. </dp:footer>
  200. </utml:form>
  201. </dp:page>
  202. </xsl:template>
  203. <!-- Generate all the markup necessary to embed the capabilities fragment in the property page -->
  204. <xsl:template name="create-fragment-UI">
  205. <xsl:param name="form-read-only"/>
  206. <script type="text/javascript">
  207. _F_Config = new Object();
  208. _F_Config.init = function(){
  209. this.gateway = "<xsl:value-of select="$gateway"/>";
  210. this.application = "/cogadmin";
  211. this.webContent = "<xsl:value-of select="$webRoot"/>";
  212. };
  213. _F_Config.init();
  214. var contextPath = _F_Config.webContent;
  215. </script>
  216. <script type="text/javascript" src="{ $gateway }/dashboard/messages/messages/pfmessages?section=JS"/>
  217. <script type="text/javascript" src="{ $webRoot }/dojo16/dojo/dojo.js"/>
  218. <script type="text/javascript" src="{ $webRoot }/fragments/xdojo/core.js"/>
  219. <script type="text/javascript" src="{ $webRoot }/fragments/fragments.js"/>
  220. <script type="text/javascript" src="{ $webRoot }/common/framework/validator/CValidator.js"/>
  221. <script type="text/javascript" src="{ $webRoot }/fragments/uicommon.js"/>
  222. <script type="text/javascript">
  223. var myfragEditor = null;
  224. var divEditor = null;
  225. function validate()
  226. {
  227. saveFragmentState();
  228. var callbackEnv = com.cognos.admin.publicParam.callbackEnv;
  229. if (callbackEnv){
  230. var privileges = new com.cognos.admin.extension.Privileges (callbackEnv);
  231. if (privileges.getUnsetEntries()) {
  232. return window.confirm("<xts:string id="IDS_PROP_CAPABILITIES_DELETE_USER_CONFIRM" encode="javascript"/>");
  233. }
  234. // alert user that if no entries are selected that policies will be acquired from the parent
  235. if (!privileges.privileges || privileges.privileges.length == 0) {
  236. return (window.confirm("<xts:string id="IDS_PROP_PERMISSIONS_SWITCH_CONFIRM" encode="javascript"/>"))
  237. }
  238. }
  239. return true;
  240. }
  241. function saveFragmentState()
  242. {
  243. var f = document.pform;
  244. f.m_userCapabilityPolicies_fragstate.value = myfragEditor.state;
  245. f.m_userCapabilityPolicies_overridePolicy.value = $("CAPABILITY_EDITORoverridePolicy").checked;
  246. f.m_userCapabilityPolicies_replace.value = $("CAPABILITY_EDITORclearChildPolicies").checked;
  247. f.m_userCapabilityPolicies_JSON.value = com.cognos.admin.util.Tools.JSON.stringify(com.cognos.admin.publicParam.states["CAPABILITY_EDITOR"].privileges);
  248. }
  249. function fragContentDiv(sId)
  250. {
  251. var div = document.createElement("DIV");
  252. div.id = sId;
  253. div.className = "boxBody";
  254. div.style.position = "absolute";
  255. div.style.width = "100%";
  256. div.style.height = "400px";
  257. div.style.overflow = "auto";
  258. document.body.appendChild(div);
  259. var waitDiv = ui_templates.get(
  260. ui_templates.contentTemplate,
  261. 'CONTENTID', 'CAPABILITY_EDITORcontent',
  262. 'CONTENTCLASS', 'cogstyle-htabs-page-content'
  263. );
  264. div.innerHTML = waitDiv;
  265. return div;
  266. }
  267. function fragResize()
  268. {
  269. _F_log("I", "resize");
  270. var viewArea = $("myfragdisplay");
  271. var cy = document.body.clientHeight;
  272. cy = Math.max(cy - 150, 400);
  273. xHeight(viewArea, cy);
  274. var x = xPageX(viewArea);
  275. var y = xPageY(viewArea);
  276. var w = xWidth(viewArea) - 5;
  277. var h = xHeight(viewArea);
  278. xResizeTo(divEditor, w, h);
  279. xShow(divEditor);
  280. viewArea.appendChild(divEditor);
  281. if (myfragEditor.onresize) {
  282. myfragEditor.onresize();
  283. }
  284. }
  285. function fragInit()
  286. {
  287. <xsl:variable name="hide-string"><xts:string id="IDS_FRAG_HIDE"/></xsl:variable>
  288. ui_error.prototype.template = "\&lt;div id=\"_THIS_errormsg\"\&gt;\&lt;/div\&gt;\&lt;div\&gt;" +
  289. "\&lt;a id=\"_THIS_error_showdetails\"\&gt;<xts:string id="IDS_FRAG_ERROR_SHOW_DETAILS" encode="javascript"/>\&lt;/a\&gt; | " +
  290. "\&lt;a id=\"_THIS_error_retry\"\&gt;<xts:string id="IDS_FRAG_ERROR_RETRY" encode="javascript"/>\&lt;/a\&gt; | " +
  291. "<xts:string id="IDS_FRAG_HIDE_MESSAGE" encode="javascript"><xts:param name="0">\&lt;a id=\"_THIS_error_hide\"\&gt;<xsl:value-of select="$hide-string"/>\&lt;/a\&gt;</xts:param></xts:string>" +
  292. "\&lt;/div\&gt;";
  293. _F_init();
  294. divEditor = fragContentDiv("CAPABILITY_EDITORcontent");
  295. myfragEditor = new fragment("/fragmentproducer/cogadmin/policy/capabilities", "CAPABILITY_EDITOR");
  296. var params = "object=<xsl:value-of select="xtsext:urlencode($object/cm:storeID)"/>";
  297. <xsl:if test="key('env-param', 'm_userCapabilityPolicies_JSON')!= ''">
  298. params += "&amp;privileges=<xsl:value-of select="xtsext:urlencode(key('env-param', 'm_userCapabilityPolicies_JSON'))" disable-output-escaping="yes"/>";
  299. </xsl:if>
  300. <xsl:choose>
  301. <xsl:when test="key('env-param', 'm_userCapabilityPolicies_overridePolicy')='false'">
  302. params += "&amp;acquired=true";
  303. </xsl:when>
  304. <xsl:when test="key('env-param', 'm_userCapabilityPolicies_overridePolicy')='true'">
  305. params += "&amp;acquired=false";
  306. </xsl:when>
  307. </xsl:choose>
  308. <xsl:if test="key('env-param', 'm_userCapabilityPolicies_replace')='true'">
  309. params += "&amp;deleteChildPolicies=true";
  310. </xsl:if>
  311. <xsl:if test="key('env-param', 'm_userCapabilityPolicies_fragstate')!=''">
  312. params += "&amp;frag-state=<xsl:value-of select="xtsext:urlencode(key('env-param', 'm_userCapabilityPolicies_fragstate'))" disable-output-escaping="yes"/>";
  313. </xsl:if>
  314. myfragEditor.retrieve(params);
  315. fragResize();
  316. xAddEventListener(window, "resize", fragResize);
  317. }
  318. xAddEventListener(window, "load", fragInit);
  319. </script>
  320. <table cellspacing="0" cellpadding="3" border="0" width="100%" role="presentation">
  321. <tbody>
  322. <tr>
  323. <td height="1" width="1"/>
  324. <td width="100%">
  325. <div id="myfragdisplay" style="width: 100%; height: 400px;"/>
  326. </td>
  327. </tr>
  328. </tbody>
  329. </table>
  330. <utml:input type="hidden" name="m_userCapabilityPolicies_overridePolicy"/>
  331. <utml:input type="hidden" name="m_userCapabilityPolicies_JSON"/>
  332. <utml:input type="hidden" name="m_userCapabilityPolicies_replace"/>
  333. <utml:input type="hidden" name="m_userCapabilityPolicies_fragstate"/>
  334. </xsl:template>
  335. </xsl:stylesheet>
  336. </xts:block>
  337. <!--
  338. ===============================================================================================
  339. debug - display debug information
  340. ===============================================================================================
  341. -->
  342. <xts:block id="debug" dependency="render_page" condition=".[/root/session/param[@name='debug']='1']" type="exec" mode="output" processor="XSLT" mandatory="false" mimeType="text/html">
  343. <!-- get the debug logic sheet -->
  344. <xts:logicsheet path="logicsheets/debuglogic.xslt"/>
  345. <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">
  346. <xsl:output method="html" version="1.0" encoding="UTF-8" indent="no" omit-xml-declaration="yes"/>
  347. <xsl:template match="/">
  348. <dbg:dumpxml select="/root"/>
  349. </xsl:template>
  350. </xsl:stylesheet>
  351. </xts:block>
  352. </xts:morphlet>