DownloadReportAction.js 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /*
  2. *+------------------------------------------------------------------------+
  3. *| Licensed Materials - Property of IBM
  4. *| IBM Cognos Products: Viewer
  5. *| (C) Copyright IBM Corp. 2013
  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. function DownloadReportAction() {
  13. this._reportFormat = null;
  14. }
  15. DownloadReportAction.prototype = new CognosViewerAction();
  16. /**
  17. * This is a PUBLIC API, do not change.
  18. */
  19. DownloadReportAction.prototype.setRequestParms = function(params) {
  20. if (params) {
  21. this._reportFormat = params.format;
  22. }
  23. };
  24. DownloadReportAction.prototype.execute = function() {
  25. if (!this._reportFormat) {
  26. return false;
  27. }
  28. var oCV = this.getCognosViewer();
  29. var envParams = oCV.envParams;
  30. var request = new HiddenIframeDispatcherEntry(oCV);
  31. request.addFormField("ui.action", "render");
  32. request.addFormField("cv.toolbar", "false");
  33. request.addFormField("cv.header", "false");
  34. request.addFormField("run.outputFormat", this._reportFormat);
  35. request.addFormField("ui.name", this.getObjectDisplayName());
  36. request.addFormField("cv.responseFormat", "downloadObject");
  37. request.addFormField("ui.conversation", oCV.getConversation());
  38. request.addFormField("run.prompt", "false");
  39. request.addFormField("asynch.attachmentEncoding", "base64");
  40. request.addFormField("run.outputEncapsulation", "URLQueryString");
  41. request.addFormField("cv.detachRelease", "true");
  42. oCV.dispatchRequest(request);
  43. return true;
  44. };