add_entries_cap.xts 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  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, 2011
  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. <!--
  13. ===============================================================================================
  14. USED BY Package Capabilities Page ONLY
  15. ===============================================================================================
  16. -->
  17. <xts:morphlet xmlns:xts="http://developer.cognos.com/schemas/xts/" messageBase="messages/portal.xml, messages/portalRL.xml">
  18. <!--
  19. ===============================================================================================
  20. initController - The first time this morphlet gets executed, set the controller_state to
  21. wizard_page1|markup to display the first page of the wizard.
  22. ===============================================================================================
  23. -->
  24. <xts:block id="initController" processor="XSLT" type="exec" condition=".[ not(/root/env/param[@name='controller_state']) ]" mandatory="false">
  25. <xts:logicsheet path="logicsheets/presentation/dialog/controller-templates.xsl"/>
  26. <xsl:stylesheet version="1.0"
  27. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  28. exclude-result-prefixes="xsl">
  29. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  30. <xsl:template match="/">
  31. <xts:sequence>
  32. <xts:append select="/root/env">
  33. <param name="controller_state">addEntries|navigate</param>
  34. </xts:append>
  35. </xts:sequence>
  36. </xsl:template>
  37. </xsl:stylesheet>
  38. </xts:block>
  39. <!-- ======================================================== -->
  40. <!-- Session Management -->
  41. <!-- ======================================================== -->
  42. <!-- Reads session-sensitive info from CM -->
  43. <xts:block processor="XSLT" type="exec" mandatory="false"
  44. id="refreshSession"
  45. path="portal/cc/read_session.xml"
  46. condition=".[
  47. string(/root/cookies/cookie[@name = 'cc_session']) = ''
  48. or /root/env/param[@name='m_reload']
  49. or /root/env/param[@name='m_root'] ]">
  50. <xts:logicsheet path="logicsheets/cm-logic.xsl"/>
  51. <xts:logicsheet path="logicsheets/buslogic.xslt"/>
  52. </xts:block>
  53. <!-- Update the <session> element for this request. -->
  54. <xts:block id="buildSession" path="portal/session.xml" dependency="refreshSession" processor="XSLT" type="exec"
  55. condition=".[
  56. /root/newSession
  57. or /root/env/param[@name='ui']
  58. or /root/env/param[@name='d']
  59. or /root/env/param[starts-with(@name,'m_s_')]
  60. or /root/env/param[@name = 'resetSort'] ]"
  61. mandatory="false"/>
  62. <!-- Save changes to the state info in a cookie -->
  63. <xts:block mode="interpret" processor="XSLT" type="exec"
  64. id="setSession"
  65. path="portal/set_session.xml"
  66. dependency="buildSession"
  67. condition=".[/root/updateSession]"
  68. mandatory="false"/>
  69. <!--
  70. ===============================================================================================
  71. callMorphlet - Calls the appropriate morphlet using the passed in params which will return
  72. markup to be displayed or the expected results
  73. ===============================================================================================
  74. -->
  75. <xts:block id="callMorphlet" processor="XSLT" type="exec" dependency="initController setSession" condition=".[ /root/env/param[@name='controller_state'] != '' ]" mandatory="false">
  76. <xts:logicsheet path="logicsheets/portal.xsl"/>
  77. <xts:logicsheet path="logicsheets/presentation/dialog/controller-templates.xsl"/>
  78. <xsl:stylesheet version="1.0"
  79. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  80. xmlns:dlgctrl="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/dialog/controller-templates/"
  81. xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt"
  82. xmlns:req-params="http://developer.cognos.com/schemas/request/params"
  83. exclude-result-prefixes="xsl dlgctrl xtsext req-params">
  84. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  85. <xsl:key name="request-param" match="/root/*[local-name()='requestParams']/*[local-name()='param']" use="@name"/>
  86. <xsl:template match="/">
  87. <xts:sequence>
  88. <dlgctrl:XTS2Request>
  89. <dlgctrl:target>/portal/addEntries/add_entries.xts</dlgctrl:target>
  90. <dlgctrl:stackName>addEntriesStack</dlgctrl:stackName>
  91. <req-params:param name="defaultTarget">/portal/add_entries_cap.xts</req-params:param>
  92. <req-params:param name="titlePostfix"><xsl:value-of select="/root/env/param[@name='m_name']"/></req-params:param>
  93. <req-params:param name="defaultSearchPath">/directory</req-params:param>
  94. <req-params:param name="showUsers">true</req-params:param>
  95. <req-params:param name="addEntriesUI"><xsl:value-of select="'privileges'"/></req-params:param>
  96. <req-params:param name="allowDuplicates"><xsl:value-of select="'false'"/></req-params:param>
  97. <req-params:param name="typeDialog">true</req-params:param>
  98. <req-params:param name="returnProperties">
  99. <req-params:property name="name"/>
  100. <req-params:property name="userName"/>
  101. <req-params:property name="storeID"/>
  102. <req-params:property name="iconURI"/>
  103. </req-params:param>
  104. </dlgctrl:XTS2Request>
  105. </xts:sequence>
  106. </xsl:template>
  107. </xsl:stylesheet>
  108. </xts:block>
  109. <!--
  110. ===============================================================================================
  111. processReponse - Process the response from the callMorphlet block and either displays
  112. the markup or processes the results
  113. ===============================================================================================
  114. -->
  115. <xts:block id="processResponse" path="/portal/addEntries/logicsheets/process_added_entries.xslt" processor="XSLT" dependency="callMorphlet" type="exec" condition=".[ /root/env/param[@name='controller_state'] != '' ]" mandatory="false">
  116. <xts:logicsheet path="logicsheets/presentation/dialog/controller-templates.xsl"/>
  117. <xts:logicsheet path="logicsheets/portal.xsl"/>
  118. </xts:block>
  119. <!--
  120. ================================================================================
  121. render_page - send the results back to Package Capabilities page
  122. ================================================================================
  123. -->
  124. <xts:block id="render_page" dependency="processResponse" mode="output" processor="XSLT" type="exec" mimeType="text/html" condition=".[not(/root/env/param[@name='controller_state']) or /root/env/param[@name='controller_state']='']" mandatory="false"
  125. xmlns:pf="http://developer.cognos.com/schemas/xts/pf"
  126. xmlns:cf="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/controls/framework/"
  127. xmlns:cp="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/controls/presentation/"
  128. xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/">
  129. <xts:logicsheet path="logicsheets/portal.xsl"/>
  130. <xts:logicsheet path="logicsheets/presentation/controls/framework.xsl"/>
  131. <xts:logicsheet path="logicsheets/presentation/controls/presentation.xsl"/>
  132. <xsl:stylesheet version="1.0"
  133. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  134. xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt"
  135. xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/"
  136. exclude-result-prefixes="xsl cm xtsext">
  137. <xsl:output method="html" version="1.0" encoding="UTF-8" indent="no" omit-xml-declaration="yes"/>
  138. <pf:variables/>
  139. <xsl:template match="/root">
  140. <xsl:text disable-output-escaping='yes'>&lt;!DOCTYPE html></xsl:text>
  141. <html>
  142. <head>
  143. <title>Loading Access Information</title>
  144. <script language="JavaScript">
  145. // the entries array is generated by the
  146. // server script, and populated with the
  147. // entries selected by he user in the CM wizard
  148. //
  149. function Entry()
  150. {
  151. var path;
  152. var objectClass;
  153. var defaultName;
  154. var iconURI;
  155. var key;
  156. }
  157. var g_vEntries = new Array();
  158. <xsl:for-each select="/root/newEntries/*">
  159. <xsl:variable name="fullPath">
  160. <cf:do-the-path-link>
  161. <cf:param name="familytree">*[local-name()='ancestors']</cf:param>
  162. <cf:param name="familymember">*[local-name()='defaultName']</cf:param>
  163. <cf:param name="onlyAncestors">true</cf:param>
  164. </cf:do-the-path-link>
  165. </xsl:variable>
  166. <xsl:variable name="i" select="position()-1"/>
  167. g_vEntries[<xsl:value-of select="$i"/>] = new Entry();
  168. g_vEntries[<xsl:value-of select="$i"/>].key = '<xsl:value-of select="xtsext:javascriptencode(string(*[local-name()='storeID']))"/>';
  169. g_vEntries[<xsl:value-of select="$i"/>].objectClass = '<xsl:value-of select="xtsext:javascriptencode(string(*[local-name()='objectClass']))"/>';
  170. g_vEntries[<xsl:value-of select="$i"/>].path = '<xsl:value-of select="xtsext:javascriptencode(string($fullPath))"/>';
  171. g_vEntries[<xsl:value-of select="$i"/>].iconURI = '<xsl:value-of select="xtsext:javascriptencode(string(*[local-name()='iconURI']))"/>';
  172. g_vEntries[<xsl:value-of select="$i"/>].defaultName = '<xsl:value-of select="xtsext:javascriptencode(string(*[local-name()='defaultName']))"/>';
  173. </xsl:for-each>
  174. <![CDATA[
  175. // function that passes the information from the g_vEntries array
  176. // to the container application
  177. parent.ui_modal_dialog.close();
  178. if (g_vEntries.length > 0){
  179. var callbackEnv = parent.com.cognos.admin.publicParam.callbackEnv;
  180. if (callbackEnv){
  181. var privileges = new parent.com.cognos.admin.extension.Privileges (callbackEnv);
  182. privileges.addEntries(g_vEntries);
  183. }
  184. }
  185. ]]>
  186. </script>
  187. </head>
  188. <body>
  189. </body>
  190. </html>
  191. </xsl:template>
  192. </xsl:stylesheet>
  193. </xts:block>
  194. <!-- <xts:block id="debug" type="exec" mode="output" processor="XSLT" mimeType="text/html" dependency="render_page processResponse">
  195. <xts:logicsheet path="logicsheets/debuglogic.xslt"/>
  196. <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">
  197. <xsl:output method="html" version="1.0" encoding="UTF-8" indent="no"/>
  198. <xsl:template match="/">
  199. <dbg:dumpxml select="/root"/>
  200. </xsl:template>
  201. </xsl:stylesheet>
  202. </xts:block> -->
  203. </xts:morphlet>