notification-task-viewer.xslt 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  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/" xmlns:hts="http://developer.cognos.com/myinbox/common/hts_ui" exclude-result-prefixes="xtsext xts hts">
  9. <xsl:import href="../../common/task-tooltip.xslt"/>
  10. <xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes"/>
  11. <xsl:variable name="notification_recipient_to_field">
  12. <xts:string id="IDS_FRAG_TASKVIEWER_LABEL_NOTIFICAION_RECIPIENT_TO_ALT_TXT"/>
  13. </xsl:variable>
  14. <xsl:variable name="notification_recipient_cc_field">
  15. <xts:string id="IDS_FRAG_TASKVIEWER_LABEL_NOTIFICAION_RECIPIENT_CC_ALT_TXT"/>
  16. </xsl:variable>
  17. <xsl:variable name="subject_input_field">
  18. <xts:string id="IDS_FRAG_TASKVIEWER_LABEL_SUBJECT_ALT_TXT"/>
  19. </xsl:variable>
  20. <xsl:template match="/">
  21. <xsl:apply-templates select="/" mode="common"/>
  22. <hts:script type="text/javascript">
  23. _THIS_.addEventListener("fragment.load", "_THIS_init");
  24. function _THIS_init() {
  25. _THIS_.parent.addEventListener('cognos.hts.notification_info', '_THIS_handleTaskInfoEvent', false);
  26. //the message has already been set so just show the info pane
  27. _THIS_.raiseEvent('cognos.hts.hideAll');
  28. }
  29. function _THIS_handleTaskInfoEvent(evt)
  30. {
  31. if (!evt.reflected) {
  32. var taskInfo = evt.payload;
  33. if (taskInfo!=null) {
  34. try {
  35. //set the localized alt and title attributes
  36. var img = dojo.byId('_THIS_taskImage');
  37. var srcPath = "_THIS?frag-resource=${0}/THIS_";
  38. var src = dojo.string.substitute(srcPath,["fragments/common/images/space.gif"]);
  39. var alt = _THIS_getLocalisedTaskTooltip(taskInfo.presentationName);
  40. var title = alt;
  41. //update the image src
  42. if (taskInfo.taskIconPath &amp;&amp; taskInfo.taskIconPath != '') {
  43. src = dojo.string.substitute(srcPath,[escape(taskInfo.taskIconPath)]);
  44. } else {
  45. if (taskInfo.taskType == 'TASK') {
  46. src = dojo.string.substitute(srcPath,["fragments/myinbox/images/icon_task.gif"]);
  47. } else if (taskInfo.taskType == 'NOTIFICATION') {
  48. src = dojo.string.substitute(srcPath,["fragments/myinbox/images/icon_notification.gif"]);
  49. }
  50. }
  51. dojo.attr(img, {src: src,alt: alt,title: title,style: {cursor: "default"}});
  52. var subjectSpan = $("_THIS_subject");
  53. hts_setText(subjectSpan,taskInfo.presentationSubject);
  54. var to = new HTSHumanRole("_THIS_TO");
  55. to.parse(taskInfo.formattedNotificationRecipients);
  56. to.commit();
  57. var cc = new HTSHumanRole("_THIS_CC");
  58. cc.parse(taskInfo.formattedTaskStakeholders);
  59. cc.commit();
  60. hts_setNotificationDeadline(taskInfo,$(_THIS_DEADLINE));
  61. } catch(ex) {
  62. alert('<xts:string id="IDS_FRAG_ERROR_MESSAGE" encode="javascript"/>' + ex);
  63. }
  64. }
  65. }
  66. //only react once to this event. the booklet sends it twice, once for each tab in the booklet.
  67. // this needs to be sorted out properly i.e. a change to the booklet code
  68. //The default distributor of notification details fragment fires this event and the
  69. //event is also fired through normal event processing, where this fragment
  70. //has registered as interested in this event.
  71. evt.reflected=true;
  72. }
  73. </hts:script>
  74. <!-- Text fields and date fields -->
  75. <hts:section format="select-dialog" style="width:100%;">
  76. <table>
  77. <tbody>
  78. <tr>
  79. <td>
  80. <img id="_THIS_taskImage" width="16" src="_THIS?frag-resource=/fragments/common/images/space.gif/THIS_"/>
  81. </td>
  82. <td>
  83. <span id="_THIS_subject" class="subject_line">
  84. <xsl:value-of select="/root/input[@name='dep']/queryResponse/*[local-name()='getTaskInfoResponse']/*[local-name()='task']/*[local-name()='presentationSubject']"/>
  85. </span>
  86. </td>
  87. </tr>
  88. </tbody>
  89. </table>
  90. <hts:rowset >
  91. <hts:row format="select">
  92. <hts:img colspan="3" src="_THIS?frag-resource=/fragments/common/images/space.gif/THIS_" alt="" width="5px"/>
  93. </hts:row>
  94. <hts:row format="select">
  95. <hts:span>
  96. <hts:value>
  97. <xts:string id="IDS_FRAG_TASKVIEWER_NOTIFICATIONTASK_LABEL_TO"/>
  98. </hts:value>
  99. </hts:span>
  100. <hts:img src="_THIS?frag-resource=/fragments/common/images/space.gif/THIS_" alt="" width="5px"/>
  101. <hts:span id="_THIS_TO_display"/>
  102. </hts:row>
  103. <hts:row>
  104. <hts:img colspan="3" src="_THIS?frag-resource=/fragments/common/images/space.gif/THIS_" alt="" width="5px"/>
  105. </hts:row>
  106. <hts:row>
  107. <hts:span>
  108. <hts:value>
  109. <xts:string id="IDS_FRAG_TASKVIEWER_NOTIFICATIONTASK_LABEL_CC"/>
  110. </hts:value>
  111. </hts:span>
  112. <hts:img src="_THIS?frag-resource=/fragments/common/images/space.gif/THIS_" alt="" width="5px"/>
  113. <hts:span id="_THIS_CC_display"/>
  114. </hts:row>
  115. <hts:row>
  116. <hts:img src="_THIS?frag-resource=/fragments/common/images/space.gif/THIS_" alt="" width="5px"/>
  117. </hts:row>
  118. <hts:row>
  119. <hts:span>
  120. <hts:value>
  121. <xts:string id="IDS_FRAG_TASKVIEWER_NOTIFICATIONTASK_LABEL_DEADLINE"/>
  122. </hts:value>
  123. </hts:span>
  124. <hts:img src="_THIS?frag-resource=/fragments/common/images/space.gif/THIS_" alt="" width="5px"/>
  125. <hts:span id="_THIS_DEADLINE"/>
  126. </hts:row>
  127. </hts:rowset>
  128. </hts:section>
  129. </xsl:template>
  130. </xsl:stylesheet>