render-notification.xslt 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  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" xmlns:hts="http://developer.cognos.com/myinbox/common/hts_ui" exclude-result-prefixes="xts xtsext hts">
  9. <xsl:import href="../../common/set-priority.xslt"/>
  10. <xsl:import href="../../common/json-converter.xslt"/>
  11. <xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes"/>
  12. <xsl:template match="/">
  13. <xsl:apply-templates select="/" mode="common"/>
  14. <script language="javascript">
  15. dojo.require("dijit.layout.ContentPane");
  16. _THIS_.addEventListener("fragment.load", "_THIS_init");
  17. _THIS_.addEventListener("fragment.retrieve.after", "_THIS_retrieveAfter");
  18. _THIS_.parent.addEventListener("fragment.unload", "_THIS_unload");
  19. var oTaskInfo;
  20. function _THIS_unload(evt) {
  21. _THIS_.raiseEvent('cognos.hts.showNotificationTaskViewer');
  22. }
  23. function _THIS_init() {
  24. //get the task info as a JSON string and fire the event
  25. <xsl:variable name="jsonTaskInfo">
  26. <xsl:call-template name="convertToJSON">
  27. <xsl:with-param name="taskInfo" select="/root/input[@name='dep']/queryResponse/*[local-name()='getTaskInfoResponse']"/>
  28. </xsl:call-template>
  29. </xsl:variable>
  30. //encode the JSON task info object
  31. <xsl:if test="$jsonTaskInfo != ''">
  32. try {
  33. oTaskInfo = eval("({<xsl:value-of select="xtsext:javascriptencode(string($jsonTaskInfo))"/>})");
  34. oTaskInfo = oTaskInfo.task;
  35. } catch (ex) {
  36. alert('<xts:string id="IDS_FRAG_ERROR_MESSAGE" encode="javascript"/>' + ex);
  37. }
  38. </xsl:if>
  39. var desc = '<xsl:value-of select="xtsext:javascriptencode(/root/*[local-name()='input']/*[local-name()='queryResponse']/*[local-name()='presentationDescription']/*[local-name()='description'][1])"/>';
  40. var description = _F_Strings.htmlDecode(desc);
  41. if (description) {
  42. dojo.addOnLoad(function() {
  43. if (dijit.byId("_THIS_notification_email_container")) {
  44. //if it there detroy it. Should really update, but for some reason
  45. //dijit.byId("_THIS_notification_email_container").attr('content', 'test')
  46. //does not work.
  47. dijit.byId("_THIS_notification_email_container").destroy();
  48. }
  49. new dijit.layout.ContentPane({content: description},"_THIS_notification_email_container");
  50. });
  51. }
  52. }
  53. function _THIS_retrieveAfter(evt) {
  54. if (evt.target.id == "_THIS_") {
  55. if(oTaskInfo) {
  56. //pass the task details to those fragments interested
  57. _THIS_.raiseEvent('cognos.hts.notification_info',oTaskInfo);
  58. }
  59. }
  60. }
  61. </script>
  62. <hts:action>
  63. <hts:div id="_THIS_notification_email_container" dojoType="dijit.layout.ContentPane" style="width:100%;height:100%;overflow-y:auto"></hts:div>
  64. </hts:action>
  65. </xsl:template>
  66. </xsl:stylesheet>