perform_actions.xslt 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3. Licensed Materials - Property of IBM
  4. IBM Cognos Products: cogadmin
  5. (C) Copyright IBM Corp. 2005, 2013
  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:uic="http://developer.cognos.com/schemas/uic/presentation/markup/"
  15. xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
  16. xmlns:muws2="http://docs.oasis-open.org/wsdm/muws2-2.xsd"
  17. xmlns:xts="http://developer.cognos.com/schemas/xts/"
  18. xmlns:resource-prop="http://developer.cognos.com/admin/properties"
  19. xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt"
  20. xmlns:ns1="http://docs.oasis-open.org/wsdm/muws1-2.xsd"
  21. xmlns:admui="http://developer.cognos.com/schemas/xts/admui"
  22. xmlns:wsrf-rp="http://docs.oasis-open.org/wsrf/rp-2"
  23. exclude-result-prefixes="wsrf-rp resource-prop admui xtsext xsl ns1 uic SOAP-ENV muws2 xts">
  24. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
  25. <!-- display variables -->
  26. <admui:variables/>
  27. <xsl:template match="/root" priority="2">
  28. <uic:fragment>
  29. <!-- build the table for the relationships view -->
  30. <uic:table height="214px" width="760px" cellpadding="0" border="0" cellspacing="0">
  31. <uic:features>
  32. <uic:tablePadding>1</uic:tablePadding>
  33. <uic:aria-label><xts:string id="IDS_ADM_ACT_VIEW_RESULTS_HEADER"><xts:param name="action"><xsl:value-of select="key('env-param','actionLabel')"/></xts:param></xts:string></uic:aria-label>
  34. </uic:features>
  35. <uic:header>
  36. <uic:row>
  37. <uic:column/>
  38. <uic:column width="30%">
  39. <uic:text>
  40. <xts:string id="IDS_ADM_ACT_TABLE_HEADER_NAME"/>
  41. </uic:text>
  42. </uic:column>
  43. <uic:column width="30%">
  44. <uic:text>
  45. <xts:string id="IDS_ADM_ACT_TABLE_HEADER_STATUS"/>
  46. </uic:text>
  47. </uic:column>
  48. <uic:column width="40%">
  49. <uic:text>
  50. <xts:string id="IDS_ADM_ACT_TABLE_HEADER_MESSAGE"/>
  51. </uic:text>
  52. </uic:column>
  53. </uic:row>
  54. </uic:header>
  55. <uic:body>
  56. <xsl:for-each select="/root/response">
  57. <xsl:sort select="displayInfo/wsrf-rp:GetMultipleResourcePropertiesResponse/resource-prop:Caption" lang="{/root/contentLocale}"/>
  58. <xsl:apply-templates select="."/>
  59. </xsl:for-each>
  60. </uic:body>
  61. </uic:table>
  62. <script>
  63. <xsl:variable name="exception" select="//actionFault//*[local-name()='exception']"/>
  64. <xsl:choose>
  65. <xsl:when test="not(/root/response/displayInfo/*[local-name()='GetMultipleResourcePropertiesResponse'])">
  66. <!-- Do nothing. The action doesn't require a results dialog -->
  67. </xsl:when>
  68. <xsl:when test="$exception//*[local-name()='exceptionDetail']">
  69. var title='<xts:string id="IDS_ADM_ACT_VIEW_ERROR_RESULTS_HEADER" encode="javascript"><xts:param name="action"><xsl:value-of select="xtsext:javascriptencode(key('env-param','actionLabel'))"/></xts:param><xts:param name="resourceId"><xsl:value-of select="xtsext:javascriptencode(/root/response/displayInfo/wsrf-rp:GetMultipleResourcePropertiesResponse/resource-prop:Caption)"/></xts:param></xts:string>';
  70. var msg = '<xsl:value-of select="xtsext:javascriptencode($exception/*[local-name()='exceptionMsg'])"/>';
  71. var errorDetails = [];
  72. <xsl:for-each select="set:distinct($exception//*[local-name()='exceptionDetail'])" xmlns:set="http://exslt.org/sets">
  73. <xsl:sort select="."/>
  74. errorDetails[errorDetails.length]='<xsl:value-of select="xtsext:javascriptencode(.)"/>';
  75. </xsl:for-each>
  76. var recovery =
  77. {
  78. 'recoverable':<xsl:value-of select="boolean($exception//*[local-name()='exceptionRecoverable'])"/>,
  79. 'msg':'<xts:string id="IDS_ADM_ACT_CONTINUE" encode="javascript"/>'
  80. };
  81. _THIS_.parent.relationshipsObj.showDetailedError(title, msg, errorDetails, recovery);
  82. </xsl:when>
  83. <xsl:otherwise>
  84. <!-- display the popup -->
  85. var title='<xts:string id="IDS_ADM_ACT_VIEW_RESULTS_HEADER" encode="javascript"><xts:param name="action"><xsl:value-of select="xtsext:javascriptencode(key('env-param','actionLabel'))"/></xts:param></xts:string>';
  86. var uiDialog = showModalDialog(ui_dialog.button.OK,_THIS_.div, title, null, 810);
  87. uiDialog.processCommand = function (btnType){
  88. raiseReloadEvent(_THIS_,'<xsl:value-of select="key('env-param','actionResourceID')"/>');
  89. uiDialog.destroy();
  90. return true;
  91. };
  92. </xsl:otherwise>
  93. </xsl:choose>
  94. </script>
  95. </uic:fragment>
  96. </xsl:template>
  97. <!-- build the rows for the table -->
  98. <xsl:template match="response">
  99. <xsl:variable name="jsEncodedResourceLabel" select="displayInfo/wsrf-rp:GetMultipleResourcePropertiesResponse/resource-prop:Caption"/>
  100. <xsl:variable name="jsEncodedIconTooltip" select="displayInfo/wsrf-rp:GetMultipleResourcePropertiesResponse/resource-prop:IconTooltip"/>
  101. <xsl:variable name="jsEncodedAncestors" select="displayInfo/wsrf-rp:GetMultipleResourcePropertiesResponse/resource-prop:Ancestors"/>
  102. <xsl:variable name="hidden" select="displayInfo/wsrf-rp:GetMultipleResourcePropertiesResponse/resource-prop:Hidden"/>
  103. <uic:row>
  104. <uic:column nowrap="nowrap">
  105. <uic:icon disabled="{$hidden}" tabIndex="-1">
  106. <uic:src>
  107. <admui:imageURL type="server">
  108. <admui:image>
  109. <xsl:value-of select="displayInfo/wsrf-rp:GetMultipleResourcePropertiesResponse/resource-prop:Icon"/>
  110. </admui:image>
  111. </admui:imageURL>
  112. </uic:src>
  113. <uic:tooltip>
  114. <xsl:choose>
  115. <xsl:when test="$jsEncodedIconTooltip != ''">
  116. <xsl:value-of select="concat($jsEncodedResourceLabel,' - ',$jsEncodedIconTooltip)"/>
  117. </xsl:when>
  118. <xsl:otherwise>
  119. <xsl:value-of select="$jsEncodedResourceLabel"/>
  120. </xsl:otherwise>
  121. </xsl:choose>
  122. </uic:tooltip>
  123. </uic:icon>
  124. </uic:column>
  125. <uic:column nowrap="nowrap">
  126. <uic:icon valign="middle">
  127. <uic:src>
  128. <admui:imageURL image="path.gif" type="skin"/>
  129. </uic:src>
  130. <uic:tooltip>
  131. <xsl:value-of select="$jsEncodedAncestors"/>
  132. </uic:tooltip>
  133. </uic:icon>
  134. <uic:text>
  135. <xsl:value-of select="$jsEncodedResourceLabel"/>
  136. </uic:text>
  137. </uic:column>
  138. <uic:column>
  139. <uic:text>
  140. <xsl:choose>
  141. <xsl:when test="actionResponse/actionFault[@partialSuccess='true']">
  142. <xts:string id="IDS_ADM_ACT_STATUS_PARTIALLY_SUCCEEDED"/>
  143. </xsl:when>
  144. <xsl:when test="actionResponse/actionFault">
  145. <xts:string id="IDS_ADM_ACT_STATUS_FAILED"/>
  146. </xsl:when>
  147. <xsl:otherwise>
  148. <xts:string id="IDS_ADM_ACT_STATUS_SUCCEEDED"/>
  149. </xsl:otherwise>
  150. </xsl:choose>
  151. </uic:text>
  152. </uic:column>
  153. <uic:column>
  154. <uic:text>
  155. <xsl:apply-templates select="actionResponse/actionFault"/>
  156. <xsl:value-of select="actionResponse/*[local-name()='ExecuteResourceActionResponse']/*[local-name()='Details']/*[local-name()='Detail']"/>
  157. </uic:text>
  158. </uic:column>
  159. </uic:row>
  160. </xsl:template>
  161. <!--
  162. Get the appropriate fault message to display
  163. -->
  164. <xsl:template match="actionFault[.//xts:exception]">
  165. <!--
  166. XTS BUS Request error handling
  167. -->
  168. <xsl:for-each select=".//xts:exception/*[local-name()='exceptionDetail']/*[local-name()='exception']">
  169. <xsl:if test="@errorCode != ''">
  170. <xsl:value-of select="@errorCode"/>
  171. <xsl:text>-</xsl:text>
  172. </xsl:if>
  173. <xsl:choose>
  174. <xsl:when test="@errorCodeString != ''">
  175. <xsl:value-of select="@errorCodeString"/>
  176. </xsl:when>
  177. <xsl:when test="./*[local-name()='message']/*[local-name()='messageString']">
  178. <xsl:value-of select="./*[local-name()='message']/*[local-name()='messageString']"/>
  179. </xsl:when>
  180. <xsl:otherwise>
  181. <xsl:value-of select="./*[local-name()='message']"/>
  182. </xsl:otherwise>
  183. </xsl:choose>
  184. </xsl:for-each>
  185. <!--
  186. XTS standard error handling
  187. TODO: investigate proper way to support standard xts error messages without appending to fault msgs already identified above
  188. This was initially added for trakker 562864
  189. -->
  190. <!--xsl:for-each select=".//xts:exception">
  191. <xsl:if test="xts:exceptionMsg">
  192. <xsl:value-of select="xts:exceptionMsg"/>
  193. </xsl:if>
  194. <xsl:if test="xts:exceptionStackTrace">
  195. <xsl:value-of select="xts:exceptionStackTrace"/>
  196. </xsl:if>
  197. </xsl:for-each-->
  198. </xsl:template>
  199. <!--
  200. Get the appropriate fault message to display
  201. -->
  202. <xsl:template match="actionFault[not (.//xts:exception) and not (//*[local-name()='deleteResponse']/@count=0)]">
  203. <xsl:value-of select="./*[local-name()='pingResponse']/*"/>
  204. </xsl:template>
  205. <!--
  206. Get the appropriate fault message to display
  207. -->
  208. <xsl:template match="actionFault[not (.//xts:exception) and (//*[local-name()='deleteResponse']/@count=0)] ">
  209. <xts:string id="IDS_ERR_NO_DATA"/>
  210. </xsl:template>
  211. <xsl:template match="node()" priority="-1">
  212. <xsl:copy>
  213. <xsl:copy-of select="@*"/>
  214. <xsl:apply-templates/>
  215. </xsl:copy>
  216. </xsl:template>
  217. <xsl:template match="text()" priority="-1">
  218. <xsl:value-of select="."/>
  219. </xsl:template>
  220. </xsl:stylesheet>