/**
* Contains email dialog class
*
* Copyright (C) 2010-2019 R-T Specialty, LLC.
*
* This file is part of the Liza Data Collection Framework.
*
* liza is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
var Class = require( 'easejs' ).Class,
DialogDecorator = require( './DialogDecorator' );
/**
* Provides logical defaults for the email dialog
*/
module.exports = Class( 'EmailDialog' )
.extend( DialogDecorator,
{
/**
* Send Email button callback
* @type {function()}
*/
'private _send_callback': function() {},
/**
* Email Subject
* @type {string}
*/
'private _subject': '',
/**
* Email To
* @type {string}
*/
'private _email_to': '',
/**
* Email From
* @type {string}
*/
'private _email_from': '',
/**
* Email Message
* @type {string}
*/
'private _email_message': '',
/**
* Form Data that is used when sending email
* @type {string}
*/
'private _form_data': '',
/**
* Initializes dialog defaults
*
* @return void
*/
'protected init': function()
{
var self = this;
// crate new dialog containing email form
this.getDialog()
.setTypeId( 'liza-email-dialog' )
.setResizable( false )
.setModal()
.setTitle( 'Email CSR' )
.setButtons( {
"Send Email": function()
{
var form_data = self._form.serialize();
self._send_callback( form_data );
},
"Close": function()
{
this.close();
}
} );
},
/**
* Displays the dialog
*
* @return {EmailDialog} self
*/
'override public open': function()
{
var dialog = this.getDialog(),
self = this;
this._form = $( '