render-acknowledgeRenderings.xslt 4.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3. Licensed Materials - Property of IBM
  4. IBM Cognos Products: HTS
  5. (C) Copyright IBM Corp. 2005, 2010
  6. US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  7. -->
  8. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xts="http://developer.cognos.com/schemas/xts/" xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt">
  9. <xsl:import href="../../common/render-outputs.xslt"/>
  10. <xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes"/>
  11. <xsl:template match="/">
  12. <xsl:apply-templates select="/root/input/queryResponse/*[local-name()='manualTask']/*[local-name()='preview']/*[local-name()='tsePreview']/*[local-name()='agentPreview']"/>
  13. </xsl:template>
  14. <xsl:template match="/root/input/queryResponse/*[local-name()='manualTask']/*[local-name()='preview']/*[local-name()='tsePreview']/*[local-name()='agentPreview']">
  15. <xsl:variable name="ackText">
  16. <xsl:choose>
  17. <xsl:when test="/root/input[@name='dep']/*[local-name()='queryResponse']/*[local-name()='manualTask']/*[local-name()='acknowledgeText']">
  18. <xsl:value-of select="/root/input[@name='dep']/*[local-name()='queryResponse']/*[local-name()='manualTask']/*[local-name()='acknowledgeText']"/>
  19. </xsl:when>
  20. <xsl:otherwise>
  21. <xts:string id="IDS_FRAG_DEFAULT_ACKNOWLEDGE_TEXT"/>
  22. </xsl:otherwise>
  23. </xsl:choose>
  24. </xsl:variable>
  25. <script type="text/javascript">
  26. _THIS_.addEventListener("fragment.load", "_THIS_init",false);
  27. _THIS_.addEventListener('fragment.unload','_THIS_unload', false);
  28. function _THIS_init(evt) {
  29. dojo.require("dijit.form.Button");
  30. //check if we have the button
  31. var btn = dijit.byId('_THIS_button');
  32. //create a new one, destroy the old one first
  33. if (btn) {
  34. btn.destroy();
  35. }
  36. var acknowledge = function(){
  37. _THIS_acknowledge(this);
  38. }
  39. //create a dojo button
  40. btn = hts_createButton('<xsl:value-of select="xtsext:javascriptencode(string($ackText))"/>',acknowledge,'_THIS_button');
  41. //Distribute to children
  42. var _THIS_distList = new Array();
  43. var _THIS_children = _THIS_.getChildren();
  44. var i, l = _THIS_children.length;
  45. for (i = 0; i &lt; l; i++) {
  46. _THIS_distList[i] = _THIS_children[i].id;
  47. }
  48. _F_Event.distribute(_THIS_distList,evt);
  49. }
  50. function _THIS_acknowledge(btn) {
  51. var theButton = dijit.byId('_THIS_button');
  52. if (theButton) {
  53. theButton.attr("disabled",true);
  54. }
  55. var params="action=completeNotification";
  56. _THIS_.retrieve(params,null,true);
  57. //update the viewer
  58. _THIS_.transientUpdate('cognosTaskChanged',new Date().toUTCString());
  59. }
  60. /**
  61. * Just pass it on to children. This may not be necessary, When destory is called
  62. * on the parent. However it may be need in other cases if they exist. The event
  63. * is then passed back to the parent as well.
  64. */
  65. function _THIS_unload(evt) {
  66. //Distribute to children
  67. var _THIS_distList = new Array();
  68. var _THIS_children = _THIS_.getChildren();
  69. var i, l = _THIS_children.length;
  70. for (i = 0; i &lt; l; i++) {
  71. _THIS_distList[i] = _THIS_children[i].id;
  72. }
  73. //do not bubble.
  74. evt.bubbles = false;
  75. _F_Event.distribute(_THIS_distList,evt);
  76. }
  77. </script>
  78. <xsl:call-template name="renderUI">
  79. <xsl:with-param name="path" select="."/>
  80. </xsl:call-template>
  81. <div>
  82. <div id="_THIS_button"/>
  83. </div>
  84. <!--div class="viewer" id="_THIS_viewercontent">_THIS?frag-subfragment=viewer/THIS_</div-->
  85. </xsl:template>
  86. </xsl:stylesheet>