diff --git a/modules/sendmail/js/functions.js b/modules/sendmail/js/functions.js index 61b0fc7c021b0ddb8df61424c65c86b0ae2d45a7..777c3b0f310ae982a1b416e0ce3c0ef66c84141d 100755 --- a/modules/sendmail/js/functions.js +++ b/modules/sendmail/js/functions.js @@ -17,14 +17,20 @@ function addTemplateToEmail(templateMails, path){ { method :'post', parameters :{ - templateId : templateMails + templateId : templateMails, + mode : mode }, onSuccess :function(answer){ eval("response = " + answer.responseText); if (response.status == 0) { var strContent = response.content; - var strContentReplace = strContent.replace(/\\n/g, ''); - tinyMCE.execCommand('mceSetContent',false,strContentReplace); + if(mode == 'html'){ + var strContentReplace = strContent.replace(/\\n/g, ''); + tinyMCE.execCommand('mceSetContent', false, strContentReplace); + } else { + var strContentReplace = strContent.replace(/\\n/g, '\n'); + $j("textarea#body_from_raw").html(strContentReplace); + } } } }); @@ -35,13 +41,20 @@ function changeSignature(selected, mailSignaturesJS){ var body = $('body_from_html_ifr').contentWindow.document.getElementById("tinymce"); var customTag = body.getElementsByTagName("mailSignature"); - if (customTag.length == 0) { - body.innerHTML += "<mailSignature>toto</mailSignature>"; + if (mode == 'html' && customTag.length == 0) { + body.innerHTML += "<mailSignature>t</mailSignature>"; customTag = body.getElementsByTagName("mailSignature"); } if (nb >= 0) { - customTag[0].innerHTML = mailSignaturesJS[nb].signature; + var strContent = mailSignaturesJS[nb].signature; + if(mode == 'html'){ + customTag[0].innerHTML = strContent; + } else { + var text = $j(strContent).text(); + $j("textarea#body_from_raw").append(text); + } + } else { customTag[0].innerHTML = ""; } diff --git a/modules/sendmail/lang/en.php b/modules/sendmail/lang/en.php index cdd186177e8859aafe03c810fa5566dfd5ee5cc6..8a8d6221ec4ee72e1988ccc33cb3eb4816b4df0d 100755 --- a/modules/sendmail/lang/en.php +++ b/modules/sendmail/lang/en.php @@ -125,7 +125,7 @@ if (!defined("_EMAIL_REMOVED")) define("_EMAIL_REMOVED", "Email removed"); if (!defined('_Label_ADD_TEMPLATE_MAIL')) - define('_Label_ADD_TEMPLATE_MAIL', 'Model of email'); + define('_Label_ADD_TEMPLATE_MAIL', 'Model : '); if (!defined('_ADD_TEMPLATE_MAIL')) define('_ADD_TEMPLATE_MAIL', 'Choose a template'); diff --git a/modules/sendmail/lang/fr.php b/modules/sendmail/lang/fr.php index 4c3b8021702ea307a520fdacc0b5b14ccab2e26a..4c817beced25ac1a005371e52ab987c43feffc99 100755 --- a/modules/sendmail/lang/fr.php +++ b/modules/sendmail/lang/fr.php @@ -127,7 +127,7 @@ if (!defined("_EMAIL_REMOVED")) if (!defined("_Label_ADD_TEMPLATE_MAIL")) - define("_Label_ADD_TEMPLATE_MAIL", "Modèle de courriel"); + define("_Label_ADD_TEMPLATE_MAIL", "Modèle : "); if (!defined("_ADD_TEMPLATE_MAIL")) define("_ADD_TEMPLATE_MAIL", "Sélectionnez le modèle désiré"); diff --git a/modules/sendmail/mail_form.php b/modules/sendmail/mail_form.php index ee38fd1f444cafb03c57a49d8bead9b60fada209..673bf506bc0de89322f92b1ba3de927324a18174 100755 --- a/modules/sendmail/mail_form.php +++ b/modules/sendmail/mail_form.php @@ -420,7 +420,7 @@ if ($mode == 'add') { $content .= "<option value='" . $result->template_id ."'>" . $result->template_label . "</option>"; } $content .= '</select>'; - $content .= '<label style="margin-left: 15%;padding-right:10px">' . 'Signature de mail' . '</label>'; + $content .= '<label style="margin-left: 15%;padding-right:10px">' . 'Signature : ' . '</label>'; $emailSignaturesClass = new EmailSignatures(); $mailSignatures = $emailSignaturesClass->getForCurrentUser(); @@ -795,7 +795,7 @@ if ($mode == 'add') { $content .= "<option value='" . $result->template_id ."'>" . $result->template_label . "</option>"; } $content .='</select>'; - $content .= '<label style="margin-left: 15%;padding-right:10px">' . 'Signature de mail' . '</label>'; + $content .= '<label style="margin-left: 15%;padding-right:10px">' . 'Signature : ' . '</label>'; $emailSignaturesClass = new EmailSignatures(); $mailSignatures = $emailSignaturesClass->getForCurrentUser(); diff --git a/modules/sendmail/sendmail_to_contact_ajax.php b/modules/sendmail/sendmail_to_contact_ajax.php index 6cfd9a82846b48fdc488f5c76779a86285be6506..a938fe3686d1749222b000fe00fe54411ef169df 100755 --- a/modules/sendmail/sendmail_to_contact_ajax.php +++ b/modules/sendmail/sendmail_to_contact_ajax.php @@ -1,19 +1,9 @@ <?php -require_once('core'.DIRECTORY_SEPARATOR.'class'.DIRECTORY_SEPARATOR.'class_request.php'); -// if($_POST['status'] != '_NOSTATUS_'){ -// $db = new Database(); - -// $db->query("UPDATE res_letterbox SET status = ? WHERE res_id = ?", array($_POST['status'],$_REQUEST['identifier'])); -// } +require_once('core'.DIRECTORY_SEPARATOR.'class'.DIRECTORY_SEPARATOR.'class_request.php'); $db = new Database(); $db->query("UPDATE mlb_coll_ext SET sve_start_date = CURRENT_TIMESTAMP WHERE res_id = ?", array($_REQUEST['identifier'])); -// header('Location: ' . $_SESSION['config']['businessappurl'] -// . 'index.php?page=view_baskets&module=basket' -// ); ?> - - diff --git a/modules/templates/templates_ajax_content_for_mails.php b/modules/templates/templates_ajax_content_for_mails.php index 197c43615aeac0e70fd5a29dc1a88af9d70e2efa..bed42750e244883d1b910e6fadd64fcb65aa5fb5 100755 --- a/modules/templates/templates_ajax_content_for_mails.php +++ b/modules/templates/templates_ajax_content_for_mails.php @@ -45,5 +45,11 @@ $template->template_content = str_replace("\r", "\n", $template->template_conten $template->template_content = str_replace("\n", "\\n ", $template->template_content); $template->template_content = str_replace("''", "'", $template->template_content); +if($_REQUEST['mode'] == 'raw'){ + $template->template_content = str_replace("<br>", "\\n", $template->template_content); + $template->template_content = str_replace("<br />", "\\n", $template->template_content); + $template->template_content = strip_tags($template->template_content); +} + echo "{status : 0, content : '" . addslashes($template->template_content) . "'}"; exit(); \ No newline at end of file diff --git a/modules/templates/xml/IVS/validation_rules.xml b/modules/templates/xml/IVS/validation_rules.xml index 1d3cfb99aa05ef05bedffc6aa6dbd61adc488783..c473684725777e84316108b23cd9c038b7911e1d 100755 --- a/modules/templates/xml/IVS/validation_rules.xml +++ b/modules/templates/xml/IVS/validation_rules.xml @@ -27,6 +27,7 @@ <parameter name="module" type="identifier" /> <parameter name="id" type="integer" /> <parameter name="templateId" type="integer" /> + <parameter name="mode" type="string" /> </validationRule> <validationRule name="templates_ajax_content_for_notes" extends="standardForm" mode="error">