2013-07-17 Miguel de Dios <miguel.dedios@artica.es>

* godmode/agentes/configurar_agente.php: fixed the default value for
	"prediction_module" in tagente_module.
	
	* include/graphs/functions_flot.php,
	include/graphs/functions_pchart.php,
	include/graphs/functions_gd.php, include/graphs/functions_utils.php,
	include/javascript/pandora_alerts.js,
	include/javascript/pandora_modules.js,
	include/javascript/pandora_events.js,
	include/functions_network_components.php: cleaned source code style.




git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@8535 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2013-07-17 11:12:37 +00:00
parent fdc49c33ad
commit 6eb071f615
10 changed files with 78 additions and 64 deletions

View File

@ -1,3 +1,16 @@
2013-07-17 Miguel de Dios <miguel.dedios@artica.es>
* godmode/agentes/configurar_agente.php: fixed the default value for
"prediction_module" in tagente_module.
* include/graphs/functions_flot.php,
include/graphs/functions_pchart.php,
include/graphs/functions_gd.php, include/graphs/functions_utils.php,
include/javascript/pandora_alerts.js,
include/javascript/pandora_modules.js,
include/javascript/pandora_events.js,
include/functions_network_components.php: cleaned source code style.
2013-07-17 Sergio Martin <sergio.martin@artica.es>
* operation/agentes/status_monitor.php

View File

