CCognosViewerRequest.js 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217
  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. * Used for QS only. They'll build a CCognosViewerRequest and call CCognosViewer.sendRequest where
  14. * we'll switch from a CCognosViewerRequest to a ViewerDispatcherEntry
  15. * @param {Object} sAction
  16. */
  17. /**
  18. @constructor
  19. @param sAction {string} See {@link #setAction} method for possible values.
  20. @type CCognosViewerRequest
  21. */
  22. function CCognosViewerRequest(sAction)
  23. {
  24. /**
  25. @private
  26. @type string
  27. */
  28. this.m_sAction = "";
  29. /**
  30. @private
  31. @type CDictionary
  32. @deprecated
  33. */
  34. this.m_oOptions = new CDictionary();
  35. /**
  36. @private
  37. @type CDictionary
  38. @deprecated
  39. */
  40. this.m_oParams = new CDictionary();
  41. /**
  42. * @private
  43. * @type CDictionary
  44. */
  45. this.m_oFormFields = new CDictionary();
  46. /**
  47. * @private
  48. * @type string
  49. */
  50. this.m_sRequestType = "ajax";
  51. /**
  52. * The callback to be executed
  53. * @private
  54. */
  55. this.m_callback = null;
  56. this.setAction(sAction);
  57. }
  58. /**
  59. * Sets the callback function to be executed
  60. * @param callbackFunction (function)
  61. */
  62. CCognosViewerRequest.prototype.setCallback = function(callback)
  63. {
  64. this.m_callback = callback;
  65. };
  66. /**
  67. * Returns the callback function to be used
  68. * @return (function)
  69. */
  70. CCognosViewerRequest.prototype.getCallback = function()
  71. {
  72. return this.m_callback;
  73. };
  74. /**
  75. * Sets the request type (ajax,post,get)
  76. * @param string
  77. */
  78. CCognosViewerRequest.prototype.setRequestType = function(sRequestType)
  79. {
  80. if(typeof sRequestType != "undefined" && typeof sRequestType == "string")
  81. {
  82. if(sRequestType.match(/\ajax\b|\bpost\b|\bget\b/i))
  83. {
  84. this.m_sRequestType = sRequestType;
  85. }
  86. }
  87. };
  88. /**
  89. * Returns the request type
  90. * @return string
  91. */
  92. CCognosViewerRequest.prototype.getRequestType = function()
  93. {
  94. return this.m_sRequestType;
  95. };
  96. /**
  97. Add a option (name/value pair). See URL Api for possible options.
  98. @param {string} sName
  99. @param {string} sValue
  100. @deprecated
  101. */
  102. CCognosViewerRequest.prototype.addOption = function(sName, sValue)
  103. {
  104. this.m_oOptions.add(sName, sValue);
  105. };
  106. /**
  107. Remove an option (by name). See URL Api for possible options.
  108. @param {string} sName
  109. @param {string} sValue
  110. @deprecated
  111. */
  112. CCognosViewerRequest.prototype.removeOption = function(sName)
  113. {
  114. this.m_oOptions.remove(sName);
  115. };
  116. /**
  117. Add a parameter name/value pair to this request (for prompts).
  118. @param {string} sName
  119. @param {string} sValue
  120. @deprecated
  121. */
  122. CCognosViewerRequest.prototype.addParameter = function(sName, sValue)
  123. {
  124. this.m_oParams.add(sName, sValue);
  125. };
  126. /**
  127. * Adds a form field to the request
  128. * @param (string) sName
  129. * @param (string) sValue
  130. */
  131. CCognosViewerRequest.prototype.addFormField = function(sName, sValue)
  132. {
  133. this.m_oFormFields.add(sName, sValue);
  134. };
  135. /**
  136. * Returns the list of form fields associated with the request
  137. * @return CDictionary
  138. */
  139. CCognosViewerRequest.prototype.getFormFields = function()
  140. {
  141. return this.m_oFormFields;
  142. };
  143. /**
  144. @type string
  145. */
  146. CCognosViewerRequest.prototype.getAction = function()
  147. {
  148. return this.m_sAction;
  149. };
  150. /**
  151. @param {string} sName
  152. @type string
  153. @deprecated
  154. */
  155. CCognosViewerRequest.prototype.getOption = function(sName)
  156. {
  157. return this.m_oOptions.get(sName);
  158. };
  159. /**
  160. @param {string} sName
  161. @type string
  162. @deprecated
  163. */
  164. CCognosViewerRequest.prototype.getParameter = function(sName)
  165. {
  166. return this.m_oParams.get(sName);
  167. };
  168. /**
  169. @param {string} sName
  170. @type bool
  171. @deprecated
  172. */
  173. CCognosViewerRequest.prototype.hasOption = function(sName)
  174. {
  175. return this.m_oOptions.exists(sName);
  176. };
  177. /**
  178. @param {string} sName
  179. @type bool
  180. @deprecated
  181. */
  182. CCognosViewerRequest.prototype.hasParameter = function(sName)
  183. {
  184. return this.m_oParams.exists(sName);
  185. };
  186. /**
  187. @param sAction {string} possible values: <ul><li>add</li><li>back</li><li>cancel</li><li>currentPage</li><li>drill</li><li>email</li><li>firstPage</li><li>forward</li><li>getOutput</li><li>lastPage</li><li>nextPage</li><li>previousPage</li><li>print</li><li>release</li><li>render</li><li>run</li><li>runSpecification</li><li>save</li><li>saveas</li><li>wait</li></ul>
  188. */
  189. CCognosViewerRequest.prototype.setAction = function(sAction)
  190. {
  191. this.m_sAction = sAction;
  192. };