rsOutputHandler.js 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. /*
  2. *+------------------------------------------------------------------------+
  3. *| Licensed Materials - Property of IBM
  4. *| IBM Cognos Products: Content-Apps
  5. *| (C) Copyright IBM Corp. 2018
  6. *|
  7. *| US Government Users Restricted Rights - Use, duplication or disclosure
  8. *| restricted by GSA ADP Schedule Contract with IBM Corp.
  9. *+------------------------------------------------------------------------+
  10. */
  11. define(['bi/content_apps/authoring/OutputHandler', 'bi/authoring/utils/rsCommon', 'bi/authoring/utils/rsOpenHelper'], function (OutputHandler, rsCommon, rsOpenHelper) {
  12. 'use strict';
  13. var _HANDLED_FORMATS = ['HTML', 'PDF'];
  14. function f_getType(options)
  15. {
  16. var v_sType;
  17. if (options.report) {
  18. if (options.report.base) {
  19. v_sType = options.report.base[0] ? options.report.base[0].type : options.report.base.type;
  20. }
  21. else {
  22. v_sType = options.report.type;
  23. }
  24. }
  25. return v_sType;
  26. }
  27. var ViewOutputHandler = OutputHandler.extend({
  28. getPriority: function() {
  29. // a relative number to other output handlers
  30. return 25;
  31. },
  32. /**
  33. * Called to determine if this handler can process specific output object in the "view versions" UI
  34. */
  35. canExecute: function(options) {
  36. var v_sFormat = options.output.format;
  37. var v_sType = f_getType( options );
  38. return (_HANDLED_FORMATS.indexOf(v_sFormat) !== -1 || v_sType == 'interactiveReport');
  39. },
  40. /**
  41. * Called to open a specific output object from the "view versions" UI
  42. */
  43. execute: function(options) {
  44. // Open a view of the specified output object
  45. rsOpenHelper.openView( {
  46. cmProperties: {
  47. id: options.output.id,
  48. type: "output" },
  49. glassContext: options.glassContext
  50. } );
  51. }
  52. });
  53. return ViewOutputHandler;
  54. });