ViewerDispatcherEntry.js 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. /*
  2. *+------------------------------------------------------------------------+
  3. *| Licensed Materials - Property of IBM
  4. *| IBM Cognos Products: Viewer
  5. *| (C) Copyright IBM Corp. 2001, 2014
  6. *|
  7. *| US Government Users Restricted Rights - Use, duplication or
  8. *| disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  9. *|
  10. *+------------------------------------------------------------------------+
  11. */
  12. /*
  13. *******************************************************************************
  14. *** View DispatcherEntry.js for information on the dispatcher entry classes ***
  15. *******************************************************************************
  16. */
  17. function ViewerDispatcherEntry(oCV) {
  18. ViewerDispatcherEntry.baseConstructor.call(this, oCV);
  19. if (oCV) {
  20. ViewerDispatcherEntry.prototype.setDefaultFormFields.call(this);
  21. this.setCallbacks( {
  22. "prompting" : {"object" : this, "method" : this.onPrompting}
  23. });
  24. var iWidget = oCV.getViewerWidget();
  25. if (iWidget.m_originalFormFields) {
  26. this.setOriginalFormFields(iWidget.m_originalFormFields);
  27. iWidget.m_originalFormFields = null;
  28. }
  29. }
  30. }
  31. ViewerDispatcherEntry.prototype = new ReportDispatcherEntry();
  32. ViewerDispatcherEntry.baseConstructor = ReportDispatcherEntry;
  33. ViewerDispatcherEntry.prototype.parent = ReportDispatcherEntry.prototype;
  34. /**
  35. * Gets called right before the request is sent
  36. */
  37. ViewerDispatcherEntry.prototype.prepareRequest = function() {
  38. this.parent.prepareRequest.call(this);
  39. var oWidget = this.getViewer().getViewerWidget();
  40. if (this.getFormField("widget.reloadToolbar")) {
  41. this.addFormField("cv.buxCurrentUserRole", oWidget.getUserRole());
  42. }
  43. if(oWidget){
  44. DispatcherEntry.addWidgetInfoToFormFields(oWidget, this);
  45. }
  46. // Set it to false here before we send the request. This bolean lets us know when all the
  47. // inline scripts from the data response are done executing
  48. this.getViewer().inlineScriptsDoneExecuting = false;
  49. };
  50. /**
  51. * Add any iWidget specific form fields
  52. */
  53. ViewerDispatcherEntry.prototype.setDefaultFormFields = function() {
  54. var oCV = this.getViewer();
  55. var widget = oCV.getViewerWidget();
  56. var envParams = oCV.envParams;
  57. this.addFormField("bux", "true");
  58. this.addFormField("cv.showFaultPage", "false");
  59. this.addDefinedNonNullFormField("baseReportModificationTime", envParams["baseReportModificationTime"]);
  60. this.addDefinedNonNullFormField("originalReport", envParams["originalReport"]);
  61. this.addDefinedNonNullFormField("ui.reportDrop", envParams["ui.reportDrop"]);
  62. this.addDefinedNonNullFormField("ui.preserveRapTags", envParams["ui.preserveRapTags"]);
  63. if (widget.getProperties()) {
  64. var flashChartOptionValue = widget.getProperties().getFlashCharts(); //properties is in undo/redo stack, so we can get current setting.
  65. if( flashChartOptionValue != null ) {
  66. this.addDefinedNonNullFormField("savedFlashChartOption", flashChartOptionValue);
  67. if (envParams.hasAVSChart) {
  68. this.addDefinedNonNullFormField("hasAVSChart", envParams.hasAVSChart);
  69. }
  70. else {
  71. this.addDefinedNonNullFormField("hasAVSChart", oCV.hasAVSChart());
  72. }
  73. }
  74. }
  75. var cvGateway = widget.getAttributeValue("gateway");
  76. if(cvGateway) {
  77. this.addDefinedNonNullFormField("cv.gateway", cvGateway);
  78. }
  79. var cvWebcontent = widget.getAttributeValue("webcontent");
  80. if(cvWebcontent) {
  81. this.addDefinedNonNullFormField("cv.webcontent", cvWebcontent);
  82. }
  83. if (oCV.envParams["cv.outputKey"]) {
  84. this.addFormField("cv.outputKey", oCV.envParams["cv.outputKey"]);
  85. this.addFormField("b_action", "cvx.high");
  86. delete oCV.envParams["cv.outputKey"];
  87. }
  88. if (widget.getXNodeId()) {
  89. this.setHeaders({"X-Node-ID" : widget.getXNodeId()});
  90. widget.setXNodeId(null);
  91. }
  92. };
  93. ViewerDispatcherEntry.prototype.onPrompting = function(response) {
  94. if (this.getRequestHandler()) {
  95. this.getRequestHandler().onPrompting(response);
  96. }
  97. };