render-notificationRenderings.xslt 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  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:xtsext="xalan://com.cognos.xts.ext.XTSExt" xmlns:xts="http://developer.cognos.com/schemas/xts/">
  9. <xsl:import href="../../common/render-outputs.xslt"/>
  10. <xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes"/>
  11. <xsl:variable name="btn_value">
  12. <xts:string id="IDS_FRAG_TASKVIEWER_NOTIFICATIONTASK_BUTTON_ACKNOWLEDGE"/>
  13. </xsl:variable>
  14. <xsl:template match="/">
  15. <xsl:variable name="ackText">
  16. <xsl:choose>
  17. <xsl:when test="/root/input/queryResponse/*[local-name()='manualTask']/*[local-name()='acknowledgeText']">
  18. <xsl:value-of select="/root/input/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. <xsl:variable name="taskid" select="/root/interactions/param[@name='taskid']"/>
  26. <script type="text/javascript">
  27. _THIS_.addEventListener('fragment.load','_THIS_init', false);
  28. _THIS_.addEventListener('fragment.unload','_THIS_unload', false);
  29. function _THIS_init(evt) {
  30. <!-- Do not include if not needed. -->
  31. <xsl:if test="/root/input/queryResponse/*[local-name()='manualTask']/*[local-name()='recordReadReceipt'] = 'true'">
  32. dojo.require("dijit.form.Button");
  33. </xsl:if>
  34. <xsl:if test="/root/input/queryResponse/*[local-name()='manualTask']/*[local-name()='recordReadReceipt'] = 'true'">
  35. //check if we have the button
  36. var btn = dijit.byId('_THIS_buttonComplete');
  37. //create a new one, destroy the old one first
  38. if (btn) {
  39. btn.destroy();
  40. }
  41. //create a dojo button
  42. var btn = hts_createButton('<xsl:value-of select="xtsext:javascriptencode(string($ackText))"/>',_THIS_completeNotification,'_THIS_buttonComplete');
  43. </xsl:if>
  44. //Distribute to children. Pass it down further.
  45. //Parent is explicitly passing the event here,
  46. //so cascade it further down.
  47. var _THIS_distList = new Array();
  48. var _THIS_children = _THIS_.getChildren();
  49. var i, l = _THIS_children.length;
  50. for (i = 0; i &lt; l; i++) {
  51. _THIS_distList[i] = _THIS_children[i].id;
  52. }
  53. _F_Event.distribute(_THIS_distList,evt);
  54. }
  55. /**
  56. * Just pass it on.
  57. */
  58. function _THIS_unload(evt){
  59. var _THIS_distList = new Array();
  60. var _THIS_children = _THIS_.getChildren();
  61. var i, l = _THIS_children.length;
  62. for (i = 0; i &lt; l; i++) {
  63. _THIS_distList[i] = _THIS_children[i].id;
  64. }
  65. //do not bubble.
  66. evt.bubbles = false;
  67. _F_Event.distribute(_THIS_distList,evt);
  68. }
  69. <xsl:if test="/root/input/queryResponse/*[local-name()='manualTask']/*[local-name()='recordReadReceipt'] = 'true'">
  70. //this function is called when the acknowledge button is pressed
  71. function _THIS_completeNotification(btn) {
  72. var acknowledgeReadReceipt = dijit.byId('_THIS_buttonComplete');
  73. if (acknowledgeReadReceipt){
  74. acknowledgeReadReceipt.attr("disabled",true);
  75. }
  76. //_THIS_.addEventListener("fragment.load", "_THIS_init");
  77. var params='action=completeNotification&amp;taskid=<xsl:value-of select="$taskid"/>';
  78. _THIS_.retrieve(params,null,true);
  79. //reload the task list to show new task if need be
  80. var _THIS_utils = new hts_utils(_THIS_);
  81. _THIS_utils.refreshCurrentTab('poolTaskList');
  82. }
  83. </xsl:if>
  84. </script>
  85. <form name="_THIS_form" action="_THIS?/THIS_" method="POST">
  86. <xsl:if test="/root/input/queryResponse/*[local-name()='manualTask']/*[local-name()='recordReadReceipt'] = 'true'">
  87. <div id="_THIS_buttonComplete"></div>
  88. </xsl:if>
  89. </form>
  90. <xsl:if test="/root/input/queryResponse/*[local-name()='manualTask']/*[local-name()='taskLinksList' or local-name()='linksList']">
  91. <xsl:call-template name="renderTaskLinks"/>
  92. </xsl:if>
  93. <!--div tabindex="0" class="viewer" id="_THIS_viewercontent">_THIS?frag-subfragment=viewer/THIS_</div-->
  94. </xsl:template>
  95. <xsl:template name="renderTaskLinks">
  96. <xsl:variable name="description">
  97. <xsl:value-of select="./taskLink/display"/>
  98. </xsl:variable>
  99. <xsl:call-template name="renderUI">
  100. <xsl:with-param name="path" select="/root/input/queryResponse/*[local-name()='manualTask']/*[local-name()='preview']/*[local-name()='tsePreview']/*[local-name()='agentPreview']"/>
  101. <xsl:with-param name="channel" select="'notifcationViewer'"/>
  102. </xsl:call-template>
  103. </xsl:template>
  104. </xsl:stylesheet>