personal_titan.xslt 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342
  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. 2015
  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. <xsl:stylesheet version="1.0"
  13. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  14. xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/"
  15. xmlns:pf="http://developer.cognos.com/schemas/xts/pf"
  16. xmlns:lyt="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/layout/"
  17. xmlns:dt="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/dialog/templates/"
  18. xmlns:dp="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/dialog/presentation/"
  19. xmlns:df="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/dialog/framework/"
  20. xmlns:dc="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/dialog/confirm/1/"
  21. xmlns:cp="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/controls/presentation/"
  22. xmlns:cf="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/controls/framework/"
  23. xmlns:utml="http://developer.cognos.com/schemas/xts/logicsheet/xslt/formlogic/"
  24. xmlns:out="dummy-uri"
  25. xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt"
  26. xmlns:xts="http://developer.cognos.com/schemas/xts/"
  27. xmlns:rdb="http://developer.cognos.com/schemas/xts/rdb">
  28. <xsl:output method="xml" encoding="UTF-8" indent="no"/>
  29. <xsl:namespace-alias stylesheet-prefix="out" result-prefix="xsl"/>
  30. <xsl:template match="rdb:preferences">
  31. <dt:selectDeselectAll/>
  32. <script language="javascript" src="{'{$webRoot}'}/cr1/caf.js"/>
  33. <script language="javascript">
  34. <!-- Define selectall and deselectall functions.-->
  35. function init()
  36. {
  37. if (document.pform.controller_state)
  38. document.pform.controller_state.value = "";
  39. if (isBidiEnabled)
  40. {
  41. if (typeof document.pform.m_p_email != "undefined")
  42. {
  43. document.pform.m_p_email.value = bidi.sttInjectUCCIntoStr(document.pform.m_p_email.value, 'email');
  44. }
  45. if (typeof document.pform.m_p_notificationEMail != "undefined")
  46. {
  47. document.pform.m_p_notificationEMail.value = bidi.sttInjectUCCIntoStr(document.pform.m_p_notificationEMail.value, 'email');
  48. }
  49. }
  50. <xsl:if test="@mode='preferences'">
  51. var f = document.pform;
  52. if(f.initAlert.value == 'true')
  53. {
  54. f.initAlert.value = 'false';
  55. if (f.m_p_email != null &amp;&amp; f.m_p_email.value != '' &amp;&amp; f.m_p_notificationEMail != null &amp;&amp; f.m_p_notificationEMail.value == '' )
  56. {
  57. if (confirm("<xts:string id="IDS_PERS_TAB_GENERAL_ALERT_EMAIL" encode="javascript"/>"))
  58. f.m_p_notificationEMail.value = f.m_p_email.value;
  59. }
  60. }
  61. </xsl:if>
  62. }
  63. function processModalCommand(sAction)
  64. {
  65. <!-- Set the right call back target -->
  66. var callBackTarget = <out:value-of select="$callBackTargetJSVar"/>;
  67. if( callBackTarget )
  68. {
  69. callBackTarget.<out:value-of select="$callBackFunctionName"/>(sAction, null);
  70. }
  71. }
  72. <xsl:if test="@mode='preferences'">
  73. var f = document.pform;
  74. //Want to warn user if she makes notificationEmail different than logon but only once per visit
  75. function validate()
  76. {
  77. if(f.valAlert &amp;&amp; f.valAlert.value == 'true')
  78. {
  79. f.valAlert.value = 'false';
  80. if (f.m_p_email != null &amp;&amp; f.m_p_email.value != '' &amp;&amp; f.m_p_notificationEMail != null &amp;&amp; f.m_p_notificationEMail.value != '' &amp;&amp; f.m_p_email.value != f.m_p_notificationEMail.value)
  81. {
  82. if ( confirm("<xts:string id="IDS_PERS_TAB_PERSONAL_ALERT_EMAIL" encode="javascript"/>") )
  83. updateAlertEmail();
  84. }
  85. }
  86. if (typeof CAFIsValidEmailAddress == "function" &amp;&amp; f.m_p_notificationEMail != null &amp;&amp; f.m_p_notificationEMail.value != '') {
  87. if (!CAFIsValidEmailAddress(f.m_p_notificationEMail.value)) {
  88. alert("<xts:string id="IDS_PERS_TAB_PERSONAL_INVALID_ALERT_EMAIL" encode="javascript"/>");
  89. return false;
  90. }
  91. }
  92. return true;
  93. }
  94. function updateAlertEmail()
  95. {
  96. f.m_p_notificationEMail.value = f.m_p_email.value;
  97. }
  98. </xsl:if>
  99. </script>
  100. <!-- Credentials ============================== -->
  101. <xsl:call-template name="generate-credentials"/>
  102. <!-- Data source credentials ============================== -->
  103. <out:if test="$showDataSourceCredentialsSection">
  104. <lyt:layout style="1" title="IDS_PERS_TAB_GENERAL_DATASOURCE_CREDENTIAL" border="yes">
  105. <lyt:section style="padding:0">
  106. <div id="datasourceCredententialsFrag" style="padding-bottom:20;padding-right:5"/>
  107. </lyt:section>
  108. </lyt:layout>
  109. </out:if>
  110. <xsl:if test="@mode='preferences'">
  111. <!-- Groups and Roles ============================== -->
  112. <lyt:layout style="1" title="IDS_PERS_TAB_PERSONAL_GROUPS_ROLES" border="yes">
  113. <lyt:section valign="top">
  114. <out:if test="count($identity/*[local-name() = 'group' or local-name() = 'role']) > 0">
  115. <dp:list width="55%">
  116. <dp:section>
  117. <dp:text width="100%"/>
  118. <dp:text nospace="nospace">
  119. <xts:string id="IDS_ENTRIES"/>1 - <out:value-of select="count($identity/*[local-name() = 'group' or local-name() = 'role'])"/>
  120. </dp:text>
  121. </dp:section>
  122. </dp:list>
  123. </out:if>
  124. <cp:table name="Groups" iterate="$identity/*[local-name() = 'group' or local-name() = 'role']" width="55%">
  125. <cp:tableHeader>
  126. <cp:columnHeader width="20"/>
  127. <cp:columnHeader width="100%">
  128. <!-- All of this is to align the header (...> Name) with the contents of the table-->
  129. <span style="padding-left: 1px; padding-right: 1px;"><xts:string id="IDS_PATH_INDICATOR"/>&#160;</span>
  130. <out:text/><xts:string id="IDS_PERS_TAB_PERSONAL_NAME_HEADER"/><out:text/>
  131. </cp:columnHeader>
  132. <cp:columnHeader width="40%"><xts:string id="IDS_PERS_TAB_PERSONAL_NAMESPACE_HEADER"/></cp:columnHeader>
  133. <cp:columnHeader width="20%"><xts:string id="IDS_PERS_TAB_PERSONAL_TYPE_HEADER"/></cp:columnHeader>
  134. </cp:tableHeader>
  135. <cp:tableContent>
  136. <cp:columnContent>
  137. <out:call-template name="gen-icon">
  138. <out:with-param name="class" select="./cm:class"/>
  139. <out:with-param name="hiddenObject" select="./cm:hidden"/>
  140. </out:call-template>
  141. </cp:columnContent>
  142. <cp:columnContent>
  143. <img border="0" align="absmiddle" height="16" width="20" src="{'{$skin_images}'}path.gif">
  144. <out:attribute name="alt">
  145. <cf:do-the-path-link>
  146. <cf:param name="familytree">cm:ancestors</cf:param>
  147. <cf:param name="familymember">cm:defaultName</cf:param>
  148. <cf:param name="onlyAncestors">true</cf:param>
  149. </cf:do-the-path-link>
  150. </out:attribute>
  151. </img>
  152. <out:text>&#160;</out:text>
  153. <out:value-of select="xtsext:enforceBTD(./cm:defaultName, $baseTextDirection, $productLocale, boolean($isBidiEnabled='true'))"/>
  154. </cp:columnContent>
  155. <cp:columnContent>
  156. <out:value-of select="cm:ancestors/cm:ancestorInfo[cm:objectClass = 'namespace']/cm:title"/>
  157. </cp:columnContent>
  158. <cp:columnContent>
  159. <out:variable name='objClass'><out:value-of select="cm:objectClass"/></out:variable>
  160. <out:value-of select="/root/objectClass/class[@name= $objClass]"/>
  161. </cp:columnContent>
  162. </cp:tableContent>
  163. </cp:table>
  164. </lyt:section>
  165. </lyt:layout>
  166. <!-- Capabilities ============================== -->
  167. <lyt:layout style="1" title="IDS_PERS_TAB_PERSONAL_CAPABILITIES" border="yes">
  168. <!-- Capabilities table is provided through a fragment -->
  169. <lyt:section style="padding:0">
  170. <div id="capabilitiesFrag"/>
  171. </lyt:section>
  172. </lyt:layout>
  173. </xsl:if>
  174. </xsl:template>
  175. <xsl:template name="generate-credentials">
  176. <out:if test="contains($user/cm:permissions,'write')">
  177. <utml:input type="hidden" name="h_CAM_action" value="" utml:update="false"/>
  178. <utml:input type="hidden" name="renew_credential" value="" utml:update="false"/>
  179. <utml:input type="hidden" name="credential_op" value="" utml:update="false"/>
  180. <utml:input type="hidden" name="credential_self" utml:update="false">
  181. <utml:value>
  182. <out:value-of select="$user/cm:searchPath"/>
  183. </utml:value>
  184. </utml:input>
  185. <utml:input type="hidden" name="controller_state" value="" utml:update="false"/>
  186. <out:variable name="credentialIsInitialized" select="/root/list"/>
  187. <out:if test="$credentialIsInitialized or not('{@mode}' = 'properties')">
  188. <lyt:layout style="1" title="IDS_PERS_TAB_GENERAL_CREDENTIAL" border="yes">
  189. <lyt:section>
  190. <dp:choice>
  191. <dp:section1 type="hint">
  192. <xts:string id="IDS_PERS_TAB_GENERAL_CREDENTIAL_DESC"/>&#160;
  193. <xsl:if test="not(@mode = 'properties')">
  194. <out:if test="$credentialIsInitialized">
  195. <xts:string id="IDS_PERS_TAB_GENERAL_RENEWCREDENTIAL_DESC"/>&#160;
  196. </out:if>
  197. <out:choose>
  198. <out:when test="$credentialIsInitialized">
  199. <utml:a utml:op="maintain" utml:formName="pform">
  200. <utml:target><out:value-of select="concat($app,'/',$mname)"/></utml:target>
  201. <utml:href>document.pform.renew_credential.value='true';document.pform.h_CAM_action.value='generateTC';</utml:href>
  202. <xts:string id="IDS_PERS_TAB_GENERAL_RENEW_CREDENTIAL"/>
  203. </utml:a>
  204. </out:when>
  205. <out:otherwise>
  206. <utml:a utml:op="maintain" utml:formName="pform">
  207. <utml:target><out:value-of select="concat($app,'/',$mname)"/></utml:target>
  208. <utml:href>document.pform.renew_credential.value='false';document.pform.h_CAM_action.value='generateTC';</utml:href>
  209. <xts:string id="IDS_PERS_TAB_GENERAL_CREATE_CREDENTIAL"/>
  210. </utml:a>
  211. </out:otherwise>
  212. </out:choose>
  213. </xsl:if>
  214. </dp:section1>
  215. </dp:choice>
  216. </lyt:section>
  217. <lyt:section noTitle="true">
  218. <out:if test="$credentialIsInitialized">
  219. <cf:main-pager-section name="cred" form="pform" width="100%" genDelete="yes">
  220. <cf:param name="item-path">/root/list/*</cf:param>
  221. <cf:param name="target">concat($app,'/',$mname)</cf:param>
  222. <cf:param name="lines-per-page">
  223. <out:choose>
  224. <out:when test="key('session-param','linesPerPage')!=''">
  225. <out:value-of select="key('session-param','linesPerPage')"/>
  226. </out:when>
  227. <out:otherwise>
  228. <out:value-of select="/root/system/param[@name='defaultPortalPreferences']/pref[@name='lines']"/>
  229. </out:otherwise>
  230. </out:choose>
  231. </cf:param>
  232. <cf:param name="actions">
  233. <cp:action>
  234. <utml:a utml:op="maintain" utml:formName="pform">
  235. <utml:href>document.pform.m_credsection.value='1';document.pform.controller_state.value='addEntries|navigate';</utml:href>
  236. <utml:target><out:value-of select="concat($app, '/', $mname)"/></utml:target>
  237. <out:text/><xts:string id="IDS_COMMAND_ADD"/><out:text/>
  238. </utml:a>
  239. </cp:action>
  240. <cp:action>
  241. <utml:a onclick="javascript:document.pform.credential_op.value='delete';if(window.preDeletecred)preDeletecred('pform','credential_chk_');" utml:formName="pform">
  242. <utml:target><out:value-of select="concat($app, '/', $mname)"/></utml:target>
  243. <out:text/><xts:string id="IDS_REMOVE"/></utml:a>
  244. </cp:action>
  245. </cf:param>
  246. <cf:param name="rows">
  247. <cp:tableHeader>
  248. <cp:columnHeader width="16" toggleName="credential_chk_" utlm="utml" noLabel="true"/>
  249. <cp:columnHeader width="16"/>
  250. <cp:columnHeader width="100%">
  251. <span style="padding-left: 1px; padding-right: 1px;"><xts:string id="IDS_PATH_INDICATOR"/>&#160;</span>
  252. <out:text/><xts:string id="IDS_NAME"/><out:text/>
  253. </cp:columnHeader>
  254. </cp:tableHeader>
  255. <cp:tableContent>
  256. <out:variable name="entryLabel">
  257. <out:value-of select="xtsext:enforceBTD(cm:defaultName, $baseTextDirection, $productLocale, boolean($isBidiEnabled='true'))"/>
  258. <out:if test="cm:userName!=''">&#160;(<out:value-of select="cm:userName"/>)</out:if>
  259. </out:variable>
  260. <cp:columnContent>
  261. <input type="checkbox" name="credential_chk_{'{position()}'}" value="{'{cm:searchPath}'}">
  262. <out:attribute name="aria-label"><xts:string id="IDS_SELECTION_FOR_PAGER_ITEM" encode="html"><xts:param name="pagerItemName"><out:value-of select="$entryLabel"/></xts:param></xts:string></out:attribute>
  263. </input>
  264. </cp:columnContent>
  265. <cp:columnContent>
  266. <out:call-template name="gen-icon">
  267. <out:with-param name="showAction" select="false()"/>
  268. <out:with-param name="hiddenObject" select="cm:hidden"/>
  269. </out:call-template>
  270. </cp:columnContent>
  271. <cp:columnContent>
  272. <img border="0" align="absmiddle" height="16" width="20" src="{'{$skin_images}'}path.gif">
  273. <out:attribute name="alt">
  274. <cf:do-the-path-link>
  275. <cf:param name="familytree">cm:ancestors</cf:param>
  276. <cf:param name="familymember">cm:defaultName</cf:param>
  277. <cf:param name="onlyAncestors">true</cf:param>
  278. </cf:do-the-path-link>
  279. </out:attribute>
  280. </img>
  281. <out:text>&#160;</out:text>
  282. <out:value-of select="$entryLabel"/>
  283. </cp:columnContent>
  284. </cp:tableContent>
  285. </cf:param>
  286. </cf:main-pager-section>
  287. </out:if>
  288. </lyt:section>
  289. </lyt:layout>
  290. </out:if>
  291. </out:if>
  292. <out:if test="$credentialExists and key('env-param','renew_credential')='true'">
  293. <script language="javascript">
  294. alert("<xts:string id="IDS_PERS_CREDENTIAL_SUCCESS" encode="javascript"/>");
  295. </script>
  296. </out:if>
  297. <!-- if the user tried to add a duplicate entry -->
  298. <script language="javascript">
  299. <out:if test="/root/duplicateEntry">
  300. <out:variable name="msg">
  301. <xts:string id="IDS_DUPLICATE_ENTRY" encode="javascript"/>
  302. </out:variable>
  303. window.alert('<out:value-of select="$msg"/>');
  304. </out:if>
  305. </script>
  306. <out:if test="/root/env/param[@name='remove_notifications'] != ''">
  307. <script language="javascript">
  308. alert("<xts:string id="IDS_PERS_REMOVE_NOTIFICATIONS_SUCCESS" encode="javascript"/>");
  309. </script>
  310. </out:if>
  311. </xsl:template>
  312. <xsl:template match="*">
  313. <xsl:copy>
  314. <xsl:copy-of select="@*"/>
  315. <xsl:apply-templates/>
  316. </xsl:copy>
  317. </xsl:template>
  318. </xsl:stylesheet>