contentLogic.xslt 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472
  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, 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:send="http://developer.cognos.com/schemas/xts/logic-sheet/xslt/brl/1/"
  15. xmlns:bus="http://developer.cognos.com/schemas/bibus/3/"
  16. xmlns:pf="http://developer.cognos.com/schemas/xts/pf"
  17. xmlns:pm="http://developer.cognos.com/schemas/xts/pm"
  18. xmlns:so="http://developer.cognos.com/schemas/xts/logicsheets/xslt/so/"
  19. xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/"
  20. xmlns:mru="http://developer.cognos.com/schemas/xts/mru/"
  21. xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt"
  22. xmlns:xts="http://developer.cognos.com/schemas/xts/"
  23. xmlns:pattern="java:org.apache.oro.text.awk.AwkCompiler"
  24. xmlns:matcher="java:org.apache.oro.text.awk.AwkMatcher"
  25. xmlns:string="java:java.lang.String"
  26. exclude-result-prefixes="xsl send bus xts xtsext pf cm string matcher pattern pm">
  27. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  28. <xsl:key name="env-param" match="/root/env/param" use="@name"/>
  29. <xsl:key name="session-param" match="/root/session/param" use="@name"/>
  30. <xsl:key name="system-param" match="/root/system/param" use="@name"/>
  31. <xsl:key name="spec-item" match="/root/selectionSpec/item" use="@name"/>
  32. <pf:variables/>
  33. <pm:permissions origin="/root/*[local-name()='queryResponse']/*[local-name()='queryReply'][1]/*/"/>
  34. <xsl:variable name="containerId" select="/root/*[local-name()='queryResponse']/*[local-name()='queryReply'][1]/*/*[local-name()='storeID']"/>
  35. <xsl:variable name="containerClass" select="/root/*[local-name()='queryResponse']/*[local-name()='queryReply'][1]/*/*[local-name()='objectClass']"/>
  36. <xsl:variable name="displayRoot" select="key('spec-item','presentation')/options/option[@name='displayVirtualRootNode']"/>
  37. <xsl:variable name="displayMRU" select="key('spec-item','presentation')/options/option[@name='displayMRU']"/>
  38. <xsl:variable name="modes" select="key('spec-item','modes')"/>
  39. <xsl:variable name="selectableObjects" select="string(key('spec-item','selectableObjects'))"/>
  40. <xsl:variable name="shortcut-targets" select="string(key('spec-item','shortcut-targets'))"/>
  41. <xsl:variable name="moveOnly" select="string(key('spec-item','operation')/@moveOnly)='true'"/>
  42. <xsl:variable name="isContainerMoveOrCopy" select="string(key('spec-item','operation')/@containerMoveOrCopy)='true'"/>
  43. <xsl:variable name="inputObjectId" select="key('spec-item','inputObjectId')"/>
  44. <xsl:variable name="inputObjectParentId" select="key('spec-item','inputObjectId')/@parentId"/>
  45. <xsl:variable name="inputObjectRootClass" select="key('spec-item','inputObjectId')/@rootClass"/>
  46. <xsl:variable name="launchableObjects" select="concat(' ',string(key('spec-item','launchableObjects')),' ')"/>
  47. <xsl:variable name="containerObjects" select="concat(' ',string(key('spec-item','containerObjects')),' ')"/>
  48. <xsl:variable name="actions" select="key('spec-item','actions')"/>
  49. <xsl:variable name="copyUserProfile" select="key('spec-item','copy_user_profile')"/>
  50. <xsl:variable name="displayRootDisabled" select="key('spec-item','presentation')/options/option[@name='displayRootDisabled']"/>
  51. <xsl:variable name="myFoldersIcon" select="string(key('spec-item','navigationId')/@myFoldersIcon)='true'"/>
  52. <xsl:variable name="publicFoldersIcon" select="string(key('spec-item','navigationId')/@publicFoldersIcon)='true'"/>
  53. <xsl:variable name="startDisplayAt" select="string(key('spec-item','presentation')/options/option[@name='startDisplayAt'])"/>
  54. <xsl:variable name="navigationId" select="string(key('spec-item','navigationId'))"/>
  55. <xsl:variable name="atRoot" select="string(key('spec-item','navigationId')/@atRoot)"/>
  56. <xsl:variable name="hasInitValue" select="string(key('spec-item','navigationId')/@initValue)"/>
  57. <xsl:variable name="mruList" select="/root/*[local-name()='queryResponse']/*[local-name()='queryReply'][3]"/>
  58. <xsl:variable name="verifyPackageWhenSearch" select="/root/*[local-name()='queryResponse']/*[local-name()='queryReply'][3]"/>
  59. <xsl:variable name="verifyPackage" select="/root/*[local-name()='queryResponse']/*[local-name()='queryReply'][4]"/>
  60. <xsl:variable name="filterToExcludeReportViewWithBaseObject" select="string(key('spec-item','filterToExcludeReportViewWithBaseObject'))"/>
  61. <xsl:variable name="overrideRoleChildRequirement" select="key('spec-item','overrideRoleChildRequirement')"/>
  62. <!--
  63. <xsl:variable name="containerPermissions">contains(./*[local-name()=&apos;permissions'],&apos;write&apos;) and contains(./*[local-name()=&apos;permissions&apos;],&apos;traverse&apos;)</xsl:variable>
  64. <xsl:variable name="containerPermissions"><xsl:value-of select="key('spec-item','filterToSelectContainerObjects')"/></xsl:variable>
  65. <xsl:variable name="selectablePermissions">contains(./*[local-name()=&apos;permissions'],&apos;read&apos;) or contains(./*[local-name()=&apos;permissions&apos;],&apos;execute&apos;)</xsl:variable>
  66. <xsl:variable name="selectablePermissions"><xsl:value-of select="key('spec-item','filterToSelectNonContainerObjects')"/></xsl:variable>
  67. <xsl:variable name="navigatePermissions"><xsl:value-of select="key('spec-item','filterToContainerObjects')"/></xsl:variable>
  68. -->
  69. <xsl:template match="root">
  70. <queryResponse xmlns="http://developer.cognos.com/schemas/xts-cm/1/">
  71. <queryReply xmlns="http://developer.cognos.com/schemas/xts-cm/1/">
  72. <xsl:copy-of select="/root/*[local-name()='queryResponse']/*[local-name()='queryReply'][1]/@*"/>
  73. <xsl:apply-templates select="/root/*[local-name()='queryResponse']/*[local-name()='queryReply'][1]/*" mode="one"/>
  74. </queryReply>
  75. <xsl:choose>
  76. <xsl:when test="count(/root/*[local-name()='queryResponse']/*[local-name()='queryReply'][2]/*)>0">
  77. <queryReply xmlns="http://developer.cognos.com/schemas/xts-cm/1/">
  78. <xsl:copy-of select="/root/*[local-name()='queryResponse']/*[local-name()='queryReply'][2]/@*"/>
  79. <xsl:apply-templates select="/root/*[local-name()='queryResponse']/*[local-name()='queryReply'][2]/*" mode="two"/>
  80. </queryReply>
  81. </xsl:when>
  82. <xsl:otherwise><queryReply xmlns="http://developer.cognos.com/schemas/xts-cm/1/"/></xsl:otherwise>
  83. </xsl:choose>
  84. <xsl:if test="string(key('env-param','sosmode')) != 'search' and count($mruList/*)>0">
  85. <queryReply xmlns="http://developer.cognos.com/schemas/xts-cm/1/">
  86. <xsl:copy-of select="$mruList/@*"/>
  87. <xsl:apply-templates select="$mruList" mode="three"/>
  88. </queryReply>
  89. </xsl:if>
  90. </queryResponse>
  91. </xsl:template>
  92. <!-- - - - - - - - - - - - - - - - - - - - - - - - - PROCESS PARENT REPLY NODE - - - - - - - - - - - - - - - - - - - - - - - - -->
  93. <xsl:template match="/root/*[local-name()='queryResponse']/*[local-name()='queryReply'][1]/*" mode="one">
  94. <xsl:variable name="inMyFolders" select="./*[local-name()='storeID']=key('session-param','mrootid') or ./*[local-name()='ancestors']/*/*[local-name()='storeID' and string(.)=key('session-param','mrootid')]"/>
  95. <xsl:variable name="inUsersMyFolders" select="not(./*[local-name()='storeID']=key('session-param','mrootid') or ./*[local-name()='ancestors']/*/*[local-name()='storeID' and string(.)=key('session-param','mrootid')]) and ./*[local-name()='ancestors']/*/*[local-name()='objectClass' and contains(string(.),'namespace')] and ./*[local-name()='ancestors']/*/*[local-name()='objectClass' and contains(string(.),'account')] and ./*[local-name()='objectClass']='folder'"/>
  96. <xsl:variable name="inMySubscriptionFolder" select="./*[local-name()='objectClass']='subscriptionFolder' and ./*[local-name()='ancestors']/*/*[local-name()='searchPath' and string(.)=key('session-param','e_hp')]"/>
  97. <xsl:variable name="inPublicFolders" select="./*[local-name()='storeID']=key('session-param','prootid') or ./*[local-name()='ancestors']/*/*[local-name()='storeID' and string(.)=key('session-param','prootid')]"/>
  98. <xsl:variable name="inAdminFolders" select="./*[local-name()='objectClass']='adminFolder'"/>
  99. <xsl:variable name="ancestorsIncludeMyFolders" select="./*[local-name()='ancestors']/*/*[local-name()='objectClass' and contains(string(.),'namespace')] and ./*[local-name()='ancestors']/*/*[local-name()='objectClass' and contains(string(.),'account')] and ./*[local-name()='ancestors']/*/*[local-name()='objectClass' and contains(string(.),'folder')]"/>
  100. <xsl:variable name="ancestorsIncludeUsersMyFolders" select="not(./*[local-name()='ancestors']/*/*[local-name()='storeID' and string(.)=key('session-param','mrootid')]) and ./*[local-name()='ancestors']/*/*[local-name()='objectClass' and contains(string(.),'namespace')] and ./*[local-name()='ancestors']/*/*[local-name()='objectClass' and contains(string(.),'account')] and ./*[local-name()='ancestors']/*/*[local-name()='objectClass' and contains(string(.),'folder')]"/>
  101. <xsl:copy>
  102. <xsl:copy-of select="./@*"/>
  103. <xsl:choose>
  104. <xsl:when test="$ancestorsIncludeUsersMyFolders='true'">
  105. <xsl:copy-of select="./*[not(local-name()='ancestors')]"/>
  106. <xsl:apply-templates select="./*[local-name()='ancestors']" mode="ans"/>
  107. </xsl:when>
  108. <xsl:when test="$inUsersMyFolders='true'">
  109. <xsl:copy-of select="./*[not(local-name()='defaultName')]"/>
  110. <defaultName>
  111. <xsl:value-of select="concat(string(./*[local-name()='defaultName']),' (',string(./*[local-name()='ancestors']/*/*[local-name()='objectClass' and string(.)='account']/../*[local-name()='title']),')')"/>
  112. </defaultName>
  113. </xsl:when>
  114. <xsl:otherwise>
  115. <xsl:copy-of select="./*"/>
  116. </xsl:otherwise>
  117. </xsl:choose>
  118. <xsl:if test="$canWrite and $actions/action">
  119. <xsl:for-each select="$actions/action">
  120. <action xmlns="http://developer.cognos.com/schemas/xts-cm/1/">
  121. <xsl:copy-of select="./@*"/>
  122. <xsl:for-each select="./param">
  123. <xsl:variable name="concatName" select="concat('m_',@name)"/>
  124. <xsl:element name="{$concatName}"><xsl:value-of select="."/></xsl:element>
  125. </xsl:for-each>
  126. <xsl:for-each select="./item">
  127. <xsl:element name="{@name}"><xsl:value-of select="."/></xsl:element>
  128. </xsl:for-each>
  129. </action>
  130. </xsl:for-each>
  131. <!-- <newAction xmlns="http://developer.cognos.com/schemas/xts-cm/1/">
  132. <xsl:copy-of select="$actions/new/@*"/>
  133. <xsl:for-each select="$actions/new/param">
  134. <xsl:variable name="concatName" select="concat('m_',@name)"/>
  135. <xsl:attribute name="{$concatName}"><xsl:value-of select="."/></xsl:attribute>
  136. </xsl:for-each>
  137. <xsl:if test="contains($containerObjects,concat(' ',string($actions/new/param[@name='new_class']),' '))">
  138. <xsl:attribute name="isContainer">true</xsl:attribute>
  139. </xsl:if>
  140. </newAction> -->
  141. </xsl:if>
  142. <xsl:if test="key('spec-item','presentation')/options/option[@name='displayCheckbox']">
  143. <xsl:variable name="objClass" select="./*[local-name()='objectClass']"/>
  144. <displayCheckboxDisabled>
  145. <xsl:choose>
  146. <xsl:when test="string(key('spec-item','presentation')/options/option[@name='displayCheckbox']/@disabledAtContainer) = $objClass">true</xsl:when>
  147. <xsl:otherwise>false</xsl:otherwise>
  148. </xsl:choose>
  149. </displayCheckboxDisabled>
  150. </xsl:if>
  151. <xsl:choose>
  152. <xsl:when test="contains($selectableObjects,concat(' ',$containerClass,' ')) and not($moveOnly and $inputObjectId=$containerId) and not($moveOnly and $isContainerMoveOrCopy and ($inputObjectId=$containerId or $inputObjectParentId=$containerId))">
  153. <!-- userInterface checking required for bread crumb since request predicate filter would be too restrictive -->
  154. <xsl:variable name="matchesUserInterface">
  155. <xsl:call-template name="matchUserInterface">
  156. <xsl:with-param name="useClass" select="$containerClass"/>
  157. </xsl:call-template>
  158. </xsl:variable>
  159. <!-- COGCQ00136780 - Portlet Generic Editor: Unable to navigate to and select a CMM package which resides under an FM package. -->
  160. <!-- The matching condition test moved here so that the bread crumb radio button is not displayed inactive, for the object that has no userinterface match -->
  161. <xsl:if test="$matchesUserInterface='true'">
  162. <locationSelect xmlns="http://developer.cognos.com/schemas/xts-cm/1/">
  163. <xsl:if test="(($navigationId != '' and ($hasInitValue!='true' or $inputObjectId='')) and $navigationId = $containerId) or $inputObjectId = $containerId">
  164. <xsl:attribute name="checked">true</xsl:attribute>
  165. </xsl:if>
  166. <xsl:variable name="permExpression">
  167. <xsl:call-template name="permissionsExpression">
  168. <xsl:with-param name="useClass" select="$containerClass"/>
  169. <xsl:with-param name="filterName" select="'filterToSelectContainerObjects'"/>
  170. </xsl:call-template>
  171. </xsl:variable>
  172. <xsl:choose>
  173. <xsl:when test="$permExpression='nil' or matcher:matches(matcher:new(), ./*[local-name()='permissions'], pattern:compile(pattern:new(), $permExpression))">
  174. <xsl:attribute name="enable">true</xsl:attribute>
  175. </xsl:when>
  176. <xsl:otherwise>
  177. <xsl:attribute name="enable">false</xsl:attribute>
  178. </xsl:otherwise>
  179. </xsl:choose>
  180. </locationSelect>
  181. </xsl:if>
  182. </xsl:when>
  183. <xsl:when test="(contains($selectableObjects,concat(' ',$containerClass,' ')) or $displayRootDisabled) and $atRoot!='true'">
  184. <locationSelect enable="false" xmlns="http://developer.cognos.com/schemas/xts-cm/1/"/>
  185. </xsl:when>
  186. </xsl:choose>
  187. <xsl:if test="(contains($selectableObjects,concat(' ',$containerClass,' ')) or $displayRootDisabled) and $atRoot!='true'">
  188. <locationGenIcons xmlns="http://developer.cognos.com/schemas/xts-cm/1/">
  189. <xsl:choose>
  190. <xsl:when test="$myFoldersIcon"><xsl:attribute name="type">myFolders</xsl:attribute></xsl:when>
  191. <xsl:when test="$publicFoldersIcon"><xsl:attribute name="type">publicFolders</xsl:attribute></xsl:when>
  192. <xsl:otherwise><xsl:attribute name="type">default</xsl:attribute></xsl:otherwise>
  193. </xsl:choose>
  194. </locationGenIcons>
  195. </xsl:if>
  196. <xsl:if test="string($atRoot)='true' or string($inMyFolders)='true' or string($inUsersMyFolders)='true' or string($inMySubscriptionFolder)='true' or string($ancestorsIncludeMyFolders)='true' or string($ancestorsIncludeUsersMyFolders)='true'">
  197. <locationRootName xmlns="http://developer.cognos.com/schemas/xts-cm/1/"><xsl:value-of select="key('spec-item','rootNodeMessage')"/></locationRootName>
  198. </xsl:if>
  199. <selectionRoot>
  200. <xsl:choose>
  201. <xsl:when test="$displayRoot">
  202. <xsl:choose>
  203. <xsl:when test="$inMyFolders='true' or $inMySubscriptionFolder='true'"><xsl:value-of select="key('session-param', 'e_hp')"/></xsl:when>
  204. <xsl:when test="$inUsersMyFolders='true' or $ancestorsIncludeUsersMyFolders='true'"><xsl:value-of select="./*[local-name()='ancestors']/*/*[local-name()='objectClass' and string(.)='account']/../*[local-name()='searchPath']"/></xsl:when>
  205. <xsl:when test="$ancestorsIncludeMyFolders='true' and not($atRoot='true')">/</xsl:when>
  206. <xsl:when test="$inPublicFolders='true' or $atRoot='true'">/</xsl:when>
  207. <xsl:when test="$inputObjectRootClass = 'adminFolder' or $inAdminFolders">/</xsl:when>
  208. <xsl:otherwise><xsl:value-of select="concat('/',$inputObjectRootClass)"/></xsl:otherwise>
  209. </xsl:choose>
  210. </xsl:when>
  211. <xsl:otherwise>
  212. <xsl:choose>
  213. <xsl:when test="string($startDisplayAt)!=''">
  214. <xsl:choose>
  215. <xsl:when test="./*[local-name()='ancestors']/*/*[local-name()='objectClass' and string(.)=$startDisplayAt]"><xsl:value-of select="./*[local-name()='ancestors']/*/*[local-name()='objectClass' and string(.)=$startDisplayAt]/../*[local-name()='searchPath']"/></xsl:when>
  216. <xsl:when test="./*[local-name()='objectClass' and string(.)=$startDisplayAt]"><xsl:value-of select="./*[local-name()='searchPath']"/></xsl:when>
  217. <xsl:otherwise><xsl:value-of select="concat('/',$inputObjectRootClass)"/></xsl:otherwise>
  218. </xsl:choose>
  219. </xsl:when>
  220. </xsl:choose>
  221. </xsl:otherwise>
  222. </xsl:choose>
  223. </selectionRoot>
  224. <!-- check to set if search should be allowed -->
  225. <xsl:if test="$modes/search">
  226. <searchmode>
  227. <xsl:if test="string($modes/search/@disabledAtContainer) = ./*[local-name()='objectClass']">
  228. <xsl:attribute name="disabled">true</xsl:attribute>
  229. </xsl:if>
  230. </searchmode>
  231. </xsl:if>
  232. </xsl:copy>
  233. </xsl:template>
  234. <!-- - - - - - - - - - - - - - - - - - - - - - - - - PROCESS CHILD REPLY NODES - - - - - - - - - - - - - - - - - - - - - - - - -->
  235. <xsl:template match="/root/*[local-name()='queryResponse']/*[local-name()='queryReply'][2]/*" mode="two">
  236. <xsl:variable name="objectPerm"><xsl:value-of select="./*[local-name()='permissions']"/></xsl:variable>
  237. <xsl:variable name="obj" select="./*[local-name()='objectClass']"/>
  238. <!--
  239. * Determine if there's a specified required capability to launch or select an object; and if so, calculate
  240. * if user has capability.
  241. -->
  242. <xsl:variable name="hasCapability">
  243. <xsl:variable name="effectiveUserCapabilities" select="./cm:effectiveUserCapabilities | ./*/*/cm:effectiveUserCapabilities"/>
  244. <xsl:variable name="doLaunch" select="key('spec-item','presentation')/options/option[@name='isLaunchable']"/>
  245. <xsl:variable name="doSelection" select="key('spec-item','presentation')/options/option[@name='isSelectable']"/>
  246. <xsl:choose>
  247. <xsl:when test="$doLaunch">
  248. <xsl:variable name="requiredCapability" select="$doLaunch/capability"/>
  249. <xsl:value-of select="string($requiredCapability) = '' or boolean($effectiveUserCapabilities/*[local-name() = $requiredCapability])"/>
  250. </xsl:when>
  251. <xsl:when test="$doSelection">
  252. <xsl:variable name="requiredCapability" select="$doSelection/capability[@class=$obj]"/>
  253. <xsl:value-of select="string($requiredCapability) = '' or boolean($effectiveUserCapabilities/*[local-name() = $requiredCapability])"/>
  254. </xsl:when>
  255. <xsl:otherwise>
  256. <xsl:value-of select="true()"/>
  257. </xsl:otherwise>
  258. </xsl:choose>
  259. </xsl:variable>
  260. <xsl:copy>
  261. <xsl:copy-of select="./*"/>
  262. <xsl:if test="string($atRoot)='true' and $displayRoot">
  263. <xsl:variable name="position" select="position() - 1"/>
  264. <position xmlns="http://developer.cognos.com/schemas/xts-cm/1/"><xsl:value-of select="$position"/></position>
  265. </xsl:if>
  266. <xsl:choose>
  267. <xsl:when test="$atRoot='true' and $displayRoot and string(./*[local-name()='storeID'])=string(key('session-param','mrootid')) and string(key('session-param','write'))!='true'"/>
  268. <xsl:when test="contains($selectableObjects,concat(' ',$obj,' ')) and $hasCapability='true'">
  269. <!-- Handle selectable objects -->
  270. <xsl:choose>
  271. <xsl:when test="contains($containerObjects,concat(' ',$obj,' '))">
  272. <!-- Handle containers -->
  273. <xsl:if test="not($moveOnly and $inputObjectId = ./*[local-name()='storeID']) and
  274. not($isContainerMoveOrCopy and ($inputObjectId=./*[local-name()='storeID'] or $inputObjectParentId=./*[local-name()='storeID'])) and
  275. (./*[local-name()='objectClass']!='reportView' or string(./*[local-name()='base']/@nil)='')">
  276. <xsl:variable name="matchesUserInterface">
  277. <xsl:call-template name="matchUserInterface">
  278. <xsl:with-param name="useClass" select="$obj"/>
  279. </xsl:call-template>
  280. </xsl:variable>
  281. <xsl:variable name="permExpression">
  282. <xsl:call-template name="permissionsExpression">
  283. <xsl:with-param name="useClass" select="$obj"/>
  284. <xsl:with-param name="filterName" select="'filterToSelectContainerObjects'"/>
  285. </xsl:call-template>
  286. </xsl:variable>
  287. <xsl:if test="$matchesUserInterface='true' and ($permExpression='nil' or matcher:matches(matcher:new(), $objectPerm, pattern:compile(pattern:new(), $permExpression)))">
  288. <radio xmlns="http://developer.cognos.com/schemas/xts-cm/1/">
  289. <xsl:if test="(($navigationId != '' and ($hasInitValue!='true' or $inputObjectId='')) and $navigationId = ./*[local-name()='storeID']) or $inputObjectId = ./*[local-name()='storeID']">
  290. <xsl:attribute name="checked">true</xsl:attribute>
  291. </xsl:if>
  292. </radio>
  293. </xsl:if>
  294. </xsl:if>
  295. </xsl:when>
  296. <xsl:when test="not($moveOnly and $inputObjectId = ./*[local-name()='storeID']) and
  297. not($isContainerMoveOrCopy and ($inputObjectId=./*[local-name()='storeID'] or $inputObjectParentId=./*[local-name()='storeID'])) and
  298. (./*[local-name()='objectClass']!='reportView' or string(./*[local-name()='base']/@nil)='')">
  299. <!-- Handle non-containers -->
  300. <xsl:variable name="permExpression">
  301. <xsl:call-template name="permissionsExpression">
  302. <xsl:with-param name="useClass" select="$obj"/>
  303. <xsl:with-param name="filterName" select="'filterToSelectNonContainerObjects'"/>
  304. </xsl:call-template>
  305. </xsl:variable>
  306. <xsl:variable name="exclude-reportView">
  307. <xsl:choose>
  308. <xsl:when test="$obj = 'reportView' and contains(string($filterToExcludeReportViewWithBaseObject), concat(' ', ./*[local-name()='base']/*/*[local-name()='objectClass'], ' '))"><xsl:value-of select="true()"/></xsl:when>
  309. <xsl:otherwise><xsl:value-of select="false()"/></xsl:otherwise>
  310. </xsl:choose>
  311. </xsl:variable>
  312. <xsl:variable name="exclude-shortcut-targets">
  313. <xsl:choose>
  314. <xsl:when test="$obj != 'shortcut' or not($shortcut-targets)"><xsl:value-of select="false()"/></xsl:when>
  315. <xsl:otherwise><xsl:value-of select="not(contains($shortcut-targets, concat(' ', ./*[local-name()='target']/*/*[local-name()='objectClass'], ' ')))"/></xsl:otherwise>
  316. </xsl:choose>
  317. </xsl:variable>
  318. <xsl:if test="not($exclude-reportView='true') and not($exclude-shortcut-targets='true') and ($permExpression='nil' or matcher:matches(matcher:new(), $objectPerm, pattern:compile(pattern:new(), $permExpression)))">
  319. <radio xmlns="http://developer.cognos.com/schemas/xts-cm/1/">
  320. <xsl:if test="(($navigationId != '' and ($hasInitValue!='true' or $inputObjectId='')) and $navigationId = ./*[local-name()='storeID']) or $inputObjectId = ./*[local-name()='storeID']">
  321. <xsl:attribute name="checked">true</xsl:attribute>
  322. </xsl:if>
  323. </radio>
  324. </xsl:if>
  325. </xsl:when>
  326. </xsl:choose>
  327. </xsl:when>
  328. </xsl:choose>
  329. <genIcon xmlns="http://developer.cognos.com/schemas/xts-cm/1/">
  330. <xsl:choose>
  331. <xsl:when test="$myFoldersIcon and $atRoot='true' and string(./*[local-name()='storeID'])=string(key('session-param','mrootid'))"><xsl:attribute name="type">myFolders</xsl:attribute></xsl:when>
  332. <xsl:when test="$publicFoldersIcon and $atRoot='true' and string(./*[local-name()='storeID'])=string(key('session-param','prootid'))"><xsl:attribute name="type">publicFolders</xsl:attribute></xsl:when>
  333. <xsl:when test="string($obj)!='reportView'"><xsl:attribute name="type">default</xsl:attribute></xsl:when>
  334. <xsl:otherwise><xsl:attribute name="type">reportView</xsl:attribute></xsl:otherwise>
  335. </xsl:choose>
  336. </genIcon>
  337. <xsl:if test="not($isContainerMoveOrCopy and $inputObjectId=./*[local-name()='storeID']) and (contains($containerObjects,concat(' ',$obj,' ')))">
  338. <!--
  339. Set drill when:
  340. - when in navigate mode
  341. - when objectClass roles and there are children.
  342. -->
  343. <xsl:if test="(string(key('env-param','sosmode')) != 'search' or $launchableObjects!='') and (not($obj='role' and string(./*[local-name()='hasChildren'])!='true') or $overrideRoleChildRequirement='true')">
  344. <xsl:variable name="permExpression">
  345. <xsl:call-template name="permissionsExpression">
  346. <xsl:with-param name="useClass" select="$obj"/>
  347. <xsl:with-param name="filterName" select="'filterToDrillContainerObjects'"/>
  348. </xsl:call-template>
  349. </xsl:variable>
  350. <xsl:if test="$permExpression='' or matcher:matches(matcher:new(), $objectPerm, pattern:compile(pattern:new(), $permExpression))">
  351. <drill name="{./*[local-name()='defaultName']}" xmlns="http://developer.cognos.com/schemas/xts-cm/1/"><xsl:value-of select="xtsext:javascriptencode(./*[local-name()='storeID'])"/></drill>
  352. </xsl:if>
  353. </xsl:if>
  354. </xsl:if>
  355. <xsl:if test="$launchableObjects!='' and contains($launchableObjects,concat(' ',$obj,' '))">
  356. <!-- Determine if the the package gets hyperlinked to launch a studio -->
  357. <!-- NOTE: the queryReply array differs between navigate and search, since navigate has a query for MRU -->
  358. <xsl:variable name="objectId" select="./*[local-name()='storeID']"/>
  359. <xsl:variable name="dfltName" select="./*[local-name()='defaultName']"/>
  360. <xsl:choose>
  361. <xsl:when test="string(key('env-param','sosmode')) != 'search' and $verifyPackage">
  362. <xsl:choose>
  363. <xsl:when test="$hasCapability = 'true' and count($verifyPackage/*)>0 and $verifyPackage/*/*[local-name()='storeID' and string(.) = string($objectId)]">
  364. <launch name="{$dfltName}" xmlns="http://developer.cognos.com/schemas/xts-cm/1/"><xsl:value-of select="xtsext:javascriptencode(string($objectId))"/></launch>
  365. </xsl:when>
  366. <xsl:otherwise><noActionLaunch name="{$dfltName}" xmlns="http://developer.cognos.com/schemas/xts-cm/1/"/></xsl:otherwise>
  367. </xsl:choose>
  368. </xsl:when>
  369. <xsl:when test="string(key('env-param','sosmode')) = 'search' and $verifyPackageWhenSearch">
  370. <xsl:choose>
  371. <xsl:when test="$hasCapability = 'true' and count($verifyPackageWhenSearch/*)>0 and $verifyPackageWhenSearch/*/*[local-name()='storeID' and string(.) = string($objectId)]">
  372. <launch name="{$dfltName}" xmlns="http://developer.cognos.com/schemas/xts-cm/1/"><xsl:value-of select="xtsext:javascriptencode(string($objectId))"/></launch>
  373. </xsl:when>
  374. <xsl:otherwise><noActionLaunch name="{$dfltName}" xmlns="http://developer.cognos.com/schemas/xts-cm/1/"/></xsl:otherwise>
  375. </xsl:choose>
  376. </xsl:when>
  377. <xsl:otherwise>
  378. <launch name="{$dfltName}" xmlns="http://developer.cognos.com/schemas/xts-cm/1/"><xsl:value-of select="xtsext:javascriptencode(string($objectId))"/></launch>
  379. </xsl:otherwise>
  380. </xsl:choose>
  381. </xsl:if>
  382. </xsl:copy>
  383. </xsl:template>
  384. <!-- - - - - - - - - - - - - - - - - - - - - - - - - PROCESS SPECIAL REPLY NODES - - - - - - - - - - - - - - - - - - - - - - - - -->
  385. <xsl:template match="/root/*[local-name()='queryResponse']/*[local-name()='queryReply'][3]" mode="three">
  386. <xsl:copy-of select="*"/>
  387. </xsl:template>
  388. <!-- - - - - - - - - - - - - - - - - - - - - - - - - PROCESS OTHER USERS ANCESTOR NODES FOR MY FOLDERS - - - - - - - - - - - - - - - - - - - - - - - - -->
  389. <xsl:template match="*[local-name()='ancestors']" mode="ans">
  390. <ancestors>
  391. <xsl:copy-of select="./@*"/>
  392. <xsl:variable name="accountName" select="concat( '(', string(./*/*[local-name()='objectClass' and string(.)='account']/../*[local-name()='title']), ')' )"/>
  393. <xsl:for-each select="./*">
  394. <xsl:choose>
  395. <xsl:when test="preceding-sibling::*/*[local-name()='objectClass' and string(.)='account']">
  396. <xsl:choose>
  397. <xsl:when test="not(preceding-sibling::*/*[local-name()='objectClass' and string(.)='folder'])">
  398. <xsl:copy>
  399. <xsl:copy-of select="@*"/>
  400. <xsl:for-each select="./*">
  401. <xsl:choose>
  402. <xsl:when test="local-name()!='title'">
  403. <xsl:copy-of select="."/>
  404. </xsl:when>
  405. <xsl:otherwise>
  406. <xsl:copy>
  407. <xsl:copy-of select="@*"/>
  408. <xsl:value-of select="concat(string(.),' ',$accountName)"/>
  409. </xsl:copy>
  410. </xsl:otherwise>
  411. </xsl:choose>
  412. </xsl:for-each>
  413. </xsl:copy>
  414. </xsl:when>
  415. <xsl:otherwise>
  416. <xsl:copy-of select="."/>
  417. </xsl:otherwise>
  418. </xsl:choose>
  419. </xsl:when>
  420. <xsl:otherwise><xsl:copy-of select="."/></xsl:otherwise>
  421. </xsl:choose>
  422. </xsl:for-each>
  423. </ancestors>
  424. </xsl:template>
  425. <!-- - - - - - - - - - - - - - - - - - - - - - - - - MATCHUSERINTERFACE TEMPLATE - - - - - - - - - - - - - - - - - - - - - - - - -->
  426. <xsl:template name="matchUserInterface">
  427. <xsl:param name="useClass" select="''"/>
  428. <xsl:variable name="userInterfacesExpression">
  429. <xsl:if test="string(key('spec-item','userInterfacesFilter')/@objectClass)=$useClass">
  430. <xsl:value-of select="key('spec-item','userInterfacesFilter')[@objectClass=$useClass]"/>
  431. </xsl:if>
  432. </xsl:variable>
  433. <xsl:choose>
  434. <xsl:when test="$userInterfacesExpression = ''">true</xsl:when>
  435. <xsl:otherwise>
  436. <xsl:choose>
  437. <xsl:when test="matcher:matches(matcher:new(), string(./*[local-name()='userInterfaces']), pattern:compile(pattern:new(), $userInterfacesExpression))">true</xsl:when>
  438. <xsl:otherwise>false</xsl:otherwise>
  439. </xsl:choose>
  440. </xsl:otherwise>
  441. </xsl:choose>
  442. </xsl:template>
  443. <!-- - - - - - - - - - - - - - - - - - - - - - - - - PERMISSIONSEXPRESSION TEMPLATE - - - - - - - - - - - - - - - - - - - - - - - - -->
  444. <xsl:template name="permissionsExpression">
  445. <xsl:param name="useClass" select="''"/>
  446. <xsl:param name="filterName" select="''"/>
  447. <xsl:choose>
  448. <xsl:when test="/root/selectionSpec/item[@name=$filterName and contains(@object,string($useClass))]">
  449. <xsl:value-of select="/root/selectionSpec/item[@name=$filterName and contains(@object,string($useClass))]"/>
  450. </xsl:when>
  451. <xsl:otherwise>
  452. <xsl:value-of select="key('spec-item',$filterName)[not(@object)]"/>
  453. </xsl:otherwise>
  454. </xsl:choose>
  455. </xsl:template>
  456. <pf:serialize-xml/>
  457. </xsl:stylesheet>