init_model.xts 32 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3. Licensed Materials - Property of IBM
  4. IBM Cognos Products: AGS
  5. (C) Copyright IBM Corp. 2005, 2017
  6. US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  7. -->
  8. <xts:morphlet xmlns:xts="http://developer.cognos.com/schemas/xts/" messageBase="messages/AGS.xml" requiredCapability="canUseEventStudio">
  9. <!--
  10. ===================================================================================
  11. Get the information about the agent datasource
  12. ===================================================================================
  13. -->
  14. <xts:block id="getAgentModel" mode="interpret" processor="XSLT" type="exec" mandatory="false" condition=".[/root/env/param[@name='ui.action'] = 'edit']">
  15. <xts:logicsheet path="logicsheets/buslogic.xslt"/>
  16. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:send="http://developer.cognos.com/schemas/xts/logic-sheet/xslt/brl/1/" xmlns:bus="http://developer.cognos.com/schemas/bibus/3/" exclude-result-prefixes="send">
  17. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  18. <xsl:template match="/">
  19. <xts:sequence>
  20. <!-- get the agent condition - which defines the model spec for the agent -->
  21. <!-- If ui.cacheContext is empty then retrieve data from CM. RTC:30774-->
  22. <xsl:choose>
  23. <xsl:when test="not(/root/env/param[@name='ui.cacheContext']) or /root/env/param[@name='ui.cacheContext']=''">
  24. <xts:append>
  25. <agentDataSource>
  26. <xts:transform src="transforms/CM/post-process.xslt" processor="XSLT">
  27. <send:request provider="cm" requester="AGS:int_model">
  28. <xts:transform src="transforms/CM/pre-process.xslt" processor="XSLT">
  29. <cm:query xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/">
  30. <cm:search>
  31. <xsl:value-of select="concat(string(/root/env/param[@name = 'ui.object']) , '/report')"/>
  32. </cm:search>
  33. <cm:properties>
  34. <cm:property name="defaultName"/>
  35. <cm:property name="metadataModelPackage"/>
  36. <cm:property name="searchPath"/>
  37. <cm:property name="metadataModel"/>
  38. <cm:property name="specification"/>
  39. </cm:properties>
  40. </cm:query>
  41. </xts:transform>
  42. </send:request>
  43. </xts:transform>
  44. </agentDataSource>
  45. </xts:append>
  46. </xsl:when>
  47. <xsl:otherwise>
  48. <!-- If ui.cacheContext is not empty then call Content Manager Cache Service. -->
  49. <!--xsl:if test="/root/env/param[@name='ui.cacheContext']!=''">
  50. <xsl:if test="/root/env/param[@name='ui.object']!=''"-->
  51. <xts:append>
  52. <cm:queryResponse xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/">
  53. <xts:request target="bus://dispatcher" name="BUS">
  54. <xts:param name="soapAction">contentManagerCacheService</xts:param>
  55. <xts:param name="responseEnvelope">false</xts:param>
  56. <xts:param name="outputHeader">false</xts:param>
  57. <SOAP-ENV:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema">
  58. <SOAP-ENV:Header>
  59. <xts:transform src="ags/transforms/transportRequester.xslt" processor="XSLT">
  60. <root>
  61. <requester>init_model</requester>
  62. <xsl:copy-of select="/root/header/bus:biBusHeader"/>
  63. </root>
  64. </xts:transform>
  65. </SOAP-ENV:Header>
  66. <SOAP-ENV:Body>
  67. <cmCache:queryCache xmlns:cmCache="http://developer.cognos.com/schemas/contentManagerCacheService/1">
  68. <bus:objectPath xsi:type="bus:searchPathSingleObject">
  69. <xsl:value-of select="concat(string(/root/env/param[@name = 'ui.object']) , '/report')"/>
  70. </bus:objectPath>
  71. <bus:searchType xsi:type="bus:classEnum">report</bus:searchType>
  72. <bus:entries xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="bus:classEnum[2]">
  73. <item xsi:type="bus:classEnum">package</item>
  74. <item xsi:type="bus:classEnum">report</item>
  75. </bus:entries>
  76. <bus:options xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="bus:option[1]">
  77. <item xsi:type="bus:genericOptionXMLEncodedXML">
  78. <bus:name xsi:type="xsd:string">http://developer.cognos.com/ceba/constants/contentManagerCacheOptionEnum#context</bus:name>
  79. <bus:value xsi:type="bus:xmlEncodedXML">
  80. <xsl:value-of select="/root/env/param[@name='ui.cacheContext']"/>
  81. </bus:value>
  82. </item>
  83. </bus:options>
  84. </cmCache:queryCache>
  85. </SOAP-ENV:Body>
  86. </SOAP-ENV:Envelope>
  87. </xts:request>
  88. </cm:queryResponse>
  89. </xts:append>
  90. <xts:append>
  91. <agentDataSource>
  92. <queryResponse>
  93. <xts:transform src="transforms/CM/post-process.xslt" processor="XSLT">
  94. <xts:queryNode select="/root/*[local-name() = 'queryResponse']/*[local-name() = 'queryCacheResult']/result/objects"/>
  95. </xts:transform>
  96. </queryResponse>
  97. </agentDataSource>
  98. </xts:append>
  99. </xsl:otherwise>
  100. </xsl:choose>
  101. </xts:sequence>
  102. </xsl:template>
  103. </xsl:stylesheet>
  104. </xts:block>
  105. <!--
  106. ===================================================================================
  107. Get information about the latest model from Content Manager
  108. ===================================================================================
  109. -->
  110. <xts:block id="getLatestModel" mode="interpret" processor="XSLT" type="exec" mandatory="false" dependency="getAgentModel" condition=".[/root/*[local-name()='agentDataSource']/*[local-name()='queryResponse']!='' or /root/env/param[@name='ui.action'] = 'new']">
  111. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/" xmlns:bus="http://developer.cognos.com/schemas/bibus/3/" xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt" exclude-result-prefixes="cm bus xtsext">
  112. <xsl:template match="/">
  113. <!--
  114. define the search path for the model, if the model package does not exist(which will be the case if the package has been removed and republished)
  115. then use the search path defined in the report specification
  116. -->
  117. <xsl:variable name="model_search">
  118. <xsl:choose>
  119. <xsl:when test="not(/root/agentDataSource/*[local-name()='queryResponse']/*[local-name()='report']/*[local-name()='metadataModelPackage']/*/*[local-name()='searchPath'])">
  120. <xsl:value-of select="/root/agentDataSource/*[local-name()='queryResponse']/*[local-name()='report']/*[local-name()='specification']/*[local-name()='report']/*[local-name()='modelPath']"/>
  121. </xsl:when>
  122. <xsl:otherwise>
  123. <xsl:value-of select="concat(/root/agentDataSource/*[local-name()='queryResponse']/*[local-name()='report']/*[local-name()='metadataModelPackage']/*/*[local-name()='searchPath'], '/model[last()]')"/>
  124. </xsl:otherwise>
  125. </xsl:choose>
  126. </xsl:variable>
  127. <xsl:choose>
  128. <xsl:when test="$model_search='' and /root/env/param[@name='ui.action']='edit'">
  129. <xts:append>
  130. <agentDataSource>
  131. <modelFound>false</modelFound>
  132. </agentDataSource>
  133. </xts:append>
  134. </xsl:when>
  135. <xsl:otherwise>
  136. <xts:sequence>
  137. <!-- get the agent condition - which defines the model spec for the agent -->
  138. <!-- If ui.cacheContext is empty then retrieve data from CM. RTC:30774-->
  139. <xsl:choose>
  140. <xsl:when test="not(/root/env/param[@name='ui.cacheContext']) or /root/env/param[@name='ui.cacheContext']=''">
  141. <xts:append>
  142. <cmLastModel action="{/root/env/param[@name='ui.action']}">
  143. <!--
  144. we need responseEnvelope="true" otherwise, when we receive a fault, XTS doesn't render default error page.
  145. -->
  146. <xts:request href="bus://dispatcher" protocol="BUS" responseEnvelope="false" soapAction="http://www.ibm.com/xmlns/prod/cognos/contentManagerService/201505/" outputHeader="true">
  147. <SOAP-ENV:Envelope xmlns:bus="http://developer.cognos.com/schemas/bibus/3/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  148. <SOAP-ENV:Header>
  149. <xsl:copy-of select="/root/header/bus:biBusHeader"/>
  150. </SOAP-ENV:Header>
  151. <SOAP-ENV:Body>
  152. <bus:query>
  153. <search xsi:type="xsd:string">
  154. <xsl:choose>
  155. <xsl:when test="/root/env/param[@name='ui.action'] = 'edit'">
  156. <xsl:value-of select="$model_search"/>
  157. </xsl:when>
  158. <xsl:otherwise>
  159. <xsl:value-of select="/root/env/param[@name='ui.object']"/>
  160. <xsl:text>/model[last()]</xsl:text>
  161. </xsl:otherwise>
  162. </xsl:choose>
  163. </search>
  164. <properties xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="bus:propEnum[3]">
  165. <item xsi:type="bus:propEnum">ancestors</item>
  166. <item xsi:type="bus:propEnum">defaultName</item>
  167. <item xsi:type="bus:propEnum">searchPath</item>
  168. </properties>
  169. <options xsi:type="cm:queryOptions">
  170. <refProps xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="cm:refProp[1]">
  171. <item xsi:type="cm:refProp">
  172. <refPropName xsi:type="cm:propEnum">parent</refPropName>
  173. <properties xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="cm:propEnum[1]">
  174. <item xsi:type="cm:propEnum">effectiveUserCapabilities</item>
  175. </properties>
  176. </item>
  177. </refProps>
  178. </options>
  179. </bus:query>
  180. </SOAP-ENV:Body>
  181. </SOAP-ENV:Envelope>
  182. </xts:request>
  183. </cmLastModel>
  184. </xts:append>
  185. </xsl:when>
  186. <xsl:otherwise>
  187. <xts:append>
  188. <cm:queryModelResponse xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/">
  189. <xts:request href="bus://dispatcher" protocol="BUS" responseEnvelope="false" soapAction="contentManagerCacheService" outputHeader="true">
  190. <SOAP-ENV:Envelope xmlns:bus="http://developer.cognos.com/schemas/bibus/3/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:cmCache="http://developer.cognos.com/schemas/contentManagerCacheService/1" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  191. <SOAP-ENV:Header>
  192. <xts:transform src="ags/transforms/transportRequester.xslt" processor="XSLT">
  193. <root>
  194. <requester>init_model</requester>
  195. <xsl:copy-of select="/root/header/bus:biBusHeader"/>
  196. </root>
  197. </xts:transform>
  198. </SOAP-ENV:Header>
  199. <SOAP-ENV:Body>
  200. <cmCache:queryCache xmlns:cmCache="http://developer.cognos.com/schemas/contentManagerCacheService/1">
  201. <xsl:choose>
  202. <xsl:when test="/root/env/param[@name='ui.action']='edit'">
  203. <bus:objectPath xsi:type="bus:searchPathSingleObject">
  204. <xsl:value-of select="$model_search"/>
  205. </bus:objectPath>
  206. </xsl:when>
  207. <xsl:otherwise>
  208. <bus:objectPath xsi:type="bus:searchPathSingleObject">
  209. <xsl:value-of select="/root/env/param[@name='ui.object']"/>
  210. <xsl:text>/model[last()]</xsl:text>
  211. </bus:objectPath>
  212. </xsl:otherwise>
  213. </xsl:choose>
  214. <bus:searchType xsi:type="bus:classEnum">model</bus:searchType>
  215. <bus:entries xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="bus:classEnum[3]">
  216. <item xsi:type="bus:classEnum">model</item>
  217. <item xsi:type="bus:classEnum">package</item>
  218. <item xsi:type="bus:classEnum">packageConfiguration</item>
  219. </bus:entries>
  220. <bus:options xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="bus:option[1]">
  221. <item xsi:type="bus:genericOptionXMLEncodedXML">
  222. <bus:name xsi:type="xsd:string">http://developer.cognos.com/ceba/constants/contentManagerCacheOptionEnum#context</bus:name>
  223. <bus:value xsi:type="bus:xmlEncodedXML">
  224. <xsl:value-of select="/root/env/param[@name='ui.cacheContext']"/>
  225. </bus:value>
  226. </item>
  227. </bus:options>
  228. </cmCache:queryCache>
  229. </SOAP-ENV:Body>
  230. </SOAP-ENV:Envelope>
  231. </xts:request>
  232. </cm:queryModelResponse>
  233. </xts:append>
  234. <xts:append>
  235. <cmLastModel action="{/root/env/param[@name='ui.action']}">
  236. <queryResponse>
  237. <queryResult>
  238. <xts:queryNode select="/root/*[local-name() = 'queryModelResponse']//*[local-name() = 'queryCacheResult']/result/objects/item"/>
  239. </queryResult>
  240. </queryResponse>
  241. </cmLastModel>
  242. </xts:append>
  243. <xts:delete select="/root/*[local-name()='queryModelResponse']" mandatory="false"/>
  244. </xsl:otherwise>
  245. </xsl:choose>
  246. </xts:sequence>
  247. </xsl:otherwise>
  248. </xsl:choose>
  249. </xsl:template>
  250. </xsl:stylesheet>
  251. </xts:block>
  252. <!--
  253. ===================================================================================
  254. Get the package configuration from the package associated with the model
  255. ===================================================================================
  256. -->
  257. <xts:block id="getPackageConfiguration" mode="interpret" processor="XSLT" type="exec" mandatory="false" dependency="getLatestModel" condition=".[/root/*[local-name()='agentDataSource']/*[local-name()='queryResponse']!='' or /root/env/param[@name='ui.action'] = 'new']">
  258. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/" xmlns:bus="http://developer.cognos.com/schemas/bibus/3/" xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt" exclude-result-prefixes="cm bus xtsext">
  259. <xsl:template match="/">
  260. <!-- cache path would be *not required
  261. -->
  262. <xsl:choose>
  263. <xsl:when test="not(/root/env/param[@name='ui.cacheContext']) or /root/env/param[@name='ui.cacheContext']=''">
  264. <xsl:variable name="package_searchPath">
  265. <xsl:value-of select="/root/cmLastModel//*[local-name()='queryResponse']/*[local-name()='queryResult']/*[local-name()='item']/*[local-name()='ancestors']/*[local-name()='value']/*[local-name()='item'][last()]/*[local-name()='searchPath']"/>
  266. </xsl:variable>
  267. <xts:sequence>
  268. <xts:append>
  269. <cmPackage action="{/root/env/param[@name='ui.action']}" xmlns:cm="http://developer.cognos.com/schemas/bibus/3/">
  270. <!--
  271. we need responseEnvelope="true" otherwise, when we receive a fault, XTS doesn't render default error page.
  272. -->
  273. <xts:request href="bus://dispatcher" protocol="BUS" responseEnvelope="true" soapAction="http://www.ibm.com/xmlns/prod/cognos/contentManagerService/201505/" outputHeader="true">
  274. <SOAP-ENV:Envelope xmlns:bus="http://developer.cognos.com/schemas/bibus/3/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  275. <SOAP-ENV:Header>
  276. <xsl:copy-of select="/root/header/bus:biBusHeader"/>
  277. </SOAP-ENV:Header>
  278. <SOAP-ENV:Body>
  279. <bus:query>
  280. <search xsi:type="xsd:string">
  281. <xsl:value-of select="concat($package_searchPath, '/packageConfiguration')"/>
  282. </search>
  283. <properties xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="bus:propEnum[2]">
  284. <item xsi:type="bus:propEnum">memberDisplayCountDefault</item>
  285. <item xsi:type="bus:propEnum">memberDisplayCountLimit</item>
  286. </properties>
  287. </bus:query>
  288. </SOAP-ENV:Body>
  289. </SOAP-ENV:Envelope>
  290. </xts:request>
  291. </cmPackage>
  292. </xts:append>
  293. </xts:sequence>
  294. </xsl:when>
  295. <xsl:otherwise>
  296. <!-- queryCache has already got package configuration needs to be copied in seperate block -->
  297. <xts:sequence>
  298. <xts:append>
  299. <cmPackage>
  300. <cm:queryResponse xmlns:cm="http://developer.cognos.com/schemas/bibus/3/" xmlns:bus="http://developer.cognos.com/schemas/bibus/3/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  301. <queryResult>
  302. <xsl:copy-of select="/root/cmLastModel//*[local-name()='queryResponse']/*[local-name()='queryResult']/*[local-name()='item'][last()]"/>
  303. </queryResult>
  304. </cm:queryResponse>
  305. </cmPackage>
  306. </xts:append>
  307. </xts:sequence>
  308. </xsl:otherwise>
  309. </xsl:choose>
  310. </xsl:template>
  311. </xsl:stylesheet>
  312. </xts:block>
  313. <!--
  314. ===================================================================================
  315. Remove that block when you remove responseEnvelope="true" from the xts:request
  316. ===================================================================================
  317. -->
  318. <xts:block id="getLastModelFromCM" mode="interpret" processor="XSLT" type="exec" dependency="getPackageConfiguration" mandatory="false" condition=".[/root/*[local-name()='agentDataSource']/*[local-name()='queryResponse']!='' or /root/env/param[@name='ui.action'] = 'new']">
  319. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:cm="http://developer.cognos.com/schemas/bibus/3/" xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
  320. <xsl:template match="/">
  321. <xsl:variable name="latest_model_ref">
  322. <xsl:choose>
  323. <xsl:when test="not(/root/env/param[@name='ui.cacheContext']) or /root/env/param[@name='ui.cacheContext']=''">
  324. <xsl:value-of select="/root/cmLastModel//*[local-name()='queryResponse']/*[local-name()='queryResult']/*[local-name()='item']/*[local-name()='searchPath']/*[local-name()='value']"/>
  325. </xsl:when>
  326. <xsl:otherwise>
  327. <xsl:value-of select="/root/cmLastModel//*[local-name()='queryResponse']/*[local-name()='queryResult']/*[local-name()='item'][./objectClass/value='model']/*[local-name()='searchPath']/*[local-name()='value']"/>
  328. </xsl:otherwise>
  329. </xsl:choose>
  330. </xsl:variable>
  331. <xsl:variable name="agent_model_ref">
  332. <xsl:value-of select="/root/agentDataSource/*[local-name()='queryResponse']/*[local-name()='report']/*[local-name()='metadataModel']/*[local-name()='model']/*[local-name()='searchPath']"/>
  333. </xsl:variable>
  334. <xts:sequence>
  335. <xts:replace select="/root/cmLastModel">
  336. <cmLastModel action="{/root/env/param[@name='ui.action']}">
  337. <xsl:copy-of select="/root/cmLastModel/*"/>
  338. <xsl:if test="not($agent_model_ref = $latest_model_ref) or $agent_model_ref = ''">
  339. <updateFrom>
  340. <xsl:value-of select="$agent_model_ref "/>
  341. </updateFrom>
  342. </xsl:if>
  343. </cmLastModel>
  344. </xts:replace>
  345. <xsl:if test="not(/root/env/param[@name='ui.cacheContext']) or /root/env/param[@name='ui.cacheContext']=''">
  346. <xts:replace select="/root/cmPackage">
  347. <cmPackage>
  348. <xsl:copy-of select="/root/cmPackage/SOAP-ENV:Envelope/SOAP-ENV:Body/*"/>
  349. </cmPackage>
  350. </xts:replace>
  351. </xsl:if>
  352. </xts:sequence>
  353. </xsl:template>
  354. </xsl:stylesheet>
  355. </xts:block>
  356. <!--
  357. ===================================================================================
  358. Get the global capabilities that we are interested in
  359. ===================================================================================
  360. -->
  361. <xts:block id="getCapabilities" mode="interpret" processor="XSLT" type="exec" dependency="getLastModelFromCM" mandatory="false" condition=".[/root/*[local-name()='agentDataSource']/*[local-name()='queryResponse']!='' or /root/env/param[@name='ui.action'] = 'new']">
  362. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:cm="http://developer.cognos.com/schemas/bibus/3/" xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
  363. <xsl:template match="/">
  364. <xts:sequence>
  365. <xts:append select="/root">
  366. <xts:transform src="ags/transforms/get_capabilities.xslt" processor="XSLT">
  367. <root>
  368. <xsl:copy-of select="/root/header/*[local-name()='biBusHeader']/*[local-name()='userCapabilityCache']/*[local-name()='userCapabilities']"/>
  369. <effectiveCapabilities>
  370. <xsl:copy-of select="/root/cmLastModel/*[local-name()='queryResponse']//*[local-name()='effectiveUserCapabilities']/value/item"/>
  371. </effectiveCapabilities>
  372. <!-- These capabilities are global and relevant to us so they are added to the capability list-->
  373. <globalCapabilities>
  374. <item>canUseContentStoreTool</item>
  375. <item>canUseIndexSearch</item>
  376. <item>canUseScheduling</item>
  377. </globalCapabilities>
  378. </root>
  379. </xts:transform>
  380. </xts:append>
  381. </xts:sequence>
  382. </xsl:template>
  383. </xsl:stylesheet>
  384. </xts:block>
  385. <!--
  386. ===================================================================================
  387. Do the output script - which sets up the properties pane and the metadata tree
  388. ===================================================================================
  389. -->
  390. <xts:block id="doScript" type="exec" mode="output" processor="XSLT" mimeType="text/html; charset=utf-8" dependency="getCapabilities" mandatory="false" condition=".[/root/*[local-name()='agentDataSource']/*[local-name()='queryResponse']!='' or /root/env/param[@name='ui.action'] = 'new']">
  391. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:bus="http://developer.cognos.com/schemas/bibus/3/" xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt" xmlns:cm="http://developer.cognos.com/schemas/bibus/3/">
  392. <xsl:output method="html" version="1.0" encoding="UTF-8" indent="no"/>
  393. <xsl:key name="env-param" match="/root/env/param" use="@name"/>
  394. <!-- current file name -->
  395. <xsl:variable name="mname" select="'/conv.xts'"/>
  396. <xsl:variable name="packageRoot">
  397. <xsl:choose>
  398. <xsl:when test="not(/root/env/param[@name='ui.cacheContext']) or /root/env/param[@name='ui.cacheContext']=''">
  399. <xsl:value-of select="/root/cmLastModel/*[local-name()='queryResponse']/queryResult/item/ancestors/value/item[objectClass='package']/searchPath"/>
  400. </xsl:when>
  401. <xsl:otherwise>
  402. <xsl:value-of select="/root/cmLastModel/*[local-name()='queryResponse']/queryResult/item[objectClass/value='package']/searchPath/value"/>
  403. </xsl:otherwise>
  404. </xsl:choose>
  405. </xsl:variable>
  406. <xsl:template match="/root">
  407. <html lang="{/root/user/param[@name='productLocale']}">
  408. <head>
  409. <title><xts:string id="METADATA_FRAME"/></title>
  410. <script type="text/javascript">
  411. <!-- this section sets the values that we need for the metadata model -->
  412. function setModelInfo() {
  413. var cf= (this.getConfigFrame?this.getConfigFrame():(parent.getConfigFrame?parent.getConfigFrame():null));
  414. if (cf==null||!cf.cfgGet||!cf.cfgGet("SCRIPT_ENGINE")) setTimeout(this.setModelInfo,250);
  415. else {
  416. // lets set the values for the locals in here too
  417. cf.cfgSet("productLocale", "<xsl:value-of select="/root/user/param[@name='productLocale']"/>");
  418. cf.cfgSet("contentLocale", "<xsl:value-of select="/root/user/param[@name='contentLocale']"/>");
  419. <!-- set the expression locale from the report on the agent -->
  420. var lastExpressionLocale = cf.cfgGet("expressionLocale");
  421. <xsl:choose>
  422. <xsl:when test="/root/env/param[@name='ui.action'] = 'edit' ">
  423. var loadedExpressionLocale = "<xsl:value-of select="xtsext:javascriptencode(string(/root/agentDataSource/*[local-name()='queryResponse']/*[local-name()='report']/*[local-name()='specification']/*[local-name()='report']/@expressionLocale))"/>";
  424. </xsl:when>
  425. <xsl:otherwise>
  426. // we can't load an expression locale from a package
  427. var loadedExpressionLocale = cf.cfgGet("contentLocale");
  428. </xsl:otherwise>
  429. </xsl:choose>
  430. var lastModel = cf.cfgGet("cmLastModel");
  431. var loadedModel = "<xsl:value-of select="xtsext:javascriptencode(string(/root/cmLastModel/*[local-name()='queryResponse']/queryResult/item/searchPath/value))"/>";
  432. // at this point we can decide if we need to blat the trees
  433. if (lastModel != loadedModel || lastExpressionLocale != loadedExpressionLocale) {
  434. // have to signal via flags - eek
  435. cf.cfgSet("reloadMetadataTree",1);
  436. cf.cfgSet("reloadFunctionsTree",1);
  437. }
  438. cf.cfgSet("expressionLocale", loadedExpressionLocale);
  439. cf.cfgSet("cmLastModel",loadedModel);
  440. <xsl:choose>
  441. <xsl:when test="$packageRoot!=''">
  442. cf.cfgSet("PackageRoot","<xsl:value-of select="xtsext:javascriptencode(xtsext:urlencode(string($packageRoot)))"/>");
  443. </xsl:when>
  444. <xsl:when test="key('env-param','ui.object')!=''">
  445. cf.cfgSet("PackageRoot","<xsl:value-of select="xtsext:javascriptencode(string(key('env-param','ui.object')))"/>");
  446. </xsl:when>
  447. </xsl:choose>
  448. <!-- save the package configuration information that we've asked for -->
  449. <xsl:variable name="t1">
  450. <xsl:choose>
  451. <xsl:when test="xtsext:javascriptencode(string(/root/cmPackage//*[local-name()='queryResponse']/queryResult/item/memberDisplayCountDefault/value))!=''">
  452. <xsl:value-of select="xtsext:javascriptencode(string(/root/cmPackage//*[local-name()='queryResponse']/queryResult/item/memberDisplayCountDefault/value))"/>
  453. </xsl:when>
  454. <xsl:otherwise>
  455. <xsl:value-of select="20"/>
  456. </xsl:otherwise>
  457. </xsl:choose>
  458. </xsl:variable>
  459. cf.cfgSet("memberDisplayCountDefault","<xsl:value-of select="$t1"/>");
  460. <xsl:variable name="t2">
  461. <xsl:choose>
  462. <xsl:when test="xtsext:javascriptencode(string(/root/cmPackage//*[local-name()='queryResponse']/queryResult/item/memberDisplayCountLimit/value))!=''">
  463. <xsl:value-of select="xtsext:javascriptencode(string(/root/cmPackage//*[local-name()='queryResponse']/queryResult/item/memberDisplayCountLimit/value))"/>
  464. </xsl:when>
  465. <xsl:otherwise>
  466. <xsl:value-of select="50"/>
  467. </xsl:otherwise>
  468. </xsl:choose>
  469. </xsl:variable>
  470. cf.cfgSet("memberDisplayCountLimit","<xsl:value-of select="$t2"/>");
  471. <!-- default report name should always be persent (for agent name - new) -->
  472. cf.cfgSet("DefaultReportName",&quot;<xts:string id="NEW_AGENT_NAME" encode="javascript"/>&quot;);
  473. <!-- if we're making a new agent - then we set the name of the agent here - cause we load up add_condition in
  474. the other thread - which does nothing. If editting an agent - we call load_agent - and that does the work -->
  475. <xsl:if test="/root/env/param[@name='ui.action'] = 'new'">
  476. cf.cfgSet("ReportName",&quot;<xts:string id="NEW_AGENT_NAME" encode="javascript"/>&quot;);
  477. cf.setWindowTitle();
  478. <xsl:if test="/root/env/param[@name = 'ui.folder']">
  479. cf.cfgSet("ReportFolder", "<xsl:value-of select="xtsext:javascriptencode(string(/root/env/param[@name='ui.folder']))"/>");
  480. </xsl:if>
  481. </xsl:if>
  482. <xsl:choose>
  483. <xsl:when test="/root/cmLastModel/updateFrom">
  484. cf.cfgSet('updatedModel', 'oldModel:<xsl:value-of select="xtsext:javascriptencode(string(/root/cmLastModel/updateFrom))"/>');
  485. </xsl:when>
  486. <xsl:otherwise>
  487. cf.cfgRemove('updatedModel');
  488. </xsl:otherwise>
  489. </xsl:choose>
  490. <!-- Trakker bug 593870.0 - The 'Schedule the agent...' link is missing from the 'I want to...' area
  491. We need to check if we have the 'canUseScheduling' capability. There will never be an effective capability for 'userCanUseSched'
  492. because it not a package capability. The check needs to be made against the users global capabilities cache
  493. Trakker bug 593901.0 - Some tasks are missing in Event Studio
  494. Missing import, export and content management
  495. -->
  496. var capabilities = "<xsl:value-of select="/root/capabilities"/>";
  497. cf.cfgSet("userCapabilities",capabilities);
  498. cf.resetMenus();
  499. cf.getCommandStackManager().processCommandStack();
  500. }
  501. }
  502. <!-- do both the modelling info and the properties info -->
  503. function doOnLoad()
  504. {
  505. setModelInfo();
  506. }
  507. </script>
  508. </head>
  509. <body onload="doOnLoad();">
  510. &#160;
  511. <!--dbg:dumpxml select="/"/-->
  512. </body>
  513. </html>
  514. </xsl:template>
  515. </xsl:stylesheet>
  516. </xts:block>
  517. <!--
  518. ===============================================================================================
  519. the agent model could not be found(maybe this user does not have permissions to view it)
  520. ===============================================================================================
  521. -->
  522. <xts:block id="doScriptNoModel" type="exec" mode="output" processor="XSLT" mimeType="text/html; charset=utf-8" dependency="getLastModelFromCM" mandatory="false" condition=".[/root/*[local-name()='agentDataSource']/*[local-name()='queryResponse']='' and /root/env/param[@name='ui.action'] = 'edit']">
  523. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:bus="http://developer.cognos.com/schemas/bibus/3/" xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt" xmlns:cm="http://developer.cognos.com/schemas/bibus/3/">
  524. <xsl:output method="html" version="1.0" encoding="UTF-8" indent="no"/>
  525. <xsl:key name="env-param" match="/root/env/param" use="@name"/>
  526. <xsl:variable name="mname" select="'/conv.xts'"/>
  527. <xsl:template match="/root">
  528. <xsl:text disable-output-escaping="yes">&lt;!DOCTYPE html&gt;</xsl:text>
  529. <html>
  530. <head>
  531. <meta http-equiv="X-UA-Compatible" content="IE=edge"/>
  532. <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
  533. <title><xts:string id="METADATA_FRAME"/></title>
  534. <script type="text/javascript">
  535. function doOnLoad() {
  536. var cf= (this.getConfigFrame?this.getConfigFrame():(parent.getConfigFrame?parent.getConfigFrame():null));
  537. cf.getCommandStackManager().initiateCommandStack("leaveAGS()","alert(\'<xts:string id="METADATA_NOT_FOUND" encode="javascript"/>\');window.onbeforeunload=null;window.close()");
  538. }
  539. </script>
  540. </head>
  541. <body onload="doOnLoad();">
  542. &#160;
  543. </body>
  544. </html>
  545. </xsl:template>
  546. </xsl:stylesheet>
  547. </xts:block>
  548. </xts:morphlet>