/* *+------------------------------------------------------------------------+ *| Licensed Materials - Property of IBM *| IBM Cognos Products: Content-Apps *| (C) Copyright IBM Corp. 2018 *| *| US Government Users Restricted Rights - Use, duplication or disclosure *| restricted by GSA ADP Schedule Contract with IBM Corp. *+------------------------------------------------------------------------+ */ define(['bi/content_apps/authoring/OutputHandler', 'bi/authoring/utils/rsCommon', 'bi/authoring/utils/rsOpenHelper'], function (OutputHandler, rsCommon, rsOpenHelper) { 'use strict'; var _HANDLED_FORMATS = ['HTML', 'PDF']; function f_getType(options) { var v_sType; if (options.report) { if (options.report.base) { v_sType = options.report.base[0] ? options.report.base[0].type : options.report.base.type; } else { v_sType = options.report.type; } } return v_sType; } var ViewOutputHandler = OutputHandler.extend({ getPriority: function() { // a relative number to other output handlers return 25; }, /** * Called to determine if this handler can process specific output object in the "view versions" UI */ canExecute: function(options) { var v_sFormat = options.output.format; var v_sType = f_getType( options ); return (_HANDLED_FORMATS.indexOf(v_sFormat) !== -1 || v_sType == 'interactiveReport'); }, /** * Called to open a specific output object from the "view versions" UI */ execute: function(options) { // Open a view of the specified output object rsOpenHelper.openView( { cmProperties: { id: options.output.id, type: "output" }, glassContext: options.glassContext } ); } }); return ViewOutputHandler; });