add send mail plain/text

This commit is contained in:
daniel 2017-09-27 13:42:02 +02:00
parent 7e6cc539e8
commit 29c69b1dbc
4 changed files with 56 additions and 7 deletions

View File

@ -165,8 +165,26 @@ if (is_ajax ()) {
$rfield = $editor_type_chkbx;
$rfield .= html_print_textarea ('field'.$i.'_recovery_value', 1, 1, '', 'class="fields_recovery"', true);
}
elseif(preg_match ("/^_content_type_$/i", $field_value)){
$editor_type_chkbx = "<div style=\"padding: 4px 0px;\"><b><small>";
$editor_type_chkbx .= __('Text/plain') . ui_print_help_tip (__("For sending emails only text plain"), true);
$editor_type_chkbx .= html_print_radio_button_extended ('field'.$i.'_value', 'text/plain', '', '', false, '', '', true);
$editor_type_chkbx .= "&nbsp;&nbsp;&nbsp;&nbsp;";
$editor_type_chkbx .= __('Text/html') . "&nbsp;&nbsp;";
$editor_type_chkbx .= html_print_radio_button_extended ('field'.$i.'_value', 'text/html', '', 'text/html', false, '', '', true);
$editor_type_chkbx .= "</small></b></div>";
$ffield = $editor_type_chkbx;
$editor_type_chkbx = "<div style=\"padding: 4px 0px;\"><b><small>";
$editor_type_chkbx .= __('Text/plain') . ui_print_help_tip (__("For sending emails only text plain"), true);
$editor_type_chkbx .= html_print_radio_button_extended ('field'.$i.'_recovery_value', 'text/plain', '', '', false, '', '', true);
$editor_type_chkbx .= "&nbsp;&nbsp;&nbsp;&nbsp;";
$editor_type_chkbx .= __('Text/html') . "&nbsp;&nbsp;";
$editor_type_chkbx .= html_print_radio_button_extended ('field'.$i.'_recovery_value', 'text/html', '', 'text/html', false, '', '', true);
$editor_type_chkbx .= "</small></b></div>";
$rfield = $editor_type_chkbx;
// Select type
else {
}else {
$fields_value_select = array();
$fv = explode(';', $field_value);

View File

@ -305,8 +305,33 @@ $(document).ready (function () {
// Replace the old column with the new
$table_macros_field.replaceWith(field_row);
if (old_value != '' || old_recovery_value != '') {
$("[name=field" + i + "_value]").val(old_value);
$("[name=field" + i + "_recovery_value]").val(old_recovery_value);
var inputType = $("[name=field" + i + "_value]").attr('type')
if (inputType == 'radio') {
if(old_value == 'text/plain'){
if ($("[name=field" + i + "_value]").val() == 'text/plain') {
$("[name=field" + i + "_value]").attr('checked','checked');
}
}
else{
if($("[name=field" + i + "_value]").val() == 'text/html') {
$("[name=field" + i + "_value]").attr('checked','checked');
}
}
if(old_recovery_value == 'text/plain'){
if ($("[name=field" + i + "_recovery_value]").val() == 'text/plain') {
$("[name=field" + i + "_recovery_value]").attr('checked','checked');
}
}
else{
if ($("[name=field" + i + "_recovery_value]").val() == 'text/html') {
$("[name=field" + i + "_recovery_value]").attr('checked','checked');
}
}
}
else {
$("[name=field" + i + "_value]").val(old_value);
$("[name=field" + i + "_recovery_value]").val(old_recovery_value);
}
}
else {
$("[name=field" + i + "_value]")

File diff suppressed because one or more lines are too long

View File

@ -1110,6 +1110,12 @@ sub pandora_execute_action ($$$$$$$$$;$) {
$field2 = subst_alert_macros ($field2, \%macros, $pa_config, $dbh, $agent, $module);
# Message
$field3 = subst_alert_macros ($field3, \%macros, $pa_config, $dbh, $agent, $module);
# Content
$field4 = subst_alert_macros ($field4, \%macros, $pa_config, $dbh, $agent, $module);
if($field4 eq ""){
$field4 = "text/html";
}
# Check for _module_graph_Xh_ macros
# Check for _module_graph_Xh_ macros and _module_graphth_Xh_
@ -1167,13 +1173,13 @@ sub pandora_execute_action ($$$$$$$$$;$) {
};
# Default content type
my $content_type = 'text/html; charset="iso-8859-1"';
my $content_type = $field4 . '; charset="iso-8859-1"';
# Check if message has non-ascii chars.
# non-ascii chars should be encoded in UTF-8.
if ($field3 =~ /[^[:ascii:]]/o) {
$field3 = encode("UTF-8", $field3);
$content_type = 'text/html; charset="UTF-8"';
$content_type = $field4 . '; charset="UTF-8"';
}