mypages.xslt 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407
  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, 2014
  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 name="generateReadOnlyPageList">
  31. <cf:main-pager-section name="sharedPagesPager" form="pform" width="100%" genDelete="no">
  32. <cf:param name="item-path">/root/sharedPagesListForDisplay/*</cf:param>
  33. <cf:param name="target">concat(concat($app,'/'),$mname)</cf:param>
  34. <cf:param name="lines-per-page">
  35. <out:choose>
  36. <out:when test="key('session-param','linesPerPage')!=''">
  37. <out:value-of select="key('session-param','linesPerPage')" />
  38. </out:when>
  39. <out:otherwise>
  40. <out:value-of select="/root/system/param[@name='defaultPortalPreferences']/pref[@name='lines']" />
  41. </out:otherwise>
  42. </out:choose>
  43. </cf:param>
  44. <cf:param name="rows">
  45. <cp:tableHeader>
  46. <cp:columnHeader width="20" />
  47. <cp:columnHeader width="100%">
  48. <span style="padding-left: 1px; padding-right: 1px;"><xts:string id="IDS_PATH_INDICATOR"/>&#160;</span>
  49. <out:text/><xts:string id="IDS_NAME"/><out:text/>
  50. </cp:columnHeader>
  51. </cp:tableHeader>
  52. <cp:tableContent>
  53. <cp:columnContent>
  54. <out:variable name="classForIcon">
  55. <!-- we must identify the personal folder as we can not use the icon associated with folder...we must use the icon for a personal folder -->
  56. <xsl:choose>
  57. <!-- the id of the my folder could be in one of two places -->
  58. <!-- for admin dialogs portal pages tab it is in the second query response. -->
  59. <!-- A query would have been required in the admin case cause the user is editing an account that is not there own or is editing the -->
  60. <!-- account object under config (ie the profile) -->
  61. <xsl:when test="@mode = 'properties'">
  62. <out:choose>
  63. <out:when test="$privateFolder/cm:storeID = cm:storeID">pfr</out:when>
  64. <out:otherwise>
  65. <out:value-of select="cm:objectClass"/>
  66. </out:otherwise>
  67. </out:choose>
  68. </xsl:when>
  69. <!-- for preferences portal pages tab it is in the session -->
  70. <xsl:otherwise>
  71. <out:choose>
  72. <out:when test="contains(cm:storeID,/root/session/param[@name = 'mrootid'])">pfr</out:when>
  73. <out:otherwise>
  74. <out:value-of select="cm:objectClass"/>
  75. </out:otherwise>
  76. </out:choose>
  77. </xsl:otherwise>
  78. </xsl:choose>
  79. </out:variable>
  80. <out:call-template name="gen-icon">
  81. <out:with-param name="class" select="$classForIcon"/>
  82. <out:with-param name="hiddenObject" select="cm:hidden"/>
  83. </out:call-template>
  84. </cp:columnContent>
  85. <cp:columnContent>
  86. <out:variable name="privateFolderId">
  87. <xsl:if test="@mode='properties'">
  88. <out:value-of select="$privateFolder/cm:storeID"/>
  89. </xsl:if>
  90. </out:variable>
  91. <out:if test="not(key('session-param','mrootid') = cm:storeID or key('session-param','prootid') = cm:storeID or ($privateFolderId != '' and $privateFolderId = cm:storeID))">
  92. <out:variable name="object-start-at-path">
  93. <out:choose>
  94. <!-- Do not provide a path for contact otherwise invalid path displayed for logged on user -->
  95. <out:when test="starts-with(cm:searchPath, '~') or starts-with(cm:searchPath,key('session-param', 'e_hp'))">
  96. <out:value-of select="concat(key('session-param', 'e_hp'), '/folder')"/>
  97. </out:when>
  98. <out:when test="starts-with(cm:searchPath,'/content')">
  99. <out:value-of select="/content"/>
  100. </out:when>
  101. </out:choose>
  102. </out:variable>
  103. <span style="padding-left: 1px; padding-right: 1px;">
  104. <img border="0" align="absmiddle" height="16" width="20" src="{'{$skin_images}'}path.gif">
  105. <out:attribute name="alt">
  106. <cf:do-the-path-link>
  107. <cf:param name="familytree">cm:ancestors</cf:param>
  108. <cf:param name="home">
  109. <out:value-of select="{'$object-start-at-path'}"/>
  110. </cf:param>
  111. <cf:param name="familymember">cm:defaultName</cf:param>
  112. <cf:param name="onlyAncestors">true</cf:param>
  113. </cf:do-the-path-link>
  114. </out:attribute>
  115. </img>
  116. &#160;
  117. </span>
  118. </out:if>
  119. <out:choose>
  120. <out:when test="string(cm:defaultName) != ''">
  121. <out:value-of select="cm:defaultName"/>
  122. </out:when>
  123. <out:otherwise>
  124. <dp:inactiveText><i><xts:string id="IDS_PAGE_UNAVAILABLE"/></i></dp:inactiveText>
  125. </out:otherwise>
  126. </out:choose>
  127. <!-- If inaccessible tabs are supposed to be hidden then show some indication that they will not appear in the portal -->
  128. <out:if test="string(key('system-param', 'hideInaccessibleTabs')) = 'true'">
  129. <xsl:call-template name="genWarningSigns"/>
  130. </out:if>
  131. </cp:columnContent>
  132. </cp:tableContent>
  133. </cf:param>
  134. </cf:main-pager-section>
  135. </xsl:template>
  136. <xsl:template name="generateWriteablePageList">
  137. <cf:main-pager-section name="sharedPagesPager" form="pform" width="100%" genDelete="no">
  138. <cf:param name="item-path">/root/sharedPagesListForDisplay/*</cf:param>
  139. <cf:param name="target">concat(concat($app,'/'),$mname)</cf:param>
  140. <cf:param name="lines-per-page">
  141. <out:choose>
  142. <out:when test="key('session-param','linesPerPage')!=''">
  143. <out:value-of select="key('session-param','linesPerPage')" />
  144. </out:when>
  145. <out:otherwise>
  146. <out:value-of select="/root/system/param[@name='defaultPortalPreferences']/pref[@name='lines']" />
  147. </out:otherwise>
  148. </out:choose>
  149. </cf:param>
  150. <cf:param name="actions">
  151. <xsl:if test="@mode = 'properties'">
  152. <cp:action>
  153. <out:variable name="publicFolderId"><out:value-of select="$publicFolder/cm:storeID"/></out:variable>
  154. <out:if test="not(/root/sharedPagesListForDisplay/pagelet[cm:storeID = $publicFolderId])">
  155. <utml:a utml:op="maintain" utml:formName="pform">
  156. <utml:href>document.pform.sharedPagesChanged.value="addpublic";</utml:href>
  157. <out:text /><xts:string id="IDS_MYPAGES_ADDPUBLIC"><xts:param name="publicContainerName"><out:value-of select="/root/session/param[@name='e_proot']"/></xts:param></xts:string><out:text />
  158. </utml:a>
  159. </out:if>
  160. </cp:action>
  161. <cp:action>
  162. <out:variable name="personalFolderId"><out:value-of select="$privateFolder/cm:storeID"/></out:variable>
  163. <out:if test="not(/root/sharedPagesListForDisplay/pagelet[cm:storeID = $personalFolderId])">
  164. <utml:a utml:op="maintain" utml:formName="pform">
  165. <utml:href>document.pform.sharedPagesChanged.value="addprivate";</utml:href>
  166. <out:text /><xts:string id="IDS_MYPAGES_ADDPRIVATE"/><out:text />
  167. </utml:a>
  168. </out:if>
  169. </cp:action>
  170. </xsl:if>
  171. <cp:action>
  172. <utml:a utml:op="maintain" utml:formName="pform">
  173. <utml:href>document.pform.m_sharedPagesPagersection.value='1';document.pform.controller_state.value='addSharedPageEntries|navigate';</utml:href>
  174. <utml:target><out:value-of select="concat($app, '/', $mname)"/></utml:target>
  175. <out:text /><xts:string id="IDS_ADD_PAGES"/><out:text />
  176. </utml:a>
  177. </cp:action>
  178. <cp:action>
  179. <out:choose>
  180. <out:when test="count(/root/sharedPagesListForDisplay/pagelet) &lt; 1">
  181. <dp:inactiveHRef><xts:string id="IDS_REMOVE"/></dp:inactiveHRef>
  182. </out:when>
  183. <out:otherwise>
  184. <utml:a utml:op="maintain" utml:formName="pform">
  185. <utml:href>document.pform.sharedPagesChanged.value="remove";</utml:href>
  186. <out:text /><xts:string id="IDS_REMOVE"/><out:text />
  187. </utml:a>
  188. </out:otherwise>
  189. </out:choose>
  190. </cp:action>
  191. <cp:action>
  192. <out:choose>
  193. <out:when test="count(/root/sharedPagesListForDisplay/pagelet) &lt; 2">
  194. <dp:inactiveHRef><xts:string id="IDS_COMMAND_RESEQUENCE"/></dp:inactiveHRef>
  195. </out:when>
  196. <out:otherwise>
  197. <utml:a utml:op="stack-up" utml:formName="pform" >
  198. <utml:target><out:value-of select="$app"/>/preferences/resequence.xts<xsl:text/></utml:target>
  199. <out:text /><xts:string id="IDS_COMMAND_RESEQUENCE"/><out:text />
  200. </utml:a>
  201. </out:otherwise>
  202. </out:choose>
  203. </cp:action>
  204. </cf:param>
  205. <cf:param name="rows">
  206. <cp:tableHeader>
  207. <cp:columnHeader width="16" toggleName="sharedPage_select_" noLabel="true"/>
  208. <cp:columnHeader width="20" />
  209. <cp:columnHeader width="100%">
  210. <span style="padding-left: 1px; padding-right: 1px;"><xts:string id="IDS_PATH_INDICATOR"/>&#160;</span>
  211. <out:text/><xts:string id="IDS_NAME"/><out:text/>
  212. </cp:columnHeader>
  213. </cp:tableHeader>
  214. <cp:tableContent>
  215. <out:variable name="entryLabel">
  216. <out:choose>
  217. <out:when test="string(cm:defaultName) != ''">
  218. <out:value-of select="xtsext:enforceBTD(cm:defaultName, $baseTextDirection, $productLocale, boolean($isBidiEnabled='true'))"/>
  219. </out:when>
  220. <out:otherwise>
  221. <dp:inactiveText><i><xts:string id="IDS_PAGE_UNAVAILABLE"/></i></dp:inactiveText>
  222. </out:otherwise>
  223. </out:choose>
  224. </out:variable>
  225. <cp:columnContent>
  226. <input type="checkbox">
  227. <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>
  228. <out:attribute name="value"><out:value-of select="@id"/></out:attribute>
  229. <out:attribute name="name">sharedPage_select_<out:value-of select="position()"/></out:attribute>
  230. </input>
  231. </cp:columnContent>
  232. <cp:columnContent>
  233. <out:variable name="classForIcon">
  234. <!-- we must identify the personal folder as we can not use the icon associated with folder...we must use the icon for a personal folder -->
  235. <xsl:choose>
  236. <!-- the id of the my folder could be in one of two places -->
  237. <!-- for admin dialogs portal pages tab it is in the second query response. -->
  238. <!-- A query would have been required in the admin case cause the user is editing an account that is not there own or is editing the -->
  239. <!-- account object under config (ie the profile) -->
  240. <xsl:when test="@mode = 'properties'">
  241. <out:choose>
  242. <out:when test="$privateFolder/cm:storeID = cm:storeID">pfr</out:when>
  243. <out:otherwise>
  244. <out:value-of select="cm:objectClass"/>
  245. </out:otherwise>
  246. </out:choose>
  247. </xsl:when>
  248. <!-- for preferences portal pages tab it is in the session -->
  249. <xsl:otherwise>
  250. <out:choose>
  251. <out:when test="contains(cm:storeID,/root/session/param[@name = 'mrootid'])">pfr</out:when>
  252. <out:otherwise>
  253. <out:value-of select="cm:objectClass"/>
  254. </out:otherwise>
  255. </out:choose>
  256. </xsl:otherwise>
  257. </xsl:choose>
  258. </out:variable>
  259. <out:call-template name="gen-icon">
  260. <out:with-param name="class" select="$classForIcon"/>
  261. <out:with-param name="hiddenObject" select="cm:hidden"/>
  262. </out:call-template>
  263. </cp:columnContent>
  264. <cp:columnContent>
  265. <out:variable name="privateFolderId">
  266. <xsl:if test="@mode='properties'">
  267. <out:value-of select="$privateFolder/cm:storeID"/>
  268. </xsl:if>
  269. </out:variable>
  270. <out:if test="not(key('session-param','mrootid') = cm:storeID or key('session-param','prootid') = cm:storeID or ($privateFolderId != '' and $privateFolderId = cm:storeID))">
  271. <out:variable name="object-start-at-path">
  272. <out:choose>
  273. <!-- Do not provide a path for contact otherwise invalid path displayed for logged on user -->
  274. <out:when test="starts-with(cm:searchPath, '~') or starts-with(cm:searchPath,key('session-param', 'e_hp'))">
  275. <out:value-of select="concat(key('session-param', 'e_hp'), '/folder')"/>
  276. </out:when>
  277. <out:when test="starts-with(cm:searchPath,'/content')">
  278. <out:value-of select="/content"/>
  279. </out:when>
  280. </out:choose>
  281. </out:variable>
  282. <span style="padding-left: 1px; padding-right: 1px;">
  283. <img border="0" align="absmiddle" height="16" width="20" src="{'{$skin_images}'}path.gif">
  284. <out:attribute name="alt">
  285. <cf:do-the-path-link>
  286. <cf:param name="familytree">cm:ancestors</cf:param>
  287. <cf:param name="home">
  288. <out:value-of select="{'$object-start-at-path'}"/>
  289. </cf:param>
  290. <cf:param name="familymember">cm:defaultName</cf:param>
  291. <cf:param name="onlyAncestors">true</cf:param>
  292. </cf:do-the-path-link>
  293. </out:attribute>
  294. </img>
  295. &#160;
  296. </span>
  297. </out:if>
  298. <out:value-of select="$entryLabel"/>
  299. <!-- If inaccessible tabs are supposed to be hidden then show some indication that they will not appear in the portal -->
  300. <out:if test="string(key('system-param', 'hideInaccessibleTabs')) = 'true'">
  301. <xsl:call-template name="genWarningSigns"/>
  302. </out:if>
  303. </cp:columnContent>
  304. </cp:tableContent>
  305. </cf:param>
  306. </cf:main-pager-section>
  307. </xsl:template>
  308. <xsl:template match="rdb:preferences">
  309. <!-- selectall / deselectall functions.-->
  310. <dt:selectDeselectAll/>
  311. <script language="javascript">
  312. function init()
  313. {
  314. if (document.pform.controller_state)
  315. {
  316. document.pform.controller_state.value = '';
  317. }
  318. }
  319. function processModalCommand(sAction)
  320. {
  321. <!-- Set the right call back target -->
  322. var callBackTarget = <out:value-of select="$callBackTargetJSVar"/>;
  323. if( callBackTarget )
  324. {
  325. callBackTarget.<out:value-of select="$callBackFunctionName"/>(sAction, null);
  326. }
  327. }
  328. </script>
  329. <!-- global form command fields -->
  330. <utml:input type="hidden" name="ifrmcmd" value="save" utml:update="false"/>
  331. <utml:input type="hidden" name="m_return" value="" utml:update="false"/>
  332. <utml:input type="hidden" name="controller_state" value="" utml:update="false"/>
  333. <lyt:layout style="1">
  334. <lyt:section>
  335. <!-- if the m_pp_shared_pages has been passed in then use it -->
  336. <!-- otherwise use re-create it using the shared pages -->
  337. <utml:input name="m_pp_shared_pages" type="hidden" update="false">
  338. <out:attribute name="value">
  339. <out:variable name="markup">
  340. <out:apply-templates select="/root/sharedPagesListForDisplay" mode="markup"/>
  341. </out:variable>
  342. <out:value-of select="xtsext:cafaction( concat('sign_wrap_setpassportid_', $passport), xtsext:web64encode(string($markup),true()))"/>
  343. </out:attribute>
  344. </utml:input>
  345. </lyt:section>
  346. </lyt:layout>
  347. <lyt:layout style="1">
  348. <lyt:section>
  349. <out:choose>
  350. <out:when test="$isNamedAccountReadOnly = 'true'"><xsl:call-template name="generateReadOnlyPageList"/></out:when>
  351. <out:otherwise><xsl:call-template name="generateWriteablePageList"/></out:otherwise>
  352. </out:choose>
  353. </lyt:section>
  354. </lyt:layout>
  355. <script language="javascript">
  356. <out:if test="/root/duplicateEntry">
  357. <out:variable name="msg">
  358. <xts:string id="IDS_DUPLICATE_ENTRY" encode="javascript"/>
  359. </out:variable>
  360. window.alert('<out:value-of select="$msg"/>');
  361. </out:if>
  362. </script>
  363. </xsl:template>
  364. <!-- Generate warning labels for inaccessible pages -->
  365. <xsl:template name="genWarningSigns">
  366. <out:variable name="warningMessage">
  367. <out:choose>
  368. <out:when test="not(cm:objectClass) or cm:objectClass = 'nil'">
  369. <xts:string id="IDS_PAGE_UNAVAILABLE"/>
  370. </out:when>
  371. <out:when test="cm:objectClass = 'pagelet' and not(contains(cm:permissions, 'execute'))">
  372. <xts:string id="IDS_PAGE_NO_ACCESS"/>
  373. </out:when>
  374. </out:choose>
  375. </out:variable>
  376. <out:if test="$warningMessage != ''">
  377. <img style="margin-right:5px;margin-left:5px;" src="{'{$image_root}'}state_warning.gif" width="11" height="16" border="0" align="absmiddle" title="{'{$warningMessage}'}" alt="{'{$warningMessage}'}"/>
  378. </out:if>
  379. </xsl:template>
  380. <xsl:template match="*">
  381. <xsl:copy>
  382. <xsl:copy-of select="@*"/>
  383. <xsl:apply-templates/>
  384. </xsl:copy>
  385. </xsl:template>
  386. </xsl:stylesheet>