2009-01-16 Esteban Sanchez <estebans@artica.es>
* pandoradb.sql: Added new field to talert_templates to specify if the alert should fire when on match or mismatch of the values. * general/header.php: Fixed the columns width. Added a control when the autorefresh is clicked so the user can select the refresh time. A countdown is also shown when the page is set to refresh. * godmode/alerts/configure_alert_template.php: Control the new flag on templates. Added an explanation to explain when the alert is going to fire. * include/javascript/jquery.js: Updated to v1.3. It promise to be quicker in a lot of situations. * include/javascript/jquery.countdown.js: Updated to latest version. * include/styles/pandora.css: Fixed duplicated input.ok. Style correction. Added invisible class and a style for alert templates page. * include/functions_alerts.php: Fixed a notice error on clean_alert_template_values(). * operation/visual_console/render_view.php: Removed jquery inclusion because it's already done in the index page. * general/main_menu.php: Do not add refr if it's zero. * index.php: Avoid the recursive addition of 1=1 when autorefresh is set. * pandoradb_migrate_20_to_21.sql: Added new fields on the tables. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1350 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
a4468758a8
commit
d4b76f5a93
|
@ -1,3 +1,38 @@
|
|||
2009-01-16 Esteban Sanchez <estebans@artica.es>
|
||||
|
||||
* pandoradb.sql: Added new field to talert_templates to specify if the
|
||||
alert should fire when on match or mismatch of the values.
|
||||
|
||||
* general/header.php: Fixed the columns width. Added a control when
|
||||
the autorefresh is clicked so the user can select the refresh time. A
|
||||
countdown is also shown when the page is set to refresh.
|
||||
|
||||
* godmode/alerts/configure_alert_template.php: Control the new flag on
|
||||
templates. Added an explanation to explain when the alert is going to
|
||||
fire.
|
||||
|
||||
* include/javascript/jquery.js: Updated to v1.3. It promise to be
|
||||
quicker in a lot of situations.
|
||||
|
||||
* include/javascript/jquery.countdown.js: Updated to latest version.
|
||||
|
||||
* include/styles/pandora.css: Fixed duplicated input.ok. Style
|
||||
correction. Added invisible class and a style for alert templates
|
||||
page.
|
||||
|
||||
* include/functions_alerts.php: Fixed a notice error on
|
||||
clean_alert_template_values().
|
||||
|
||||
* operation/visual_console/render_view.php: Removed jquery inclusion
|
||||
because it's already done in the index page.
|
||||
|
||||
* general/main_menu.php: Do not add refr if it's zero.
|
||||
|
||||
* index.php: Avoid the recursive addition of 1=1 when autorefresh is
|
||||
set.
|
||||
|
||||
* pandoradb_migrate_20_to_21.sql: Added new fields on the tables.
|
||||
|
||||
2009-01-16 Ramon Novoa <rnovoa@artica.es>
|
||||
|
||||
* pandoradb.sql: Updated alert schema to work with the new alert
|
||||
|
|
|
@ -33,14 +33,14 @@ echo '<a href="index.php"><img src="images/pandora_logo_head.png" alt="logo" sty
|
|||
echo '</td><td width="20"> </td>';
|
||||
|
||||
// First column (identifier)
|
||||
echo '<td><img src="images/user_'.((dame_admin ($_SESSION["id_usuario"]) == 1) ? 'suit' : 'green' ).'.png" class="bot"> '.'<a class="white">'.__('You are').' [<b>'.$_SESSION["id_usuario"].'</b>]</a>';
|
||||
echo '<td width="20%"><img src="images/user_'.((dame_admin ($_SESSION["id_usuario"]) == 1) ? 'suit' : 'green' ).'.png" class="bot"> '.'<a class="white">'.__('You are').' [<b>'.$_SESSION["id_usuario"].'</b>]</a>';
|
||||
|
||||
//First column, second row (logout button)
|
||||
echo '<br /><br />';
|
||||
echo '<a class="white_bold" href="index.php?bye=bye"><img src="images/lock.png" class="bot"> '. __('Logout').'</a>';
|
||||
|
||||
// Second column (link to main page)
|
||||
echo '</td><td>';
|
||||
echo '</td><td width="20%">';
|
||||
echo '<a class="white_bold" href="index.php?sec=main"><img src="images/information.png" class="bot"> '.__('General information').'</a>';
|
||||
|
||||
//Second column, second row (System up/down)
|
||||
|
@ -65,11 +65,27 @@ echo "</a>";
|
|||
|
||||
// Third column
|
||||
// Autorefresh
|
||||
echo "</td><td>";
|
||||
if (get_parameter ("refr") != 0) {
|
||||
echo '<a class="white_grey_bold" href="'.((substr ($_SERVER['REQUEST_URI'],-1) != "/") ? $_SERVER['REQUEST_URI'] : 'index.php?' ).'&refr=0"><img src="images/page_lightning.png" class="bot" /> '. __('Autorefresh').'</a>';
|
||||
echo '</td><td width="20%">';
|
||||
$refr = (int) get_parameter ("refr");
|
||||
if ($refr) {
|
||||
echo '<a id="autorefresh" class="white_grey_bold" href="'.((substr ($_SERVER['REQUEST_URI'],-1) != "/") ? $_SERVER['REQUEST_URI'] : 'index.php?' ).'&refr=0"><img src="images/page_lightning.png" class="bot" /> '. __('Autorefresh');
|
||||
echo ' (<span id="refr">'.date ("i:s", $refr).'</span>)';
|
||||
echo '</a>';
|
||||
} else {
|
||||
echo '<a class="white_bold" href="'.((substr ($_SERVER['REQUEST_URI'],-1) != "/") ? $_SERVER['REQUEST_URI'] : "index.php?" ).'&refr=5"><img src="images/page_lightning.png" class="bot" /> '.__('Autorefresh').'</a>';
|
||||
echo '<a id="autorefresh" class="white_bold" href="'.((substr ($_SERVER['REQUEST_URI'],-1) != "/") ? $_SERVER['REQUEST_URI'] : "index.php?" ).(count($_GET)?"&":"?").'refr="><img src="images/page_lightning.png" class="bot" /> '.__('Autorefresh').'</a>';
|
||||
$values = array ('5' => '5 '.__('seconds'),
|
||||
'10' => '10 '.__('seconds'),
|
||||
'15' => '15 '.__('seconds'),
|
||||
'30' => '30 '.__('seconds'),
|
||||
'60' => '1 '.__('minute'),
|
||||
'120' => '2 '.__('minutes'),
|
||||
'300' => '5 '.__('minutes'),
|
||||
'900' => '15 '.__('minutes'),
|
||||
'1800' => '30 '.__('minutes'),
|
||||
'3600' => '1 '.__('hour'));
|
||||
echo '<span id="combo_refr" style="display: none">';
|
||||
print_select ($values, 'ref', '', '', __('Select'), '0', false, false, false);
|
||||
echo '</span>';
|
||||
}
|
||||
|
||||
//Events
|
||||
|
@ -77,5 +93,35 @@ echo '<br /><br />';
|
|||
echo '<a class="white_bold" href="index.php?sec=eventos&sec2=operation/events/events&refr=5"><img src="images/lightning_go.png" class="bot" /> '.__('Events').'</a>';
|
||||
|
||||
// Styled text
|
||||
echo '</td><td><div id="head_r"><span id="logo_text1">Pandora</span> <span id="logo_text2">FMS</span></div></td></tr></table>';
|
||||
echo '</td><td width="20%"><div id="head_r"><span id="logo_text1">Pandora</span> <span id="logo_text2">FMS</span></div></td></tr></table>';
|
||||
?>
|
||||
|
||||
<script type="text/javascript" src="include/javascript/jquery.countdown.js"></script>
|
||||
<script language="javascript" type="text/javascript">
|
||||
$(document).ready (function () {
|
||||
<?php if ($refr): ?>
|
||||
t = new Date();
|
||||
t.setTime (t.getTime () + <?php echo $refr * 1000; ?>);
|
||||
$("#refr").countdown ({until: t,
|
||||
layout: '%M%nn%M:%S%nn%S',
|
||||
labels: ['', '', '', '', '', '', ''],
|
||||
onExpiry: function () {
|
||||
$(this).text ("...");
|
||||
}
|
||||
});
|
||||
<?php else: ?>
|
||||
$("a#autorefresh").click (function () {
|
||||
var a = this;
|
||||
|
||||
$(this).hide ().unbind ("click");
|
||||
$("#combo_refr").show ();
|
||||
$("select#ref").change (function () {
|
||||
href = $(a).attr ("href");
|
||||
$(document).attr ("location", href + this.value);
|
||||
});
|
||||
|
||||
return false;
|
||||
});
|
||||
<?php endif; ?>
|
||||
});
|
||||
</script>
|
||||
|
|
|
@ -50,7 +50,7 @@ function temp_print_menu ($menu, $type) {
|
|||
//Print out the first level
|
||||
echo '<ul'.($class ? ' class="'.$class.'"' : '').'>';
|
||||
echo '<li class="mainmenu '.$class.'" id="'.$main["id"].'">';
|
||||
echo '<a href="index.php?sec='.$mainsec.'&sec2='.$main["sec2"].'&refr='.$main["refr"].'">'.$main["text"].'</a>';
|
||||
echo '<a href="index.php?sec='.$mainsec.'&sec2='.$main["sec2"].($main["refr"] ? '&refr='.$main["refr"] : '').'">'.$main["text"].'</a>';
|
||||
echo '</li>';
|
||||
|
||||
foreach ($main["sub"] as $subsec2 => $sub) {
|
||||
|
@ -85,7 +85,7 @@ function temp_print_menu ($menu, $type) {
|
|||
$link_add = "";
|
||||
}
|
||||
echo '<li'.($class ? ' class="'.$class.'"' : '').'>';
|
||||
echo '<a href="index.php?sec='.$mainsec.'&sec2='.$subsec2.'&refr='.$sub["refr"].$link_add.'">'.$sub["text"].'</a>';
|
||||
echo '<a href="index.php?sec='.$mainsec.'&sec2='.$subsec2.($main["refr"] ? '&refr='.$main["refr"] : '').$link_add.'">'.$sub["text"].'</a>';
|
||||
echo '</li>';
|
||||
}
|
||||
}
|
||||
|
|
|
@ -78,6 +78,71 @@ function print_alert_template_steps ($step, $id) {
|
|||
echo '</div>';
|
||||
}
|
||||
|
||||
function print_alert_template_example ($id, $return = false) {
|
||||
$output = '';
|
||||
|
||||
$is = false;
|
||||
$is_not = false;
|
||||
$matches = false;
|
||||
$matches_not = false;
|
||||
$between = false;
|
||||
$between_not = false;
|
||||
$under = false;
|
||||
$over = false;
|
||||
$max = false;
|
||||
$min = false;
|
||||
$value = false;
|
||||
|
||||
$output .= '<img src="images/information.png" /> ';
|
||||
$output .= '<span id="example">';
|
||||
|
||||
if ($id) {
|
||||
$template = get_alert_template ($id);
|
||||
|
||||
switch ($template['type']) {
|
||||
case 'not_equal':
|
||||
/* Do not translate the HTML attributes */
|
||||
$output .= __('The alert would fire when the value is <span id="value"></span>');
|
||||
break;
|
||||
case 'equal':
|
||||
/* Do not translate the HTML attributes */
|
||||
$output .= __('The alert would fire when the value is not <span id="value"></span>');
|
||||
break;
|
||||
case 'regex':
|
||||
if ($template['matches_value'])
|
||||
/* Do not translate the HTML attributes */
|
||||
$output .= __('The alert would fire when the value matches <span id="value"></span>');
|
||||
else
|
||||
/* Do not translate the HTML attributes */
|
||||
$output .= __('The alert would fire when the value doesn\'t match <span id="value"></span>');
|
||||
$value = $template['value'];
|
||||
break;
|
||||
case 'max_min':
|
||||
if ($template['matches_value'])
|
||||
/* Do not translate the HTML attributes */
|
||||
$output .= __('The alert would fire when the value is between <span id="min"></span> and <span id="max"></span>');
|
||||
else
|
||||
/* Do not translate the HTML attributes */
|
||||
$output .= __('The alert would fire when the value is not between <span id="min"></span> and <span id="max"></span>');
|
||||
break;
|
||||
case 'max':
|
||||
/* Do not translate the HTML attributes */
|
||||
$output .= __('The alert would fire when the value is over <span id="max"></span>');
|
||||
|
||||
break;
|
||||
case 'min':
|
||||
/* Do not translate the HTML attributes */
|
||||
$output .= __('The alert would fire when the value is under <span id="min"></span>');
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$output .= '</span>';
|
||||
if ($return)
|
||||
return $output;
|
||||
echo $output;
|
||||
}
|
||||
|
||||
function update_template ($step) {
|
||||
$id = (int) get_parameter ('id');
|
||||
|
||||
|
@ -92,13 +157,15 @@ function update_template ($step) {
|
|||
$value = (string) get_parameter ('value');
|
||||
$max = (float) get_parameter ('max');
|
||||
$min = (float) get_parameter ('min');
|
||||
$matches = (bool) get_parameter ('matches_value');
|
||||
|
||||
$result = update_alert_template ($id,
|
||||
array ('type' => $type,
|
||||
'description' => $description,
|
||||
'value' => $value,
|
||||
'max_value' => $max,
|
||||
'min_value' => $min));
|
||||
'min_value' => $min,
|
||||
'matches_value' => $matches));
|
||||
} elseif ($step == 2) {
|
||||
$monday = (bool) get_parameter ('monday');
|
||||
$tuesday = (bool) get_parameter ('tuesday');
|
||||
|
@ -247,6 +314,7 @@ if ($id && ! $create_template) {
|
|||
$value = $template['value'];
|
||||
$max = $template['max_value'];
|
||||
$min = $template['min_value'];
|
||||
$matches = $template['matches_value'];
|
||||
$time_from = $template['time_from'];
|
||||
$time_to = $template['time_to'];
|
||||
$monday = (bool) $template['monday'];
|
||||
|
@ -392,15 +460,18 @@ if ($step == 2) {
|
|||
$table->rowstyle['value'] = 'display: none';
|
||||
$table->rowstyle['max'] = 'display: none';
|
||||
$table->rowstyle['min'] = 'display: none';
|
||||
$table->rowstyle['example'] = 'display: none';
|
||||
|
||||
$show_matches = false;
|
||||
if ($id) {
|
||||
$table->rowstyle['example'] = '';
|
||||
switch ($type) {
|
||||
case "equal":
|
||||
case "not_equal":
|
||||
case "regex":
|
||||
$show_matches = true;
|
||||
$table->rowstyle['value'] = '';
|
||||
break;
|
||||
case "max_min":
|
||||
$show_matches = true;
|
||||
case "max":
|
||||
$table->rowstyle['max'] = '';
|
||||
if ($type == 'max')
|
||||
|
@ -421,6 +492,11 @@ if ($step == 2) {
|
|||
$table->data[2][0] = __('Condition type');
|
||||
$table->data[2][1] = print_select (get_alert_templates_types (), 'type',
|
||||
$type, '', __('Select'), 0, true, false, false);
|
||||
$table->data[2][1] .= '<span id="matches_value" '.($show_matches ? '' : 'style="display: none"').'>';
|
||||
$table->data[2][1] .= print_checkbox ('matches_value', 1, $matches, true);
|
||||
$table->data[2][1] .= print_label (__('Trigger when matches the value'),
|
||||
'checkbox-matches_value', true);
|
||||
$table->data[2][1] .= '</span>';
|
||||
|
||||
$table->data['value'][0] = __('Value');
|
||||
$table->data['value'][1] = print_input_text ('value', $value, '',
|
||||
|
@ -441,6 +517,9 @@ if ($step == 2) {
|
|||
|
||||
$table->data['min'][0] = __('Min.');
|
||||
$table->data['min'][1] = print_input_text ('min', $min, '', 5, 255, true);
|
||||
|
||||
$table->data['example'][1] = print_alert_template_example ($id, true);
|
||||
$table->colspan['example'][1] = 2;
|
||||
}
|
||||
|
||||
/* If it's the last step it will redirect to template lists */
|
||||
|
@ -476,6 +555,16 @@ echo '</form>';
|
|||
<script src="include/languages/time_<?php echo $config['language']; ?>.js"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
var matches = "<?php echo __('The alert would fire when the value matches <span id=\"value\"></span>');?>";
|
||||
var matches_not = "<?php echo __('The alert would fire when the value doesn\'t match <span id=\"value\"></span>');?>";
|
||||
var is = "<?php echo __('The alert would fire when the value is <span id=\"value\"></span>');?>";
|
||||
var is_not = "<?php echo __('The alert would fire when the value is not <span id=\"value\"></span>');?>";
|
||||
var between = "<?php echo __('The alert would fire when the value is between <span id=\"min\"></span> and <span id=\"max\"></span>');?>";
|
||||
var between_not = "<?php echo __('The alert would fire when the value is not between <span id=\"min\"></span> and <span id=\"max\"></span>');?>";
|
||||
var under = "<?php echo __('The alert would fire when the value is under <span id=\"min\"></span>');?>";
|
||||
var over = "<?php echo __('The alert would fire when the value is over <span id=\"max\"></span>');?>";
|
||||
|
||||
function check_regex () {
|
||||
if ($("#type").attr ('value') != 'regex') {
|
||||
$("img#regex_good, img#regex_bad").hide ();
|
||||
|
@ -493,71 +582,140 @@ function check_regex () {
|
|||
$("img#regex_good").show ();
|
||||
}
|
||||
|
||||
function render_example () {
|
||||
/* Set max */
|
||||
max = $("input#text-max").attr ("value")
|
||||
if (max == '') {
|
||||
$("span#max").empty ().append ("0");
|
||||
} else {
|
||||
$("span#max").empty ().append (max);
|
||||
}
|
||||
|
||||
/* Set min */
|
||||
min = $("input#text-min").attr ("value")
|
||||
if (min == '') {
|
||||
$("span#min").empty ().append ("0");
|
||||
} else {
|
||||
$("span#min").empty ().append (min);
|
||||
}
|
||||
|
||||
/* Set value */
|
||||
value = $("input#text-value").attr ("value")
|
||||
if (value == '') {
|
||||
$("span#value").empty ().append ("<em><?php echo __('Empty');?></em>");
|
||||
} else {
|
||||
$("span#value").empty ().append (value);
|
||||
}
|
||||
}
|
||||
|
||||
$(document).ready (function () {
|
||||
render_example ();
|
||||
$("#text-time_from, #text-time_to").timeEntry ({
|
||||
spinnerImage: 'images/time-entry.png',
|
||||
spinnerSize: [20, 20, 0]
|
||||
}
|
||||
);
|
||||
|
||||
$("input#text-value").keyup (render_example);
|
||||
$("input#text-max").keyup (render_example);
|
||||
$("input#text-min").keyup (render_example);
|
||||
|
||||
$("#type").change (function () {
|
||||
switch (this.value) {
|
||||
case "equal":
|
||||
case "not_equal":
|
||||
$("img#regex_good, img#regex_bad").hide ();
|
||||
$("img#regex_good, img#regex_bad, span#matches_value").hide ();
|
||||
$("#template-max, #template-min").hide ();
|
||||
$("#template-value, #template-example").show ();
|
||||
|
||||
/* Show example */
|
||||
if (this.value == "equal")
|
||||
$("span#example").empty ().append (is);
|
||||
else
|
||||
$("span#example").empty ().append (is_not);
|
||||
|
||||
break;
|
||||
case "regex":
|
||||
$("#template-max, #template-min").fadeOut ('normal',
|
||||
function () {
|
||||
$("#template-value").fadeIn ();
|
||||
check_regex ();
|
||||
}
|
||||
);
|
||||
$("#template-max, #template-min").hide ();
|
||||
$("#template-value, #template-example, span#matches_value").show ();
|
||||
check_regex ();
|
||||
|
||||
/* Show example */
|
||||
if ($("#checkbox-matches_value")[0].checked)
|
||||
$("span#example").empty ().append (matches);
|
||||
else
|
||||
$("span#example").empty ().append (matches_not);
|
||||
|
||||
break;
|
||||
case "max_min":
|
||||
$("#template-value").fadeOut ('normal',
|
||||
function () {
|
||||
$("#template-max").fadeIn ();
|
||||
$("#template-min").fadeIn ();
|
||||
}
|
||||
);
|
||||
$("#template-value").hide ();
|
||||
$("#template-max, #template-min, #template-example, span#matches_value").show ();
|
||||
|
||||
/* Show example */
|
||||
if ($("#checkbox-matches_value")[0].checked)
|
||||
$("span#example").empty ().append (between);
|
||||
else
|
||||
$("span#example").empty ().append (between_not);
|
||||
|
||||
break;
|
||||
case "max":
|
||||
$("#template-value, #template-min").fadeOut ('normal',
|
||||
function () {
|
||||
$("#template-max").fadeIn ();
|
||||
}
|
||||
);
|
||||
$("#template-value, #template-min, span#matches_value").hide ();
|
||||
$("#template-max, #template-example").show ();
|
||||
|
||||
/* Show example */
|
||||
$("span#example").empty ().append (over);
|
||||
break;
|
||||
case "min":
|
||||
$("#template-value, #template-max").fadeOut ('normal',
|
||||
function () {
|
||||
$("#template-min").fadeIn ();
|
||||
}
|
||||
);
|
||||
$("#template-value, #template-max, span#matches_value").hide ();
|
||||
$("#template-min, #template-example").show ();
|
||||
|
||||
/* Show example */
|
||||
$("span#example").empty ().append (under);
|
||||
break;
|
||||
default:
|
||||
$("#template-value, #template-max, #template-min").fadeOut ();
|
||||
$("#template-value, #template-max, #template-min, #template-example, span#matches_value").hide ();
|
||||
break;
|
||||
}
|
||||
|
||||
render_example ();
|
||||
});
|
||||
|
||||
$("#checkbox-matches_value").click (function () {
|
||||
enabled = this.checked;
|
||||
type = $("#type").attr ("value");
|
||||
if (type == "regex") {
|
||||
if (enabled) {
|
||||
$("span#example").empty ().append (matches);
|
||||
} else {
|
||||
$("span#example").empty ().append (matches_not);
|
||||
}
|
||||
} else if (type == "max_min") {
|
||||
if (enabled) {
|
||||
$("span#example").empty ().append (between);
|
||||
} else {
|
||||
$("span#example").empty ().append (between_not);
|
||||
}
|
||||
}
|
||||
render_example ();
|
||||
});
|
||||
|
||||
$("#text-value").keyup (check_regex);
|
||||
$("#threshold").change (function () {
|
||||
if (this.value == -1) {
|
||||
$("#text-other_threshold").attr ("value", "");
|
||||
$("#template-threshold-other_label").fadeIn ();
|
||||
$("#template-threshold-other_input").fadeIn ();
|
||||
$("#template-threshold-other_label").show ();
|
||||
$("#template-threshold-other_input").show ();
|
||||
} else {
|
||||
$("#template-threshold-other_label").fadeOut ();
|
||||
$("#template-threshold-other_input").fadeOut ();
|
||||
$("#template-threshold-other_label").hide ();
|
||||
$("#template-threshold-other_input").hide ();
|
||||
}
|
||||
});
|
||||
|
||||
$("#recovery_notify").change (function () {
|
||||
if (this.value == 1) {
|
||||
$("#template-field2, #template-field3").fadeIn ();
|
||||
$("#template-field2, #template-field3").show ();
|
||||
} else {
|
||||
$("#template-field2, #template-field3").fadeOut ();
|
||||
$("#template-field2, #template-field3").hide ();
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -579,13 +737,13 @@ $(document).ready (function () {
|
|||
original_command = html_entity_decode (data["command"]["command"]);
|
||||
render_command_preview ();
|
||||
|
||||
$("#template-field1, #template-field2, #template-field3, #template-preview")
|
||||
.fadeIn ();
|
||||
$("#template-field1, #template-field2, #template-field3, #template-example")
|
||||
.show ();
|
||||
},
|
||||
"json"
|
||||
);
|
||||
} else {
|
||||
$("#template-field1, #template-field2, #template-field3, #template-preview").fadeOut ();
|
||||
$("#template-field1, #template-field2, #template-field3").hide ();
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -313,10 +313,12 @@ function clean_alert_template_values ($values, $set_empty = true) {
|
|||
if (isset ($values['min_alerts']))
|
||||
$retvalues['min_alerts'] = (int) $values['min_alerts'];
|
||||
/* Ensure max an min orders */
|
||||
$max = max ($retvalues['max_alerts'], $retvalues['min_alerts']);
|
||||
$min = min ($retvalues['max_alerts'], $retvalues['min_alerts']);
|
||||
$retvalues['max_alerts'] = $max;
|
||||
$retvalues['min_alerts'] = $min;
|
||||
if (isset ($values['min_alerts']) && isset ($values['max_alerts'])) {
|
||||
$max = max ($retvalues['max_alerts'], $retvalues['min_alerts']);
|
||||
$min = min ($retvalues['max_alerts'], $retvalues['min_alerts']);
|
||||
$retvalues['max_alerts'] = $max;
|
||||
$retvalues['min_alerts'] = $min;
|
||||
}
|
||||
if (isset ($values['monday']))
|
||||
$retvalues['monday'] = (bool) $values['monday'];
|
||||
if (isset ($values['tuesday']))
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -276,7 +276,7 @@ input.copy {
|
|||
input.ok {
|
||||
background: #e5e5e5 url(../../images/ok.png) no-repeat right 3px;
|
||||
}
|
||||
input.ok {
|
||||
input.add {
|
||||
background: #e5e5e5 url(../../images/add.png) no-repeat right 3px;
|
||||
}
|
||||
table, img {
|
||||
|
@ -341,14 +341,15 @@ td.datos_id {
|
|||
color: #fff;
|
||||
text-align: center;
|
||||
}
|
||||
.suc, .error {
|
||||
padding: 4px 1px 6px 30px;
|
||||
}
|
||||
.suc {
|
||||
color: #5a8629;
|
||||
background: url(../../images/suc.png) no-repeat 1px;
|
||||
padding: 4px 1px 6px 30px;
|
||||
}
|
||||
.error {
|
||||
background: url(../../images/err.png) no-repeat;
|
||||
padding: 4px 1px 6px 30px;
|
||||
}
|
||||
.red, .redb, .redi, .error {
|
||||
color: #f00;
|
||||
|
@ -743,3 +744,9 @@ code {
|
|||
select#template, select#action {
|
||||
width: 250px;
|
||||
}
|
||||
.invisible {
|
||||
display: none;
|
||||
}
|
||||
#label-checkbox-matches_value {
|
||||
display: inline;
|
||||
}
|
||||
|
|
|
@ -80,23 +80,28 @@ $config["pure"] = (bool) get_parameter ("pure", 0);
|
|||
$config["refr"] = (int) get_parameter ("refr", 0);
|
||||
if ($config["refr"] > 0) {
|
||||
// Agent selection filters and refresh
|
||||
$query = 'http' . (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == TRUE ? 's': '') . '://' . $_SERVER['SERVER_NAME'];
|
||||
$query = 'http' . (isset ($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == TRUE ? 's': '') . '://' . $_SERVER['SERVER_NAME'];
|
||||
if ($_SERVER['SERVER_PORT'] != 80 && (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == TRUE && $_SERVER['SERVER_PORT'] != 443)) {
|
||||
$query .= ":" . $_SERVER['SERVER_PORT'];
|
||||
}
|
||||
|
||||
$query .= $_SERVER['SCRIPT_NAME'];
|
||||
$query .= '?1=1'; //Some (old) browsers don't like the ?&key=var
|
||||
if (sizeof ($_REQUEST))
|
||||
//Some (old) browsers don't like the ?&key=var
|
||||
$query .= '?1=1';
|
||||
|
||||
//We don't clean these variables up as they're only being passed along
|
||||
foreach ($_GET as $key => $value) {
|
||||
/* Avoid the 1=1 */
|
||||
if ($key == 1)
|
||||
continue;
|
||||
$query .= '&'.$key.'='.$value;
|
||||
}
|
||||
foreach ($_POST as $key => $value) {
|
||||
$query .= '&'.$key.'='.$value;
|
||||
}
|
||||
|
||||
echo '<meta http-equiv="refresh" content="' . $config["refr"] . '; URL=' . $query . '">';
|
||||
echo '<meta http-equiv="refresh" content="'.$config["refr"].'; URL='.$query.'">';
|
||||
}
|
||||
|
||||
enterprise_include ('index.php');
|
||||
|
@ -136,7 +141,6 @@ $page = $sec2; //Reference variable for old time sake
|
|||
|
||||
$sec = get_parameter_get ('sec');
|
||||
$sec = safe_url_extraclean ($sec);
|
||||
|
||||
|
||||
// Login process
|
||||
if (! isset ($_SESSION['id_usuario']) && isset ($_GET["login"])) {
|
||||
|
@ -182,7 +186,7 @@ if (! isset ($_SESSION['id_usuario']) && isset ($_GET["login"])) {
|
|||
|
||||
// Log off
|
||||
if (isset ($_GET["bye"])) {
|
||||
include "general/logoff.php";
|
||||
include ("general/logoff.php");
|
||||
$iduser = $_SESSION["id_usuario"];
|
||||
logoff_db ($iduser, $REMOTE_ADDR);
|
||||
session_unregister ("id_usuario");
|
||||
|
@ -231,7 +235,7 @@ if ($page != "") {
|
|||
}
|
||||
}
|
||||
|
||||
if ($config["pure"] == 0) {
|
||||
if ($config["pure"] == 0) {
|
||||
echo '</div>'; // main
|
||||
echo '<div style="clear:both"> </div>';
|
||||
echo '</div>'; // page (id = page)
|
||||
|
|
|
@ -91,7 +91,7 @@ if (get_parameter ('alert_validate')) {
|
|||
if (! empty ($ids)) {
|
||||
require_once ("include/functions_alerts.php");
|
||||
$result = validate_alert_agent_module ($ids);
|
||||
|
||||
|
||||
print_error_message ($result, __('Alert(s) validated'),
|
||||
__('Error processing alert(s)'));
|
||||
}
|
||||
|
|
|
@ -106,7 +106,6 @@ echo "</form>";
|
|||
?>
|
||||
|
||||
<link rel="stylesheet" href="include/styles/countdown.css" type="text/css" />
|
||||
<script type="text/javascript" src="include/javascript/jquery.js"></script>
|
||||
<script type="text/javascript" src="include/javascript/jquery.countdown.js"></script>
|
||||
<script type="text/javascript" src="include/languages/countdown_<?php echo $config['language']?>.js"></script>
|
||||
<script type="text/javascript" src="include/javascript/pandora_visual_console.js"></script>
|
||||
|
|
|
@ -231,6 +231,7 @@ CREATE TABLE IF NOT EXISTS `talert_templates` (
|
|||
`field3` mediumtext NOT NULL,
|
||||
`type` ENUM ('regex', 'max_min', 'max', 'min', 'equal', 'not_equal'),
|
||||
`value` varchar(255) default '',
|
||||
`matches_value` tinyint(1) default 0,
|
||||
`max_value` double(18,2) default NULL,
|
||||
`min_value` double(18,2) default NULL,
|
||||
`time_threshold` int(10) NOT NULL default '0',
|
||||
|
@ -239,13 +240,13 @@ CREATE TABLE IF NOT EXISTS `talert_templates` (
|
|||
`alert_text` varchar(255) default '',
|
||||
`time_from` time default '00:00:00',
|
||||
`time_to` time default '00:00:00',
|
||||
`monday` tinyint(1) default '1',
|
||||
`tuesday` tinyint(1) default '1',
|
||||
`wednesday` tinyint(1) default '1',
|
||||
`thursday` tinyint(1) default '1',
|
||||
`friday` tinyint(1) default '1',
|
||||
`saturday` tinyint(1) default '1',
|
||||
`sunday` tinyint(1) default '1',
|
||||
`monday` tinyint(1) default 1,
|
||||
`tuesday` tinyint(1) default 1,
|
||||
`wednesday` tinyint(1) default 1,
|
||||
`thursday` tinyint(1) default 1,
|
||||
`friday` tinyint(1) default 1,
|
||||
`saturday` tinyint(1) default 1,
|
||||
`sunday` tinyint(1) default 1,
|
||||
`recovery_notify` tinyint(1) default '0',
|
||||
`field2_recovery` varchar(255) NOT NULL default '',
|
||||
`field3_recovery` mediumtext NOT NULL,
|
||||
|
|
|
@ -50,55 +50,56 @@ CREATE TABLE IF NOT EXISTS `talert_actions` (
|
|||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `talert_templates` (
|
||||
`id` int(10) unsigned NOT NULL auto_increment,
|
||||
`name` varchar(255) default '',
|
||||
`description` mediumtext,
|
||||
`id_alert_action` int(10) unsigned NULL,
|
||||
`field1` varchar(255) default '',
|
||||
`field2` varchar(255) default '',
|
||||
`field3` mediumtext NOT NULL,
|
||||
`type` ENUM ('regex', 'max_min', 'max', 'min', 'equal', 'not_equal'),
|
||||
`value` varchar(255) default '',
|
||||
`max_value` double(18,2) default NULL,
|
||||
`min_value` double(18,2) default NULL,
|
||||
`time_threshold` int(10) NOT NULL default '0',
|
||||
`max_alerts` int(4) unsigned NOT NULL default '1',
|
||||
`module_type` int(10) unsigned NOT NULL default '0',
|
||||
`min_alerts` int(4) unsigned NOT NULL default '0',
|
||||
`alert_text` varchar(255) default '',
|
||||
`time_from` time default '00:00:00',
|
||||
`time_to` time default '00:00:00',
|
||||
`monday` tinyint(1) default '1',
|
||||
`tuesday` tinyint(1) default '1',
|
||||
`wednesday` tinyint(1) default '1',
|
||||
`thursday` tinyint(1) default '1',
|
||||
`friday` tinyint(1) default '1',
|
||||
`saturday` tinyint(1) default '1',
|
||||
`sunday` tinyint(1) default '1',
|
||||
`recovery_notify` tinyint(1) default '0',
|
||||
`field2_recovery` varchar(255) NOT NULL default '',
|
||||
`field3_recovery` mediumtext NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
FOREIGN KEY (`id_alert_action`) REFERENCES talert_actions(`id`)
|
||||
ON DELETE RESTRICT ON UPDATE CASCADE
|
||||
`id` int(10) unsigned NOT NULL auto_increment,
|
||||
`name` varchar(255) default '',
|
||||
`description` mediumtext default '',
|
||||
`id_alert_action` int(10) unsigned NULL,
|
||||
`field1` varchar(255) default '',
|
||||
`field2` varchar(255) default '',
|
||||
`field3` mediumtext NOT NULL,
|
||||
`type` ENUM ('regex', 'max_min', 'max', 'min', 'equal', 'not_equal'),
|
||||
`value` varchar(255) default '',
|
||||
`matches_value` tinyint(1) default 0,
|
||||
`max_value` double(18,2) default NULL,
|
||||
`min_value` double(18,2) default NULL,
|
||||
`time_threshold` int(10) NOT NULL default '0',
|
||||
`max_alerts` int(4) unsigned NOT NULL default '1',
|
||||
`min_alerts` int(4) unsigned NOT NULL default '0',
|
||||
`alert_text` varchar(255) default '',
|
||||
`time_from` time default '00:00:00',
|
||||
`time_to` time default '00:00:00',
|
||||
`monday` tinyint(1) default 1,
|
||||
`tuesday` tinyint(1) default 1,
|
||||
`wednesday` tinyint(1) default 1,
|
||||
`thursday` tinyint(1) default 1,
|
||||
`friday` tinyint(1) default 1,
|
||||
`saturday` tinyint(1) default 1,
|
||||
`sunday` tinyint(1) default 1,
|
||||
`recovery_notify` tinyint(1) default '0',
|
||||
`field2_recovery` varchar(255) NOT NULL default '',
|
||||
`field3_recovery` mediumtext NOT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
FOREIGN KEY (`id_alert_action`) REFERENCES talert_actions(`id`)
|
||||
ON DELETE RESTRICT ON UPDATE CASCADE
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `talert_template_modules` (
|
||||
`id` int(10) unsigned NOT NULL auto_increment,
|
||||
`id_agent_module` int(10) unsigned NOT NULL,
|
||||
`id_alert_template` int(10) unsigned NOT NULL,
|
||||
`internal_counter` int(4) default '0',
|
||||
`last_fired` bigint(20) NOT NULL default '0',
|
||||
`times_fired` int(3) NOT NULL default '0',
|
||||
`disabled` tinyint(1) default '0',
|
||||
`priority` tinyint(4) default '0',
|
||||
`force_execution` tinyint(1) default '0',
|
||||
PRIMARY KEY (`id`),
|
||||
FOREIGN KEY (`id_agent_module`) REFERENCES tagente_modulo(`id_agente_modulo`)
|
||||
ON DELETE CASCADE ON UPDATE CASCADE,
|
||||
FOREIGN KEY (`id_alert_template`) REFERENCES talert_templates(`id`)
|
||||
ON DELETE RESTRICT ON UPDATE CASCADE,
|
||||
UNIQUE (`id_agent_module`, `id_alert_template`)
|
||||
`id` int(10) unsigned NOT NULL auto_increment,
|
||||
`id_agent_module` int(10) unsigned NOT NULL,
|
||||
`id_alert_template` int(10) unsigned NOT NULL,
|
||||
`internal_counter` int(4) default '0',
|
||||
`last_fired` bigint(20) NOT NULL default '0',
|
||||
`last_reference` bigint(20) NOT NULL default '0',
|
||||
`times_fired` int(3) NOT NULL default '0',
|
||||
`disabled` tinyint(1) default '0',
|
||||
`priority` tinyint(4) default '0',
|
||||
`force_execution` tinyint(1) default '0',
|
||||
PRIMARY KEY (`id`),
|
||||
FOREIGN KEY (`id_agent_module`) REFERENCES tagente_modulo(`id_agente_modulo`)
|
||||
ON DELETE CASCADE ON UPDATE CASCADE,
|
||||
FOREIGN KEY (`id_alert_template`) REFERENCES talert_templates(`id`)
|
||||
ON DELETE RESTRICT ON UPDATE CASCADE,
|
||||
UNIQUE (`id_agent_module`, `id_alert_template`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS `talert_template_module_actions` (
|
||||
|
|
Loading…
Reference in New Issue