"use strict"; /** * Licensed Materials - Property of IBM * IBM Cognos Products: admin * 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/RunAsOptionsView', 'bi/content_apps/authoring/AuthoringHelper', 'bi/content_apps/nls/StringResource'], function (BasePane, AuthoringHelper, StringResource) { //NOSONAR: needed for amd var ScheduleRunAsView = BasePane.extend({ init: function init(options) { ScheduleRunAsView.inherited('init', this, arguments); if (options.objectInformation.options.outputLocale) { this._selections = options.objectInformation.options; this._selections.languages = options.objectInformation.options.outputLocale; this._selections.formats = {}; options.objectInformation.options.outputFormat.forEach(function (format) { this._selections.formats[format] = true; }.bind(this)); this._outputFormat = options.objectInformation.options.outputFormat[0]; this._requestParams.parameters = options.objectInformation.parameters; if (this._requestParams.parameters) { this._promptValue = this._requestParams.parameters.length === 0; } } }, _getRunInBackgroundToggleSpec: function _getRunInBackgroundToggleSpec() { var itemSpec = ScheduleRunAsView.inherited('_getRunInBackgroundToggleSpec', this, arguments); itemSpec.checked = true; return itemSpec; }, _getPromptForValuesOptionSpec: function _getPromptForValuesOptionSpec() { var itemSpec = ScheduleRunAsView.inherited('_getPromptForValuesOptionSpec', this, arguments); itemSpec.checked = this._promptValue; return itemSpec; }, _getRunInBackgroundFormatsSpec: function _getRunInBackgroundFormatsSpec() { var itemSpec = ScheduleRunAsView.inherited('_getRunInBackgroundFormatsSpec', this, arguments); if (this.objectInformation.options.outputFormat) { if (itemSpec[0].items) { itemSpec[0].items.forEach(function (checkBox) { checkBox.checked = this.objectInformation.options.outputFormat.indexOf(checkBox.value) !== -1; }.bind(this)); } } return itemSpec; }, _setOutputFormatRequestParams: function _setOutputFormatRequestParams() { var selectedOutputFormats = this._getSelectedFormats(true /*bRunInBackgroud*/ ); this._requestParams.options.outputFormat = selectedOutputFormats; }, render: function render() { ScheduleRunAsView.inherited('render', this, arguments).then(function () { this._toggleOptionsControl(); this._selections[BasePane.OPTION.RUN_IN_BG] = true; }.bind(this)); } }); return ScheduleRunAsView; });