Skip to content

Commit

Permalink
Merge pull request #34 from YetiForceCompany/developer
Browse files Browse the repository at this point in the history
YetiForce CRM ver. 5.2.0
  • Loading branch information
mariuszkrzaczkowski authored Sep 9, 2019
2 parents 326fba5 + b0c6e4f commit 2ef861e
Show file tree
Hide file tree
Showing 10 changed files with 168 additions and 122 deletions.
29 changes: 13 additions & 16 deletions plugins/yetiforce/compose.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
'use strict';
/* {[The file is published on the basis of MIT License]} */

window.rcmail && rcmail.addEventListener('init', function (evt) {
Expand Down Expand Up @@ -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('<li class="' + value.moduleName + '"><a href="#" data-module="' + value.module + '" data-tplid="' + value.id + '" class="active">' + value.name + '</a></li>');
tmp[value.module_name] = value.moduleTranslate;
jQuery('#tplmenu #texttplsmenu').append('<li class="' + value.module_name + '"><a href="#" data-module="' + value.module_name + '" data-tplid="' + value.id + '" class="active">' + value.name + '</a></li>');
});

$.each(tmp, function (index, value) {
if (jQuery.inArray(value.name, modules) == -1) {
jQuery('#vtmodulemenu .toolbarmenu').append('<li class="' + value.name + '"><a href="#" data-module="' + value.name + '" class="active">' + value.label + '</a></li>');
modules.push(value.name);
$.each(tmp, function (moduleName, moduleTranslate) {
if (moduleName) {
jQuery('#vtmodulemenu .toolbarmenu').append('<li class="' + moduleName + '"><a href="#" data-module="' + moduleName + '" class="active">' + moduleTranslate + '</a></li>');
}
});

Expand Down Expand Up @@ -174,22 +170,23 @@ 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,
select_module: module
},
success: function (data) {
data = JSON.parse(data);
var oldSubject = jQuery('[name="_subject"]').val();
var html = jQuery("<div/>").html(data.content).html();
let oldSubject = jQuery('[name="_subject"]').val(),
html = jQuery("<div/>").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) {
Expand Down
2 changes: 1 addition & 1 deletion plugins/yetiforce/compose.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 2ef861e

Please sign in to comment.