Merge branch '38-no-funciona-event-alerts-sobre-alertas-de-snmp-traps-integria-4383' into 'develop'

Fix sound console for snmp traps alert, multiple selection and fix icons - #38

See merge request !110
This commit is contained in:
Enrique Camargo 2017-02-02 17:48:18 +01:00
commit a1fe59a83b
3 changed files with 19 additions and 9 deletions

View File

@ -155,9 +155,14 @@ function alerts_get_event_status_group($idGroup, $type = "alert_fired", $query =
$agents = agents_get_group_agents($idGroup, false, "lower", false); $agents = agents_get_group_agents($idGroup, false, "lower", false);
$idAgents = array_keys($agents); $idAgents = array_keys($agents);
} }
else { else {
$idAgents = array_values($agents); $idAgents = array_values($agents);
if($type=='alert_fired'){
$idAgents = array_keys($agents);
}
} }
$result = db_get_all_rows_sql('SELECT id_evento $result = db_get_all_rows_sql('SELECT id_evento

View File

@ -429,7 +429,7 @@ function html_print_select_groups($id_user = false, $privilege = "AR",
function html_print_select ($fields, $name, $selected = '', $script = '', function html_print_select ($fields, $name, $selected = '', $script = '',
$nothing = '', $nothing_value = 0, $return = false, $multiple = false, $nothing = '', $nothing_value = 0, $return = false, $multiple = false,
$sort = true, $class = '', $disabled = false, $style = false, $sort = true, $class = '', $disabled = false, $style = false,
$option_style = false, $size = false,$modal=false,$message=''){ $option_style = false, $size = false,$modal=false,$message='',$select_all=false){
$output = "\n"; $output = "\n";
@ -513,7 +513,12 @@ function html_print_select ($fields, $name, $selected = '', $script = '',
$optlabel = $label['name']; $optlabel = $label['name'];
} }
$output .= '<option value="'.$value.'"'; $output .= '<option ';
if($select_all){
$output .= 'selected ';
}
$output .= 'value="'.$value.'"';
if (is_array ($selected) && in_array ($value, $selected)) { if (is_array ($selected) && in_array ($value, $selected)) {
$output .= ' selected="selected"'; $output .= ' selected="selected"';
} }

View File

@ -77,7 +77,7 @@ $table->style[1] = 'font-weight: bold; vertical-align: top;';
$table->data[0][0] = __('Group'); $table->data[0][0] = __('Group');
$table->data[0][0] .= html_print_select_groups(false, $access, true, 'group', '', 'changeGroup();', '', 0, true) . '<br />' . '<br />'; $table->data[0][0] .= html_print_select_groups(false, $access, true, 'group', '', 'changeGroup();', '', 0, true) . '<br />' . '<br />';
$table->data[0][0] .= __('Agent'); $table->data[0][0] .= __('Agent');
$table->data[0][0] .= html_print_select($agents, 'id_agents[]', true, false, '', '', true, true); $table->data[0][0] .= html_print_select($agents, 'id_agents[]', true, false, '', '', true, true,'','','','','',false,'','',true);
$table->data[0][1] = __('Type'); $table->data[0][1] = __('Type');
$table->data[0][1] .= '<br />' . html_print_checkbox('alert_fired', 'alert_fired', true, true, false, 'changeType();') . __('Alert fired') . '<br />' . $table->data[0][1] .= '<br />' . html_print_checkbox('alert_fired', 'alert_fired', true, true, false, 'changeType();') . __('Alert fired') . '<br />' .
html_print_checkbox('critical', 'critical', true, true, false, 'changeType();') . __('Monitor critical') . '<br />' . html_print_checkbox('critical', 'critical', true, true, false, 'changeType();') . __('Monitor critical') . '<br />' .
@ -87,17 +87,17 @@ $table->data[0][1] .= '<br />' . html_print_checkbox('alert_fired', 'alert_fired
html_print_table($table); html_print_table($table);
echo '<br />'; echo '<br />';
echo '<div style="text-align:center">';
echo '<a href="javascript: toggleButton();">' . echo '<a href="javascript: toggleButton();">' .
html_print_image("images/icono_play.png", true, array("id" => "button")) . html_print_image("images/play.button.png", true, array("id" => "button")) .
'</a>'; '</a>';
echo '<a href="javascript: ok();">' . echo '<a href="javascript: ok();">' .
html_print_image("images/icono_ok.png", true, array("style" => "margin-left: 15px;")) . html_print_image("images/ok.button.png", true, array("style" => "margin-left: 15px;")) .
'</a>'; '</a>';
echo '<a href="javascript: test_sound_button();">' . echo '<a href="javascript: test_sound_button();">' .
html_print_image("images/icono_test.png", true, array("id" => "button_try", "style" => "margin-left: 15px;")) . html_print_image("images/icono_test.png", true, array("id" => "button_try", "style" => "margin-left: 15px;")) .
'</a>'; '</a>';
echo '</div>';
?> ?>
<script src="../../include/javascript/jquery.js" type="text/javascript"></script> <script src="../../include/javascript/jquery.js" type="text/javascript"></script>
<script type="text/javascript"> <script type="text/javascript">
@ -165,14 +165,14 @@ function toggleButton() {
if (button_play_status == 'pause') { if (button_play_status == 'pause') {
//~ if ($("#button").attr('src') == '../../images/pause.button.png') { //~ if ($("#button").attr('src') == '../../images/pause.button.png') {
$("#button").attr('src', '../../images/icono_play.png'); $("#button").attr('src', '../../images/play.button.png');
stopSound(); stopSound();
button_play_status = 'play'; button_play_status = 'play';
} }
else { else {
$("#button").attr('src', '../../images/icono_pausa.png'); $("#button").attr('src', '../../images/pause.button.png');
forgetPreviousEvents(); forgetPreviousEvents();
startSound(); startSound();