render-planningReviewerTaskRenderings.xslt 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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/">
  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. <script type="text/javascript">
  13. _THIS_.addEventListener('fragment.unload','_THIS_unload', false);
  14. _THIS_.addEventListener('fragment.load','_THIS_init', false);
  15. /**
  16. * Just pass it on.
  17. */
  18. function _THIS_unload(evt){
  19. var _THIS_distList = new Array();
  20. var _THIS_children = _THIS_.getChildren();
  21. var i, l = _THIS_children.length;
  22. for (i = 0; i &lt; l; i++) {
  23. _THIS_distList[i] = _THIS_children[i].id;
  24. }
  25. //do not bubble.
  26. evt.bubbles = false;
  27. _F_Event.distribute(_THIS_distList,evt);
  28. }
  29. function _THIS_init(evt) {
  30. //Distribute to children. Pass it down further.
  31. //Parent is explicitly passing the event here,
  32. //so cascade it further down.
  33. var _THIS_distList = new Array();
  34. var _THIS_children = _THIS_.getChildren();
  35. var i, l = _THIS_children.length;
  36. for (i = 0; i &lt; l; i++) {
  37. _THIS_distList[i] = _THIS_children[i].id;
  38. }
  39. _F_Event.distribute(_THIS_distList,evt);
  40. }
  41. </script>
  42. <xsl:choose>
  43. <xsl:when test="/root/input[@name='dep']/queryResponse/*[local-name()='approveOutput']">
  44. <xsl:apply-templates select="/root/input[@name='dep']/queryResponse/*[local-name()='approveOutput']"/>
  45. </xsl:when>
  46. <xsl:when test="/root/input/queryResponse/*[local-name()='planningTask']/*[local-name()='preview']/*[local-name()='tsePreview']/*[local-name()='agentPreview']">
  47. <xsl:apply-templates select="/root/input/queryResponse/*[local-name()='planningTask']/*[local-name()='preview']/*[local-name()='tsePreview']/*[local-name()='agentPreview']"/>
  48. </xsl:when>
  49. <xsl:when test="/root/input/queryResponse/*[local-name()='planningTask']/*[local-name()='taskLinksList' or local-name()='linksList']">
  50. <xsl:call-template name="renderTaskLinks"/>
  51. </xsl:when>
  52. <xsl:when test="/root/input/queryResponse/*[local-name()='planningTask']/*[local-name()='contextURL']">
  53. <xsl:call-template name="renderTM1Div"/>
  54. </xsl:when>
  55. </xsl:choose>
  56. </xsl:template>
  57. <xsl:template name="renderTaskLinks">
  58. <xsl:variable name="description"><xsl:value-of select="./link/display"/></xsl:variable>
  59. <xsl:call-template name="renderUI">
  60. <xsl:with-param name="path" select="/root/input/queryResponse/*[local-name()='planningTask']/*[local-name()='preview']/*[local-name()='tsePreview']/*[local-name()='agentPreview']"/>
  61. </xsl:call-template>
  62. <!--div tabindex="0" class="viewer" id="_THIS_viewercontent">_THIS?frag-subfragment=viewer/THIS_</div-->
  63. </xsl:template>
  64. <xsl:template name="renderTM1Div">
  65. <xsl:variable name="url"><xsl:value-of select="/root/input/queryResponse/*[local-name()='planningTask']/*[local-name()='contextURL']"/></xsl:variable>
  66. <script type="text/javascript">
  67. function openDialog() {
  68. var dlg = new ui_dialog("TM1Contributor", PFM.JS.IDS_JS_DETAILS, ui_dialog.style.BTN_OK | ui_dialog.style.CENTER | ui_dialog.style.RESIZABLE, -1, -1, 800, 600);
  69. dlg.processCommand = function(cmd) {
  70. if ((cmd == ui_dialog.button.OK)) {
  71. //alert("ok");
  72. }
  73. this.destroy();
  74. return true;
  75. };
  76. var markup = "&lt;iframe height=\&quot;100%\&quot; width=\&quot;100%\&quot; src=\&quot;<xsl:value-of select="$url"/>\&quot; &gt;&lt;/iframe&gt;";
  77. dlg.setContent(markup);
  78. dlg.show();
  79. }
  80. </script>
  81. <a href="#" onclick="javascript:openDialog();">Visit IBM Cognos TM1 Contributor</a>
  82. </xsl:template>
  83. </xsl:stylesheet>