ViewerDispatcherEntry.js 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. /*
  2. *+------------------------------------------------------------------------+
  3. *| Licensed Materials - Property of IBM
  4. *| IBM Cognos Products: Viewer
  5. *| (C) Copyright IBM Corp. 2001, 2016
  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. }
  22. }
  23. ViewerDispatcherEntry.prototype = new ReportDispatcherEntry();
  24. ViewerDispatcherEntry.baseConstructor = ReportDispatcherEntry;
  25. ViewerDispatcherEntry.prototype.setDefaultFormFields = function() {
  26. var oCV = this.getViewer();
  27. var envParams = oCV.envParams;
  28. for(var param in envParams) {
  29. if(this.getFormField(param) == null && param.indexOf("frag-") != 0 && param != "cv.fragmentEvent" && param != "cv.transientSpec" && param != "cv.actionState" && param != "globalViewerTransient") {
  30. this.addFormField(param, envParams[param]);
  31. }
  32. }
  33. this.getFormFields().remove("b_action");
  34. this.addFormField("cv.ignoreState", "true");
  35. this.addFormField("cv.responseFormat", "fragment");
  36. this.addFormField("cv.id", "_THIS_");
  37. this.addFormField("cv.catchLogOnFault", "false");
  38. this.addDefinedNonNullFormField("cv.header", envParams["cv.header"]);
  39. this.addDefinedNonNullFormField("cv.toolbar", envParams["cv.toolbar"]);
  40. this.addDefinedNonNullFormField("m_session", envParams["m_session"]);
  41. this.addDefinedNonNullFormField("m_sessionConv", envParams["m_sessionConv"]);
  42. };
  43. /**
  44. * Override the sendRequest method when we're in fragments since we need to do a retrieve
  45. */
  46. ViewerDispatcherEntry.prototype.sendRequest = function() {
  47. // So that we'll end up on the same tab
  48. if (this.getViewer().getCurrentlySelectedTab() && !this.formFieldExists("generic.anyURI.http://developer.cognos.com/ceba/constants/runOptionEnum#pageGroup")) {
  49. this.addFormField("generic.anyURI.http://developer.cognos.com/ceba/constants/runOptionEnum#pageGroup", this.getViewer().getCurrentlySelectedTab());
  50. }
  51. if(this.getFormField("cv.fragmentEvent") == null && (this.getFormField("ui.action") == "forward" || this.getFormField("ui.action") == "back")) {
  52. this.addFormField("cv.fragmentEvent", "false");
  53. this.getViewer().m_viewerFragment.changePromptValues(this.getFormFields());
  54. }
  55. var sParams = this.getRequest().convertFormFieldsToUrl();
  56. var dispatcher = eval(this.getViewer().getId())
  57. dispatcher.retrieve(sParams);
  58. };