delete.xts 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  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. <!--
  13. ===============================================================================================
  14. Deletes an object in CM based on parameters passed in.
  15. Should delete a CM command like so:
  16. <delete xmlns="http://developer.cognos.com/schemas/xts-cm/1/" select="/Contents/folder/report"/>
  17. ===============================================================================================
  18. -->
  19. <xts:morphlet xmlns:xts="http://developer.cognos.com/schemas/xts/" xmlns:cml="http://developer.cognos.com/schemas/xts/logic-sheet/xslt/cml/1/" xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/" xmlns:create="http://developer.cognos.com/schemas/xts/portal/iFrmCmd/1/" xmlns:cms="http://developer.cognos.com/schemas/xts/logic-sheet/xslt/cms/1/">
  20. <xts:block id="doFormCommand" processor="XSLT" type="exec">
  21. <xts:logicsheet path="portal/iFrmCmd/logicsheets/cm-save.xsl"/>
  22. <xts:logicsheet path="logicsheets/buslogic.xslt"/>
  23. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
  24. xmlns:xts="http://developer.cognos.com/schemas/xts/"
  25. xmlns:send="http://developer.cognos.com/schemas/xts/logic-sheet/xslt/brl/1/"
  26. xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/"
  27. xmlns:form="http://developer.cognos.com/schemas/xts/portal/iFrmCmd/1/"
  28. xmlns:bus="http://developer.cognos.com/schemas/bibus/3/"
  29. xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt"
  30. exclude-result-prefixes="xtsext">
  31. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  32. <xsl:template match="/root/command/form:delete/form:env">
  33. <xts:sequence>
  34. <xts:append>
  35. <xts:transform src="transforms/CM/post-process.xslt" processor="XSLT">
  36. <send:request provider="cm">
  37. <xts:transform src="transforms/CM/pre-process.xslt" processor="XSLT">
  38. <cm:delete>
  39. <cm:objects xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/">
  40. <!-- Determine if doing a version delete, if so then skip the m_obj delete otherwise you'll lose the parent object too -->
  41. <xsl:variable name="isVersionsDelete" select="form:param[@name = 'vrsn_del']='true'"/>
  42. <xsl:choose>
  43. <!-- Single object delete. Execlude requests from the "previous versions" page where both m_obj and checkboxes might exist in the request -->
  44. <xsl:when test="(form:param[@name = 'm_obj'] and (form:param[@name = 'm_obj'] != ''))and not($isVersionsDelete)">
  45. <cm:nil>
  46. <cm:searchPath><xsl:value-of select="form:param[@name = 'm_obj']"/></cm:searchPath>
  47. </cm:nil>
  48. </xsl:when>
  49. <!-- Group delete -->
  50. <xsl:otherwise>
  51. <xsl:for-each select="form:param[starts-with(@name, 'checkbox_') and not (starts-with(@name, 'checkbox_dispatcher_')) and not (starts-with(@name, 'checkbox_configurationFolder_true_'))]">
  52. <cm:nil>
  53. <cm:searchPath><xsl:value-of select="xtsext:urldecode(string(.))"/></cm:searchPath>
  54. </cm:nil>
  55. </xsl:for-each>
  56. </xsl:otherwise>
  57. </xsl:choose>
  58. </cm:objects>
  59. <cm:options recursive="true" force="true"/>
  60. </cm:delete>
  61. </xts:transform>
  62. </send:request>
  63. </xts:transform>
  64. </xts:append>
  65. </xts:sequence>
  66. </xsl:template>
  67. </xsl:stylesheet>
  68. </xts:block>
  69. <!-- Delete notification that are no longer being used >
  70. <xts:block id="deleteSchedules" processor="XSLT" type="exec" dependency="doFormCommand">
  71. <xts:logicsheet path="logicsheets/buslogic.xslt"/>
  72. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xts="http://developer.cognos.com/schemas/xts/" xmlns:send="http://developer.cognos.com/schemas/xts/logic-sheet/xslt/brl/1/" xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/" xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt" exclude-result-prefixes="xtsext">
  73. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  74. <xsl:template match="/root/schedules">
  75. <xts:sequence>
  76. <xts:append>
  77. <xsl:for-each select=".//cm:schedule">
  78. <send:request provider="xts">
  79. <Delete xmlns="http://developer.cognos.com/schemas/upfront/">
  80. <id><xsl:value-of select="cm:defaultName"/></id>
  81. </Delete>
  82. </send:request>
  83. </xsl:for-each>
  84. </xts:append>
  85. </xts:sequence>
  86. </xsl:template>
  87. </xsl:stylesheet>
  88. </xts:block-->
  89. <!-- operation results -->
  90. <xts:block id="commandResults" processor="XSLT" type="exec" mode="output" mimeType="text/xml" dependency="doFormCommand">
  91. <xts:logicsheet path="logicsheets/cm-logic.xsl"/>
  92. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/" version="1.0">
  93. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  94. <xsl:template match="/root">
  95. <response xmlns="http://developer.cognos.com/schemas/xts/portal/iFrmCmd/1/">
  96. <xsl:choose>
  97. <xsl:when test="cm:deleteResponse"><xsl:copy-of select="cm:deleteResponse"/></xsl:when>
  98. <xsl:otherwise><error/></xsl:otherwise>
  99. </xsl:choose>
  100. </response>
  101. </xsl:template>
  102. <xsl:template match="text()"/>
  103. </xsl:stylesheet>
  104. </xts:block>
  105. </xts:morphlet>