buildSpec.xslt 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639
  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. <xsl:stylesheet version="1.0"
  13. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  14. xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt"
  15. xmlns:xts="http://developer.cognos.com/schemas/xts/"
  16. xmlns:pf="http://developer.cognos.com/schemas/xts/pf"
  17. exclude-result-prefixes="xtsext xts xsl pf">
  18. <!-- xmlns:so="http://developer.cognos.com/schemas/xts/so" -->
  19. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  20. <pf:variables/>
  21. <xsl:key name="env-param" match="/root/env/param" use="@name"/>
  22. <xsl:key name="env-param" match="/root/session/param" use="@name"/>
  23. <!-- Parameter select - must be a value that matches a subject, based on specGuide.xml. -->
  24. <xsl:variable name="soSelect" select="key('env-param','so.select')"/>
  25. <!-- Parameter editOp - operation: either move or copy. -->
  26. <xsl:variable name="soEditOp" select="key('env-param','so.editOp')"/>
  27. <!-- Parameter defaultObjectId - current object being operated on. -->
  28. <xsl:variable name="soDefObjectId" select="string(key('env-param','so.defaultObjectId'))"/>
  29. <!-- Parameter defaultLocationId - current immediate parent to the default object. -->
  30. <xsl:variable name="soDefLocationId">
  31. <xsl:choose>
  32. <xsl:when test="string(key('env-param','so.defaultLocationId'))!=''">
  33. <xsl:value-of select="string(key('env-param','so.defaultLocationId'))"/>
  34. </xsl:when>
  35. <xsl:when test="/root/specGuide/subject[contains(concat(' ',@match,' '),concat(' ',$soSelect,' '))]/param[@name='defaultRootId']">
  36. <xsl:variable name="dl" select="/root/specGuide/subject[contains(concat(' ',@match,' '),concat(' ',$soSelect,' '))]/param[@name='defaultRootId']"/>
  37. <xsl:value-of select="key('env-param',concat('so.',$dl))"/>
  38. </xsl:when>
  39. </xsl:choose>
  40. </xsl:variable>
  41. <!-- current root id for the default object -->
  42. <xsl:variable name="soDefRootId" select="string(key('env-param','so.defaultRootId'))"/>
  43. <!-- current root class for the default object -->
  44. <xsl:variable name="soDefRootClass" select="string(key('env-param','so.defaultRootClass'))"/>
  45. <!-- current object being operated on for the move or copy -->
  46. <xsl:variable name="soEditOpObjId" select="string(key('env-param','so.defaultEditOpObjectId'))"/>
  47. <!-- For display purposes the name of the object needs to be displayed in the title - so.objectName is generated in the handleCallerEnv block -->
  48. <xsl:variable name="soObjectName" select="string(key('env-param','so.objectName'))"/>
  49. <!-- current selected object id. -->
  50. <xsl:variable name="soInObjId" select="string(key('env-param','so.id'))"/>
  51. <!-- the current object is the object's root -->
  52. <xsl:variable name="soAtInObjRootId">
  53. <xsl:choose>
  54. <xsl:when test="$soDefObjectId=$soDefRootId">true</xsl:when>
  55. <xsl:otherwise>false</xsl:otherwise>
  56. </xsl:choose>
  57. </xsl:variable>
  58. <!-- current object id during navigation -->
  59. <xsl:variable name="soNavigationId" select="key('env-param','so.navigationId')"/>
  60. <!-- current root id - corresponds to path '/' -->
  61. <xsl:variable name="soCmRootId" select="string(key('env-param','so.cmRootId'))"/>
  62. <!-- current adminFolder id - corresponds to path '/adminFolder' -->
  63. <xsl:variable name="soAdminId" select="string(key('env-param','so.adminId'))"/>
  64. <!-- Set the parent id to the default object id -->
  65. <xsl:variable name="soInObjParentId">
  66. <xsl:if test="string($soEditOpObjId) != ''"><xsl:value-of select="$soDefObjectId"/></xsl:if>
  67. </xsl:variable>
  68. <!-- Set the object id to use based on whether or not the opEdit is set. -->
  69. <xsl:variable name="useObjId">
  70. <xsl:choose>
  71. <xsl:when test="string($soEditOpObjId)!=''"><xsl:value-of select="$soEditOpObjId"/></xsl:when>
  72. <xsl:otherwise><xsl:value-of select="$soDefObjectId"/></xsl:otherwise>
  73. </xsl:choose>
  74. </xsl:variable>
  75. <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
  76. <!-- Main template +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
  77. <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
  78. <xsl:template match="/root">
  79. <xsl:choose>
  80. <!-- First time displaying selection dialogue - build the selectionSpec based on the specGuide xml file -->
  81. <xsl:when test="not(/root/selectionSpec)">
  82. <xsl:variable name="subjectNode" select="/root/specGuide/subject[contains(concat(' ',@match,' '),concat(' ',$soSelect,' '))]"/>
  83. <selectionSpec>
  84. <xsl:choose>
  85. <xsl:when test="not($subjectNode)">
  86. <xsl:value-of select="/root/selectionSpecMessages/message[@id='specification.error']/property[@name='introText']"/>,<xsl:value-of select="/root/selectionSpecMessages/message[@id='specification.error']/property[@name='specErrorText']"/>
  87. </xsl:when>
  88. <xsl:when test="$subjectNode/param[@name='objects']">
  89. <xsl:call-template name="buildCoreSelectionSpec">
  90. <xsl:with-param name="API" select="string($subjectNode/@api)"/>
  91. </xsl:call-template>
  92. <xsl:apply-templates select="$subjectNode/*" mode="socss"/>
  93. <xsl:if test="not($subjectNode/param[@name='consumer-root'])">
  94. <xsl:call-template name="setConsumerRoot"/>
  95. </xsl:if>
  96. <xsl:if test="not($subjectNode/param[@name='filterToExcludeReportViewWithBaseObject'])">
  97. <!-- Generate the reportView-exclusions when subject does not specify permissions parameter -->
  98. <xsl:apply-templates select="/root/specGuide/globalParams/param[@name='filterToExcludeReportViewWithBaseObject']" mode="socss"/>
  99. </xsl:if>
  100. <xsl:if test="not($subjectNode/param[@name='permissions'])">
  101. <!-- Generate the permissions when subject does not specify permissions parameter -->
  102. <xsl:apply-templates select="/root/specGuide/globalParams/param[@name='permissions']" mode="socss"/>
  103. </xsl:if>
  104. <!--
  105. <xsl:if test="not($subjectNode/param[@name='containerPermissions'])">
  106. <xsl:apply-templates select="/root/specGuide/globalParams/param[@name='containerPermissions']" mode="socss"/>
  107. </xsl:if>
  108. <xsl:if test="not($subjectNode/param[@name='selectablePermissions'])">
  109. <xsl:apply-templates select="/root/specGuide/globalParams/param[@name='selectablePermissions']" mode="socss"/>
  110. </xsl:if>
  111. <xsl:if test="not($subjectNode/param[@name='navigatePermissions'])">
  112. <xsl:apply-templates select="/root/specGuide/globalParams/param[@name='navigatePermissions']" mode="socss"/>
  113. </xsl:if>
  114. -->
  115. <!-- Generate the returns with any previous values when passed from a calling dialogue -->
  116. <xsl:if test="not($subjectNode/param[@name='returns'])">
  117. <xsl:apply-templates select="/root/specGuide/globalParams/param[@name='returns']" mode="rtns"/>
  118. </xsl:if>
  119. <xsl:apply-templates select="/root/searchSpecMessages" mode="mp"/>
  120. </xsl:when>
  121. </xsl:choose>
  122. </selectionSpec>
  123. </xsl:when>
  124. <!-- Navigating within the selection dialogue - update pertinent selectionSpec entries -->
  125. <xsl:otherwise>
  126. <selectionSpec>
  127. <xsl:apply-templates select="/root/selectionSpec/*" mode="ssu"/>
  128. </selectionSpec>
  129. </xsl:otherwise>
  130. </xsl:choose>
  131. </xsl:template>
  132. <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
  133. <!-- Templates for updating the selectionSpec DOM entry (mode ssu) ++++++++++++++++++++++++++++ -->
  134. <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
  135. <!-- update selectionPath with the current location to use in the cm request -->
  136. <xsl:template match="item[@name='navigationId']" mode="ssu">
  137. <item name="navigationId" input="so.navigationId">
  138. <xsl:attribute name="atRoot">
  139. <xsl:choose>
  140. <xsl:when test="/root/selectionSpec/item[@name='presentation']/options/option[@name='displayVirtualRootNode']">
  141. <xsl:choose>
  142. <xsl:when test="$soNavigationId=$soCmRootId">true</xsl:when>
  143. <xsl:otherwise>false</xsl:otherwise>
  144. </xsl:choose>
  145. </xsl:when>
  146. <xsl:otherwise>false</xsl:otherwise>
  147. </xsl:choose>
  148. </xsl:attribute>
  149. <!-- update atSelectionPFRoot if navigated to the Public Folders directory -->
  150. <xsl:attribute name="atSelectionPFRoot">
  151. <xsl:choose>
  152. <xsl:when test="key('session-param','prootid')=$soNavigationId">true</xsl:when>
  153. <xsl:otherwise>false</xsl:otherwise>
  154. </xsl:choose>
  155. </xsl:attribute>
  156. <xsl:call-template name="publicFoldersIcon"/>
  157. <!-- update atSelectionMFRoot if navigated to the My Folders directory -->
  158. <xsl:attribute name="atSelectionMFRoot">
  159. <xsl:choose>
  160. <xsl:when test="key('session-param','mrootid')=$soNavigationId">true</xsl:when>
  161. <xsl:otherwise>false</xsl:otherwise>
  162. </xsl:choose>
  163. </xsl:attribute>
  164. <xsl:attribute name="rootId"><xsl:value-of select="$soCmRootId"/></xsl:attribute>
  165. <!-- update atInputObjectRoot if we are located at the input objects root location -->
  166. <xsl:attribute name="atInputObjectRoot"><xsl:value-of select="$soAtInObjRootId"/></xsl:attribute>
  167. <xsl:if test="/root/selectionSpec/item[@name='navigationId']/@displayRootWhenAdmin"><xsl:attribute name="displayRootWhenAdmin"><xsl:value-of select="/root/selectionSpec/item[@name='navigationId']/@displayRootWhenAdmin"/></xsl:attribute></xsl:if>
  168. <xsl:attribute name="initValue">false</xsl:attribute>
  169. <xsl:call-template name="myFoldersIcon"/>
  170. <xsl:value-of select="$soNavigationId"/>
  171. </item>
  172. </xsl:template>
  173. <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
  174. <xsl:template match="item[@name='presentation']" mode="ssu">
  175. <xsl:variable name="condition" select="string(key('env-param',concat('so.condition_',./options/option[@name='displayCheckbox']/@oncheckDisplay)))"/>
  176. <xsl:choose>
  177. <xsl:when test="$condition=''"><xsl:copy-of select="."/></xsl:when>
  178. <xsl:otherwise>
  179. <xsl:copy>
  180. <xsl:apply-templates select="@*" mode="socss"/>
  181. <xsl:apply-templates select="./*" mode="ssu"/>
  182. </xsl:copy>
  183. </xsl:otherwise>
  184. </xsl:choose>
  185. </xsl:template>
  186. <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
  187. <xsl:template match="options" mode="ssu">
  188. <xsl:copy>
  189. <xsl:apply-templates select="./option" mode="ssu"/>
  190. </xsl:copy>
  191. </xsl:template>
  192. <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
  193. <xsl:template match="option" mode="ssu">
  194. <xsl:variable name="condition" select="string(key('env-param',concat('so.condition_',@oncheckDisplay)))"/>
  195. <xsl:choose>
  196. <xsl:when test="not(@name='displayCheckbox')"><xsl:copy-of select="."/></xsl:when>
  197. <xsl:otherwise>
  198. <xsl:copy>
  199. <xsl:apply-templates select="@*[not(local-name()='state')]" mode="socss"/>
  200. <xsl:attribute name="state"><xsl:value-of select="$condition"/></xsl:attribute>
  201. </xsl:copy>
  202. </xsl:otherwise>
  203. </xsl:choose>
  204. </xsl:template>
  205. <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
  206. <xsl:template match="*" mode="ssu">
  207. <xsl:copy-of select="."/>
  208. </xsl:template>
  209. <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
  210. <!-- Templates for creating the selectionSpec DOM entry +++++++++++++++++++++++++++++++++++++ -->
  211. <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
  212. <xsl:template match="param[@name='objects']" mode="socss">
  213. <xsl:variable name="param" select="."/>
  214. <!-- create items for all object attributes other than those starting with 'is' or 'over' -->
  215. <xsl:apply-templates select="$param/*/@*[not(starts-with(string(local-name()),'is') or starts-with(string(local-name()),'over'))]" mode="soobj"/>
  216. <item name="containerObjects">
  217. <xsl:apply-templates select="$param/*[string(@isContainer)='true']" mode="soobj"/>
  218. </item>
  219. <item name="selectableObjects">
  220. <xsl:apply-templates select="$param/*[string(@isSelectable)='true']" mode="soobj"/>
  221. </item>
  222. <xsl:if test="$param/*[string(@isLaunchable)='true']">
  223. <item name="launchableObjects">
  224. <xsl:apply-templates select="$param/object[string(@isLaunchable)='true']" mode="soobj"/>
  225. <xsl:text> </xsl:text>
  226. </item>
  227. </xsl:if>
  228. <xsl:apply-templates select="/root/specGuide/globalParams/param[@name='filterToSelectContainerObjects']" mode="socss"/>
  229. <xsl:apply-templates select="/root/specGuide/globalParams/param[@name='filterToSelectNonContainerObjects']" mode="socss"/>
  230. <xsl:apply-templates select="/root/specGuide/globalParams/param[@name='filterToDrillContainerObjects']" mode="socss"/>
  231. <xsl:if test="$param/*[@overrideFilterToSelectContainerObjects]">
  232. <xsl:apply-templates select="$param/*[@overrideFilterToSelectContainerObjects]" mode="ovrfltr"/>
  233. </xsl:if>
  234. <xsl:if test="$param/*[@overrideFilterToSelectNonContainerObjects]">
  235. <xsl:apply-templates select="$param/*[@overrideFilterToSelectNonContainerObjects]" mode="ovrfltr"/>
  236. </xsl:if>
  237. <xsl:if test="$param/*[@overrideFilterToDrillContainerObjects]">
  238. <xsl:apply-templates select="$param/*[@overrideFilterToDrillContainerObjects]" mode="ovrfltr"/>
  239. </xsl:if>
  240. <xsl:variable name="optionalObject" select="../param[@name='presentation']/options/option[@name='displayCheckbox']"/>
  241. <xsl:variable name="objectFilter">
  242. <xsl:text/>/*[<xsl:text/>
  243. <xsl:for-each select="$param/*[not(string(.)=string($optionalObject/@oncheckDisplay))]">
  244. <xsl:variable name="pos" select="position()"/>
  245. <xsl:if test="$pos > 1"><xsl:text/> or <xsl:text/></xsl:if>
  246. <xsl:text/>@objectClass="<xsl:value-of select="string(.)"/>"<xsl:text/>
  247. </xsl:for-each>
  248. <xsl:text/>]<xsl:text/>
  249. </xsl:variable>
  250. <item name="selectionFilter"><xsl:value-of select="$objectFilter"/></item>
  251. <xsl:if test="$optionalObject">
  252. <item name="conditionFilter_{$optionalObject/@oncheckDisplay}">
  253. <xsl:value-of select="substring-before($objectFilter,']')"/><xsl:text/> or @objectClass="<xsl:text/><xsl:value-of select="$optionalObject/@oncheckDisplay"/><xsl:text/>"]<xsl:text/>
  254. </item>
  255. </xsl:if>
  256. <item name="operation">
  257. <xsl:if test="$soEditOp='move'">
  258. <xsl:attribute name="moveOnly">true</xsl:attribute><xsl:attribute name="moveOrCopy">true</xsl:attribute>
  259. <xsl:if test="string(../param[@name='presentation']/options/option[@name='onMove']/@objectIsContainer)='false'"><xsl:attribute name="containerMoveOrCopy">true</xsl:attribute></xsl:if>
  260. </xsl:if>
  261. <xsl:if test="$soEditOp='copy'">
  262. <xsl:attribute name="copyOnly">true</xsl:attribute><xsl:attribute name="moveOrCopy">true</xsl:attribute>
  263. <xsl:if test="string(../param[@name='presentation']/options/option[@name='onCopy']/@objectIsContainer)='false'"><xsl:attribute name="containerMoveOrCopy">true</xsl:attribute></xsl:if>
  264. </xsl:if>
  265. <xsl:value-of select="$soEditOp"/>
  266. </item>
  267. </xsl:template>
  268. <xsl:template match="param[@name='shortcut-targets']" mode="socss">
  269. <item name="shortcut-targets">
  270. <xsl:apply-templates select="./*" mode="soobj"/>
  271. </item>
  272. </xsl:template>
  273. <xsl:template match="param[@name='filterToExcludeReportViewWithBaseObject']" mode="socss">
  274. <item name="filterToExcludeReportViewWithBaseObject">
  275. <xsl:apply-templates select="./*" mode="soobj"/>
  276. </item>
  277. </xsl:template>
  278. <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
  279. <xsl:template match="param[@name='permissions']" mode="socss">
  280. <item name="selectionPermissions"><xsl:value-of select="."/></item>
  281. </xsl:template>
  282. <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
  283. <xsl:template match="object" mode="ovrfltr">
  284. <xsl:variable name="filter">
  285. <xsl:choose>
  286. <xsl:when test="@overrideFilterToSelectContainerObjects"><xsl:value-of select="@overrideFilterToSelectContainerObjects"/></xsl:when>
  287. <xsl:when test="@overrideFilterToSelectNonContainerObjects"><xsl:value-of select="@overrideFilterToSelectNonContainerObjects"/></xsl:when>
  288. <xsl:when test="@overrideFilterToDrillContainerObjects"><xsl:value-of select="@overrideFilterToDrillContainerObjects"/></xsl:when>
  289. </xsl:choose>
  290. </xsl:variable>
  291. <xsl:variable name="filterName">
  292. <xsl:choose>
  293. <xsl:when test="@overrideFilterToSelectContainerObjects">filterToSelectContainerObjects</xsl:when>
  294. <xsl:when test="@overrideFilterToSelectNonContainerObjects">filterToSelectNonContainerObjects</xsl:when>
  295. <xsl:when test="@overrideFilterToDrillContainerObjects">filterToDrillContainerObjects</xsl:when>
  296. </xsl:choose>
  297. </xsl:variable>
  298. <item name="{$filterName}" object="{string(.)}">
  299. <xsl:value-of select="$filter"/>
  300. </item>
  301. </xsl:template>
  302. <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
  303. <xsl:template match="param[@name='returns']" mode="socss">
  304. <item name="returns">
  305. <!-- <xsl:apply-templates select="/root/specGuide/globalParams/param[@name='returns']/*" mode="rtns"/> -->
  306. <xsl:apply-templates select="*" mode="rtns"/>
  307. </item>
  308. </xsl:template>
  309. <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
  310. <xsl:template match="param[@name='returns']" mode="rtns">
  311. <item name="returns"><xsl:apply-templates select="*" mode="rtns"/></item>
  312. </xsl:template>
  313. <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
  314. <xsl:template match="return" mode="rtns">
  315. <param>
  316. <xsl:copy-of select="@*"/>
  317. </param>
  318. </xsl:template>
  319. <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
  320. <xsl:template match="param[@name='presentation']" mode="socss">
  321. <xsl:variable name="messageId" select="@messageId"/>
  322. <xsl:variable name="currentObject">
  323. <xsl:choose>
  324. <xsl:when test="$soNavigationId!=''"><xsl:value-of select="$soNavigationId"/></xsl:when>
  325. <xsl:when test="string(../param[string(@name)='objects']/*[string(@isLaunchable)='true'])!='' and $soDefObjectId != ''"><xsl:value-of select="$soDefObjectId"/></xsl:when>
  326. <xsl:when test="$soDefLocationId!=''"><xsl:value-of select="$soDefLocationId"/></xsl:when>
  327. <xsl:when test="$soDefRootId!=''"><xsl:value-of select="$soDefRootId"/></xsl:when>
  328. <xsl:otherwise><xsl:value-of select="key('session-param','prootid')"/></xsl:otherwise>
  329. </xsl:choose>
  330. </xsl:variable>
  331. <item name="presentation">
  332. <xsl:call-template name="myFoldersIcon"/>
  333. <xsl:apply-templates select="./*" mode="socss-present"/>
  334. </item>
  335. <xsl:apply-templates select="/root/selectionSpecMessages/message[@id=$messageId]/property" mode="mp"/>
  336. <xsl:if test="./options/option/@name='displayVirtualRootNode'">
  337. <xsl:apply-templates select="/root/selectionSpecMessages/message[@id='root']/property" mode="mp"/>
  338. </xsl:if>
  339. <item name="inputObjectId">
  340. <xsl:attribute name="parentId"><xsl:value-of select="$soInObjParentId"/></xsl:attribute>
  341. <xsl:attribute name="rootClass"><xsl:value-of select="$soDefRootClass"/></xsl:attribute>
  342. <xsl:choose>
  343. <xsl:when test="$soInObjId!=''">
  344. <xsl:value-of select="$soInObjId"/>
  345. </xsl:when>
  346. <xsl:otherwise>
  347. <xsl:attribute name="param">so.objectId</xsl:attribute>
  348. <xsl:value-of select="$useObjId"/>
  349. </xsl:otherwise>
  350. </xsl:choose>
  351. </item>
  352. <item name="navigationId" input="so.navigationId">
  353. <!-- This attribute indicates if the current location is root '/' -->
  354. <xsl:attribute name="navClass"/>
  355. <xsl:attribute name="navClassInput">so.navigationClass</xsl:attribute>
  356. <xsl:attribute name="atRoot">
  357. <xsl:choose>
  358. <xsl:when test="./options/option[@name='displayVirtualRootNode'] and $soCmRootId=$soNavigationId">true</xsl:when>
  359. <xsl:when test="./options/option[@name='displayVirtualRootNode'] and (not($soNavigationId) and $soCmRootId=$soDefLocationId)">true</xsl:when>
  360. <xsl:otherwise>false</xsl:otherwise>
  361. </xsl:choose>
  362. </xsl:attribute>
  363. <!-- This attribute indicates if the current location is at My Folders -->
  364. <xsl:attribute name="atSelectionMFRoot">
  365. <xsl:choose>
  366. <xsl:when test="(not($soNavigationId) and $currentObject=key('session-param','mrootid')) or ($soNavigationId=key('session-param','mrootid'))">true</xsl:when>
  367. <xsl:otherwise>false</xsl:otherwise>
  368. </xsl:choose>
  369. </xsl:attribute>
  370. <xsl:call-template name="myFoldersIcon">
  371. <xsl:with-param name="currentObject" select="$currentObject"/>
  372. </xsl:call-template>
  373. <!-- This attribute indicates if the current location is at Public Folders-->
  374. <xsl:attribute name="atSelectionPFRoot">
  375. <xsl:choose>
  376. <xsl:when test="(not($soNavigationId) and $currentObject=key('session-param','prootid')) or ($soNavigationId=key('session-param','prootid'))">true</xsl:when>
  377. <xsl:otherwise>false</xsl:otherwise>
  378. </xsl:choose>
  379. </xsl:attribute>
  380. <xsl:call-template name="publicFoldersIcon">
  381. <xsl:with-param name="currentObject" select="$currentObject"/>
  382. </xsl:call-template>
  383. <xsl:attribute name="rootId"><xsl:value-of select="$soCmRootId"/></xsl:attribute>
  384. <xsl:attribute name="atInputObjectRoot"><xsl:value-of select="$soAtInObjRootId"/></xsl:attribute>
  385. <xsl:attribute name="initValue">true</xsl:attribute>
  386. <xsl:call-template name="myFoldersIcon"/>
  387. <xsl:value-of select="$currentObject"/>
  388. </item>
  389. </xsl:template>
  390. <xsl:template match="searchSpecMessages" mode="mp">
  391. <xsl:copy-of select="."/>
  392. </xsl:template>
  393. <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
  394. <xsl:template match="param[@name='actions']" mode="socss">
  395. <item name="actions">
  396. <xsl:choose>
  397. <xsl:when test="@references">
  398. <xsl:variable name="references" select="@references"/>
  399. <xsl:apply-templates select="/root/specGuide/globalParams/param[@name=$references]/action" mode="soact"/>
  400. </xsl:when>
  401. <xsl:otherwise>
  402. <xsl:apply-templates select="./action" mode="soact"/>
  403. </xsl:otherwise>
  404. </xsl:choose>
  405. </item>
  406. </xsl:template>
  407. <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
  408. <xsl:template match="action" mode="soact">
  409. <xsl:variable name="messageId" select="@messageId"/>
  410. <action name="{@name}">
  411. <xsl:copy-of select="@*[name()!='messageId' and name()!='name']"/>
  412. <xsl:copy-of select="./*"/>
  413. <xsl:apply-templates select="/root/selectionSpecMessages/message[@id=$messageId]/property" mode="mp"/>
  414. </action>
  415. </xsl:template>
  416. <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
  417. <xsl:template match="param[@name='modes']" mode="socss">
  418. <item name="modes">
  419. <xsl:copy-of select="@*"/>
  420. <xsl:apply-templates select="./*" mode="socss-modes"/>
  421. </item>
  422. </xsl:template>
  423. <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
  424. <xsl:template match="search" mode="socss-modes">
  425. <xsl:choose>
  426. <xsl:when test="@references">
  427. <xsl:variable name="references" select="@references"/>
  428. <xsl:copy-of select="/root/specGuide/globalParams/param[@name=$references]/*"/>
  429. </xsl:when>
  430. <xsl:otherwise>
  431. <xsl:copy-of select="."/>
  432. </xsl:otherwise>
  433. </xsl:choose>
  434. </xsl:template>
  435. <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
  436. <xsl:template match="options" mode="socss-present">
  437. <xsl:copy>
  438. <xsl:apply-templates select="./*" mode="socss-present"/>
  439. </xsl:copy>
  440. </xsl:template>
  441. <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
  442. <xsl:template match="option" mode="socss-present">
  443. <xsl:choose>
  444. <xsl:when test="@references">
  445. <xsl:variable name="references" select="@references"/>
  446. <option>
  447. <xsl:attribute name="name"><xsl:value-of select="@name"/></xsl:attribute>
  448. <xsl:copy-of select="/root/specGuide/globalParams/param[@name=$references]/*"/>
  449. </option>
  450. </xsl:when>
  451. <xsl:otherwise>
  452. <xsl:copy-of select="."/>
  453. </xsl:otherwise>
  454. </xsl:choose>
  455. </xsl:template>
  456. <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
  457. <xsl:template match="param[@name='includeItems']" mode="socss">
  458. <xsl:copy-of select="./*"/>
  459. </xsl:template>
  460. <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
  461. <xsl:template match="param" mode="socss">
  462. <item name="{./@name}"><xsl:value-of select="string(.)"/></item>
  463. </xsl:template>
  464. <xsl:template match="object" mode="soobj">
  465. <xsl:variable name="pos" select="position()"/>
  466. <xsl:text> </xsl:text><xsl:value-of select="string(.)"/><xsl:if test="$pos=last()"><xsl:text> </xsl:text></xsl:if>
  467. </xsl:template>
  468. <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
  469. <xsl:template match="property" mode="mp">
  470. <!-- set all the messages based on the subjects presentation messageId -->
  471. <xsl:choose>
  472. <xsl:when test="@name!='selectionTitle'">
  473. <item>
  474. <xsl:copy-of select="@*"/>
  475. <xsl:value-of select="."/>
  476. </item>
  477. </xsl:when>
  478. <xsl:otherwise>
  479. <xsl:choose>
  480. <xsl:when test="$soObjectName!='' and (@includes='objectName' or not(../property[@name='selectionTitle' and @includes='objectName']))">
  481. <item>
  482. <xsl:copy-of select="@*"/>
  483. <xsl:value-of select="."/>
  484. </item>
  485. </xsl:when>
  486. <xsl:when test="$soObjectName='' and not(@includes='objectName')">
  487. <item>
  488. <xsl:copy-of select="@*"/>
  489. <xsl:value-of select="."/>
  490. </item>
  491. </xsl:when>
  492. </xsl:choose>
  493. </xsl:otherwise>
  494. </xsl:choose>
  495. </xsl:template>
  496. <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
  497. <xsl:template match="@*" mode="soobj">
  498. <!-- creates items for some attributes from the object in the selectionSpec -->
  499. <item name="{name()}" objectClass="{string(parent::node())}"><xsl:value-of select="."/></item>
  500. </xsl:template>
  501. <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
  502. <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
  503. <xsl:template match="@*" mode="socss">
  504. <!-- adds all the attributes from the subject to the items in the selectionSpec -->
  505. <xsl:attribute name="{name()}"><xsl:value-of select="."/></xsl:attribute>
  506. </xsl:template>
  507. <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
  508. <!-- Template processes all non-matching nodes from the specGuide -->
  509. <xsl:template match="*"/>
  510. <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
  511. <!-- Template to build the core items in the selectionSpec -->
  512. <xsl:template name="buildCoreSelectionSpec">
  513. <xsl:param name="API"/>
  514. <!-- This item contains the permissions to use with the cm request; uses the specGuide selectionPermissions when no filter is specified and does not use it when usePermissions attribute is false -->
  515. <xsl:for-each select="/root/env/param[starts-with(@name,'so.return.')]">
  516. <item name="{@name}"><xsl:value-of select="."/></item>
  517. </xsl:for-each>
  518. <!-- Special processing in contentLogic for copy_user_profile -->
  519. <xsl:if test="$soSelect='copy_user_profile'">
  520. <item name="{$soSelect}"/>
  521. </xsl:if>
  522. <item name="errorReturnsFailText"><xsl:value-of select="/root/selectionSpecMessages/message[@id='specification.error']/property[@name='errorReturnsFailText']"/></item>
  523. </xsl:template>
  524. <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
  525. <!-- Template to set the genPublicFoldersIcon attribute for presentation -->
  526. <xsl:template name="publicFoldersIcon">
  527. <xsl:param name="currentObject" select="''"/>
  528. <xsl:attribute name="publicFoldersIcon">
  529. <xsl:choose>
  530. <xsl:when test="(not($soNavigationId) and string($currentObject)=key('session-param','prootid')) or ($soNavigationId=$soCmRootId or $soNavigationId=key('session-param','prootid'))">true</xsl:when>
  531. <xsl:otherwise>false</xsl:otherwise>
  532. </xsl:choose>
  533. </xsl:attribute>
  534. </xsl:template>
  535. <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
  536. <!-- Template to set the genMyFoldersIcon attribute for presentation -->
  537. <xsl:template name="myFoldersIcon">
  538. <xsl:param name="currentObject" select="''"/>
  539. <xsl:attribute name="myFoldersIcon">
  540. <xsl:choose>
  541. <xsl:when test="(not($soNavigationId) and string($currentObject)=key('session-param','mrootid')) or ($soNavigationId=$soCmRootId or $soNavigationId=key('session-param','mrootid'))">true</xsl:when>
  542. <xsl:otherwise>false</xsl:otherwise>
  543. </xsl:choose>
  544. </xsl:attribute>
  545. </xsl:template>
  546. <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
  547. <!-- Template to build the consumer-root item when not defined in spec -->
  548. <xsl:template name="setConsumerRoot">
  549. <item name="consumer-root"><xsl:value-of select="string(key('env-param','so.consumerRoot'))"/></item>
  550. </xsl:template>
  551. </xsl:stylesheet>