ActionFormFields.js 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. /*
  2. *+------------------------------------------------------------------------+
  3. *| Licensed Materials - Property of IBM
  4. *| IBM Cognos Products: Viewer
  5. *| (C) Copyright IBM Corp. 2001, 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. /**
  13. * Class which knows what form fields are needed for the Action classes
  14. * and info requests
  15. * @param {Object} DispatcherEntry
  16. */
  17. function ActionFormFields(dispatcherEntry) {
  18. this.m_dispatcherEntry = dispatcherEntry;
  19. this.m_oCV = dispatcherEntry.getViewer();
  20. }
  21. ActionFormFields.prototype.addFormFields = function() {
  22. var dispatcherEntry = this.m_dispatcherEntry;
  23. var action = dispatcherEntry.getAction();
  24. action.preProcess();
  25. dispatcherEntry.addFormField("ui.action", "modifyReport");
  26. if(this.m_oCV.getModelPath() !== "") {
  27. dispatcherEntry.addFormField("modelPath", this.m_oCV.getModelPath());
  28. if(typeof this.m_oCV.envParams["metaDataModelModificationTime"] != "undefined") {
  29. dispatcherEntry.addFormField("metaDataModelModificationTime", this.m_oCV.envParams["metaDataModelModificationTime"]);
  30. }
  31. }
  32. if( action.doAddActionContext() === true ) {
  33. var actionContext = action.addActionContext();
  34. dispatcherEntry.addFormField("cv.actionContext", actionContext);
  35. if (window.gViewerLogger) {
  36. window.gViewerLogger.log('Action context', actionContext, "xml");
  37. }
  38. }
  39. var isBux = this.m_oCV.envParams["bux"] == "true";
  40. if (isBux) {
  41. dispatcherEntry.addFormField("cv.showFaultPage", "false");
  42. }
  43. else {
  44. dispatcherEntry.addFormField("cv.showFaultPage", "true");
  45. }
  46. dispatcherEntry.addFormField("ui.object", this.m_oCV.envParams["ui.object"]);
  47. dispatcherEntry.addDefinedFormField("ui.spec", this.m_oCV.envParams["ui.spec"]);
  48. dispatcherEntry.addDefinedFormField("modelPath", this.m_oCV.envParams["modelPath"]);
  49. dispatcherEntry.addDefinedFormField("packageBase", this.m_oCV.envParams["packageBase"]);
  50. dispatcherEntry.addDefinedFormField("rap.state", this.m_oCV.envParams["rap.state"]);
  51. dispatcherEntry.addDefinedFormField("rap.reportInfo", this.m_oCV.envParams["rapReportInfo"]);
  52. dispatcherEntry.addDefinedFormField("ui.primaryAction", this.m_oCV.envParams["ui.primaryAction"]);
  53. dispatcherEntry.addNonNullFormField("cv.debugDirectory", this.m_oCV.envParams["cv.debugDirectory"]);
  54. dispatcherEntry.addNonNullFormField("ui.objectClass", this.m_oCV.envParams["ui.objectClass"]);
  55. dispatcherEntry.addNonNullFormField("bux", this.m_oCV.envParams["bux"]);
  56. dispatcherEntry.addNonNullFormField("baseReportModificationTime", this.m_oCV.envParams["baseReportModificationTime"]);
  57. dispatcherEntry.addNonNullFormField("originalReport", this.m_oCV.envParams["originalReport"]);
  58. //Flash chart option
  59. var flashChartOptionValue = this.m_oCV.getFlashChartOption();
  60. if( flashChartOptionValue != null)
  61. {
  62. dispatcherEntry.addFormField("savedFlashChartOption", flashChartOptionValue);
  63. if (flashChartOptionValue && action !=null && typeof(action.m_requestParams)!= "undefined" && typeof(action.m_requestParams.targetType)!= "undefined") {
  64. var hasAVSChart = false;
  65. var sTarget = null;
  66. if (typeof(action.m_requestParams.targetType.targetType)!= "undefined") {
  67. //fix for Defect:COGCQ00676339 Error generated on conversion of crosstab to chart, with chart animation enabled
  68. //TargetType may be an Object type
  69. sTarget = action.m_requestParams.targetType.targetType;
  70. } else {
  71. sTarget = action.m_requestParams.targetType;
  72. }
  73. if (sTarget.match('v2_') != null || sTarget.match('_v2') != null)
  74. {
  75. hasAVSChart = true;
  76. }
  77. else
  78. {
  79. var oRAPReportInfo = this.m_oCV.getRAPReportInfo();
  80. var selectedReportInfo = action.getSelectedReportInfo();
  81. if (oRAPReportInfo && selectedReportInfo) {
  82. // get all the display types except for the currently selected container. We already checked
  83. // the currently selected container in the about 'if' statement
  84. var sDisplayTypes = oRAPReportInfo.getDisplayTypes(selectedReportInfo.container);
  85. if (sDisplayTypes.match('v2_') != null || sDisplayTypes.match('_v2') != null) {
  86. hasAVSChart = true;
  87. }
  88. }
  89. }
  90. dispatcherEntry.addFormField("hasAVSChart", hasAVSChart);
  91. }
  92. else
  93. {
  94. dispatcherEntry.addFormField("hasAVSChart", this.m_oCV.hasAVSChart());
  95. }
  96. }
  97. var sEP = this.m_oCV.getExecutionParameters();
  98. if (sEP) {
  99. dispatcherEntry.addFormField("executionParameters", encodeURIComponent(sEP));
  100. }
  101. dispatcherEntry.addFormField("ui.conversation", encodeURIComponent(this.m_oCV.getConversation())); //MARK: needed? (its a primary request)
  102. dispatcherEntry.addFormField("m_tracking", encodeURIComponent(this.m_oCV.getTracking())); //MARK: needed? (its a primary request)
  103. var sCAF = this.m_oCV.getCAFContext();
  104. if (sCAF) {
  105. dispatcherEntry.addFormField("ui.cafcontextid", sCAF);
  106. }
  107. if (action.forceRunSpecRequest()) {
  108. dispatcherEntry.addFormField("widget.forceRunSpec", "true");
  109. }
  110. };