SuiteCRM-Core/include/javascript/message-box.js
Clemente Raposo 41c2374a54 Squashed 'public/legacy/' changes from bb959a145..4f401678f
4f401678f SuiteCRM 7.12.2 Release
647fd6ad5 Fix #9382 - Outbound Emails editview Unsupported operand types fatal in php8
2b116b8a8 Fix #9374 - OAuth password creation Unsupported operand types fatal in php8
97fe07b7a Allow changing text colors when composing an email
eed4acacd Fix #9376 - allow workflows on import
5ca4e3e7f Fix Campaign Email settings removes Email settings
4b0dc4ffb fix #9383 - upgrade existing php code using each() function
0590b3690 Fix #8602 - Fix email view action return_action
2bf8e17cf Fix #8602 - Fix email message modal displayed buttons

git-subtree-dir: public/legacy
git-subtree-split: 4f401678fdb1f769ea897c82d4504ab8380ff9af
2021-12-15 16:20:24 +00:00

48 lines
No EOL
6.6 KiB
JavaScript
Executable file
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/**
*
* SugarCRM Community Edition is a customer relationship management program developed by
* SugarCRM, Inc. Copyright (C) 2004-2013 SugarCRM Inc.
*
* SuiteCRM is an extension to SugarCRM Community Edition developed by SalesAgility Ltd.
* Copyright (C) 2011 - 2018 SalesAgility Ltd.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License version 3 as published by the
* Free Software Foundation with the addition of the following permission added
* to Section 15 as permitted in Section 7(a): FOR ANY PART OF THE COVERED WORK
* IN WHICH THE COPYRIGHT IS OWNED BY SUGARCRM, SUGARCRM DISCLAIMS THE WARRANTY
* OF NON INFRINGEMENT OF THIRD PARTY RIGHTS.
*
* 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 Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along with
* this program; if not, see http://www.gnu.org/licenses or write to the Free
* Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301 USA.
*
* You can contact SugarCRM, Inc. headquarters at 10050 North Wolfe Road,
* SW2-130, Cupertino, CA 95014, USA. or at email address contact@sugarcrm.com.
*
* The interactive user interfaces in modified source and object code versions
* of this program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU Affero General Public License version 3.
*
* In accordance with Section 7(b) of the GNU Affero General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "Powered by
* SugarCRM" logo and "Supercharged by SuiteCRM" logo. If the display of the logos is not
* reasonably feasible for technical reasons, the Appropriate Legal Notices must
* display the words "Powered by SugarCRM" and "Supercharged by SuiteCRM".
*/(function($){$.fn.messageBox=function(options){"use strict";var self=this;self.controls={};self.controls.modal={};if(typeof $.fn.modal==="undefined"){console.error('messageBox - Missing Dependency Required: Bootstrap model');return self;}
self.modal=$.fn.modal;var opts=$.extend({},$.fn.messageBox.defaults,options);self.show=function(){"use strict";self.controls.modal.container.modal('show');return self;};self.onOk=function(){"use strict";$(self).trigger('ok');return false;};self.onCancel=function(){"use strict";$(self).trigger('cancel');return false;};self.generateID=function(){"use strict";var characters=['a','b','c','d','e','f','1','2','3','4','5','6','7','8','9'];var format='0000000-0000-0000-0000-00000000000';var z=Array.prototype.map.call(format,function($obj){var min=0;var max=characters.length-1;if($obj=='0'){var index=Math.round(Math.random()*(max-min)+min);$obj=characters[index];}
return $obj;}).toString().replace(/(,)/g,'');return z;};self.setTitle=function(content){"use strict";self.controls.modal.container.find('.modal-title').html(content);};self.getTitle=function(){"use strict";return self.controls.modal.container.find('.modal-title');};self.setBody=function(content){"use strict";self.controls.modal.container.find('.modal-body').html(content);};self.getBody=function(){"use strict";return self.controls.modal.container.find('.modal-body');};self.showHeader=function(){"use strict";return self.controls.modal.container.find('.modal-header').show();};self.hideHeader=function(){"use strict";return self.controls.modal.container.find('.modal-header').hide();};self.showFooter=function(){"use strict";return self.controls.modal.container.find('.modal-footer').show();};self.hideCancel=function(){"use strict";return self.controls.modal.container.find('.btn-cancel').hide();};self.hideOk=function(){"use strict";return self.controls.modal.container.find('.btn-ok').hide();};self.hideFooter=function(){"use strict";return self.controls.modal.container.find('.modal-footer').hide();};self.headerContent='<button type="button" class="close btn-cancel" aria-label="Close"><span aria-hidden="true">×</span></button><h4 class="modal-title"></h4>';self.footerContent='<button class="button btn-ok" type="button">'+SUGAR.language.translate('','LBL_OK')+'</button> <button class="button btn-cancel" type="button">'+SUGAR.language.translate('','LBL_CANCEL_BUTTON_LABEL')+'</button> ';self.construct=function(constructOptions){"use strict";if(typeof self.controls.modal.container==="undefined"){if(typeof opts.onOK==="undefined"){opts.onOK=self.onOk;}
if(typeof opts.onCancel==="undefined"){opts.onCancel=self.onCancel;}
if(typeof opts.headerContent==="undefined"){opts.headerContent=self.headerContent;}
if(typeof opts.footerContent==="undefined"){opts.footerContent=self.footerContent;}
self.controls.modal.container=self.addClass('modal fade message-box').attr('id',self.generateID()).attr('role','dialog');self.controls.modal.dialog=$('<div></div>').addClass('modal-dialog modal-'+opts.size).attr('role','document').appendTo(self.controls.modal.container);self.controls.modal.content=$('<div></div>').addClass('modal-content').appendTo(self.controls.modal.dialog);self.controls.modal.header=$('<div></div>').addClass('modal-header').appendTo(self.controls.modal.content);self.controls.modal.header.html(opts.headerContent);self.controls.modal.body=$('<div></div>').addClass('modal-body').appendTo(self.controls.modal.content);self.controls.modal.footer=$('<div></div>').addClass('modal-footer').html(opts.footerContent).appendTo(self.controls.modal.content);self.controls.modal.footer.html(opts.footerContent);self.controls.modal.buttons={};self.controls.modal.buttons.ok=$(self.controls.modal.container).find('.btn-ok');self.controls.modal.buttons.cancel=$(self.controls.modal.container).find('.btn-cancel');self.controls.modal.container.find('.btn-ok').click(opts.onOK);self.controls.modal.container.find('.btn-cancel').click(opts.onCancel);if(opts.showHeader===false){self.controls.modal.header.hide();};if(opts.showFooter===false){self.controls.modal.footer.hide();};self.modal(opts);}
$(self).on('remove',self.destruct);return self;}
self.destruct=function(){"use strict";self.attr('aria-hidden',"true");$('.modal-backdrop').last().remove();if($('.message-box').length<=1){$('.modal-open').removeClass('modal-open');}
return true;}
self.construct(opts);return self;};$.fn.messageBox.defaults={"showHeader":true,"headerContent":self.headerContent,"footerContent":self.footerContent,"showFooter":true,"onOK":self.onOK,"onCancel":self.onCancel,"size":'sm',"show":false,"backdrop":true,"keyboard":true}}(jQuery));messageBox=function(options){"use strict";return $('<div></div>').appendTo('body').messageBox(options);};