group_actions.xslt 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  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, 2014
  6. US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  7. -->
  8. <!--
  9. Copyright (C) 2008 Cognos ULC, an IBM Company. All rights reserved.
  10. Cognos (R) is a trademark of Cognos ULC, (formerly Cognos Incorporated).
  11. -->
  12. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:uic="http://developer.cognos.com/schemas/uic/presentation/markup/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:muws2="http://docs.oasis-open.org/wsdm/muws2-2.xsd" xmlns:xts="http://developer.cognos.com/schemas/xts/" xmlns:resource-prop="http://developer.cognos.com/admin/properties" xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt" xmlns:ns1="http://docs.oasis-open.org/wsdm/muws1-2.xsd" xmlns:admui="http://developer.cognos.com/schemas/xts/admui" xmlns:wsrf-rp="http://docs.oasis-open.org/wsrf/rp-2" exclude-result-prefixes="wsrf-rp resource-prop admui xtsext xsl ns1 uic SOAP-ENV muws2 xts">
  13. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
  14. <xsl:template match="/root" priority="2">
  15. <uic:fragment>
  16. <xsl:variable name="impersonateTenantResponse" select="/root/response//*[local-name() = 'selectTenantsResponse']"/>
  17. <xsl:variable name="terminateSessionsResponse" select="/root/response/*[local-name() = 'terminateSessionsResponse']"/>
  18. <xsl:variable name="cancelInteractiveActivitiesResponse" select="/root/response/*[local-name() = 'CancelInteractiveActivitiesResponse']"/>
  19. <xsl:choose>
  20. <!-- a fault happened that we caught -->
  21. <xsl:when test="/root/response/actionFault">
  22. <script>
  23. <xsl:variable name="cmError" select="string(/root/response/actionFault/fault/*[local-name()='exception']/*[local-name()='exceptionDetail']/*[local-name()='exception']/*[local-name()='message']/*)"/>
  24. <xsl:variable name="isDeleteTenantsError" select="contains($cmError, 'CM-REQ-4403') or contains($cmError, 'CM-REQ-4407') or contains($cmError, 'CM-REQ-4412')"/>
  25. <xsl:variable name="isPersonalDataSetLOBError" select="contains($cmError, 'MSR-LOB-')"/>
  26. <xsl:choose>
  27. <xsl:when test="$isDeleteTenantsError or $isPersonalDataSetLOBError">
  28. alert('<xsl:value-of select="xtsext:javascriptencode($cmError)"/>');
  29. </xsl:when>
  30. <xsl:when test="/root/env/param[@name='groupAction'] = 'false'">
  31. alert('<xts:string id="IDS_SCH_ACTION_SINGLE_FAILED" encode="javascript"/>');
  32. </xsl:when>
  33. <xsl:otherwise>
  34. alert('<xts:string id="IDS_SCH_ACTION_FAILED" encode="javascript"/>');
  35. </xsl:otherwise>
  36. </xsl:choose>
  37. raiseReloadEvent(_THIS_);
  38. </script>
  39. </xsl:when>
  40. <!-- show result in a popup dialog for cancel interactive action -->
  41. <xsl:when test="$impersonateTenantResponse">
  42. <script>_F_getFragmentByID('adminconsole_xmlbookletheader').retrieve();</script>
  43. </xsl:when>
  44. <xsl:when test="$terminateSessionsResponse or $cancelInteractiveActivitiesResponse">
  45. <uic:body>
  46. <uic:table width="100%">
  47. <xsl:choose>
  48. <xsl:when test="$terminateSessionsResponse">
  49. <uic:header>
  50. <uic:row>
  51. <uic:column width="100%">
  52. <uic:text>
  53. <xts:string id="IDS_ADM_ACT_NUMBER_OF_TERMINATED_SESSIONS"/>
  54. </uic:text>
  55. </uic:column>
  56. </uic:row>
  57. </uic:header>
  58. <uic:body>
  59. <uic:row>
  60. <uic:column nowrap="nowrap">
  61. <uic:text>
  62. <xsl:value-of select="number($terminateSessionsResponse)"/>
  63. </uic:text>
  64. </uic:column>
  65. </uic:row>
  66. </uic:body>
  67. </xsl:when>
  68. <xsl:otherwise>
  69. <uic:header>
  70. <uic:row>
  71. <uic:column width="30%">
  72. <uic:text>
  73. <xts:string id="IDS_ADM_ACT_TABLE_HEADER_NAME"/>
  74. </uic:text>
  75. </uic:column>
  76. <uic:column width="70%">
  77. <uic:text>
  78. <xts:string id="IDS_ADM_ACT_TABLE_HEADER_MESSAGE"/>
  79. </uic:text>
  80. </uic:column>
  81. </uic:row>
  82. </uic:header>
  83. <uic:body>
  84. <xsl:for-each select="$cancelInteractiveActivitiesResponse/*[local-name() = 'Result']">
  85. <uic:row>
  86. <uic:column nowrap="nowrap">
  87. <uic:text>
  88. <xsl:variable name="reqId">
  89. <xsl:value-of select="@RequestID"/>
  90. </xsl:variable>
  91. <xsl:for-each select="/root/env/param[starts-with(@name, 'requestID_') and text() = $reqId ]">
  92. <xsl:variable name="nameVar">
  93. <xsl:value-of select="concat('reportName_', substring-after(@name, 'requestID_'))"/>
  94. </xsl:variable>
  95. <xsl:value-of select="/root/env/param[@name= $nameVar]"/>
  96. </xsl:for-each>
  97. </uic:text>
  98. </uic:column>
  99. <uic:column nowrap="nowrap">
  100. <uic:text>
  101. <xsl:value-of select="."/>
  102. </uic:text>
  103. </uic:column>
  104. </uic:row>
  105. </xsl:for-each>
  106. </uic:body>
  107. </xsl:otherwise>
  108. </xsl:choose>
  109. </uic:table>
  110. </uic:body>
  111. <!-- show ourselves -->
  112. <xsl:variable name="actionName">
  113. <xsl:choose>
  114. <xsl:when test="$terminateSessionsResponse">
  115. <xts:string id="IDS_ADM_ACT_TERMINATE_SESSIONS"/>
  116. </xsl:when>
  117. <xsl:otherwise>
  118. <xts:string id="IDS_CUR_CANCEL_EXECUTION"/>
  119. </xsl:otherwise>
  120. </xsl:choose>
  121. </xsl:variable>
  122. <xsl:variable name="headerTitle">
  123. <xts:string id="IDS_ADM_ACT_VIEW_RESULTS_HEADER">
  124. <xts:param name="action">
  125. <xsl:value-of select="$actionName"/>
  126. </xts:param>
  127. </xts:string>
  128. </xsl:variable>
  129. <script>
  130. var uiDialog = showModalDialog(ui_dialog.button.OK,_THIS_.div, '<xsl:value-of select="normalize-space($headerTitle)"/>',null , 500);
  131. uiDialog.processCommand = function (btnType){
  132. raiseReloadEvent(_THIS_);
  133. uiDialog.destroy();
  134. return true;
  135. };
  136. </script>
  137. </xsl:when>
  138. <!-- for other actions, just refresh the page -->
  139. <xsl:otherwise>
  140. <script>
  141. raiseReloadEvent(_THIS_);
  142. </script>
  143. </xsl:otherwise>
  144. </xsl:choose>
  145. </uic:fragment>
  146. </xsl:template>
  147. <xsl:template match="node()" priority="-1">
  148. <xsl:copy>
  149. <xsl:copy-of select="@*"/>
  150. <xsl:apply-templates/>
  151. </xsl:copy>
  152. </xsl:template>
  153. <xsl:template match="text()" priority="-1">
  154. <xsl:value-of select="."/>
  155. </xsl:template>
  156. </xsl:stylesheet>