PowerPlayReportIWidget.js 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. // Licensed Materials - Property of IBM
  2. //
  3. // IBM Cognos Products: pps
  4. //
  5. // (C) Copyright IBM Corp. 2009, 2017
  6. //
  7. // US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  8. dojo.provide("bux.powerplay_report");
  9. dojo.declare("bux.powerplay_report", null, {
  10. getDisplayName: function() {
  11. return this.getAttributeValue("widgetTitle");
  12. },
  13. getSavedOutput: function() {
  14. return this.savedOutput;
  15. },
  16. getAttributeValue: function(name) {
  17. return this.iContext.getiWidgetAttributes().getItemValue(name);
  18. },
  19. setAttributeValue: function(name, value) {
  20. this.iContext.getiWidgetAttributes().setItemValue(name, value);
  21. },
  22. getPowerPlayDiv: function() {
  23. return dojo.byId("_" + this.iContext.widgetId + "_pps_report");
  24. },
  25. getPowerPlayIFrame: function() {
  26. return dojo.byId("_" + this.iContext.widgetId + "_pps_report_iframe");
  27. },
  28. onLoad: function() {
  29. var iframe = this.getPowerPlayIFrame();
  30. var doc = iframe.contentWindow.document;
  31. var form = doc.createElement("FORM");
  32. form.method = "POST";
  33. form.target = iframe.name;
  34. form.action = this.getAttributeValue("gateway");
  35. this.appendToForm( doc, form, "b_action", "xts.run");
  36. this.appendToForm( doc, form, "m", "portal/launch.xts");
  37. this.appendToForm( doc, form, "ui.action", "run");
  38. this.appendToForm( doc, form, "ui.crnfrm", "PDF");
  39. this.appendToForm( doc, form, "ui.crnp", "true");
  40. this.appendToForm( doc, form, "ui.tool", "PowerplayStudio");
  41. this.appendToForm( doc, form, "ddo", "true");
  42. this.appendToForm( doc, form, "ui.gateway", this.getAttributeValue("gateway"));
  43. this.appendToForm( doc, form, "ui.object", this.getAttributeValue("originalReport"));
  44. this.appendToForm( doc, form, "launch.openJSStudioInFrame", "true");
  45. if (!doc.body) // IE6 - <body> is null by default.
  46. doc.appendChild(doc.createElement("body"));
  47. //Submit the form
  48. doc.body.appendChild(form);
  49. form.submit();
  50. },
  51. appendToForm: function( doc, form, fname, fvalue ) {
  52. var input = doc.createElement("INPUT");
  53. input.setAttribute("type", "hidden");
  54. input.setAttribute("name", fname);
  55. input.setAttribute("value", fvalue);
  56. form.appendChild(input);
  57. },
  58. onWidgetSave: function(evt) {
  59. this.fireEvent( "com.ibm.bux.widget.save.done", null, {'status':true});
  60. },
  61. onWidgetRefresh: function ( evt ){
  62. this.onLoad();
  63. this.fireEvent('com.ibm.bux.widget.refresh.done');
  64. },
  65. onWidgetResize: function(evt) {
  66. var iframe = this.getPowerPlayIFrame();
  67. var width = evt.payload.resize.w;
  68. var height = evt.payload.resize.h;
  69. iframe.style.width = eval(width - 5) + "px";
  70. iframe.style.height = eval(height - 5) + "px";
  71. },
  72. isSaveNecessary: function (prompt) {
  73. return false;
  74. },
  75. fireEvent: function( eventName, arg, payload) {
  76. this.iContext.iEvents.fireEvent( eventName, arg, payload );
  77. }
  78. });