Merge branch '145-plain-text-mail-cannot-be-send-by-email_2' into 'develop'
Resolve "plain text mail cannot be send by 'eMail'." See merge request artica/pandorafms!1033
This commit is contained in:
commit
68a6770a45
|
@ -6,4 +6,16 @@ ALTER TABLE treport_content ADD COLUMN visual_format tinyint(1) default '0';
|
|||
ALTER TABLE treport_content_template ADD COLUMN lapse_calc tinyint(1) default '0';
|
||||
ALTER TABLE treport_content_template ADD COLUMN lapse int(11) default '300';
|
||||
ALTER TABLE treport_content_template ADD COLUMN visual_format tinyint(1) default '0';
|
||||
|
||||
UPDATE `talert_commands`
|
||||
SET `description` = 'This alert send an email using internal Pandora FMS Server SMTP capabilities (defined in each server, using:
_field1_ as destination email address, and
_field2_ as subject for message. 
_field3_ as text of message. 
_field4_ as content type (text/plain or html/text).',
|
||||
`fields_descriptions` = '[\"Destination address\",\"Subject\",\"Text\",\"Content Type\",\"\",\"\",\"\",\"\",\"\",\"\"]',
|
||||
`fields_values` = '[\"\",\"\",\"_html_editor_\",\"_content_type_\",\"\",\"\",\"\",\"\",\"\",\"\"]'
|
||||
WHERE id=1;
|
||||
|
||||
UPDATE `talert_actions`
|
||||
SET `field4` = 'text/html',
|
||||
`field4_recovery` = 'text/html'
|
||||
WHERE id = 1;
|
||||
|
||||
COMMIT;
|
|
@ -1137,6 +1137,10 @@ ALTER TABLE talert_actions ADD COLUMN `field15_recovery` TEXT NOT NULL DEFAULT "
|
|||
-- ---------------------------------------------------------------------
|
||||
UPDATE `talert_commands` SET `fields_descriptions` = '[\"Integria IMS API path\",\"Integria IMS API pass\",\"Integria IMS user\",\"Integria IMS user pass\",\"Ticket title\",\"Ticket group ID\",\"Ticket priority\",\"Email copy\",\"Ticket owner\",\"Ticket description\"]', `fields_values` = '[\"\",\"\",\"\",\"\",\"\",\"\",\"10,Maintenance;0,Informative;1,Low;2,Medium;3,Serious;4,Very Serious\",\"\",\"\",\"\"]' WHERE `id` = 11 AND `name` = 'Integria IMS Ticket';
|
||||
|
||||
UPDATE `talert_commands` SET `description` = 'This alert send an email using internal Pandora FMS Server SMTP capabilities (defined in each server, using:
_field1_ as destination email address, and
_field2_ as subject for message. 
_field3_ as text of message. 
_field4_ as content type (text/plain or html/text).', `fields_descriptions` = '[\"Destination address\",\"Subject\",\"Text\",\"Content Type\",\"\",\"\",\"\",\"\",\"\",\"\"]', `fields_values` = '[\"\",\"\",\"_html_editor_\",\"_content_type_\",\"\",\"\",\"\",\"\",\"\",\"\"]' WHERE id=1;
|
||||
|
||||
UPDATE `talert_actions` SET `field4` = 'text/html', `field4_recovery` = 'text/html' WHERE id = 1;
|
||||
|
||||
-- ---------------------------------------------------------------------
|
||||
-- Table `tmap`
|
||||
-- ---------------------------------------------------------------------
|
||||
|
|
|
@ -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 .= " ";
|
||||
$editor_type_chkbx .= __('Text/html') . " ";
|
||||
$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 .= " ";
|
||||
$editor_type_chkbx .= __('Text/html') . " ";
|
||||
$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);
|
||||
|
||||
|
|
|
@ -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
|
@ -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"';
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue