add_entries.xts 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276
  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 FM 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.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="'members'"/></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="fromFM">true</req-params:param>
  99. <req-params:param name="returnProperties">
  100. <req-params:property name="name"/>
  101. <req-params:property name="userName"/>
  102. <req-params:property name="storeID"/>
  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 FM
  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 type;
  153. var names;
  154. var userName;
  155. var displayPath;
  156. }
  157. function MultilingualName()
  158. {
  159. var lang;
  160. var name;
  161. }
  162. var g_vEntries = new Array();
  163. <xsl:for-each select="/root/newEntries/*">
  164. <xsl:variable name="fullPath">
  165. <cf:do-the-path-link>
  166. <cf:param name="familytree">*[local-name()='ancestors']</cf:param>
  167. <cf:param name="familymember">*[local-name()='defaultName']</cf:param>
  168. <cf:param name="onlyAncestors">true</cf:param>
  169. </cf:do-the-path-link>
  170. </xsl:variable>
  171. <xsl:variable name="i" select="position()-1"/>
  172. g_vEntries[<xsl:value-of select="$i"/>] = new Entry();
  173. <xsl:choose>
  174. <xsl:when test="key('env-param','storeID')='true'">
  175. g_vEntries[<xsl:value-of select="$i"/>].path = '<xsl:value-of select="xtsext:javascriptencode(string(*[local-name()='storeID']))"/>';
  176. </xsl:when>
  177. <xsl:otherwise>
  178. g_vEntries[<xsl:value-of select="$i"/>].path = '<xsl:value-of select="xtsext:javascriptencode(string(*[local-name()='searchPath']))"/>';
  179. </xsl:otherwise>
  180. </xsl:choose>
  181. g_vEntries[<xsl:value-of select="$i"/>].type = '<xsl:value-of select="xtsext:javascriptencode(string(*[local-name()='objectClass']))"/>';
  182. g_vEntries[<xsl:value-of select="$i"/>].userName = '<xsl:value-of select="xtsext:javascriptencode(string(*[local-name()='userName']))"/>';
  183. g_vEntries[<xsl:value-of select="$i"/>].displayPath = '<xsl:value-of select="xtsext:javascriptencode(string($fullPath))"/>';
  184. g_vEntries[<xsl:value-of select="$i"/>].names = new Array();
  185. g_vEntries[<xsl:value-of select="$i"/>].names[0] = new MultilingualName();
  186. g_vEntries[<xsl:value-of select="$i"/>].names[0].lang = '<xsl:value-of select="xtsext:javascriptencode(string($contentLocale))"/>';
  187. g_vEntries[<xsl:value-of select="$i"/>].names[0].name = '<xsl:value-of select="xtsext:javascriptencode(string(*[local-name()='defaultName']))"/>';
  188. </xsl:for-each>
  189. <![CDATA[
  190. // function that passes the information from the g_vEntries array
  191. // to the container application
  192. function OnPageLoaded()
  193. {
  194. var ext = window.external;
  195. if (!ext || (ext.Signature != "BMT-CMAccessDlg" && ext.Signatue != "TrCMAccessDlg"))
  196. return;
  197. for (var i = 0; i < g_vEntries.length; i++)
  198. {
  199. var e = g_vEntries[i];
  200. var nExtIndex = ext.AddEntry(e.path, e.type);
  201. if (-1 != nExtIndex)
  202. {
  203. for (var j = 0; j < e.names.length; j++)
  204. {
  205. ext.AddEntryName(nExtIndex, e.names[j].lang, e.names[j].name, e.userName, e.displayPath);
  206. }
  207. }
  208. }
  209. ext.OnClose(0);
  210. }
  211. ]]>
  212. </script>
  213. </head>
  214. <body onload="OnPageLoaded();" style="background-color:buttonface;border:0 solid #FFFFFF;overflow:auto;">
  215. <table width="100%" height="100%">
  216. <tr height="100%">
  217. <td align="center">
  218. <table>
  219. <tr>
  220. <td>
  221. <span style="font-family:Verdana,Tahoma,Arial;font-size:8pt;font-weight:normal;">
  222. Loading Access Information...
  223. </span>
  224. </td>
  225. </tr>
  226. </table>
  227. </td>
  228. </tr>
  229. </table>
  230. </body>
  231. </html>
  232. </xsl:template>
  233. </xsl:stylesheet>
  234. </xts:block>
  235. <!-- <xts:block id="debug" type="exec" mode="output" processor="XSLT" mimeType="text/html" dependency="render_page processResponse">
  236. <xts:logicsheet path="logicsheets/debuglogic.xslt"/>
  237. <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">
  238. <xsl:output method="html" version="1.0" encoding="UTF-8" indent="no"/>
  239. <xsl:template match="/">
  240. <dbg:dumpxml select="/root"/>
  241. </xsl:template>
  242. </xsl:stylesheet>
  243. </xts:block> -->
  244. </xts:morphlet>