'use strict'; /** * Licensed Materials - Property of IBM * IBM Cognos Products: BI Cloud (C) Copyright IBM Corp. 2014, 2018 * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp. */ define(['../../../lib/@waca/core-client/js/core-client/ui/dialogs/BaseDialog', 'jquery', 'underscore', '../../nls/StringResources'], function (BaseDialog, $, _, stringResources) { var Dialog = null; Dialog = BaseDialog.extend({ init: function init(options) { this._props = { 'type': options.sType, 'title': options.sTitle, 'value': options.sValue, 'actionHandler': options.actionHandler }; // Add a close (predefined in BaseDialog), Copy and (optionally) a custom Save button this._close = { 'text': stringResources.get('close'), 'handler': this.cancel, 'type': options.updateable ? 'secondary' : 'primary' }; this._buttons = [this._close]; if (options.updateable) { this._buttons.push({ 'text': stringResources.get('dlg_update'), 'handler': this.save, 'type': 'primary' }); } this._buttons.push({ 'text': stringResources.get('copyButton'), 'handler': this.copy, 'type': options.updateable ? 'secondary' : 'primary' }); Dialog.inherited('init', this, arguments); }, save: function save() { if (this._props.actionHandler && this._props.actionHandler(this.$textarea.val())) { this.hide(); } }, copy: function copy() { document.execCommand('copy'); }, focusOnButton: function focusOnButton() { var secondBtn = this._container().find('footer').children('.dialogButton')[1]; if (secondBtn) { secondBtn.focus(); } }, show: function show() { Dialog.inherited('show', this, arguments); this.$textarea[0].select(); }, renderContent: function renderContent(n) { this.$textarea = $('