ViewerDispatcherEntry_mobile.js 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /*
  2. *+------------------------------------------------------------------------+
  3. *| Licensed Materials - Property of IBM
  4. *| IBM Cognos Products: Viewer
  5. *| (C) Copyright IBM Corp. 2001, 2012
  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. * Override the sendRequest method so we call to mobile
  14. * instead of posting a form/sending an ajax request
  15. */
  16. ViewerDispatcherEntry.prototype.sendRequest = function() {
  17. this.prepareRequest();
  18. var oCV = this.getViewer();
  19. // Make sure we always return a mobile output
  20. if (oCV.envParams["ui.action"] == "view") {
  21. this.addFormField("cv.responseFormat", "mobileView");
  22. }
  23. else {
  24. this.addFormField("cv.responseFormat", "mobileData");
  25. }
  26. // Sometimes mobile will show the response in a new window. We need to make
  27. // sure we reset the viewerDispatcher or else this request will be stuck in the
  28. // queue and no other requests will go through
  29. oCV.resetViewerDispatcher();
  30. // Since Mobile always uses non-ajax request we need to round trip all our form fields
  31. // Loop through all the form field to send along any missing ones
  32. var formFields = this.getRequest().getFormFields();
  33. for(param in oCV.envParams) {
  34. if(!formFields.exists(param) && param != "cv.actionState") {
  35. this.addFormField(param, oCV.envParams[param]);
  36. }
  37. }
  38. if (!ViewerMobileRequest.passRequestFieldsToMobile(this.getRequest())) {
  39. var formRequest = this.buildRequestForm();
  40. formRequest.submit();
  41. }
  42. };