diff --git a/plugins/yetiforce/compose.js b/plugins/yetiforce/compose.js
index 3a395848..e4370d14 100644
--- a/plugins/yetiforce/compose.js
+++ b/plugins/yetiforce/compose.js
@@ -1,3 +1,4 @@
+'use strict';
/* {[The file is published on the basis of MIT License]} */
window.rcmail && rcmail.addEventListener('init', function (evt) {
@@ -124,23 +125,18 @@ window.rcmail && rcmail.addEventListener('init', function (evt) {
url: "?_task=mail&_action=plugin.yetiforce.getEmailTemplates&_id=" + rcmail.env.compose_id,
async: false,
success: function (data) {
- var modules = [];
- var tmp = [];
+ let tmp = {};
data = JSON.parse(data);
$.each(data, function (index, value) {
jQuery('#vtmodulemenulink').removeClass('disabled');
jQuery('#tplmenulink').removeClass('disabled');
- tmp.push({
- name: value.moduleName,
- label: value.moduleName
- });
- jQuery('#tplmenu #texttplsmenu').append('
' + value.name + '');
+ tmp[value.module_name] = value.moduleTranslate;
+ jQuery('#tplmenu #texttplsmenu').append('' + value.name + '');
});
- $.each(tmp, function (index, value) {
- if (jQuery.inArray(value.name, modules) == -1) {
- jQuery('#vtmodulemenu .toolbarmenu').append('' + value.label + '');
- modules.push(value.name);
+ $.each(tmp, function (moduleName, moduleTranslate) {
+ if (moduleName) {
+ jQuery('#vtmodulemenu .toolbarmenu').append('' + moduleTranslate + '');
}
});
@@ -174,7 +170,7 @@ window.rcmail && rcmail.addEventListener('init', function (evt) {
}
jQuery.ajax({
type: 'Get',
- url: "?_task=mail&_action=plugin.yetiforce.getConntentEmailTemplate&_id=" + rcmail.env.compose_id,
+ url: "?_task=mail&_action=plugin.yetiforce.getContentEmailTemplate&_id=" + rcmail.env.compose_id,
data: {
id: id,
record_id: recordId,
@@ -182,14 +178,15 @@ window.rcmail && rcmail.addEventListener('init', function (evt) {
},
success: function (data) {
data = JSON.parse(data);
- var oldSubject = jQuery('[name="_subject"]').val();
- var html = jQuery("").html(data.content).html();
+ let oldSubject = jQuery('[name="_subject"]').val(),
+ html = jQuery("").html(data.content).html(),
+ ed = '';
jQuery('[name="_subject"]').val(oldSubject + ' ' + data.subject);
if (window.tinyMCE && (ed = tinyMCE.get(rcmail.env.composebody))) {
- var oldBody = tinyMCE.activeEditor.getContent();
+ let oldBody = tinyMCE.activeEditor.getContent();
tinymce.activeEditor.setContent(html + oldBody);
} else {
- var oldBody = jQuery('#composebody').val();
+ let oldBody = jQuery('#composebody').val();
jQuery('#composebody').val(html + oldBody);
}
if (typeof data.attachments !== 'undefined' && data.attachments !== null) {
diff --git a/plugins/yetiforce/compose.min.js b/plugins/yetiforce/compose.min.js
index 2f72170b..1600eef7 100644
--- a/plugins/yetiforce/compose.min.js
+++ b/plugins/yetiforce/compose.min.js
@@ -6,5 +6,5 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
};
-window.rcmail&&rcmail.addEventListener('init',function(){function getEmailAddresses(responseData,e,module){var aDeferred=$.Deferred(),emails=[];return 'undefined'!=typeof e.target&&('email'===$(e.target).data('type')||'multiEmail'===$(e.target).data('type'))?(emails.push($(e.target).text()),aDeferred.resolve(emails)):function(){var i=0;for(var id in responseData)window.crm.app.getRecordDetails({record:id,module:module,fieldType:['email','multiEmail']}).done(function(data){i++,emails.push(getFirstEmailAddress(data.result.data)),i===Object.keys(responseData).length&&aDeferred.resolve(emails);});}(),aDeferred.promise()}function getFirstEmailAddress(mailObj){var emails=[];for(var key in mailObj)if(mailObj[key])if(window.crm.app.isJsonString(mailObj[key])){var multiEmail=JSON.parse(mailObj[key]);for(var i in multiEmail)emails.push(multiEmail[i].e);break}else{emails.push(mailObj[key]);break}return emails}var crm=window.crm=getCrmWindow(),crmPath=rcmail.env.site_URL+'index.php?';rcmail.env.compose_commands.push('yetiforce.addFilesToMail'),rcmail.env.compose_commands.push('yetiforce.addFilesFromCRM'),rcmail.register_command('yetiforce.addFilesToMail',function(data){var ts=new Date().getTime(),frame=rcmail.async_upload_form_frame('rcmupload'+ts);data._uploadid=ts,jQuery.ajax({url:'?_task=mail&_action=plugin.yetiforce.addFilesToMail&_id='+rcmail.env.compose_id,type:'POST',data:data,success:function success(data){var doc=frame[0],body=$(doc);body.html(data);}});},!0),rcmail.register_command('yetiforce.addFilesFromCRM',function(){!1!=crm&&window.crm.app.showRecordsList({module:'Documents',src_module:'Documents',multi_select:!0,additionalInformations:!0},function(modal,instance){instance.setSelectEvent(function(responseData){rcmail.command('yetiforce.addFilesToMail',{ids:Object.keys(responseData),_uploadid:new Date().getTime()});});});},!0),$('#composeheaders #yt_adress_buttons .button').click(function(){var mailField=$(this).attr('data-input'),module=$(this).attr('data-module');window.crm.app.showRecordsList({module:module,src_module:'OSSMail',multi_select:!0,additionalInformations:!0},function(modal,instance){instance.setSelectEvent(function(responseData,e){getEmailAddresses(responseData,e,module).done(function(emails){if(emails.length){var value=$('#'+mailField).val();''!=value&&','!=value.charAt(value.length-1)&&(value+=','),$('#'+mailField).val(value+emails.join(','));}else window.crm.Vtiger_Helper_Js.showPnotify({text:window.crm.app.vtranslate('NoFindEmailInRecord'),animation:'show'});});});});}),rcmail.env.isPermittedMailTemplates&&jQuery.ajax({type:'Get',url:'?_task=mail&_action=plugin.yetiforce.getEmailTemplates&_id='+rcmail.env.compose_id,async:!1,success:function success(data){var modules=[],tmp=[];data=JSON.parse(data),$.each(data,function(index,value){jQuery('#vtmodulemenulink').removeClass('disabled'),jQuery('#tplmenulink').removeClass('disabled'),tmp.push({name:value.moduleName,label:value.moduleName}),jQuery('#tplmenu #texttplsmenu').append(''+value.name+'');}),$.each(tmp,function(index,value){-1==jQuery.inArray(value.name,modules)&&(jQuery('#vtmodulemenu .toolbarmenu').append(''+value.label+''),modules.push(value.name));});}}),jQuery('#vtmodulemenu li a').on('click',function(){var selectModule=jQuery(this).data('module');selectModule==null?jQuery('#tplmenu li').show():(jQuery('#tplmenu li.'+selectModule).show(),jQuery('#tplmenu li').not('.'+selectModule).hide());}),rcmail.env.crmModule!=null&&jQuery('#vtmodulemenu li.'+rcmail.env.crmModule+' a').trigger('click'),jQuery('#tplmenu li a').on('click',function(){var id=jQuery(this).data('tplid'),recordId=rcmail.env.crmRecord,module=rcmail.env.crmModule,view=rcmail.env.crmView;if('List'==view){var chElement=jQuery(crm.document).find('.listViewEntriesCheckBox')[0];recordId=jQuery(chElement).val();}jQuery.ajax({type:'Get',url:'?_task=mail&_action=plugin.yetiforce.getConntentEmailTemplate&_id='+rcmail.env.compose_id,data:{id:id,record_id:recordId,select_module:module},success:function success(data){data=JSON.parse(data);var oldSubject=jQuery('[name="_subject"]').val(),html=jQuery('').html(data.content).html();if(jQuery('[name="_subject"]').val(oldSubject+' '+data.subject),window.tinyMCE&&(ed=tinyMCE.get(rcmail.env.composebody))){var oldBody=tinyMCE.activeEditor.getContent();tinymce.activeEditor.setContent(html+oldBody);}else{var oldBody=jQuery('#composebody').val();jQuery('#composebody').val(html+oldBody);}'undefined'!=typeof data.attachments&&null!==data.attachments&&rcmail.command('yetiforce.addFilesToMail',data.attachments);}});});});function getCrmWindow(){if(null!==opener)return opener.parent;return !('object'!=_typeof(parent.app))&&parent}
+window.rcmail&&rcmail.addEventListener('init',function(){function getEmailAddresses(responseData,e,module){var aDeferred=$.Deferred(),emails=[];return 'undefined'!=typeof e.target&&('email'===$(e.target).data('type')||'multiEmail'===$(e.target).data('type'))?(emails.push($(e.target).text()),aDeferred.resolve(emails)):function(){var i=0;for(var id in responseData)window.crm.app.getRecordDetails({record:id,module:module,fieldType:['email','multiEmail']}).done(function(data){i++,emails.push(getFirstEmailAddress(data.result.data)),i===Object.keys(responseData).length&&aDeferred.resolve(emails);});}(),aDeferred.promise()}function getFirstEmailAddress(mailObj){var emails=[];for(var key in mailObj)if(mailObj[key])if(window.crm.app.isJsonString(mailObj[key])){var multiEmail=JSON.parse(mailObj[key]);for(var i in multiEmail)emails.push(multiEmail[i].e);break}else{emails.push(mailObj[key]);break}return emails}var crm=window.crm=getCrmWindow(),crmPath=rcmail.env.site_URL+'index.php?';rcmail.env.compose_commands.push('yetiforce.addFilesToMail'),rcmail.env.compose_commands.push('yetiforce.addFilesFromCRM'),rcmail.register_command('yetiforce.addFilesToMail',function(data){var ts=new Date().getTime(),frame=rcmail.async_upload_form_frame('rcmupload'+ts);data._uploadid=ts,jQuery.ajax({url:'?_task=mail&_action=plugin.yetiforce.addFilesToMail&_id='+rcmail.env.compose_id,type:'POST',data:data,success:function success(data){var doc=frame[0],body=$(doc);body.html(data);}});},!0),rcmail.register_command('yetiforce.addFilesFromCRM',function(){!1!=crm&&window.crm.app.showRecordsList({module:'Documents',src_module:'Documents',multi_select:!0,additionalInformations:!0},function(modal,instance){instance.setSelectEvent(function(responseData){rcmail.command('yetiforce.addFilesToMail',{ids:Object.keys(responseData),_uploadid:new Date().getTime()});});});},!0),$('#composeheaders #yt_adress_buttons .button').click(function(){var mailField=$(this).attr('data-input'),module=$(this).attr('data-module');window.crm.app.showRecordsList({module:module,src_module:'OSSMail',multi_select:!0,additionalInformations:!0},function(modal,instance){instance.setSelectEvent(function(responseData,e){getEmailAddresses(responseData,e,module).done(function(emails){if(emails.length){var value=$('#'+mailField).val();''!=value&&','!=value.charAt(value.length-1)&&(value+=','),$('#'+mailField).val(value+emails.join(','));}else window.crm.Vtiger_Helper_Js.showPnotify({text:window.crm.app.vtranslate('NoFindEmailInRecord'),animation:'show'});});});});}),rcmail.env.isPermittedMailTemplates&&jQuery.ajax({type:'Get',url:'?_task=mail&_action=plugin.yetiforce.getEmailTemplates&_id='+rcmail.env.compose_id,async:!1,success:function success(data){var tmp={};data=JSON.parse(data),$.each(data,function(index,value){jQuery('#vtmodulemenulink').removeClass('disabled'),jQuery('#tplmenulink').removeClass('disabled'),tmp[value.module_name]=value.moduleTranslate,jQuery('#tplmenu #texttplsmenu').append(''+value.name+'');}),$.each(tmp,function(moduleName,moduleTranslate){moduleName&&jQuery('#vtmodulemenu .toolbarmenu').append(''+moduleTranslate+'');});}}),jQuery('#vtmodulemenu li a').on('click',function(){var selectModule=jQuery(this).data('module');selectModule==null?jQuery('#tplmenu li').show():(jQuery('#tplmenu li.'+selectModule).show(),jQuery('#tplmenu li').not('.'+selectModule).hide());}),rcmail.env.crmModule!=null&&jQuery('#vtmodulemenu li.'+rcmail.env.crmModule+' a').trigger('click'),jQuery('#tplmenu li a').on('click',function(){var id=jQuery(this).data('tplid'),recordId=rcmail.env.crmRecord,module=rcmail.env.crmModule,view=rcmail.env.crmView;if('List'==view){var chElement=jQuery(crm.document).find('.listViewEntriesCheckBox')[0];recordId=jQuery(chElement).val();}jQuery.ajax({type:'Get',url:'?_task=mail&_action=plugin.yetiforce.getContentEmailTemplate&_id='+rcmail.env.compose_id,data:{id:id,record_id:recordId,select_module:module},success:function success(data){data=JSON.parse(data);var oldSubject=jQuery('[name="_subject"]').val(),html=jQuery('').html(data.content).html(),ed='';if(jQuery('[name="_subject"]').val(oldSubject+' '+data.subject),window.tinyMCE&&(ed=tinyMCE.get(rcmail.env.composebody))){var oldBody=tinyMCE.activeEditor.getContent();tinymce.activeEditor.setContent(html+oldBody);}else{var _oldBody=jQuery('#composebody').val();jQuery('#composebody').val(html+_oldBody);}'undefined'!=typeof data.attachments&&null!==data.attachments&&rcmail.command('yetiforce.addFilesToMail',data.attachments);}});});});function getCrmWindow(){if(null!==opener)return opener.parent;return !('object'!=_typeof(parent.app))&&parent}
//# sourceMappingURL=compose.min.js.map
diff --git a/plugins/yetiforce/compose.min.js.map b/plugins/yetiforce/compose.min.js.map
index cbd2bbd9..9929f1ce 100644
--- a/plugins/yetiforce/compose.min.js.map
+++ b/plugins/yetiforce/compose.min.js.map
@@ -1 +1 @@
-{"version":3,"file":"compose.min.js","sources":["compose.js"],"sourcesContent":["/* {[The file is published on the basis of MIT License]} */\n\nwindow.rcmail && rcmail.addEventListener('init', function (evt) {\n\n\tvar crm = window.crm = getCrmWindow();\n\tvar crmPath = rcmail.env.site_URL + 'index.php?';\n\n\trcmail.env.compose_commands.push('yetiforce.addFilesToMail');\n\trcmail.env.compose_commands.push('yetiforce.addFilesFromCRM');\n\n\t// Document selection\n\trcmail.register_command('yetiforce.addFilesToMail', function (data) {\n\t\tvar ts = new Date().getTime(),\n\t\t\tframe_name = 'rcmupload' + ts,\n\t\t\tframe = rcmail.async_upload_form_frame(frame_name);\n\t\tdata._uploadid = ts;\n\t\tjQuery.ajax({\n\t\t\turl: \"?_task=mail&_action=plugin.yetiforce.addFilesToMail&_id=\" + rcmail.env.compose_id,\n\t\t\ttype: \"POST\",\n\t\t\tdata: data,\n\t\t\tsuccess: function (data) {\n\t\t\t\tvar doc = frame[0];\n\t\t\t\tvar body = $(doc);\n\t\t\t\tbody.html(data);\n\t\t\t}\n\t\t});\n\t}, true);\n\n\t// Add a document to an email crm\n\trcmail.register_command('yetiforce.addFilesFromCRM', function (data) {\n\t\tif (crm != false) {\n\t\t\twindow.crm.app.showRecordsList({\n\t\t\t\tmodule: 'Documents',\n\t\t\t\tsrc_module: 'Documents',\n\t\t\t\tmulti_select: true,\n\t\t\t\tadditionalInformations: true\n\t\t\t}, (modal, instance) => {\n\t\t\t\tinstance.setSelectEvent((responseData) => {\n\t\t\t\t\trcmail.command('yetiforce.addFilesToMail', {\n\t\t\t\t\t\tids: Object.keys(responseData),\n\t\t\t\t\t\t_uploadid: new Date().getTime()\n\t\t\t\t\t});\n\t\t\t\t});\n\t\t\t});\n\t\t}\n\t}, true);\n\t// Selection of email with popup\n\t$('#composeheaders #yt_adress_buttons .button').click(function () {\n\t\tvar mailField = $(this).attr('data-input');\n\t\tvar module = $(this).attr('data-module');\n\t\twindow.crm.app.showRecordsList({\n\t\t\tmodule: module,\n\t\t\tsrc_module: 'OSSMail',\n\t\t\tmulti_select: true,\n\t\t\tadditionalInformations: true\n\t\t}, (modal, instance) => {\n\t\t\tinstance.setSelectEvent((responseData, e) => {\n\t\t\t\tgetEmailAddresses(responseData, e, module).done((emails) => {\n\t\t\t\t\tif (emails.length) {\n\t\t\t\t\t\tlet value = $('#' + mailField).val();\n\t\t\t\t\t\tif (value != '' && value.charAt(value.length - 1) != ',') {\n\t\t\t\t\t\t\tvalue = value + ',';\n\t\t\t\t\t\t}\n\t\t\t\t\t\t$('#' + mailField).val(value + emails.join(','));\n\t\t\t\t\t} else {\n\t\t\t\t\t\twindow.crm.Vtiger_Helper_Js.showPnotify({\n\t\t\t\t\t\t\ttext: window.crm.app.vtranslate('NoFindEmailInRecord'),\n\t\t\t\t\t\t\tanimation: 'show'\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t});\n\t\t});\n\t});\n\n\tfunction getEmailAddresses(responseData, e, module) {\n\t\tlet aDeferred = $.Deferred(),\n\t\t\temails = [];\n\t\tif (typeof e.target !== 'undefined' && ($(e.target).data('type') === 'email' || $(e.target).data('type') === 'multiEmail')) {\n\t\t\temails.push($(e.target).text());\n\t\t\taDeferred.resolve(emails);\n\t\t} else {\n\t\t\tlet i = 0;\n\t\t\tfor (let id in responseData) {\n\t\t\t\twindow.crm.app.getRecordDetails({\n\t\t\t\t\trecord: id,\n\t\t\t\t\tmodule: module,\n\t\t\t\t\tfieldType: ['email', 'multiEmail']\n\t\t\t\t}).done((data) => {\n\t\t\t\t\ti++;\n\t\t\t\t\temails.push(getFirstEmailAddress(data.result.data));\n\t\t\t\t\tif (i === Object.keys(responseData).length) { //last iteration\n\t\t\t\t\t\taDeferred.resolve(emails);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t\treturn aDeferred.promise();\n\t}\n\n\tfunction getFirstEmailAddress(mailObj) {\n\t\tlet emails = [];\n\t\tfor (let key in mailObj) {\n\t\t\tif (mailObj[key]) {\n\t\t\t\tif (window.crm.app.isJsonString(mailObj[key])) {\n\t\t\t\t\tlet multiEmail = JSON.parse(mailObj[key]);\n\t\t\t\t\tfor (let i in multiEmail) {\n\t\t\t\t\t\temails.push(multiEmail[i].e);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t} else {\n\t\t\t\t\temails.push(mailObj[key]);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn emails;\n\t}\n\n\t//Loading list of modules with templates mail\n\tif (rcmail.env.isPermittedMailTemplates) {\n\t\tjQuery.ajax({\n\t\t\ttype: 'Get',\n\t\t\turl: \"?_task=mail&_action=plugin.yetiforce.getEmailTemplates&_id=\" + rcmail.env.compose_id,\n\t\t\tasync: false,\n\t\t\tsuccess: function (data) {\n\t\t\t\tvar modules = [];\n\t\t\t\tvar tmp = [];\n\t\t\t\tdata = JSON.parse(data);\n\t\t\t\t$.each(data, function (index, value) {\n\t\t\t\t\tjQuery('#vtmodulemenulink').removeClass('disabled');\n\t\t\t\t\tjQuery('#tplmenulink').removeClass('disabled');\n\t\t\t\t\ttmp.push({\n\t\t\t\t\t\tname: value.moduleName,\n\t\t\t\t\t\tlabel: value.moduleName\n\t\t\t\t\t});\n\t\t\t\t\tjQuery('#tplmenu #texttplsmenu').append('' + value.name + '');\n\t\t\t\t});\n\n\t\t\t\t$.each(tmp, function (index, value) {\n\t\t\t\t\tif (jQuery.inArray(value.name, modules) == -1) {\n\t\t\t\t\t\tjQuery('#vtmodulemenu .toolbarmenu').append('' + value.label + '');\n\t\t\t\t\t\tmodules.push(value.name);\n\t\t\t\t\t}\n\t\t\t\t});\n\n\t\t\t}\n\t\t});\n\t}\n\t// Limit the list of templates\n\tjQuery('#vtmodulemenu li a').on('click', function () {\n\t\tvar selectModule = jQuery(this).data('module');\n\t\tif (selectModule == undefined) {\n\t\t\tjQuery('#tplmenu li').show();\n\t\t} else {\n\t\t\tjQuery('#tplmenu li.' + selectModule).show();\n\t\t\tjQuery('#tplmenu li').not(\".\" + selectModule).hide();\n\t\t}\n\t});\n\n\tif (rcmail.env.crmModule != undefined) {\n\t\tjQuery('#vtmodulemenu li.' + rcmail.env.crmModule + ' a').trigger(\"click\");\n\t}\n\n\t// Loading a template mail\n\tjQuery('#tplmenu li a').on('click', function () {\n\t\tvar id = jQuery(this).data('tplid');\n\t\tvar recordId = rcmail.env.crmRecord,\n\t\t\tmodule = rcmail.env.crmModule,\n\t\t\tview = rcmail.env.crmView;\n\t\tif (view == 'List') {\n\t\t\tvar chElement = jQuery(crm.document).find('.listViewEntriesCheckBox')[0];\n\t\t\trecordId = jQuery(chElement).val();\n\t\t}\n\t\tjQuery.ajax({\n\t\t\ttype: 'Get',\n\t\t\turl: \"?_task=mail&_action=plugin.yetiforce.getConntentEmailTemplate&_id=\" + rcmail.env.compose_id,\n\t\t\tdata: {\n\t\t\t\tid: id,\n\t\t\t\trecord_id: recordId,\n\t\t\t\tselect_module: module\n\t\t\t},\n\t\t\tsuccess: function (data) {\n\t\t\t\tdata = JSON.parse(data);\n\t\t\t\tvar oldSubject = jQuery('[name=\"_subject\"]').val();\n\t\t\t\tvar html = jQuery(\"\").html(data.content).html();\n\t\t\t\tjQuery('[name=\"_subject\"]').val(oldSubject + ' ' + data.subject);\n\t\t\t\tif (window.tinyMCE && (ed = tinyMCE.get(rcmail.env.composebody))) {\n\t\t\t\t\tvar oldBody = tinyMCE.activeEditor.getContent();\n\t\t\t\t\ttinymce.activeEditor.setContent(html + oldBody);\n\t\t\t\t} else {\n\t\t\t\t\tvar oldBody = jQuery('#composebody').val();\n\t\t\t\t\tjQuery('#composebody').val(html + oldBody);\n\t\t\t\t}\n\t\t\t\tif (typeof data.attachments !== 'undefined' && data.attachments !== null) {\n\t\t\t\t\trcmail.command('yetiforce.addFilesToMail', data.attachments);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t});\n});\n\nfunction getCrmWindow() {\n\tif (opener !== null) {\n\t\treturn opener.parent;\n\t} else if (typeof parent.app == \"object\") {\n\t\treturn parent;\n\t}\n\treturn false;\n}\n"],"names":["window","rcmail","addEventListener","responseData","e","module","$","Deferred","emails","target","data","push","text","aDeferred","resolve","crm","app","getRecordDetails","record","id","fieldType","done","i","getFirstEmailAddress","result","Object","keys","length","promise","mailObj","key","isJsonString","JSON","parse","multiEmail","getCrmWindow","crmPath","env","site_URL","compose_commands","register_command","getTime","frame","async_upload_form_frame","ts","_uploadid","jQuery","ajax","url","compose_id","type","success","body","doc","html","showRecordsList","src_module","multi_select","additionalInformations","modal","instance","setSelectEvent","command","ids","click","attr","getEmailAddresses","mailField","val","charAt","value","join","Vtiger_Helper_Js","showPnotify","vtranslate","animation","isPermittedMailTemplates","async","tmp","each","index","removeClass","name","moduleName","label","append","inArray","modules","on","selectModule","show","not","hide","crmModule","trigger","recordId","crmRecord","view","crmView","document","find","chElement","record_id","select_module","content","oldSubject","subject","tinyMCE","ed","get","composebody","activeEditor","getContent","tinymce","setContent","oldBody","attachments","parent"],"mappings":";;;;;;;;AAEAA,OAAOC,MAAP,EAAiBA,OAAOC,gBAAP,CAAwB,MAAxB,CAAgC,UAAe,CAyE/D,0BAAA,CAA2BC,YAA3B,CAAyCC,CAAzC,CAA4CC,MAA5C,CAAoD,CACnD,cAAgBC,EAAEC,QAAF,EAAhB,CACCC,OAAS,EADV,CAqBA,OAnBwB,WAApB,WAASC,MAAT,GAAiE,OAA7B,KAAEL,EAAEK,MAAJ,EAAYC,IAAZ,CAAiB,MAAjB,GAAqE,YAA7B,KAAEN,EAAEK,MAAJ,EAAYC,IAAZ,CAAiB,MAAjB,CAA5E,CAmBJ,EAlBCF,OAAOG,IAAP,CAAYL,EAAEF,EAAEK,MAAJ,EAAYG,IAAZ,EAAZ,CAkBD,CAjBCC,UAAUC,OAAV,CAAkBN,MAAlB,CAiBD,aAfC,MAAQ,CAAR,CACA,IAAK,MAAL,gBAAA,CACCR,OAAOe,GAAP,CAAWC,GAAX,CAAeC,gBAAf,CAAgC,CAC/BC,OAAQC,EADuB,CAE/Bd,OAAQA,MAFuB,CAG/Be,UAAW,CAAC,OAAD,CAAU,YAAV,CAHoB,CAAhC,EAIGC,IAJH,CAIQ,SAACX,IAAD,CAAU,CACjBY,GADiB,CAEjBd,OAAOG,IAAP,CAAYY,qBAAqBb,KAAKc,MAAL,CAAYd,IAAjC,CAAZ,CA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AHY,GAIfqG,MAGR"}
\ No newline at end of file
+{"version":3,"file":"compose.min.js","sources":["compose.js"],"sourcesContent":["'use strict';\n/* {[The file is published on the basis of MIT License]} */\n\nwindow.rcmail && rcmail.addEventListener('init', function (evt) {\n\n\tvar crm = window.crm = getCrmWindow();\n\tvar crmPath = rcmail.env.site_URL + 'index.php?';\n\n\trcmail.env.compose_commands.push('yetiforce.addFilesToMail');\n\trcmail.env.compose_commands.push('yetiforce.addFilesFromCRM');\n\n\t// Document selection\n\trcmail.register_command('yetiforce.addFilesToMail', function (data) {\n\t\tvar ts = new Date().getTime(),\n\t\t\tframe_name = 'rcmupload' + ts,\n\t\t\tframe = rcmail.async_upload_form_frame(frame_name);\n\t\tdata._uploadid = ts;\n\t\tjQuery.ajax({\n\t\t\turl: \"?_task=mail&_action=plugin.yetiforce.addFilesToMail&_id=\" + rcmail.env.compose_id,\n\t\t\ttype: \"POST\",\n\t\t\tdata: data,\n\t\t\tsuccess: function (data) {\n\t\t\t\tvar doc = frame[0];\n\t\t\t\tvar body = $(doc);\n\t\t\t\tbody.html(data);\n\t\t\t}\n\t\t});\n\t}, true);\n\n\t// Add a document to an email crm\n\trcmail.register_command('yetiforce.addFilesFromCRM', function (data) {\n\t\tif (crm != false) {\n\t\t\twindow.crm.app.showRecordsList({\n\t\t\t\tmodule: 'Documents',\n\t\t\t\tsrc_module: 'Documents',\n\t\t\t\tmulti_select: true,\n\t\t\t\tadditionalInformations: true\n\t\t\t}, (modal, instance) => {\n\t\t\t\tinstance.setSelectEvent((responseData) => {\n\t\t\t\t\trcmail.command('yetiforce.addFilesToMail', {\n\t\t\t\t\t\tids: Object.keys(responseData),\n\t\t\t\t\t\t_uploadid: new Date().getTime()\n\t\t\t\t\t});\n\t\t\t\t});\n\t\t\t});\n\t\t}\n\t}, true);\n\t// Selection of email with popup\n\t$('#composeheaders #yt_adress_buttons .button').click(function () {\n\t\tvar mailField = $(this).attr('data-input');\n\t\tvar module = $(this).attr('data-module');\n\t\twindow.crm.app.showRecordsList({\n\t\t\tmodule: module,\n\t\t\tsrc_module: 'OSSMail',\n\t\t\tmulti_select: true,\n\t\t\tadditionalInformations: true\n\t\t}, (modal, instance) => {\n\t\t\tinstance.setSelectEvent((responseData, e) => {\n\t\t\t\tgetEmailAddresses(responseData, e, module).done((emails) => {\n\t\t\t\t\tif (emails.length) {\n\t\t\t\t\t\tlet value = $('#' + mailField).val();\n\t\t\t\t\t\tif (value != '' && value.charAt(value.length - 1) != ',') {\n\t\t\t\t\t\t\tvalue = value + ',';\n\t\t\t\t\t\t}\n\t\t\t\t\t\t$('#' + mailField).val(value + emails.join(','));\n\t\t\t\t\t} else {\n\t\t\t\t\t\twindow.crm.Vtiger_Helper_Js.showPnotify({\n\t\t\t\t\t\t\ttext: window.crm.app.vtranslate('NoFindEmailInRecord'),\n\t\t\t\t\t\t\tanimation: 'show'\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t});\n\t\t});\n\t});\n\n\tfunction getEmailAddresses(responseData, e, module) {\n\t\tlet aDeferred = $.Deferred(),\n\t\t\temails = [];\n\t\tif (typeof e.target !== 'undefined' && ($(e.target).data('type') === 'email' || $(e.target).data('type') === 'multiEmail')) {\n\t\t\temails.push($(e.target).text());\n\t\t\taDeferred.resolve(emails);\n\t\t} else {\n\t\t\tlet i = 0;\n\t\t\tfor (let id in responseData) {\n\t\t\t\twindow.crm.app.getRecordDetails({\n\t\t\t\t\trecord: id,\n\t\t\t\t\tmodule: module,\n\t\t\t\t\tfieldType: ['email', 'multiEmail']\n\t\t\t\t}).done((data) => {\n\t\t\t\t\ti++;\n\t\t\t\t\temails.push(getFirstEmailAddress(data.result.data));\n\t\t\t\t\tif (i === Object.keys(responseData).length) { //last iteration\n\t\t\t\t\t\taDeferred.resolve(emails);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t\treturn aDeferred.promise();\n\t}\n\n\tfunction getFirstEmailAddress(mailObj) {\n\t\tlet emails = [];\n\t\tfor (let key in mailObj) {\n\t\t\tif (mailObj[key]) {\n\t\t\t\tif (window.crm.app.isJsonString(mailObj[key])) {\n\t\t\t\t\tlet multiEmail = JSON.parse(mailObj[key]);\n\t\t\t\t\tfor (let i in multiEmail) {\n\t\t\t\t\t\temails.push(multiEmail[i].e);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t} else {\n\t\t\t\t\temails.push(mailObj[key]);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn emails;\n\t}\n\n\t//Loading list of modules with templates mail\n\tif (rcmail.env.isPermittedMailTemplates) {\n\t\tjQuery.ajax({\n\t\t\ttype: 'Get',\n\t\t\turl: \"?_task=mail&_action=plugin.yetiforce.getEmailTemplates&_id=\" + rcmail.env.compose_id,\n\t\t\tasync: false,\n\t\t\tsuccess: function (data) {\n\t\t\t\tlet tmp = {};\n\t\t\t\tdata = JSON.parse(data);\n\t\t\t\t$.each(data, function (index, value) {\n\t\t\t\t\tjQuery('#vtmodulemenulink').removeClass('disabled');\n\t\t\t\t\tjQuery('#tplmenulink').removeClass('disabled');\n\t\t\t\t\ttmp[value.module_name] = value.moduleTranslate;\n\t\t\t\t\tjQuery('#tplmenu #texttplsmenu').append('' + value.name + '');\n\t\t\t\t});\n\n\t\t\t\t$.each(tmp, function (moduleName, moduleTranslate) {\n\t\t\t\t\tif (moduleName) {\n\t\t\t\t\t\tjQuery('#vtmodulemenu .toolbarmenu').append('' + moduleTranslate + '');\n\t\t\t\t\t}\n\t\t\t\t});\n\n\t\t\t}\n\t\t});\n\t}\n\t// Limit the list of templates\n\tjQuery('#vtmodulemenu li a').on('click', function () {\n\t\tvar selectModule = jQuery(this).data('module');\n\t\tif (selectModule == undefined) {\n\t\t\tjQuery('#tplmenu li').show();\n\t\t} else {\n\t\t\tjQuery('#tplmenu li.' + selectModule).show();\n\t\t\tjQuery('#tplmenu li').not(\".\" + selectModule).hide();\n\t\t}\n\t});\n\n\tif (rcmail.env.crmModule != undefined) {\n\t\tjQuery('#vtmodulemenu li.' + rcmail.env.crmModule + ' a').trigger(\"click\");\n\t}\n\n\t// Loading a template mail\n\tjQuery('#tplmenu li a').on('click', function () {\n\t\tvar id = jQuery(this).data('tplid');\n\t\tvar recordId = rcmail.env.crmRecord,\n\t\t\tmodule = rcmail.env.crmModule,\n\t\t\tview = rcmail.env.crmView;\n\t\tif (view == 'List') {\n\t\t\tvar chElement = jQuery(crm.document).find('.listViewEntriesCheckBox')[0];\n\t\t\trecordId = jQuery(chElement).val();\n\t\t}\n\t\tjQuery.ajax({\n\t\t\ttype: 'Get',\n\t\t\turl: \"?_task=mail&_action=plugin.yetiforce.getContentEmailTemplate&_id=\" + rcmail.env.compose_id,\n\t\t\tdata: {\n\t\t\t\tid: id,\n\t\t\t\trecord_id: recordId,\n\t\t\t\tselect_module: module\n\t\t\t},\n\t\t\tsuccess: function (data) {\n\t\t\t\tdata = JSON.parse(data);\n\t\t\t\tlet oldSubject = jQuery('[name=\"_subject\"]').val(),\n\t\t\t\thtml = jQuery(\"\").html(data.content).html(),\n\t\t\t\ted = '';\n\t\t\t\tjQuery('[name=\"_subject\"]').val(oldSubject + ' ' + data.subject);\n\t\t\t\tif (window.tinyMCE && (ed = tinyMCE.get(rcmail.env.composebody))) {\n\t\t\t\t\tlet oldBody = tinyMCE.activeEditor.getContent();\n\t\t\t\t\ttinymce.activeEditor.setContent(html + oldBody);\n\t\t\t\t} else {\n\t\t\t\t\tlet oldBody = jQuery('#composebody').val();\n\t\t\t\t\tjQuery('#composebody').val(html + oldBody);\n\t\t\t\t}\n\t\t\t\tif (typeof data.attachments !== 'undefined' && data.attachments !== null) {\n\t\t\t\t\trcmail.command('yetiforce.addFilesToMail', data.attachments);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t});\n});\n\nfunction getCrmWindow() {\n\tif (opener !== null) {\n\t\treturn opener.parent;\n\t} else if (typeof parent.app == \"object\") {\n\t\treturn parent;\n\t}\n\treturn false;\n}\n"],"names":["window","rcmail","addEventListener","responseData","e","module","$","Deferred","emails","target","data","push","text","aDeferred","resolve","crm","app","getRecordDetails","record","id","fieldType","done","i","getFirstEmailAddress","result","Object","keys","length","promise","mailObj","key","isJsonString","JSON","parse","multiEmail","getCrmWindow","crmPath","env","site_URL","compose_commands","register_command","getTime","frame","async_upload_form_frame","ts","_uploadid","jQuery","ajax","url","compose_id","type","success","body","doc","html","showRecordsList","src_module","multi_select","additionalInformations","modal","instance","setSelectEvent","command","ids","click","attr","getEmailAddresses","mailField","val","charAt","value","join","Vtiger_Helper_Js","showPnotify","vtranslate","animation","isPermittedMailTemplates","async","each","index","removeClass","tmp","module_name","moduleTranslate","append","name","moduleName","on","selectModule","show","not","hide","crmModule","trigger","recordId","crmRecord","view","crmView","document","find","chElement","record_id","select_module","content","ed","oldSubject","subject","tinyMCE","get","composebody","activeEditor","getContent","tinymce","setContent","oldBody","attachments","parent"],"mappings":";;;;;;;;AAGAA,OAAOC,MAAP,EAAiBA,OAAOC,gBAAP,CAAwB,MAAxB,CAAgC,UAAe,CAyE/D,0BAAA,CAA2BC,YAA3B,CAAyCC,CAAzC,CAA4CC,MAA5C,CAAoD,CACnD,cAAgBC,EAAEC,QAAF,EAAhB,CACCC,OAAS,EADV,CAqBA,OAnBwB,WAApB,WAASC,MAAT,GAAiE,OAA7B,KAAEL,EAAEK,MAAJ,EAAYC,IAAZ,CAAiB,MAAjB,GAAqE,YAA7B,KAAEN,EAAEK,MAAJ,EAAYC,IAAZ,CAAiB,MAAjB,CAA5E,CAmBJ,EAlBCF,OAAOG,IAAP,CAAYL,EAAEF,EAAEK,MAAJ,EAAYG,IAAZ,EAAZ,CAkBD,CAjBCC,UAAUC,OAAV,CAAkBN,MAAlB,CAiBD,aAfC,MAAQ,CAAR,CACA,IAAK,MAAL,gBAAA,CACCR,OAAOe,GAAP,CAAWC,GAAX,CAAeC,gBAAf,CAAgC,CAC/BC,OAAQC,EADuB,CAE/Bd,OAAQA,M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AHY,GAIfoG,MAGR"}
\ No newline at end of file
diff --git a/plugins/yetiforce/preview.css b/plugins/yetiforce/preview.css
index ac52a232..27a0834f 100644
--- a/plugins/yetiforce/preview.css
+++ b/plugins/yetiforce/preview.css
@@ -1,20 +1,20 @@
.pull-right {
- float: right !important
+ float: right !important;
}
#ytActionBarContent select {
- padding: 0
+ padding: 0;
}
#ytActionBarContent .row:before {
display: table;
- content: " "
+ content: ' ';
}
#ytActionBarContent .row:after {
clear: both;
display: table;
- content: " "
+ content: ' ';
}
#ytActionBarContent .ytHeader {
@@ -23,43 +23,43 @@
}
#ytActionBarContent .rowReletedRecord .rowActions {
- display: none
+ display: none;
}
#ytActionBarContent .rowReletedRecord:hover .rowActions {
- display: block
+ display: block;
}
#ytActionBarContent .noRecords {
background: #70a8cb;
text-align: center;
color: #fff;
- padding: 2px 0
+ padding: 2px 0;
}
#ytActionBarContent .noRecords a.importMail {
color: #ecf6ff;
cursor: pointer;
- font-weight: 800
+ font-weight: 800;
}
#ytActionBarContent .rowReletedRecord {
- margin: 3px 0 6px 0
+ margin: 3px 0 6px 0;
}
#ytActionBarContent .rowReletedRecord {
- margin: 3px 0 6px 0
+ margin: 3px 0 6px 0;
}
#ytActionBarContent .pull-right button {
line-height: 10px;
margin-left: 3px;
padding: 0 6px;
- height: 14px
+ height: 14px;
}
#ytActionBarContent .relatedModuleIcon {
- margin-right: 5px
+ margin-right: 5px;
}
#messageheader.previewheader {
@@ -146,12 +146,15 @@
color: black;
}
-button, select, .rowRelatedRecord {
- border-radius: .25rem;
+button,
+select,
+.rowRelatedRecord {
+ border-radius: 0.25rem;
padding: 0.1rem 0.2rem;
}
-button, select {
+button,
+select {
cursor: pointer;
}
@@ -177,7 +180,8 @@ button {
border: 1px solid transparent;
padding: 0.2rem 0.3rem;
border-radius: 0.25rem;
- transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
+ transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out,
+ box-shadow 0.15s ease-in-out;
}
button:hover {
@@ -223,7 +227,7 @@ button:hover {
.c-ical__card__year {
font-size: 9px;
- color: #888888
+ color: #888888;
}
.c-ical__card__time {
@@ -247,4 +251,9 @@ button:hover {
.mr-1 {
margin-right: 0.25rem;
-}
\ No newline at end of file
+}
+
+.action-bar__head__message {
+ text-align: center !important;
+ display: block;
+}
diff --git a/plugins/yetiforce/preview.js b/plugins/yetiforce/preview.js
index 7ba034f1..9b0af302 100644
--- a/plugins/yetiforce/preview.js
+++ b/plugins/yetiforce/preview.js
@@ -94,6 +94,11 @@ function registerRemoveRecord(content) {
function registerSelectRecord(content) {
let id = content.find('#mailActionBarID').val();
content.find('button.selectRecord').click(function (e) {
+ let relationSelect = content.find('#addRelationSelect').val();
+ let getCacheModule = window.crm.app.moduleCacheGet('selectedModuleName');
+ if (getCacheModule === 'undefined' || relationSelect !== getCacheModule) {
+ window.crm.app.moduleCacheSet('selectedModuleName', relationSelect);
+ }
let relParams = {
mailId: id
};
@@ -170,18 +175,31 @@ function registerAddAttachments(content) {
}
function registerAddRecord(content) {
var id = content.find('#mailActionBarID').val();
- content.find('button.addRecord').click(function (e) {
+ let getCacheModule = window.crm.app.moduleCacheGet('selectedModuleName');
+ if (getCacheModule) {
+ content.find('#addRelationSelect').val(getCacheModule);
+ }
+ content.find('button.addRecord').click(function(e) {
+ var relationSelect = content.find('#addRelationSelect').val();
+ if (getCacheModule === 'undefined' || relationSelect !== getCacheModule) {
+ window.crm.app.moduleCacheSet('selectedModuleName', relationSelect);
+ }
var col = $(e.currentTarget).closest('.js-head-container');
let selectValue = col.find('.module').val();
if (selectValue !== null) {
- showQuickCreateForm(selectValue, id);
+ let relatedRecords = []
+ content.find('.js-data').find('.rowRelatedRecord').each((i, record) => {
+ let data = $(record).data()
+ relatedRecords.push({module: data.module, id: data.id})
+ })
+ showQuickCreateForm(selectValue, id, {relatedRecords: relatedRecords});
}
});
}
function removeRecord(crmid) {
- var id = $('#mailActionBarID').val();
- var params = {}
+ const id = $('#mailActionBarID').val();
+ let params = {}
params.data = {
module: 'OSSMail',
action: 'ExecuteActions',
@@ -194,18 +212,17 @@ function removeRecord(crmid) {
params.async = false;
params.dataType = 'json';
window.crm.AppConnector.request(params).done(function (data) {
- var response = data['result'];
+ const response = data['result'];
+ let notifyParams = {
+ text: response['data'],
+ animation: 'show'
+ };
if (response['success']) {
- var notifyParams = {
+ notifyParams = {
text: response['data'],
type: 'info',
animation: 'show'
};
- } else {
- var notifyParams = {
- text: response['data'],
- animation: 'show'
- };
}
window.crm.Vtiger_Helper_Js.showPnotify(notifyParams);
loadActionBar();
@@ -247,24 +264,23 @@ function showPopup(params, actionsParams) {
});
}
-function showQuickCreateForm(moduleName, record, params) {
- var content = $('#ytActionBarContent');
- if (params == undefined) {
- var params = {};
- }
- var relatedParams = {};
+function showQuickCreateForm(moduleName, record, params = {}) {
+ const content = $('#ytActionBarContent');
+ let relatedParams = {},
+ sourceModule = 'OSSMailView';
if (params['sourceModule']) {
- var sourceModule = params['sourceModule'];
- } else {
- var sourceModule = 'OSSMailView';
+ sourceModule = params['sourceModule'];
}
- var postShown = function (data) {
+ const postShown = function (data) {
var index, queryParam, queryParamComponents;
$('').appendTo(data);
$('').appendTo(data);
$('').appendTo(data);
}
- var ids = {
+ const postQuickCreate = function (data) {
+ loadActionBar();
+ }
+ const ids = {
link: 'modulesLevel0',
process: 'modulesLevel1',
subprocess: 'modulesLevel2',
@@ -298,21 +314,25 @@ function showQuickCreateForm(moduleName, record, params) {
}
relatedParams['email'] = rcmail.env.fromMail;
relatedParams['email1'] = rcmail.env.fromMail;
- relatedParams['description'] = $('#messagebody').text();
+ let messageBody = $('#messagebody').clone()
+ messageBody.find('.image-attachment').remove()
+ relatedParams['description'] = messageBody.text()
//relatedParams['related_to'] = record;
- var postQuickCreate = function (data) {
- loadActionBar();
+ if (params.relatedRecords !== undefined) {
+ relatedParams['relatedRecords'] = params.relatedRecords;
}
relatedParams['sourceModule'] = sourceModule;
relatedParams['sourceRecord'] = record;
relatedParams['relationOperation'] = true;
- var quickCreateParams = {
- callbackFunction: postQuickCreate,
+ const quickCreateParams = {
+ callbackFunction: (data) => {
+ loadActionBar();
+ },
callbackPostShown: postShown,
data: relatedParams,
noCache: true
};
- var headerInstance = new window.crm.Vtiger_Header_Js();
+ const headerInstance = new window.crm.Vtiger_Header_Js();
headerInstance.quickCreateModule(moduleName, quickCreateParams);
}
diff --git a/plugins/yetiforce/preview.min.css b/plugins/yetiforce/preview.min.css
index 320569ba..b2b99161 100644
--- a/plugins/yetiforce/preview.min.css
+++ b/plugins/yetiforce/preview.min.css
@@ -1 +1 @@
-.pull-right{float:right !important}#ytActionBarContent select{padding:0}#ytActionBarContent .row:before{display:table;content:" "}#ytActionBarContent .row:after{clear:both;display:table;content:" "}#ytActionBarContent .ytHeader{position:relative;border-bottom:1px solid #dfdfdf}#ytActionBarContent .rowReletedRecord .rowActions{display:none}#ytActionBarContent .rowReletedRecord:hover .rowActions{display:block}#ytActionBarContent .noRecords{background:#70a8cb;text-align:center;color:#fff;padding:2px 0}#ytActionBarContent .noRecords a.importMail{color:#ecf6ff;cursor:pointer;font-weight:800}#ytActionBarContent .rowReletedRecord{margin:3px 0 6px 0}#ytActionBarContent .rowReletedRecord{margin:3px 0 6px 0}#ytActionBarContent .pull-right button{line-height:10px;margin-left:3px;padding:0 6px;height:14px}#ytActionBarContent .relatedModuleIcon{margin-right:5px}#messageheader.previewheader{padding:0 0 3px 30px}.rcmaddcontact{display:none}.d-none{display:none}.mr-5px{margin-right:5px}.mr-3px{margin-right:3px}.ml-5px{margin-left:5px}.w-100{width:100%}.flex-wrap{display:flex;flex-wrap:wrap}.flex-nowrap{display:flex;flex-wrap:nowrap}.rowRelatedRecord{background:#bbdde8;margin-left:3px;border:1px #c1c1c1 solid}.action-bar__head__container{display:flex;flex-wrap:nowrap;width:fit-content;margin-right:5px}.action-bar__head a{text-decoration:none;color:#000}.action-bar__head{color:#fff;padding:0 2px 4px;display:flex;flex-wrap:wrap}.action-bar__head>*{margin-top:4px}.action-bar__col{background-color:#4a5364;width:100%}.action-bar__select{margin-left:3px}.action-bar__select:required:invalid{color:gray}.action-bar__select optgroup{color:black}button,select,.rowRelatedRecord{border-radius:.25rem;padding:.1rem .2rem}button,select{cursor:pointer}.rowActions{display:inline-flex;align-items:center}.rowActions button{padding:.005rem .2rem;margin-left:5px}button{display:inline-block;background-color:#f8f9fa;border-color:#f8f9fa;font-weight:400;text-align:center;white-space:nowrap;vertical-align:middle;user-select:none;border:1px solid transparent;padding:.2rem .3rem;border-radius:.25rem;transition:color .15s ease-in-out,background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out}button:hover{color:#212529;background-color:#e2e6ea;border-color:#dae0e5}.c-ical{margin:2px}.c-ical__event{background:#fffdfd;margin:2px 0;border:1px solid #dedede;margin:3px auto;border-radius:6px}.c-ical__wrapper{margin:3px}.c-ical__card{width:fit-content;height:fit-content;background:white;border:1px solid #d0d0d0;border-radius:6px;color:#c51818;padding:0 2px 2px;margin:2px;text-align:center}.c-ical__card__day{font-size:15px;margin:0 auto;width:fit-content;color:black}.c-ical__card__year{font-size:9px;color:#888}.c-ical__card__time{font-size:18px;margin:auto 5px}.c-ical__card__arrow{margin:auto 5px}.c-ical__subject{margin:0 auto;text-align:center;background:#4a5364;color:white;border-top-left-radius:6px;border-top-right-radius:6px;padding-bottom:2px}.mr-1{margin-right:.25rem}
\ No newline at end of file
+.pull-right{float:right!important}#ytActionBarContent select{padding:0}#ytActionBarContent .row:before{display:table;content:' '}#ytActionBarContent .row:after{clear:both;display:table;content:' '}#ytActionBarContent .ytHeader{position:relative;border-bottom:1px solid #dfdfdf}#ytActionBarContent .rowReletedRecord .rowActions{display:none}#ytActionBarContent .rowReletedRecord:hover .rowActions{display:block}#ytActionBarContent .noRecords{background:#70a8cb;text-align:center;color:#fff;padding:2px 0}#ytActionBarContent .noRecords a.importMail{color:#ecf6ff;cursor:pointer;font-weight:800}#ytActionBarContent .rowReletedRecord{margin:3px 0 6px 0}#ytActionBarContent .rowReletedRecord{margin:3px 0 6px 0}#ytActionBarContent .pull-right button{line-height:10px;margin-left:3px;padding:0 6px;height:14px}#ytActionBarContent .relatedModuleIcon{margin-right:5px}#messageheader.previewheader{padding:0 0 3px 30px}.rcmaddcontact{display:none}.d-none{display:none}.mr-5px{margin-right:5px}.mr-3px{margin-right:3px}.ml-5px{margin-left:5px}.w-100{width:100%}.flex-wrap{display:flex;flex-wrap:wrap}.flex-nowrap{display:flex;flex-wrap:nowrap}.rowRelatedRecord{background:#bbdde8;margin-left:3px;border:1px #c1c1c1 solid}.action-bar__head__container{display:flex;flex-wrap:nowrap;width:fit-content;margin-right:5px}.action-bar__head a{text-decoration:none;color:#000}.action-bar__head{color:#fff;padding:0 2px 4px;display:flex;flex-wrap:wrap}.action-bar__head>*{margin-top:4px}.action-bar__col{background-color:#4a5364;width:100%}.action-bar__select{margin-left:3px}.action-bar__select:required:invalid{color:gray}.action-bar__select optgroup{color:#000}.rowRelatedRecord,button,select{border-radius:.25rem;padding:.1rem .2rem}button,select{cursor:pointer}.rowActions{display:inline-flex;align-items:center}.rowActions button{padding:.005rem .2rem;margin-left:5px}button{display:inline-block;background-color:#f8f9fa;border-color:#f8f9fa;font-weight:400;text-align:center;white-space:nowrap;vertical-align:middle;user-select:none;border:1px solid transparent;padding:.2rem .3rem;border-radius:.25rem;transition:color .15s ease-in-out,background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out}button:hover{color:#212529;background-color:#e2e6ea;border-color:#dae0e5}.c-ical{margin:2px}.c-ical__event{background:#fffdfd;margin:2px 0;border:1px solid #dedede;margin:3px auto;border-radius:6px}.c-ical__wrapper{margin:3px}.c-ical__card{width:fit-content;height:fit-content;background:#fff;border:1px solid #d0d0d0;border-radius:6px;color:#c51818;padding:0 2px 2px;margin:2px;text-align:center}.c-ical__card__day{font-size:15px;margin:0 auto;width:fit-content;color:#000}.c-ical__card__year{font-size:9px;color:#888}.c-ical__card__time{font-size:18px;margin:auto 5px}.c-ical__card__arrow{margin:auto 5px}.c-ical__subject{margin:0 auto;text-align:center;background:#4a5364;color:#fff;border-top-left-radius:6px;border-top-right-radius:6px;padding-bottom:2px}.mr-1{margin-right:.25rem}.action-bar__head__message{text-align:center!important;display:block}
\ No newline at end of file
diff --git a/plugins/yetiforce/preview.min.js b/plugins/yetiforce/preview.min.js
index 3efcfbc8..7384c07a 100644
--- a/plugins/yetiforce/preview.min.js
+++ b/plugins/yetiforce/preview.min.js
@@ -6,5 +6,5 @@ var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
};
-window.rcmail&&rcmail.addEventListener('init',function(){window.crm=getCrmWindow(),loadActionBar(),rcmail.env.message_commands.push('yetiforce.importICS'),rcmail.register_command('yetiforce.importICS',function(part,type){jQuery.ajax({type:'POST',url:'./?_task=mail&_action=plugin.yetiforce.importIcs&_mbox='+urlencode(rcmail.env.mailbox)+'&_uid='+urlencode(rcmail.env.uid)+'&_part='+part+'&_type='+type,async:!1,success:function success(data){data=JSON.parse(data),window.crm.Vtiger_Helper_Js.showPnotify({text:data.message,type:'info',animation:'show'});}});},!0);});function loadActionBar(){var content=$('#ytActionBarContent'),params={module:'OSSMail',view:'MailActionBar',uid:rcmail.env.uid,folder:rcmail.env.mailbox,rcId:rcmail.env.user_id};window.crm.AppConnector.request(params).done(function(response){content.find('.ytHeader').html(response),$('#messagecontent').css('top',content.outerHeight()+$('#messageheader').outerHeight()+'px'),registerEvents(content);});}function registerEvents(content){registerAddRecord(content),registerAddReletedRecord(content),registerSelectRecord(content),registerRemoveRecord(content),registerImportMail(content);var block=content.find('.ytHeader .js-data');content.find('.hideBtn').click(function(){var button=$(this),icon=button.find('.glyphicon');'0'==button.data('type')?(button.data('type','1'),icon.removeClass('glyphicon-chevron-up').addClass('glyphicon-chevron-down')):(button.data('type','0'),icon.removeClass('glyphicon-chevron-down').addClass('glyphicon-chevron-up')),block.toggle(),$(window).trigger('resize');});}function registerImportMail(content){content.find('.importMail').click(function(){window.crm.Vtiger_Helper_Js.showPnotify({text:window.crm.app.vtranslate('StartedDownloadingEmail'),type:'info'}),window.crm.AppConnector.request({module:'OSSMail',action:'ImportMail',uid:rcmail.env.uid,folder:rcmail.env.mailbox,rcId:rcmail.env.user_id}).done(function(){loadActionBar(),window.crm.Vtiger_Helper_Js.showPnotify({text:window.crm.app.vtranslate('AddFindEmailInRecord'),type:'success'});});});}function registerRemoveRecord(content){content.find('button.removeRecord').click(function(e){var row=$(e.currentTarget).closest('.rowRelatedRecord');removeRecord(row.data('id'));});}function registerSelectRecord(content){var id=content.find('#mailActionBarID').val();content.find('button.selectRecord').click(function(){var relParams={mailId:id};if(0==$(this).data('type')){var module=$(this).closest('.js-head-container').find('.module').val();if(null===module)return}else{var module=$(this).data('module');relParams.crmid=$(this).closest('.rowRelatedRecord').data('id'),relParams.mod=$(this).closest('.rowRelatedRecord').data('module'),relParams.newModule=module;}showPopup({module:module,src_module:'OSSMailView',src_record:id},relParams);});}function registerAddReletedRecord(content){content.find('#mailActionBarID').val();content.find('button.addRelatedRecord').click(function(e){var targetElement=$(e.currentTarget),row=targetElement.closest('.rowRelatedRecord'),params={sourceModule:row.data('module')};showQuickCreateForm(targetElement.data('module'),row.data('id'),params);});}function registerAddRecord(content){var id=content.find('#mailActionBarID').val();content.find('button.addRecord').click(function(e){var col=$(e.currentTarget).closest('.js-head-container'),selectValue=col.find('.module').val();null!==selectValue&&showQuickCreateForm(selectValue,id);});}function removeRecord(crmid){var id=$('#mailActionBarID').val(),params={};params.data={module:'OSSMail',action:'ExecuteActions',mode:'removeRelated',params:{mailId:id,crmid:crmid}},params.async=!1,params.dataType='json',window.crm.AppConnector.request(params).done(function(data){var response=data.result;if(response.success)var notifyParams={text:response.data,type:'info',animation:'show'};else var notifyParams={text:response.data,animation:'show'};window.crm.Vtiger_Helper_Js.showPnotify(notifyParams),loadActionBar();});}function showPopup(params,actionsParams){actionsParams.newModule=params.module,window.crm.app.showRecordsList(params,function(modal,instance){instance.setSelectEvent(function(responseData){actionsParams.newCrmId=responseData.id,window.crm.AppConnector.request({async:!1,dataType:'json',data:{module:'OSSMail',action:'ExecuteActions',mode:'addRelated',params:actionsParams}}).done(function(data){var response=data.result;if(response.success)var notifyParams={text:response.data,type:'info',animation:'show'};else var notifyParams={text:response.data,animation:'show'};window.crm.Vtiger_Helper_Js.showPnotify(notifyParams),loadActionBar();});});});}function showQuickCreateForm(moduleName,record,params){var content=$('#ytActionBarContent');var relatedParams={};if(false)var sourceModule=params.sourceModule;else var sourceModule='OSSMailView';var postShown=function(data){$('').appendTo(data),$('').appendTo(data),$('').appendTo(data);},ids={link:'modulesLevel0',process:'modulesLevel1',subprocess:'modulesLevel2',linkextend:'modulesLevel3'};for(var i in ids){var element=content.find('#'+ids[i]),value=element.length?JSON.parse(element.val()):[];0<=$.inArray(sourceModule,value)&&(relatedParams[i]=record);}'Leads'==moduleName&&(relatedParams.company=rcmail.env.fromName),('Leads'==moduleName||'Contacts'==moduleName)&&(relatedParams.lastname=rcmail.env.fromName),'Project'==moduleName&&(relatedParams.projectname=rcmail.env.subject),'HelpDesk'==moduleName&&(relatedParams.ticket_title=rcmail.env.subject),'Products'==moduleName&&(relatedParams.productname=rcmail.env.subject),'Services'==moduleName&&(relatedParams.servicename=rcmail.env.subject),relatedParams.email=rcmail.env.fromMail,relatedParams.email1=rcmail.env.fromMail,relatedParams.description=$('#messagebody').text();relatedParams.sourceModule=sourceModule,relatedParams.sourceRecord=record,relatedParams.relationOperation=!0;var headerInstance=new window.crm.Vtiger_Header_Js;headerInstance.quickCreateModule(moduleName,{callbackFunction:function postQuickCreate(){loadActionBar();},callbackPostShown:postShown,data:relatedParams,noCache:!0});}function getCrmWindow(){if(null!==opener&&'object'==opener.parent.CONFIG)return opener.parent;return 'object'==_typeof(parent.CONFIG)?parent:'object'==_typeof(parent.parent.CONFIG)?parent.parent:!('object'!=_typeof(opener.crm.CONFIG))&&opener.crm}
+window.rcmail&&rcmail.addEventListener('init',function(){window.crm=getCrmWindow(),loadActionBar(),rcmail.env.message_commands.push('yetiforce.importICS'),rcmail.register_command('yetiforce.importICS',function(part,type){jQuery.ajax({type:'POST',url:'./?_task=mail&_action=plugin.yetiforce.importIcs&_mbox='+urlencode(rcmail.env.mailbox)+'&_uid='+urlencode(rcmail.env.uid)+'&_part='+part+'&_type='+type,async:!1,success:function success(data){data=JSON.parse(data),window.crm.Vtiger_Helper_Js.showPnotify({text:data.message,type:'info',animation:'show'});}});},!0);});function loadActionBar(){var content=$('#ytActionBarContent'),params={module:'OSSMail',view:'MailActionBar',uid:rcmail.env.uid,folder:rcmail.env.mailbox,rcId:rcmail.env.user_id};window.crm.AppConnector.request(params).done(function(response){content.find('.ytHeader').html(response),$('#messagecontent').css('top',content.outerHeight()+$('#messageheader').outerHeight()+'px'),registerEvents(content);});}function registerEvents(content){registerAddRecord(content),registerAddReletedRecord(content),registerSelectRecord(content),registerRemoveRecord(content),registerImportMail(content);var block=content.find('.ytHeader .js-data');content.find('.hideBtn').click(function(){var button=$(this),icon=button.find('.glyphicon');'0'==button.data('type')?(button.data('type','1'),icon.removeClass('glyphicon-chevron-up').addClass('glyphicon-chevron-down')):(button.data('type','0'),icon.removeClass('glyphicon-chevron-down').addClass('glyphicon-chevron-up')),block.toggle(),$(window).trigger('resize');});}function registerImportMail(content){content.find('.importMail').click(function(){window.crm.Vtiger_Helper_Js.showPnotify({text:window.crm.app.vtranslate('StartedDownloadingEmail'),type:'info'}),window.crm.AppConnector.request({module:'OSSMail',action:'ImportMail',uid:rcmail.env.uid,folder:rcmail.env.mailbox,rcId:rcmail.env.user_id}).done(function(){loadActionBar(),window.crm.Vtiger_Helper_Js.showPnotify({text:window.crm.app.vtranslate('AddFindEmailInRecord'),type:'success'});});});}function registerRemoveRecord(content){content.find('button.removeRecord').click(function(e){var row=$(e.currentTarget).closest('.rowRelatedRecord');removeRecord(row.data('id'));});}function registerSelectRecord(content){var id=content.find('#mailActionBarID').val();content.find('button.selectRecord').click(function(){var relParams={mailId:id};if(0==$(this).data('type')){var module=$(this).closest('.js-head-container').find('.module').val();if(null===module)return}else{var module=$(this).data('module');relParams.crmid=$(this).closest('.rowRelatedRecord').data('id'),relParams.mod=$(this).closest('.rowRelatedRecord').data('module'),relParams.newModule=module;}showPopup({module:module,src_module:'OSSMailView',src_record:id},relParams);});}function registerAddReletedRecord(content){content.find('#mailActionBarID').val();content.find('button.addRelatedRecord').click(function(e){var targetElement=$(e.currentTarget),row=targetElement.closest('.rowRelatedRecord'),params={sourceModule:row.data('module')};showQuickCreateForm(targetElement.data('module'),row.data('id'),params);});}function registerAddRecord(content){var id=content.find('#mailActionBarID').val();content.find('button.addRecord').click(function(e){var col=$(e.currentTarget).closest('.js-head-container'),selectValue=col.find('.module').val();if(null!==selectValue){var relatedRecords=[];content.find('.js-data').find('.rowRelatedRecord').each(function(i,record){var data=$(record).data();relatedRecords.push({module:data.module,id:data.id});}),showQuickCreateForm(selectValue,id,{relatedRecords:relatedRecords});}});}function removeRecord(crmid){var id=$('#mailActionBarID').val(),params={};params.data={module:'OSSMail',action:'ExecuteActions',mode:'removeRelated',params:{mailId:id,crmid:crmid}},params.async=!1,params.dataType='json',window.crm.AppConnector.request(params).done(function(data){var response=data.result,notifyParams={text:response.data,animation:'show'};response.success&&(notifyParams={text:response.data,type:'info',animation:'show'}),window.crm.Vtiger_Helper_Js.showPnotify(notifyParams),loadActionBar();});}function showPopup(params,actionsParams){actionsParams.newModule=params.module,window.crm.app.showRecordsList(params,function(modal,instance){instance.setSelectEvent(function(responseData){actionsParams.newCrmId=responseData.id,window.crm.AppConnector.request({async:!1,dataType:'json',data:{module:'OSSMail',action:'ExecuteActions',mode:'addRelated',params:actionsParams}}).done(function(data){var response=data.result;if(response.success)var notifyParams={text:response.data,type:'info',animation:'show'};else var notifyParams={text:response.data,animation:'show'};window.crm.Vtiger_Helper_Js.showPnotify(notifyParams),loadActionBar();});});});}function showQuickCreateForm(moduleName,record){var params=2').appendTo(data),$('').appendTo(data),$('').appendTo(data);},ids={link:'modulesLevel0',process:'modulesLevel1',subprocess:'modulesLevel2',subprocess_sl:'modulesLevel3',linkextend:'modulesLevel4'};for(var i in ids){var element=content.find('#'+ids[i]),value=element.length?JSON.parse(element.val()):[];0<=$.inArray(sourceModule,value)&&(relatedParams[i]=record);}'Leads'==moduleName&&(relatedParams.company=rcmail.env.fromName),('Leads'==moduleName||'Contacts'==moduleName)&&(relatedParams.lastname=rcmail.env.fromName),'Project'==moduleName&&(relatedParams.projectname=rcmail.env.subject),'HelpDesk'==moduleName&&(relatedParams.ticket_title=rcmail.env.subject),'Products'==moduleName&&(relatedParams.productname=rcmail.env.subject),'Services'==moduleName&&(relatedParams.servicename=rcmail.env.subject),relatedParams.email=rcmail.env.fromMail,relatedParams.email1=rcmail.env.fromMail;var messageBody=$('#messagebody').clone();messageBody.find('.image-attachment').remove(),relatedParams.description=messageBody.text(),params.relatedRecords!==void 0&&(relatedParams.relatedRecords=params.relatedRecords),relatedParams.sourceModule=sourceModule,relatedParams.sourceRecord=record,relatedParams.relationOperation=!0;var headerInstance=new window.crm.Vtiger_Header_Js;headerInstance.quickCreateModule(moduleName,{callbackFunction:function callbackFunction(){loadActionBar();},callbackPostShown:postShown,data:relatedParams,noCache:!0});}function getCrmWindow(){if(null!==opener&&'object'==opener.parent.CONFIG)return opener.parent;return 'object'==_typeof(parent.CONFIG)?parent:'object'==_typeof(parent.parent.CONFIG)?parent.parent:!('object'!=_typeof(opener.crm.CONFIG))&&opener.crm}
//# sourceMappingURL=preview.min.js.map
diff --git a/plugins/yetiforce/preview.min.js.map b/plugins/yetiforce/preview.min.js.map
index 28175f24..b7e3c10c 100644
--- a/plugins/yetiforce/preview.min.js.map
+++ b/plugins/yetiforce/preview.min.js.map
@@ -1 +1 @@
-{"version":3,"file":"preview.min.js","sources":["preview.js"],"sourcesContent":["/* {[The file is published on the basis of MIT License]} */\nwindow.rcmail && rcmail.addEventListener('init', function (evt) {\n\t\twindow.crm = getCrmWindow();\n\t\tloadActionBar();\n\t\trcmail.env.message_commands.push('yetiforce.importICS');\n\t\trcmail.register_command('yetiforce.importICS', function (part, type) {\n\t\t\tjQuery.ajax({\n\t\t\t\ttype: 'POST',\n\t\t\t\turl: \"./?_task=mail&_action=plugin.yetiforce.importIcs&_mbox=\" + urlencode(rcmail.env.mailbox) + '&_uid=' + urlencode(rcmail.env.uid) + '&_part=' + part + '&_type=' + type,\n\t\t\t\tasync: false,\n\t\t\t\tsuccess: function (data) {\n\t\t\t\t\tdata = JSON.parse(data);\n\t\t\t\t\twindow.crm.Vtiger_Helper_Js.showPnotify({\n\t\t\t\t\t\ttext: data['message'],\n\t\t\t\t\t\ttype: 'info',\n\t\t\t\t\t\tanimation: 'show'\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t});\n\t\t}, true);\n\t}\n);\n\nfunction loadActionBar() {\n\tvar content = $('#ytActionBarContent');\n\tvar params = {\n\t\tmodule: 'OSSMail',\n\t\tview: 'MailActionBar',\n\t\tuid: rcmail.env.uid,\n\t\tfolder: rcmail.env.mailbox,\n\t\trcId: rcmail.env.user_id\n\t};\n\twindow.crm.AppConnector.request(params).done(function (response) {\n\t\tcontent.find('.ytHeader').html(response);\n\t\t$('#messagecontent').css('top', (content.outerHeight() + $('#messageheader').outerHeight()) + 'px');\n\t\tregisterEvents(content);\n\t});\n}\n\nfunction registerEvents(content) {\n\tregisterAddRecord(content);\n\tregisterAddReletedRecord(content);\n\tregisterSelectRecord(content);\n\tregisterRemoveRecord(content);\n\tregisterImportMail(content);\n\n\tvar block = content.find('.ytHeader .js-data');\n\tcontent.find('.hideBtn').click(function () {\n\t\tvar button = $(this);\n\t\tvar icon = button.find('.glyphicon');\n\n\t\tif (button.data('type') == '0') {\n\t\t\tbutton.data('type', '1');\n\t\t\ticon.removeClass(\"glyphicon-chevron-up\").addClass(\"glyphicon-chevron-down\");\n\t\t} else {\n\t\t\tbutton.data('type', '0');\n\t\t\ticon.removeClass(\"glyphicon-chevron-down\").addClass(\"glyphicon-chevron-up\");\n\t\t}\n\t\tblock.toggle();\n\t\t$(window).trigger(\"resize\");\n\t});\n}\n\nfunction registerImportMail(content) {\n\tcontent.find('.importMail').click(function (e) {\n\t\twindow.crm.Vtiger_Helper_Js.showPnotify({\n\t\t\ttext: window.crm.app.vtranslate('StartedDownloadingEmail'),\n\t\t\ttype: 'info'\n\t\t});\n\t\twindow.crm.AppConnector.request({\n\t\t\tmodule: 'OSSMail',\n\t\t\taction: 'ImportMail',\n\t\t\tuid: rcmail.env.uid,\n\t\t\tfolder: rcmail.env.mailbox,\n\t\t\trcId: rcmail.env.user_id\n\t\t}).done(function (data) {\n\t\t\tloadActionBar();\n\t\t\twindow.crm.Vtiger_Helper_Js.showPnotify({\n\t\t\t\ttext: window.crm.app.vtranslate('AddFindEmailInRecord'),\n\t\t\t\ttype: 'success'\n\t\t\t});\n\t\t})\n\t});\n}\n\nfunction registerRemoveRecord(content) {\n\tcontent.find('button.removeRecord').click(function (e) {\n\t\tvar row = $(e.currentTarget).closest('.rowRelatedRecord');\n\t\tremoveRecord(row.data('id'));\n\t});\n}\n\nfunction registerSelectRecord(content) {\n\tlet id = content.find('#mailActionBarID').val();\n\tcontent.find('button.selectRecord').click(function (e) {\n\t\tlet relParams = {\n\t\t\tmailId: id\n\t\t};\n\t\tif ($(this).data('type') == 0) {\n\t\t\tvar module = $(this).closest('.js-head-container').find('.module').val();\n\t\t\tif (module === null) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t} else {\n\t\t\tvar module = $(this).data('module');\n\t\t\trelParams.crmid = $(this).closest('.rowRelatedRecord').data('id');\n\t\t\trelParams.mod = $(this).closest('.rowRelatedRecord').data('module');\n\t\t\trelParams.newModule = module;\n\t\t}\n\t\tshowPopup({\n\t\t\tmodule: module,\n\t\t\tsrc_module: 'OSSMailView',\n\t\t\tsrc_record: id,\n\t\t}, relParams);\n\t});\n}\n\nfunction registerAddReletedRecord(content) {\n\tvar id = content.find('#mailActionBarID').val();\n\tcontent.find('button.addRelatedRecord').click(function (e) {\n\t\tvar targetElement = $(e.currentTarget);\n\t\tvar row = targetElement.closest('.rowRelatedRecord');\n\t\tvar params = {sourceModule: row.data('module')};\n\t\tshowQuickCreateForm(targetElement.data('module'), row.data('id'), params);\n\t});\n}\n\nfunction registerAddRecord(content) {\n\tvar id = content.find('#mailActionBarID').val();\n\tcontent.find('button.addRecord').click(function (e) {\n\t\tvar col = $(e.currentTarget).closest('.js-head-container');\n\t\tlet selectValue = col.find('.module').val();\n\t\tif (selectValue !== null) {\n\t\t\tshowQuickCreateForm(selectValue, id);\n\t\t}\n\t});\n}\n\nfunction removeRecord(crmid) {\n\tvar id = $('#mailActionBarID').val();\n\tvar params = {}\n\tparams.data = {\n\t\tmodule: 'OSSMail',\n\t\taction: 'ExecuteActions',\n\t\tmode: 'removeRelated',\n\t\tparams: {\n\t\t\tmailId: id,\n\t\t\tcrmid: crmid\n\t\t}\n\t}\n\tparams.async = false;\n\tparams.dataType = 'json';\n\twindow.crm.AppConnector.request(params).done(function (data) {\n\t\tvar response = data['result'];\n\t\tif (response['success']) {\n\t\t\tvar notifyParams = {\n\t\t\t\ttext: response['data'],\n\t\t\t\ttype: 'info',\n\t\t\t\tanimation: 'show'\n\t\t\t};\n\t\t} else {\n\t\t\tvar notifyParams = {\n\t\t\t\ttext: response['data'],\n\t\t\t\tanimation: 'show'\n\t\t\t};\n\t\t}\n\t\twindow.crm.Vtiger_Helper_Js.showPnotify(notifyParams);\n\t\tloadActionBar();\n\t});\n}\n\nfunction showPopup(params, actionsParams) {\n\tactionsParams['newModule'] = params['module'];\n\twindow.crm.app.showRecordsList(params, (modal, instance) => {\n\t\tinstance.setSelectEvent((responseData, e) => {\n\t\t\tactionsParams['newCrmId'] = responseData.id;\n\t\t\twindow.crm.AppConnector.request({\n\t\t\t\tasync: false,\n\t\t\t\tdataType: 'json',\n\t\t\t\tdata: {\n\t\t\t\t\tmodule: 'OSSMail',\n\t\t\t\t\taction: 'ExecuteActions',\n\t\t\t\t\tmode: 'addRelated',\n\t\t\t\t\tparams: actionsParams\n\t\t\t\t}\n\t\t\t}).done(function (data) {\n\t\t\t\tlet response = data['result'];\n\t\t\t\tif (response['success']) {\n\t\t\t\t\tvar notifyParams = {\n\t\t\t\t\t\ttext: response['data'],\n\t\t\t\t\t\ttype: 'info',\n\t\t\t\t\t\tanimation: 'show'\n\t\t\t\t\t};\n\t\t\t\t} else {\n\t\t\t\t\tvar notifyParams = {\n\t\t\t\t\t\ttext: response['data'],\n\t\t\t\t\t\tanimation: 'show'\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\twindow.crm.Vtiger_Helper_Js.showPnotify(notifyParams);\n\t\t\t\tloadActionBar();\n\t\t\t});\n\t\t});\n\t});\n}\n\nfunction showQuickCreateForm(moduleName, record, params) {\n\tvar content = $('#ytActionBarContent');\n\tif (params == undefined) {\n\t\tvar params = {};\n\t}\n\tvar relatedParams = {};\n\tif (params['sourceModule']) {\n\t\tvar sourceModule = params['sourceModule'];\n\t} else {\n\t\tvar sourceModule = 'OSSMailView';\n\t}\n\tvar postShown = function (data) {\n\t\tvar index, queryParam, queryParamComponents;\n\t\t$('').appendTo(data);\n\t\t$('').appendTo(data);\n\t\t$('').appendTo(data);\n\t}\n\tvar ids = {\n\t\tlink: 'modulesLevel0',\n\t\tprocess: 'modulesLevel1',\n\t\tsubprocess: 'modulesLevel2',\n\t\tlinkextend: 'modulesLevel3'\n\t};\n\tfor (var i in ids) {\n\t\tvar element = content.find('#' + ids[i]);\n\t\tvar value = element.length ? JSON.parse(element.val()) : [];\n\t\tif ($.inArray(sourceModule, value) >= 0) {\n\t\t\trelatedParams[i] = record;\n\t\t}\n\t}\n\tif (moduleName == 'Leads') {\n\t\trelatedParams['company'] = rcmail.env.fromName;\n\t}\n\tif (moduleName == 'Leads' || moduleName == 'Contacts') {\n\t\trelatedParams['lastname'] = rcmail.env.fromName;\n\t}\n\tif (moduleName == 'Project') {\n\t\trelatedParams['projectname'] = rcmail.env.subject;\n\t}\n\tif (moduleName == 'HelpDesk') {\n\t\trelatedParams['ticket_title'] = rcmail.env.subject;\n\t}\n\tif (moduleName == 'Products') {\n\t\trelatedParams['productname'] = rcmail.env.subject;\n\t}\n\tif (moduleName == 'Services') {\n\t\trelatedParams['servicename'] = rcmail.env.subject;\n\t}\n\trelatedParams['email'] = rcmail.env.fromMail;\n\trelatedParams['email1'] = rcmail.env.fromMail;\n\trelatedParams['description'] = $('#messagebody').text();\n\t//relatedParams['related_to'] = record;\n\tvar postQuickCreate = function (data) {\n\t\tloadActionBar();\n\t}\n\trelatedParams['sourceModule'] = sourceModule;\n\trelatedParams['sourceRecord'] = record;\n\trelatedParams['relationOperation'] = true;\n\tvar quickCreateParams = {\n\t\tcallbackFunction: postQuickCreate,\n\t\tcallbackPostShown: postShown,\n\t\tdata: relatedParams,\n\t\tnoCache: true\n\t};\n\tvar headerInstance = new window.crm.Vtiger_Header_Js();\n\theaderInstance.quickCreateModule(moduleName, quickCreateParams);\n}\n\nfunction getCrmWindow() {\n\tif (opener !== null && opener.parent.CONFIG == \"object\") {\n\t\treturn opener.parent;\n\t} else if (typeof parent.CONFIG == \"object\") {\n\t\treturn parent;\n\t} else if (typeof parent.parent.CONFIG == \"object\") {\n\t\treturn parent.parent;\n\t} else if (typeof opener.crm.CONFIG == \"object\") {\n\t\treturn opener.crm;\n\t}\n\treturn false;\n}\n"],"names":["window","rcmail","addEventListener","crm","getCrmWindow","loadActionBar","env","message_commands","push","register_command","part","type","jQuery","ajax","url","urlencode","mailbox","uid","async","success","data","JSON","parse","Vtiger_Helper_Js","showPnotify","text","animation","$","params","module","view","folder","rcId","user_id","AppConnector","request","done","response","content","find","html","css","outerHeight","registerEvents","registerAddRecord","registerAddReletedRecord","registerSelectRecord","registerRemoveRecord","registerImportMail","click","icon","button","removeClass","addClass","block","toggle","trigger","app","vtranslate","action","e","currentTarget","closest","removeRecord","row","val","mailId","id","relParams","crmid","mod","newModule","showPopup","src_module","src_record","targetElement","sourceModule","showQuickCreateForm","selectValue","col","mode","dataType","notifyParams","actionsParams","showRecordsList","modal","instance","setSelectEvent","responseData","moduleName","record","appendTo","ids","link","process","subprocess","linkextend","i","value","element","length","inArray","relatedParams","fromName","subject","fromMail","Vtiger_Header_Js","headerInstance","quickCreateModule","callbackFunction","callbackPostShown","postShown","noCache","parent","CONFIG","opener"],"mappings":";;;;;;;;AACAA,OAAOC,MAAP,EAAiBA,OAAOC,gBAAP,CAAwB,MAAxB,CAAgC,UAAe,CAC9DF,OAAOG,GAAP,CAAaC,cADiD,CAE9DC,eAF8D,CAG9DJ,OAAOK,GAAP,CAAWC,gBAAX,CAA4BC,IAA5B,CAAiC,qBAAjC,CAH8D,CAI9DP,OAAOQ,gBAAP,CAAwB,qBAAxB,CAA+C,SAAUC,IAAV,CAAgBC,IAAhB,CAAsB,CACpEC,OAAOC,IAAP,CAAY,CACXF,KAAM,MADK,CAEXG,IAAK,0DAA4DC,UAAUd,OAAOK,GAAP,CAAWU,OAArB,CAA5D,CAA4F,QAA5F,CAAuGD,UAAUd,OAAOK,GAAP,CAAWW,GAArB,CAAvG,CAAmI,SAAnI,CAA+IP,IAA/I,CAAsJ,SAAtJ,CAAkKC,IAF5J,CAGXO,QAHW,CAIXC,QAAS,iBAAUC,IAAV,CAAgB,CACxBA,KAAOC,KAAKC,KAAL,CAAWF,IAAX,CADiB,CAExBpB,OAAOG,GAAP,CAAWoB,gBAAX,CAA4BC,WAA5B,CAAwC,CACvCC,KAAML,YADiC,CAEvCT,KAAM,MAFiC,CAGvCe,UAAW,MAH4B,CAAxC,EAKA,CAXU,CAAZ,EAaA,CAdD,KAeA,CAnBe,EAsBjB,sBAAA,EAAyB,aACVC,EAAE,qBAAF,CADU,CAEpBC,OAAS,CACZC,OAAQ,SADI,CAEZC,KAAM,eAFM,CAGZb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,CACC,cAAcD,MAAd,CAFsB,OAGY,QAAxB,UAAOA,OAAOC,MAAd,CAHY,CAIfD,MAJe,CAKmB,QAA/B,UAAOA,OAAOA,MAAP,CAAcC,MAArB,CALY,CAMfD,OAAOA,MANQ,GAOgB,QAA5B,UAAOE,OAAOhH,GAAP,CAAW+G,MAAlB,CAPY,GAQfC,OAAOhH,GAGf"}
\ No newline at end of file
+{"version":3,"file":"preview.min.js","sources":["preview.js"],"sourcesContent":["/* {[The file is published on the basis of MIT License]} */\nwindow.rcmail && rcmail.addEventListener('init', function (evt) {\n\t\twindow.crm = getCrmWindow();\n\t\tloadActionBar();\n\t\trcmail.env.message_commands.push('yetiforce.importICS');\n\t\trcmail.register_command('yetiforce.importICS', function (part, type) {\n\t\t\tjQuery.ajax({\n\t\t\t\ttype: 'POST',\n\t\t\t\turl: \"./?_task=mail&_action=plugin.yetiforce.importIcs&_mbox=\" + urlencode(rcmail.env.mailbox) + '&_uid=' + urlencode(rcmail.env.uid) + '&_part=' + part + '&_type=' + type,\n\t\t\t\tasync: false,\n\t\t\t\tsuccess: function (data) {\n\t\t\t\t\tdata = JSON.parse(data);\n\t\t\t\t\twindow.crm.Vtiger_Helper_Js.showPnotify({\n\t\t\t\t\t\ttext: data['message'],\n\t\t\t\t\t\ttype: 'info',\n\t\t\t\t\t\tanimation: 'show'\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t});\n\t\t}, true);\n\t}\n);\n\nfunction loadActionBar() {\n\tvar content = $('#ytActionBarContent');\n\tvar params = {\n\t\tmodule: 'OSSMail',\n\t\tview: 'MailActionBar',\n\t\tuid: rcmail.env.uid,\n\t\tfolder: rcmail.env.mailbox,\n\t\trcId: rcmail.env.user_id\n\t};\n\twindow.crm.AppConnector.request(params).done(function (response) {\n\t\tcontent.find('.ytHeader').html(response);\n\t\t$('#messagecontent').css('top', (content.outerHeight() + $('#messageheader').outerHeight()) + 'px');\n\t\tregisterEvents(content);\n\t});\n}\n\nfunction registerEvents(content) {\n\tregisterAddRecord(content);\n\tregisterAddReletedRecord(content);\n\tregisterSelectRecord(content);\n\tregisterRemoveRecord(content);\n\tregisterImportMail(content);\n\n\tvar block = content.find('.ytHeader .js-data');\n\tcontent.find('.hideBtn').click(function () {\n\t\tvar button = $(this);\n\t\tvar icon = button.find('.glyphicon');\n\n\t\tif (button.data('type') == '0') {\n\t\t\tbutton.data('type', '1');\n\t\t\ticon.removeClass(\"glyphicon-chevron-up\").addClass(\"glyphicon-chevron-down\");\n\t\t} else {\n\t\t\tbutton.data('type', '0');\n\t\t\ticon.removeClass(\"glyphicon-chevron-down\").addClass(\"glyphicon-chevron-up\");\n\t\t}\n\t\tblock.toggle();\n\t\t$(window).trigger(\"resize\");\n\t});\n}\n\nfunction registerImportMail(content) {\n\tcontent.find('.importMail').click(function (e) {\n\t\twindow.crm.Vtiger_Helper_Js.showPnotify({\n\t\t\ttext: window.crm.app.vtranslate('StartedDownloadingEmail'),\n\t\t\ttype: 'info'\n\t\t});\n\t\twindow.crm.AppConnector.request({\n\t\t\tmodule: 'OSSMail',\n\t\t\taction: 'ImportMail',\n\t\t\tuid: rcmail.env.uid,\n\t\t\tfolder: rcmail.env.mailbox,\n\t\t\trcId: rcmail.env.user_id\n\t\t}).done(function (data) {\n\t\t\tloadActionBar();\n\t\t\twindow.crm.Vtiger_Helper_Js.showPnotify({\n\t\t\t\ttext: window.crm.app.vtranslate('AddFindEmailInRecord'),\n\t\t\t\ttype: 'success'\n\t\t\t});\n\t\t})\n\t});\n}\n\nfunction registerRemoveRecord(content) {\n\tcontent.find('button.removeRecord').click(function (e) {\n\t\tvar row = $(e.currentTarget).closest('.rowRelatedRecord');\n\t\tremoveRecord(row.data('id'));\n\t});\n}\n\nfunction registerSelectRecord(content) {\n\tlet id = content.find('#mailActionBarID').val();\n\tcontent.find('button.selectRecord').click(function (e) {\n\t\tlet relParams = {\n\t\t\tmailId: id\n\t\t};\n\t\tif ($(this).data('type') == 0) {\n\t\t\tvar module = $(this).closest('.js-head-container').find('.module').val();\n\t\t\tif (module === null) {\n\t\t\t\treturn;\n\t\t\t}\n\t\t} else {\n\t\t\tvar module = $(this).data('module');\n\t\t\trelParams.crmid = $(this).closest('.rowRelatedRecord').data('id');\n\t\t\trelParams.mod = $(this).closest('.rowRelatedRecord').data('module');\n\t\t\trelParams.newModule = module;\n\t\t}\n\t\tshowPopup({\n\t\t\tmodule: module,\n\t\t\tsrc_module: 'OSSMailView',\n\t\t\tsrc_record: id,\n\t\t}, relParams);\n\t});\n}\n\nfunction registerAddReletedRecord(content) {\n\tvar id = content.find('#mailActionBarID').val();\n\tcontent.find('button.addRelatedRecord').click(function (e) {\n\t\tvar targetElement = $(e.currentTarget);\n\t\tvar row = targetElement.closest('.rowRelatedRecord');\n\t\tvar params = {sourceModule: row.data('module')};\n\t\tshowQuickCreateForm(targetElement.data('module'), row.data('id'), params);\n\t});\n}\n\nfunction registerAddRecord(content) {\n\tvar id = content.find('#mailActionBarID').val();\n\tcontent.find('button.addRecord').click(function (e) {\n\t\tvar col = $(e.currentTarget).closest('.js-head-container');\n\t\tlet selectValue = col.find('.module').val();\n\t\tif (selectValue !== null) {\n\t\t\tlet relatedRecords = []\n\t\t\tcontent.find('.js-data').find('.rowRelatedRecord').each((i, record) => {\n\t\t\t\tlet data = $(record).data()\n\t\t\t\trelatedRecords.push({module: data.module, id: data.id})\n\t\t\t})\n\t\t\tshowQuickCreateForm(selectValue, id, {relatedRecords: relatedRecords});\n\t\t}\n\t});\n}\n\nfunction removeRecord(crmid) {\n\tconst id = $('#mailActionBarID').val();\n\tlet params = {}\n\tparams.data = {\n\t\tmodule: 'OSSMail',\n\t\taction: 'ExecuteActions',\n\t\tmode: 'removeRelated',\n\t\tparams: {\n\t\t\tmailId: id,\n\t\t\tcrmid: crmid\n\t\t}\n\t}\n\tparams.async = false;\n\tparams.dataType = 'json';\n\twindow.crm.AppConnector.request(params).done(function (data) {\n\t\tconst response = data['result'];\n\t\tlet notifyParams = {\n\t\t\ttext: response['data'],\n\t\t\tanimation: 'show'\n\t\t};\n\t\tif (response['success']) {\n\t\t\tnotifyParams = {\n\t\t\t\ttext: response['data'],\n\t\t\t\ttype: 'info',\n\t\t\t\tanimation: 'show'\n\t\t\t};\n\t\t}\n\t\twindow.crm.Vtiger_Helper_Js.showPnotify(notifyParams);\n\t\tloadActionBar();\n\t});\n}\n\nfunction showPopup(params, actionsParams) {\n\tactionsParams['newModule'] = params['module'];\n\twindow.crm.app.showRecordsList(params, (modal, instance) => {\n\t\tinstance.setSelectEvent((responseData, e) => {\n\t\t\tactionsParams['newCrmId'] = responseData.id;\n\t\t\twindow.crm.AppConnector.request({\n\t\t\t\tasync: false,\n\t\t\t\tdataType: 'json',\n\t\t\t\tdata: {\n\t\t\t\t\tmodule: 'OSSMail',\n\t\t\t\t\taction: 'ExecuteActions',\n\t\t\t\t\tmode: 'addRelated',\n\t\t\t\t\tparams: actionsParams\n\t\t\t\t}\n\t\t\t}).done(function (data) {\n\t\t\t\tlet response = data['result'];\n\t\t\t\tif (response['success']) {\n\t\t\t\t\tvar notifyParams = {\n\t\t\t\t\t\ttext: response['data'],\n\t\t\t\t\t\ttype: 'info',\n\t\t\t\t\t\tanimation: 'show'\n\t\t\t\t\t};\n\t\t\t\t} else {\n\t\t\t\t\tvar notifyParams = {\n\t\t\t\t\t\ttext: response['data'],\n\t\t\t\t\t\tanimation: 'show'\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t\twindow.crm.Vtiger_Helper_Js.showPnotify(notifyParams);\n\t\t\t\tloadActionBar();\n\t\t\t});\n\t\t});\n\t});\n}\n\nfunction showQuickCreateForm(moduleName, record, params = {}) {\n\tconst content = $('#ytActionBarContent');\n\tlet relatedParams = {},\n\t\tsourceModule = 'OSSMailView';\n\tif (params['sourceModule']) {\n\t\tsourceModule = params['sourceModule'];\n\t}\n\tconst postShown = function (data) {\n\t\tvar index, queryParam, queryParamComponents;\n\t\t$('').appendTo(data);\n\t\t$('').appendTo(data);\n\t\t$('').appendTo(data);\n\t}\n\tconst postQuickCreate = function (data) {\n\t\tloadActionBar();\n\t}\n\tconst ids = {\n\t\tlink: 'modulesLevel0',\n\t\tprocess: 'modulesLevel1',\n\t\tsubprocess: 'modulesLevel2',\n\t\tsubprocess_sl: 'modulesLevel3',\n\t\tlinkextend: 'modulesLevel4'\n\t};\n\tfor (var i in ids) {\n\t\tvar element = content.find('#' + ids[i]);\n\t\tvar value = element.length ? JSON.parse(element.val()) : [];\n\t\tif ($.inArray(sourceModule, value) >= 0) {\n\t\t\trelatedParams[i] = record;\n\t\t}\n\t}\n\tif (moduleName == 'Leads') {\n\t\trelatedParams['company'] = rcmail.env.fromName;\n\t}\n\tif (moduleName == 'Leads' || moduleName == 'Contacts') {\n\t\trelatedParams['lastname'] = rcmail.env.fromName;\n\t}\n\tif (moduleName == 'Project') {\n\t\trelatedParams['projectname'] = rcmail.env.subject;\n\t}\n\tif (moduleName == 'HelpDesk') {\n\t\trelatedParams['ticket_title'] = rcmail.env.subject;\n\t}\n\tif (moduleName == 'Products') {\n\t\trelatedParams['productname'] = rcmail.env.subject;\n\t}\n\tif (moduleName == 'Services') {\n\t\trelatedParams['servicename'] = rcmail.env.subject;\n\t}\n\trelatedParams['email'] = rcmail.env.fromMail;\n\trelatedParams['email1'] = rcmail.env.fromMail;\n\tlet messageBody = $('#messagebody').clone()\n\tmessageBody.find('.image-attachment').remove()\n\trelatedParams['description'] = messageBody.text()\n\t//relatedParams['related_to'] = record;\n\tif (params.relatedRecords !== undefined) {\n\t\trelatedParams['relatedRecords'] = params.relatedRecords;\n\t}\n\trelatedParams['sourceModule'] = sourceModule;\n\trelatedParams['sourceRecord'] = record;\n\trelatedParams['relationOperation'] = true;\n\tconst quickCreateParams = {\n\t\tcallbackFunction: (data) => {\n\t\t\tloadActionBar();\n\t\t},\n\t\tcallbackPostShown: postShown,\n\t\tdata: relatedParams,\n\t\tnoCache: true\n\t};\n\tconst headerInstance = new window.crm.Vtiger_Header_Js();\n\theaderInstance.quickCreateModule(moduleName, quickCreateParams);\n}\n\nfunction getCrmWindow() {\n\tif (opener !== null && opener.parent.CONFIG == \"object\") {\n\t\treturn opener.parent;\n\t} else if (typeof parent.CONFIG == \"object\") {\n\t\treturn parent;\n\t} else if (typeof parent.parent.CONFIG == \"object\") {\n\t\treturn parent.parent;\n\t} else if (typeof opener.crm.CONFIG == \"object\") {\n\t\treturn opener.crm;\n\t}\n\treturn false;\n}\n"],"names":["window","rcmail","addEventListener","crm","getCrmWindow","loadActionBar","env","message_commands","push","register_command","part","type","jQuery","ajax","url","urlencode","mailbox","uid","async","success","data","JSON","parse","Vtiger_Helper_Js","showPnotify","text","animation","$","params","module","view","folder","rcId","user_id","AppConnector","request","done","response","content","find","html","css","outerHeight","registerEvents","registerAddRecord","registerAddReletedRecord","registerSelectRecord","registerRemoveRecord","registerImportMail","click","icon","button","removeClass","addClass","block","toggle","trigger","app","vtranslate","action","e","currentTarget","closest","removeRecord","row","val","mailId","id","relParams","crmid","mod","newModule","showPopup","src_module","src_record","targetElement","sourceModule","showQuickCreateForm","selectValue","col","each","i","record","relatedRecords","mode","dataType","notifyParams","actionsParams","showRecordsList","modal","instance","setSelectEvent","responseData","moduleName","relatedParams","appendTo","ids","link","process","subprocess","subprocess_sl","linkextend","value","element","length","inArray","fromName","subject","fromMail","clone","messageBody","remove","Vtiger_Header_Js","headerInstance","quickCreateModule","callbackFunction","callbackPostShown","postShown","noCache","parent","CONFIG","opener"],"mappings":";;;;;;;;AACAA,OAAOC,MAAP,EAAiBA,OAAOC,gBAAP,CAAwB,MAAxB,CAAgC,UAAe,CAC9DF,OAAOG,GAAP,CAAaC,cADiD,CAE9DC,eAF8D,CAG9DJ,OAAOK,GAAP,CAAWC,gBAAX,CAA4BC,IAA5B,CAAiC,qBAAjC,CAH8D,CAI9DP,OAAOQ,gBAAP,CAAwB,qBAAxB,CAA+C,SAAUC,IAAV,CAAgBC,IAAhB,CAAsB,CACpEC,OAAOC,IAAP,CAAY,CACXF,KAAM,MADK,C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,CAAcC,MAArB,CALY,CAMfD,OAAOA,MANQ,GAOgB,QAA5B,UAAOE,OAAOtH,GAAP,CAAWqH,MAAlB,CAPY,GAQfC,OAAOtH,GAGf"}
\ No newline at end of file
diff --git a/plugins/yetiforce/yetiforce.php b/plugins/yetiforce/yetiforce.php
index d8fa53ec..f43f0548 100644
--- a/plugins/yetiforce/yetiforce.php
+++ b/plugins/yetiforce/yetiforce.php
@@ -5,6 +5,7 @@
*
* @license MIT
* @author Mariusz Krzaczkowski
+ * @author Radosław Skrzypczak
*/
class yetiforce extends rcube_plugin
{
@@ -27,10 +28,10 @@ public function init()
$this->add_hook('login_after', [$this, 'loginAfter']);
$this->add_hook('startup', [$this, 'startup']);
$this->add_hook('authenticate', [$this, 'authenticate']);
- if ($this->rc->task == 'mail') {
+ if ('mail' == $this->rc->task) {
$this->register_action('plugin.yetiforce.addFilesToMail', [$this, 'addFilesToMail']);
$this->register_action('plugin.yetiforce.getEmailTemplates', [$this, 'getEmailTemplates']);
- $this->register_action('plugin.yetiforce.getConntentEmailTemplate', [$this, 'getConntentEmailTemplate']);
+ $this->register_action('plugin.yetiforce.getContentEmailTemplate', [$this, 'getContentEmailTemplate']);
$this->register_action('plugin.yetiforce.importIcs', [$this, 'importIcs']);
$this->rc->output->set_env('site_URL', $this->rc->config->get('site_URL'));
$this->include_stylesheet('../../../../../layouts/resources/icons/userIcon.css');
@@ -40,7 +41,7 @@ public function init()
chdir($this->rc->config->get('root_directory'));
$this->loadCurrentUser();
- if ($this->rc->action === 'compose') {
+ if ('compose' === $this->rc->action) {
$composeAddressModules = [];
foreach (\App\Config::component('Mail', 'RC_COMPOSE_ADDRESS_MODULES') as $moduleName) {
if (\App\Privilege::isPermitted($moduleName)) {
@@ -68,7 +69,7 @@ public function init()
$this->rc->output->set_env('crmView', $_SESSION['compose_data_' . $id]['param']['crmview']);
}
}
- if ($this->rc->action === 'preview' || $this->rc->action === 'show') {
+ if ('preview' === $this->rc->action || 'show' === $this->rc->action) {
$this->include_script('preview.js');
$this->include_stylesheet('../../../../../libraries/@fortawesome/fontawesome-free/css/all.css');
$this->include_stylesheet('preview.css');
@@ -112,7 +113,7 @@ public function authenticate($args)
if ($row = $this->getAutoLogin()) {
$host = false;
foreach ($this->rc->config->get('default_host') as $key => $value) {
- if (strpos($key, $row['mail_host']) !== false) {
+ if (false !== strpos($key, $row['mail_host'])) {
$host = $key;
}
}
@@ -145,7 +146,7 @@ public function loginAfter($args)
require_once 'include/main/WebUI.php';
$pass = \App\Encryption::getInstance()->encrypt($pass);
chdir($currentPath);
- call_user_func_array([$this->rc->db, 'query'], array_merge([$sql], [$pass, $this->rc->get_user_id()]));
+ \call_user_func_array([$this->rc->db, 'query'], array_merge([$sql], [$pass, $this->rc->get_user_id()]));
$this->rc->db->affected_rows();
}
if ($_GET['_autologin'] && !empty($_REQUEST['_composeKey'])) {
@@ -182,7 +183,7 @@ public function messageLoad($args)
$from = $args['object']->headers->from;
$from = explode('<', rtrim($from, '>'), 2);
$fromName = '';
- if (count($from) > 1) {
+ if (\count($from) > 1) {
$fromName = $from[0];
$fromMail = $from[1];
} else {
@@ -209,9 +210,9 @@ public function messageComposeHead($args)
foreach ($params as $key => &$value) {
$args['param'][$key] = $value;
}
- if ((isset($params['crmmodule']) && $params['crmmodule'] == 'Documents') || (isset($params['filePath']) && $params['filePath'])) {
+ if ((isset($params['crmmodule']) && 'Documents' == $params['crmmodule']) || (isset($params['filePath']) && $params['filePath'])) {
$userid = $this->rc->user->ID;
- list($usec, $sec) = explode(' ', microtime());
+ [$usec, $sec] = explode(' ', microtime());
$dId = preg_replace('/[^0-9]/', '', $userid . $sec . $usec);
foreach (self::getAttachment($params['crmrecord'], $params['filePath']) as $index => $attachment) {
$attachment['group'] = $COMPOSE_ID;
@@ -258,7 +259,7 @@ public function messageComposeHead($args)
$subjectNumber = \App\Fields\Email::findRecordNumber($subject, $params['crmmodule']);
$recordNumber = \App\Fields\Email::findRecordNumber("[{$params['recordNumber']}]", $params['crmmodule']);
- if ($subject === false || ($subject !== false && $subjectNumber !== $recordNumber)) {
+ if (false === $subject || (false !== $subject && $subjectNumber !== $recordNumber)) {
$subject = "[{$params['recordNumber']}] $subject";
}
chdir($currentPath);
@@ -289,7 +290,7 @@ public function messageComposeBody($args)
$replyto = $row['reply_to_email'];
$prefix = $suffix = '';
- if ($type === 'forward') {
+ if ('forward' === $type) {
if (!$bodyIsHtml) {
$prefix = "\n\n\n-------- " . $this->rc->gettext('originalmessage') . " --------\n";
$prefix .= $this->rc->gettext('subject') . ': ' . $subject . "\n";
@@ -376,7 +377,7 @@ public function loadSignature($response)
$signatures[$identityId]['text'] = $signature['text'] . PHP_EOL . $gS['text'];
$signatures[$identityId]['html'] = $signature['html'] . '' . $gS['html'] . '
';
}
- if (count($MESSAGE->identities)) {
+ if (\count($MESSAGE->identities)) {
foreach ($MESSAGE->identities as &$identity) {
$identityId = $identity['identity_id'];
if (!isset($signatures[$identityId])) {
@@ -412,7 +413,7 @@ public function checkAddSignature()
$db = $RCMAIL->get_dbh();
$sqlResult = $db->query("SELECT * FROM yetiforce_mail_config WHERE `type` = 'signature' AND `name` = 'addSignature';");
while ($sql_arr = $db->fetch_assoc($sqlResult)) {
- return $sql_arr['value'] == 'false' ? true : false;
+ return 'false' == $sql_arr['value'] ? true : false;
}
return true;
}
@@ -434,13 +435,13 @@ public function addFilesToMail()
}
$this->rc = rcmail::get_instance();
$index = 0;
-
+ $htmlAttachments = '';
$attachments = $this->getAttachment($ids, false);
foreach ($attachments as $attachment) {
- $index++;
+ ++$index;
$attachment['group'] = $COMPOSE_ID;
$userid = rcmail::get_instance()->user->ID;
- list($usec, $sec) = explode(' ', microtime());
+ [$usec, $sec] = explode(' ', microtime());
$id = preg_replace('/[^0-9]/', '', $userid . $sec . $usec) . $index;
$attachment['id'] = $id;
$_SESSION['plugins']['filesystem_attachments'][$COMPOSE_ID][$id] = realpath($attachment['path']);
@@ -470,9 +471,9 @@ public function addFilesToMail()
'class' => 'delete',
'aria-label' => $this->rc->gettext('delete') . ' ' . $attachment['name'],
], $button);
- $content = $COMPOSE['icon_pos'] == 'left' ? $delete_link . $content_link : $content_link . $delete_link;
+ $content = 'left' == $COMPOSE['icon_pos'] ? $delete_link . $content_link : $content_link . $delete_link;
- $htmlAttachments = 'window.rcmail.add2attachment_list("rcmfile' . $id . '",{html:"' . rcube::JQ($content) . '",name:"' . $attachment['name'] . '",mimetype:"' . $attachment['mimetype'] . '",classname:"' . rcube_utils::file2class($attachment['mimetype'], $attachment['name']) . '",complete:true},"' . $uploadid . '");' . PHP_EOL;
+ $htmlAttachments .= 'window.rcmail.add2attachment_list("rcmfile' . $id . '",{html:"' . rcube::JQ($content) . '",name:"' . $attachment['name'] . '",mimetype:"' . $attachment['mimetype'] . '",classname:"' . rcube_utils::file2class($attachment['mimetype'], $attachment['name']) . '",complete:true},"' . $uploadid . '");' . PHP_EOL;
}
echo '
@@ -497,7 +498,7 @@ public function getAttachment($ids, $files)
if (empty($ids) && empty($files)) {
return $attachments;
}
- if (is_array($ids)) {
+ if (\is_array($ids)) {
$ids = implode(',', $ids);
}
$this->rc = rcmail::get_instance();
@@ -508,7 +509,7 @@ public function getAttachment($ids, $files)
$sql_result = $db->query("SELECT vtiger_attachments.* FROM vtiger_attachments INNER JOIN vtiger_seattachmentsrel ON vtiger_seattachmentsrel.attachmentsid=vtiger_attachments.attachmentsid WHERE vtiger_seattachmentsrel.crmid IN ($ids);");
while ($row = $db->fetch_assoc($sql_result)) {
$orgFile = $this->rc->config->get('root_directory') . $row['path'] . $row['attachmentsid'];
- list($usec, $sec) = explode(' ', microtime());
+ [$usec, $sec] = explode(' ', microtime());
$filepath = $this->rc->config->get('temp_dir') . DIRECTORY_SEPARATOR . "{$sec}_{$userid}_{$row['attachmentsid']}_$index.tmp";
if (file_exists($orgFile)) {
copy($orgFile, $filepath);
@@ -520,24 +521,34 @@ public function getAttachment($ids, $files)
];
$attachments[] = $attachment;
}
- $index++;
+ ++$index;
}
}
if ($files) {
- $orgFile = $this->rc->config->get('root_directory') . $files;
- list($usec, $sec) = explode(' ', microtime());
- $filepath = $this->rc->config->get('root_directory') . "cache/mail/{$sec}_{$userid}_{$index}.tmp";
- if (file_exists($orgFile)) {
- copy($orgFile, $filepath);
- $attachment = [
- 'path' => $filepath,
- 'size' => filesize($filepath),
- 'name' => basename($orgFile),
- 'mimetype' => rcube_mime::file_content_type($filepath, basename($orgFile)),
- ];
- $attachments[] = $attachment;
- }
- $index++;
+ if (!\is_array($files)) {
+ $files = [$files];
+ }
+ foreach ($files as $file) {
+ $orgFileName = $file['name'] ?? basename($file);
+ $orgFilePath = $file['path'] ?? $file;
+ $orgFile = $this->rc->config->get('root_directory') . $orgFilePath;
+ [$usec, $sec] = explode(' ', microtime());
+ $filepath = $this->rc->config->get('temp_dir') . DIRECTORY_SEPARATOR . "{$sec}_{$userid}_{$index}.tmp";
+ if (file_exists($orgFile)) {
+ copy($orgFile, $filepath);
+ $attachment = [
+ 'path' => $filepath,
+ 'size' => filesize($filepath),
+ 'name' => $orgFileName,
+ 'mimetype' => rcube_mime::file_content_type($filepath, $orgFileName),
+ ];
+ if (0 === strpos($orgFilePath, 'cache')) {
+ unlink($orgFile);
+ }
+ $attachments[] = $attachment;
+ }
+ ++$index;
+ }
}
return $attachments;
}
@@ -550,13 +561,13 @@ public function rcmailWrapAndQuote($text, $length = 72)
$out = '';
foreach ($lines as $line) {
// don't wrap already quoted lines
- if ($line[0] == '>') {
+ if ('>' == $line[0]) {
$line = '>' . rtrim($line);
} elseif (mb_strlen($line) > $max) {
$newline = '';
foreach (explode("\n", rcube_mime::wordwrap($line, $length - 2)) as $l) {
- if (strlen($l)) {
+ if (\strlen($l)) {
$newline .= '> ' . $l . "\n";
} else {
$newline .= ">\n";
@@ -644,7 +655,11 @@ public function getEmailTemplates()
$currentPath = getcwd();
chdir($this->rc->config->get('root_directory'));
$this->loadCurrentUser();
- $emailTemplates = App\Mail::getTempleteList(false, 'PLL_MAIL');
+ $emailTemplates = App\Mail::getTemplateList('', 'PLL_MAIL');
+ foreach ($emailTemplates as &$template) {
+ $moduleLabel = $template['module_name'];
+ $template['moduleTranslate'] = $moduleLabel ? \App\Language::translate($moduleLabel, $moduleLabel) : '';
+ }
echo App\Json::encode($emailTemplates);
chdir($currentPath);
exit;
@@ -653,24 +668,27 @@ public function getEmailTemplates()
/**
* Function to get info about email template.
*/
- public function getConntentEmailTemplate()
+ public function getContentEmailTemplate()
{
- $templeteId = rcube_utils::get_input_value('id', rcube_utils::INPUT_GPC);
+ $templateId = rcube_utils::get_input_value('id', rcube_utils::INPUT_GPC);
$recordId = rcube_utils::get_input_value('record_id', rcube_utils::INPUT_GPC);
$moduleName = rcube_utils::get_input_value('select_module', rcube_utils::INPUT_GPC);
$currentPath = getcwd();
chdir($this->rc->config->get('root_directory'));
$this->loadCurrentUser();
- $mail = App\Mail::getTemplete($templeteId);
- if ($recordId) {
- $textParser = \App\TextParser::getInstanceById($recordId, $moduleName);
- $mail['subject'] = $textParser->setContent($mail['subject'])->parse()->getContent();
- $mail['content'] = $textParser->setContent($mail['content'])->parse()->getContent();
+ $mail = [];
+ if (\App\Privilege::isPermitted('EmailTemplates', 'DetailView', $templateId)) {
+ $mail = \App\Mail::getTemplate($templateId);
+ if ($recordId) {
+ $textParser = \App\TextParser::getInstanceById($recordId, $moduleName);
+ $mail['subject'] = $textParser->setContent($mail['subject'])->parse()->getContent();
+ $mail['content'] = $textParser->setContent($mail['content'])->parse()->getContent();
+ }
}
echo App\Json::encode([
- 'subject' => $mail['subject'],
- 'content' => $mail['content'],
- 'attachments' => $mail['attachments'],
+ 'subject' => $mail['subject'] ?? null,
+ 'content' => $mail['content'] ?? null,
+ 'attachments' => $mail['attachments'] ?? null
]);
chdir($currentPath);
exit;
@@ -685,12 +703,12 @@ public function setIcsData(array $args)
{
$this->message = $args['object'];
foreach ((array) $this->message->attachments as $attachment) {
- if ($attachment->mimetype === 'application/ics' || $attachment->mimetype === 'text/calendar') {
+ if ('application/ics' === $attachment->mimetype || 'text/calendar' === $attachment->mimetype) {
$this->icsParts[] = ['part' => $attachment->mime_id, 'uid' => $this->message->uid, 'type' => 'attachments'];
}
}
foreach ((array) $this->message->parts as $part) {
- if ($part->mimetype === 'application/ics' || $part->mimetype === 'text/calendar') {
+ if ('application/ics' === $part->mimetype || 'text/calendar' === $part->mimetype) {
$this->icsParts[] = ['part' => $part->mime_id, 'uid' => $this->message->uid, 'type' => 'parts'];
}
}
@@ -717,7 +735,7 @@ public function appendIcsPreview($args)
if (!isset($ics[$key])) {
$ics[$key] = [$recordModel, $icsPart];
if (isset($counterBtn[$icsPart['part']])) {
- $counterBtn[$icsPart['part']]++;
+ ++$counterBtn[$icsPart['part']];
} else {
$counterBtn[$icsPart['part']] = 1;
}
@@ -799,7 +817,7 @@ public function appendIcsPreview($args)
$showMore = true;
}
if (isset($counterList[$icsPart['part']])) {
- $counterList[$icsPart['part']]++;
+ ++$counterList[$icsPart['part']];
} else {
$counterList[$icsPart['part']] = 1;
}
@@ -828,7 +846,8 @@ public function importIcs()
$recordModel->set('assigned_user_id', $this->currentUser->getId());
$recordModel->save();
if ($recordModel->getId()) {
- $status++;
+ $calendar->recordSaveAttendee($recordModel);
+ ++$status;
}
}
chdir($currentPath);
diff --git a/version.php b/version.php
index 4c74cbe6..d319fa79 100644
--- a/version.php
+++ b/version.php
@@ -1,5 +1,6 @@
'2019.02.26',
- 'version' => '0.0.67'
+ 'patch' => '2019.07.26',
+ 'version' => '0.0.77'
];