@ -741,7 +741,7 @@ if ($update_module || $create_module) {
// 1.23E-10 is 0.000000000123
$post_process = (string) get_parameter ('post_process', 0.0);
$prediction_module = 1;
$prediction_module = 0;
$max_timeout = (int) get_parameter ('max_timeout');
$max_retries = (int) get_parameter ('max_retries');
$min = (int) get_parameter_post ("min");

View File

@ -226,7 +226,7 @@ function network_components_get_network_component ($id_network_component, $filte
$network_component = db_get_row_filter ('tnetwork_component', $filter, $fields);
if(!empty($network_component) && $network_component['id_category'] != 0) {
if (!empty($network_component) && $network_component['id_category'] != 0) {
$network_component['category_name'] = (string) db_get_value('name','tcategory','id',$network_component['id_category']);
}

View File

@ -61,7 +61,7 @@ function include_javascript_dependencies_flot_graph($return = false) {
percent = parseFloat(obj.series.percent).toFixed(2);
$('#hover').html('<span style=\'font-weight: bold; color: '+obj.series.color+'\'>'+obj.series.label+' ('+percent+'%)</span>');
$('.legendLabel').each(function() {
if($(this).html() == obj.series.label) {
if ($(this).html() == obj.series.label) {
$(this).css('font-weight','bold');
}
else {
@ -344,7 +344,7 @@ function flot_pie_chart ($values, $labels, $width, $height, $water_mark,
$return = "<div id='$graph_id' class='graph' style='width: ".$width."px; height: ".$height."px;'></div>";
if($water_mark != '') {
if ($water_mark != '') {
$return .= "<div id='watermark_$graph_id' style='display:none; position:absolute;'><img id='watermark_image_$graph_id' src='$water_mark'></div>";
$water_mark = 'true';
}
@ -356,7 +356,7 @@ function flot_pie_chart ($values, $labels, $width, $height, $water_mark,
$labels = implode($separator, $labels);
$values = implode($separator, $values);
if(!empty($colors)) {
if (!empty($colors)) {
$colors = implode($separator, $colors);
}
@ -417,8 +417,8 @@ function flot_hcolumn_chart ($graph_data, $width, $height, $water_mark) {
$jsvar = "data_".$graph_id."_".$key;
if ($multicolor) {
for($j = count($graph_data) - 1; $j>=0; $j--) {
if($j == $i) {
for ($j = count($graph_data) - 1; $j>=0; $j--) {
if ($j == $i) {
$data[$jsvar.$i][$j] = $value;
}
else {
@ -431,7 +431,7 @@ function flot_hcolumn_chart ($graph_data, $width, $height, $water_mark) {
}
$return .= "<div id='value_".$i."_$graph_id' class='values_$graph_id' style='color: #000; position:absolute;'>$value</div>";
if($value > $max) {
if ($value > $max) {
$max = $value;
}
}
@ -522,9 +522,9 @@ function flot_vcolumn_chart ($graph_data, $width, $height, $color, $legend, $lon
foreach ($values as $key => $value) {
$jsvar = "data_".$graph_id."_".$key;
if($multicolor) {
for($j = count($graph_data) - 1; $j>=0; $j--) {
if($j == $i) {
if ($multicolor) {
for ($j = count($graph_data) - 1; $j>=0; $j--) {
if ($j == $i) {
$data[$jsvar.$i][$j] = $value;
}
else {
@ -623,7 +623,7 @@ function flot_slicesbar_graph ($graph_data, $period, $width, $height, $legend, $
$i_aux = $i;
while(1) {
if($i_aux <= $maxticks ) {
if ($i_aux <= $maxticks ) {
break;
}
@ -636,13 +636,13 @@ function flot_slicesbar_graph ($graph_data, $period, $width, $height, $legend, $
$acumulate = 0;
$c = 0;
$acumulate_data = array();
foreach($graph_data as $label => $values) {
foreach ($graph_data as $label => $values) {
$labels[] = io_safe_output($label);
$i--;
foreach($values as $key => $value) {
foreach ($values as $key => $value) {
$jsvar = "d_".$graph_id."_".$i;
if($key == 'data') {
if ($key == 'data') {
$datacolor[$jsvar] = $colors[$value];
continue;
}
@ -653,7 +653,7 @@ function flot_slicesbar_graph ($graph_data, $period, $width, $height, $legend, $
$c++;
//$return .= "<div id='value_".$i."_$graph_id' class='values_$graph_id' style='color: #000; position:absolute;'>$value</div>";
if($value > $max) {
if ($value > $max) {
$max = $value;
}
}

View File

@ -30,7 +30,7 @@ $types = array('histogram', 'progressbar');
$id_graph = get_parameter('id_graph', false);
$graph_type = get_parameter('graph_type', '');
if($id_graph && in_array($graph_type, $types)) {
if ($id_graph && in_array($graph_type, $types)) {
if (!$id_graph) {
exit;
@ -136,7 +136,7 @@ function gd_histogram ($width, $height, $mode, $data, $max_value, $font, $title,
$margin_up += $rectangle_height + 1;
$c++;
if(!isset($colors[$c])) {
if (!isset($colors[$c])) {
$c = 0;
}
}
@ -161,11 +161,11 @@ function gd_histogram ($width, $height, $mode, $data, $max_value, $font, $title,
// Draw a dynamic progress bubble using GDlib directly
// ***************************************************************************
function gd_progress_bubble ($width, $height, $progress, $title, $font, $out_of_lim_str, $out_of_lim_image, $mode = 1, $fontsize=10, $value_text = '', $colorRGB = '') {
if($out_of_lim_str === false) {
if ($out_of_lim_str === false) {
$out_of_lim_str = __("Out of limits");
}
if($out_of_lim_image === false) {
if ($out_of_lim_image === false) {
$out_of_lim_image = "images_graphs/outlimits.png";
}
@ -231,7 +231,7 @@ function gd_progress_bubble ($width, $height, $progress, $title, $font, $out_of_
imagefilledellipse($image, $width / 2, $height / 2,
$ratingWidth, $ratingHeight, $soft_red);
}
else if($rating > 0) {
else if ($rating > 0) {
imagefilledellipse($image, $width / 2, $height / 2,
$ratingWidth, $ratingHeight, $other_red);
}
@ -342,8 +342,8 @@ function gd_progress_bar ($width, $height, $progress, $title, $font, $out_of_lim
ImageRectangleWithRoundedCorners($image, $x1, $y1, $x2, $y2, $radius, $soft_red);
$bordercolor = $soft_red_border;
}
else if($rating > 0) {
if($radius != 0) {
else if ($rating > 0) {
if ($radius != 0) {
$x2 = $ratingbar30;
}
ImageRectangleWithRoundedCorners($image, $x1, $y1, $x2, $y2, $radius, $other_red);
@ -358,8 +358,8 @@ function gd_progress_bar ($width, $height, $progress, $title, $font, $out_of_lim
ImageRectangleWithRoundedCorners($image, $x1, $y1, $x2, $y2, $radius,$red);
elseif ($rating == 100)
ImageRectangleWithRoundedCorners($image, $x1, $y1, $x2, $y2, $radius,$green);
else if($rating > 0){
if($radius != 0 && $rating < 30) {
else if ($rating > 0){
if ($radius != 0 && $rating < 30) {
$x2 = $ratingbar30;
}
ImageRectangleWithRoundedCorners($image, $x1, $y1, $x2, $y2, $radius,$blue);
@ -383,8 +383,8 @@ function gd_progress_bar ($width, $height, $progress, $title, $font, $out_of_lim
ImageRectangleWithRoundedCorners($image, $x1, $y1, $x2, $y2, $radius, $soft_red);
elseif ($rating > 30)
ImageRectangleWithRoundedCorners($image, $x1, $y1, $x2, $y2, $radius, $soft_yellow);
else if($rating > 0) {
if($radius != 0) {
else if ($rating > 0) {
if ($radius != 0) {
$x2 = $ratingbar30;
}
ImageRectangleWithRoundedCorners($image, $x1, $y1, $x2, $y2, $radius, $soft_green);
@ -392,7 +392,7 @@ function gd_progress_bar ($width, $height, $progress, $title, $font, $out_of_lim
break;
}
if($bordercolor !== false) {
if ($bordercolor !== false) {
$x1-=1;
$x2 = $width-2;
imageline($image, $x1+$radius, $y1, $x2-$radius, $y1, $bordercolor);

View File

@ -136,7 +136,7 @@ if ($force_steps) {
$pixels_between_xdata = 50;
$max_xdata_display = round($width / $pixels_between_xdata);
$ndata = count($data);
if($max_xdata_display > $ndata) {
if ($max_xdata_display > $ndata) {
$xdata_display = $ndata;
}
else {
@ -522,10 +522,10 @@ function pch_bar_graph ($graph_type, $index, $data, $width, $height, $font,
}
// Assign cyclic colors to bars if are setted
if($fine_colors) {
if ($fine_colors) {
$c = 0;
foreach($values as $ii => $vv) {
if(!isset($fine_colors[$c])) {
foreach ($values as $ii => $vv) {
if (!isset($fine_colors[$c])) {
$c = 0;
}
$overridePalette[$ii] = $fine_colors[$c];
@ -600,7 +600,7 @@ function pch_bar_graph ($graph_type, $index, $data, $width, $height, $font,
$myPicture->drawScale($scaleSettings);
if(isset($legend)) {
if (isset($legend)) {
/* Write the chart legend */
$size = $myPicture->getLegendSize(array("Style"=>LEGEND_NOBORDER,"Mode"=>LEGEND_HORIZONTAL));
$myPicture->drawLegend($width-$size['Width'],0,array("Style"=>LEGEND_NOBORDER,"Mode"=>LEGEND_HORIZONTAL, "BoxWidth"=>10, "BoxHeight"=>10));
@ -710,7 +710,7 @@ function pch_vertical_graph ($graph_type, $index, $data, $width, $height,
/* Set horizontal legend if is posible */
$legend_mode = LEGEND_HORIZONTAL;
$size = $myPicture->getLegendSize(array("Style"=>LEGEND_NOBORDER,"Mode"=>$legend_mode));
if($size['Width'] > ($width - 5)) {
if ($size['Width'] > ($width - 5)) {
$legend_mode = LEGEND_VERTICAL;
$size = $myPicture->getLegendSize(array("Style"=>LEGEND_NOBORDER,"Mode"=>$legend_mode));
}
@ -891,7 +891,7 @@ function pch_threshold_graph ($graph_type, $index, $data, $width, $height, $font
$myPicture->drawSplineChart($settings);
$myPicture->setShadow(FALSE);
if($show_legend) {
if ($show_legend) {
/* Write the chart legend */
$myPicture->drawLegend(643,210,array("Style"=>LEGEND_NOBORDER,"Mode"=>LEGEND_HORIZONTAL));
}

View File

@ -51,7 +51,7 @@ function unserialize_in_temp($serial_id = null, $delete = true, $ttl = 1) {
$array = json_decode($content, true);
if ($delete) {
if($volume == $ttl) {
if ($volume == $ttl) {
unlink($file_path);
}
else {

View File

@ -19,8 +19,9 @@ function parse_alert_command (command) {
function render_command_preview (original_command) {
$("#textarea_command_preview").text (parse_alert_command (original_command));
}
function render_command_description (command_description) {
if(command_description != '') {
if (command_description != '') {
command_description = '<br>'+command_description;
}
$("#command_description").html(command_description);

View File

@ -319,8 +319,8 @@ function get_response_target(event_id, response_id, server_id) {
// Replace the custom params macros
var response_params = get_response_params(response_id);
if(response_params.length > 1 || response_params[0] != '') {
for(i=0;i<response_params.length;i++) {
if (response_params.length > 1 || response_params[0] != '') {
for (i = 0; i < response_params.length; i++) {
target = target.replace('_'+response_params[i]+'_',$('#'+response_params[i]).val());
}
}
@ -331,7 +331,7 @@ function get_response_target(event_id, response_id, server_id) {
// Perform a response and put the output into a div
function perform_response(target) {
var ajax_file = $('#hidden-ajax_file').val();
$('#re_exec_command').hide();
$('#response_loading_command').show();
$('#response_out').html('');
@ -394,12 +394,12 @@ function event_change_status(event_ids) {
$('#button-status_button').removeAttr('disabled');
$('#response_loading').hide();
show_event_dialog(event_id, $('#hidden-group_rep').val(), 'responses', data);
if(data == 'status_ok') {
if (data == 'status_ok') {
}
else {
}
}
});
});
return false;
}
@ -444,13 +444,13 @@ function event_change_owner() {
// Save a comment into an event
function event_comment() {
var ajax_file = $('#hidden-ajax_file').val();
var event_id = $('#hidden-id_event').val();
var comment = $('#textarea_comment').val();
var meta = $('#hidden-meta').val();
var history = $('#hidden-history').val();
if(comment == '') {
if (comment == '') {
show_event_dialog(event_id, $('#hidden-group_rep').val(), 'comments', 'comment_error');
return false;
}
@ -465,7 +465,7 @@ function event_comment() {
$('#button-comment_button').attr('disabled','disabled');
$('#response_loading').show();
jQuery.ajax ({
data: params.join ("&"),
type: 'POST',
@ -479,7 +479,7 @@ function event_comment() {
show_event_dialog(event_id, $('#hidden-group_rep').val(), 'comments', data);
}
});
});
return false;
}

View File

@ -117,7 +117,7 @@ function configure_modules_form () {
$("#text-max").attr ("value", data["max"]);
$("#text-min").attr ("value", data["min"]);
// Workaround to update the advanced select control from html and ajax
if(typeof 'period_select_module_interval_update' == 'function') {
if (typeof 'period_select_module_interval_update' == 'function') {
period_select_module_interval_update(data["module_interval"]);
}
else {
@ -154,32 +154,32 @@ function configure_modules_form () {
// Reset the selection of tags (put all of them into available box)
$("#id_tag_selected option").each(function(){
if($(this).attr('value') != '') {
if ($(this).attr('value') != '') {
$("#id_tag_selected").find("option[value='" + $(this).attr('value') + "']").remove();
$("select[name='id_tag_available[]']").append($("<option></option>").val($(this).attr('value')).html($(this).text()));
}
});
if($("#id_tag_available option").length > 1) {
if ($("#id_tag_available option").length > 1) {
$("#id_tag_available").find("option[value='']").remove();
}
if($("#id_tag_selected option").length == 0) {
if ($("#id_tag_selected option").length == 0) {
$("select[name='id_tag_selected[]']").append($("<option></option>").val('').html('<i>None</i>'));
}
if(tags != '') {
if (tags != '') {
tags = tags.split(',');
// Fill the selected tags box with select ones
for(i=0; i<tags.length; i++){
for (i = 0; i < tags.length; i++){
$("#id_tag_available option").each(function(){
if(tags[i] == $(this).text()) {
if (tags[i] == $(this).text()) {
$("#id_tag_available").find("option[value='" + $(this).attr('value') + "']").remove();
$("select[name='id_tag_selected[]']").append($("<option></option>").val($(this).attr('value')).html($(this).text()));
$("#id_tag_selected").find("option[value='']").remove();
}
});
if($("#id_tag_available option").length == 0) {
if ($("#id_tag_available option").length == 0) {
$("select[name='id_tag_available[]']").append($("<option></option>").val('').html('<i>None</i>'));
}
}
@ -192,7 +192,7 @@ function configure_modules_form () {
var legend = '';
// If exist macros, load the fields
if(data["macros"] != '' && data["macros"] != null) {
if (data["macros"] != '' && data["macros"] != null) {
$('#hidden-macros').val(Base64.encode(data["macros"]));
var obj = jQuery.parseJSON(data["macros"]);
@ -237,7 +237,7 @@ function configure_modules_form () {
$("#text-max").attr ("value", data["max"]);
$("#text-min").attr ("value", data["min"]);
// Workaround to update the advanced select control from html and ajax
if(typeof 'period_select_module_interval_update' == 'function') {
if (typeof 'period_select_module_interval_update' == 'function') {
period_select_module_interval_update(data["module_interval"]);
}
else {
@ -287,7 +287,7 @@ function configure_modules_form () {
// Reset the selection of tags (put all of them into available box)
$("#id_tag_selected option").each(function(){
if($(this).attr('value') != '') {
if ($(this).attr('value') != '') {
$("#id_tag_selected").find("option[value='" + $(this).attr('value') + "']").remove();
$("select[name='id_tag_available[]']").append($("<option></option>").val($(this).attr('value')).html($(this).text()));
}
@ -303,16 +303,16 @@ function configure_modules_form () {
tags = tags.split(',');
// Fill the selected tags box with select ones
for(i=0; i<tags.length; i++){
for (i = 0; i < tags.length; i++){
$("#id_tag_available option").each(function(){
if(tags[i] == $(this).text()) {
if (tags[i] == $(this).text()) {
$("#id_tag_available").find("option[value='" + $(this).attr('value') + "']").remove();
$("select[name='id_tag_selected[]']").append($("<option></option>").val($(this).attr('value')).html($(this).text()));
$("#id_tag_selected").find("option[value='']").remove();
}
});
if($("#id_tag_available option").length == 0) {
if ($("#id_tag_available option").length == 0) {
$("select[name='id_tag_available[]']").append($("<option></option>").val('').html('<i>None</i>'));
}
}
@ -324,7 +324,7 @@ function configure_modules_form () {
$('#hidden-macros').val('');
// If exist macros, load the fields
if(data["macros"] != '' && data["macros"] != null) {
if (data["macros"] != '' && data["macros"] != null) {
$('#hidden-macros').val(Base64.encode(data["macros"]));
var obj = jQuery.parseJSON(data["macros"]);
@ -407,7 +407,7 @@ function configure_modules_form () {
return true;
});
if(typeof $("#prediction_id_group").pandoraSelectGroupAgent == 'function') {
if (typeof $("#prediction_id_group").pandoraSelectGroupAgent == 'function') {
$("#prediction_id_group").pandoraSelectGroupAgent ({
agentSelect: "select#prediction_id_agent",
callbackBefore: function () {
@ -610,7 +610,7 @@ function load_plugin_macros_fields(row_model_id) {
if (data['array'] != null) {
$('#hidden-macros').val(data['base64']);
jQuery.each (data['array'], function (i, macro) {
if(macro['desc'] != '') {
if (macro['desc'] != '') {
add_macro_field(macro, row_model_id);
}
});