diff --git a/pandora_console/include/class/CredentialStore.class.php b/pandora_console/include/class/CredentialStore.class.php index 8bdc200299..befc213a8c 100644 --- a/pandora_console/include/class/CredentialStore.class.php +++ b/pandora_console/include/class/CredentialStore.class.php @@ -103,42 +103,16 @@ class CredentialStore extends Wizard */ private function ajaxMsg($type, $msg, $delete=false) { - $msg_err = 'Failed while saving: %s'; - $msg_ok = 'Successfully saved into keystore '; - - if ($delete) { - $msg_err = 'Failed while removing: %s'; - $msg_ok = 'Successfully deleted '; - } - - if ($type == 'error') { - echo json_encode( - [ - $type => ui_print_error_message( - __( - $msg_err, - $msg - ), - '', - true - ), - ] - ); + if ($type === 'error') { + $msg_title = ($delete === true) ? 'Failed while removing' : 'Failed while saving'; } else { - echo json_encode( - [ - $type => ui_print_success_message( - __( - $msg_ok, - $msg - ), - '', - true - ), - ] - ); + $msg_title = ($delete === true) ? 'Successfully deleted' : 'Successfully saved into keystore'; } + echo json_encode( + [ $type => __($msg_title).':
'.$msg ] + ); + exit; } diff --git a/pandora_console/include/class/ModuleTemplates.class.php b/pandora_console/include/class/ModuleTemplates.class.php index e9a03a90b9..2e777bdf4c 100644 --- a/pandora_console/include/class/ModuleTemplates.class.php +++ b/pandora_console/include/class/ModuleTemplates.class.php @@ -264,27 +264,11 @@ class ModuleTemplates extends HTML */ private function ajaxMsg($type, $msg) { - if ($type == 'error') { - echo json_encode( - [ - $type => ui_print_error_message( - __($msg), - '', - true - ), - ] - ); - } else { - echo json_encode( - [ - $type => ui_print_success_message( - __($msg), - '', - true - ), - ] - ); - } + echo json_encode( + [ + $type => __($msg), + ] + ); exit; } diff --git a/pandora_console/include/class/SatelliteAgent.class.php b/pandora_console/include/class/SatelliteAgent.class.php index 0d9111a24b..aa86f25e81 100644 --- a/pandora_console/include/class/SatelliteAgent.class.php +++ b/pandora_console/include/class/SatelliteAgent.class.php @@ -959,41 +959,28 @@ class SatelliteAgent extends HTML */ private function ajaxMsg($type, $msg, $delete=false, $disable=false) { - $msg_err = 'Failed while saving: %s'; - $msg_ok = 'Successfully saved agent '; - - if ($delete === true) { - $msg_err = 'Failed while removing: %s'; - $msg_ok = 'Successfully deleted '; - } - - if ($disable === true) { - $msg_err = 'Failed while disabling: %s'; - $msg_ok = 'Successfully disabled'; - } - - if ($type == 'error') { - echo json_encode( - [ - $type => ui_print_error_message( - __($msg), - '', - true - ), - ] - ); + if ($type === 'error') { + if ($delete === true) { + $msg_title = 'Failed while removing'; + } else if ($disable === true) { + $msg_title = 'Failed while disabling'; + } else { + $msg_title = 'Failed while saving'; + } } else { - echo json_encode( - [ - $type => ui_print_success_message( - __($msg), - '', - true - ), - ] - ); + if ($delete === true) { + $msg_title = 'Successfully deleted'; + } else if ($disable === true) { + $msg_title = 'Successfully disabled'; + } else { + $msg_title = 'Successfully saved agent'; + } } + echo json_encode( + [ $type => __($msg_title).':
'.$msg ] + ); + exit; } diff --git a/pandora_console/include/class/SatelliteCollection.class.php b/pandora_console/include/class/SatelliteCollection.class.php index aae0cb6780..6ef72c40c4 100644 --- a/pandora_console/include/class/SatelliteCollection.class.php +++ b/pandora_console/include/class/SatelliteCollection.class.php @@ -475,27 +475,11 @@ class SatelliteCollection extends HTML */ private function ajaxMsg(string $type, string $msg) { - if ($type === 'error') { - echo json_encode( - [ - $type => ui_print_error_message( - __($msg), - '', - true - ), - ] - ); - } else { - echo json_encode( - [ - $type => ui_print_success_message( - __($msg), - '', - true - ), - ] - ); - } + echo json_encode( + [ + $type => __($msg), + ] + ); exit; }