RefreshViewAction.js 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. /*
  2. *+------------------------------------------------------------------------+
  3. *| Licensed Materials - Property of IBM
  4. *| IBM Cognos Products: Viewer
  5. *| (C) Copyright IBM Corp. 2001, 2011
  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. * This is the base class for refreshing the report. It'll get the latest
  14. * saved output or rerun the report if there's no saved output
  15. */
  16. function RefreshViewAction()
  17. {
  18. this.m_bCanvasRefreshEvent = false;
  19. }
  20. RefreshViewAction.prototype = new CognosViewerAction();
  21. RefreshViewAction.prototype.addCommonOptions = function(oRequest)
  22. {
  23. // removed the cache CM response about the saved outputs. This will
  24. // force the Snapshots menu to get updated
  25. var widget = this.getCognosViewer().getViewerWidget();
  26. if (this.m_bCanvasRefreshEvent && widget.getSavedOutputSearchPath() != null)
  27. {
  28. oRequest.addFormField("ui.savedOutputSearchPath", encodeURIComponent(widget.getSavedOutputSearchPath()));
  29. }
  30. else
  31. {
  32. widget.setSavedOutputsCMResponse(null);
  33. widget.setSavedOutputSearchPath(null);
  34. }
  35. oRequest.addFormField("run.outputFormat", "HTML");
  36. // need since we might be going from saved output to live if the saved output is no longer available
  37. oRequest.addFormField("widget.reloadToolbar", "true");
  38. // Clear the properties dialog to it'll get rebuilt. This is needed for the 'View report specification' link in
  39. // case we go from saved output to live during the refresh operation
  40. widget.clearPropertiesDialog();
  41. var formWarpRequest = document.getElementById("formWarpRequest" + this.getCognosViewer().getId());
  42. oRequest.addFormField("ui.object", formWarpRequest["reRunObj"].value);
  43. };
  44. RefreshViewAction.prototype.execute = function()
  45. {
  46. var oRequest = this.createCognosViewerDispatcherEntry( "buxDropReportOnCanvas" );
  47. this.addCommonOptions(oRequest);
  48. var oCV = this.getCognosViewer();
  49. var widget = oCV.getViewerWidget();
  50. if (oCV.getCurrentlySelectedTab() && widget.getSavedOutput()) {
  51. oCV.setKeepTabSelected(oCV.getCurrentlySelectedTab());
  52. }
  53. this.getCognosViewer().dispatchRequest(oRequest);
  54. };
  55. RefreshViewAction.prototype.doAddActionContext = function()
  56. {
  57. return false;
  58. };
  59. RefreshViewAction.prototype.updateMenu = function(jsonSpec)
  60. {
  61. jsonSpec.disabled = false;
  62. var oCV = this.getCognosViewer();
  63. if( oCV )
  64. {
  65. var widget = oCV.getViewerWidget();
  66. if( widget && widget.getSavedOutputSearchPath() != null)
  67. {
  68. jsonSpec.disabled = true;
  69. }
  70. }
  71. return jsonSpec;
  72. };