2013-03-12 Miguel de Dios <miguel.dedios@artica.es>

* godmode/modules/manage_network_components_form.php,
	godmode/modules/manage_network_templates_form.php: improved the code
	style.
	
	* extensions/update_manager/lib/functions.ajax.php,
	include/graphs/functions_flot.php: fixed the warnings PHP messages.
	
	Fixes: #3607177




git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7838 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2013-03-12 16:20:53 +00:00
parent c17b95ffee
commit 5547e637af
5 changed files with 92 additions and 69 deletions

View File

@ -1,3 +1,14 @@
2013-03-12 Miguel de Dios <miguel.dedios@artica.es>
* godmode/modules/manage_network_components_form.php,
godmode/modules/manage_network_templates_form.php: improved the code
style.
* extensions/update_manager/lib/functions.ajax.php,
include/graphs/functions_flot.php: fixed the warnings PHP messages.
Fixes: #3607177
2013-03-11 Miguel de Dios <miguel.dedios@artica.es> 2013-03-11 Miguel de Dios <miguel.dedios@artica.es>
* extensions/update_manager/lib/functions.ajax.php: disabled the * extensions/update_manager/lib/functions.ajax.php: disabled the

View File

@ -110,7 +110,11 @@ function update_pandora_get_packages_online_ajax($ajax = true) {
$return['last'] = $last; $return['last'] = $last;
$return['package'] = $package; $return['package'] = $package;
$return['timestamp'] = date($config["date_format"], $timestamp); if (!isset($config["date_format"]))
$default_date_format = "F j, Y, g:i a";
else
$default_date_format = $config["date_format"];
$return['timestamp'] = date($default_date_format, $timestamp);
$return['text_adv'] = html_print_image('images/world.png', true); $return['text_adv'] = html_print_image('images/world.png', true);
$return['end'] = 1; $return['end'] = 1;
} }

View File

@ -435,150 +435,154 @@ $(document).ready (function () {
$("input[name=snmp3_privacy_pass]").css({backgroundColor: '#fff'}); $("input[name=snmp3_privacy_pass]").css({backgroundColor: '#fff'});
$("input[name=snmp3_privacy_pass]").removeAttr('disabled'); $("input[name=snmp3_privacy_pass]").removeAttr('disabled');
$("#snmp3_auth_method").css({backgroundColor: '#fff'}); $("#snmp3_auth_method").css({backgroundColor: '#fff'});
$("#snmp3_auth_method").removeAttr('disabled'); $("#snmp3_auth_method").removeAttr('disabled');
$("#snmp3_security_level").css({backgroundColor: '#fff'}); $("#snmp3_security_level").css({backgroundColor: '#fff'});
$("#snmp3_security_level").removeAttr('disabled'); $("#snmp3_security_level").removeAttr('disabled');
$("input[name=active_snmp_v3]").val(1); $("input[name=active_snmp_v3]").val(1);
$("input[name=snmp_community]").css({backgroundColor: '#ddd'}); $("input[name=snmp_community]").css({backgroundColor: '#ddd'});
$("input[name=snmp_community]").attr("disabled",true); $("input[name=snmp_community]").attr("disabled",true);
} }
else{ else{
$("input[name=snmp3_auth_user]").val(""); $("input[name=snmp3_auth_user]").val("");
$("input[name=snmp3_auth_user]").css({backgroundColor: '#ddd'}); $("input[name=snmp3_auth_user]").css({backgroundColor: '#ddd'});
$("input[name=snmp3_auth_user]").attr("disabled", true); $("input[name=snmp3_auth_user]").attr("disabled", true);
$("input[name=snmp3_auth_pass]").val(""); $("input[name=snmp3_auth_pass]").val("");
$("input[name=snmp3_auth_pass]").css({backgroundColor: '#ddd'}); $("input[name=snmp3_auth_pass]").css({backgroundColor: '#ddd'});
$("input[name=snmp3_auth_pass]").attr("disabled", true); $("input[name=snmp3_auth_pass]").attr("disabled", true);
$("#snmp3_privacy_method").css({backgroundColor: '#ddd'}); $("#snmp3_privacy_method").css({backgroundColor: '#ddd'});
$("#snmp3_privacy_method").attr("disabled", true); $("#snmp3_privacy_method").attr("disabled", true);
$("input[name=snmp3_privacy_pass]").val(""); $("input[name=snmp3_privacy_pass]").val("");
$("input[name=snmp3_privacy_pass]").css({backgroundColor: '#ddd'}); $("input[name=snmp3_privacy_pass]").css({backgroundColor: '#ddd'});
$("input[name=snmp3_privacy_pass]").attr("disabled", true); $("input[name=snmp3_privacy_pass]").attr("disabled", true);
$("#snmp3_auth_method").css({backgroundColor: '#ddd'}); $("#snmp3_auth_method").css({backgroundColor: '#ddd'});
$("#snmp3_auth_method").attr("disabled", true); $("#snmp3_auth_method").attr("disabled", true);
$("#snmp3_security_level").css({backgroundColor: '#ddd'}); $("#snmp3_security_level").css({backgroundColor: '#ddd'});
$("#snmp3_security_level").attr("disabled", true); $("#snmp3_security_level").attr("disabled", true);
$("input[name=active_snmp_v3]").val(0); $("input[name=active_snmp_v3]").val(0);
$("input[name=snmp_community]").css({backgroundColor: '#fff'}); $("input[name=snmp_community]").css({backgroundColor: '#fff'});
$("input[name=snmp_community]").removeAttr('disabled'); $("input[name=snmp_community]").removeAttr('disabled');
} }
$("#snmp_version").change(function () { $("#snmp_version").change(function () {
if (this.value == "3") { if (this.value == "3") {
$("input[name=snmp3_auth_user]").css({backgroundColor: '#fff'}); $("input[name=snmp3_auth_user]").css({backgroundColor: '#fff'});
$("input[name=snmp3_auth_user]").removeAttr('disabled'); $("input[name=snmp3_auth_user]").removeAttr('disabled');
$("input[name=snmp3_auth_pass]").css({backgroundColor: '#fff'}); $("input[name=snmp3_auth_pass]").css({backgroundColor: '#fff'});
$("input[name=snmp3_auth_pass]").removeAttr('disabled'); $("input[name=snmp3_auth_pass]").removeAttr('disabled');
$("#snmp3_privacy_method").css({backgroundColor: '#fff'}); $("#snmp3_privacy_method").css({backgroundColor: '#fff'});
$("#snmp3_privacy_method").removeAttr('disabled'); $("#snmp3_privacy_method").removeAttr('disabled');
$("input[name=snmp3_privacy_pass]").css({backgroundColor: '#fff'}); $("input[name=snmp3_privacy_pass]").css({backgroundColor: '#fff'});
$("input[name=snmp3_privacy_pass]").removeAttr('disabled'); $("input[name=snmp3_privacy_pass]").removeAttr('disabled');
$("#snmp3_auth_method").css({backgroundColor: '#fff'}); $("#snmp3_auth_method").css({backgroundColor: '#fff'});
$("#snmp3_auth_method").removeAttr('disabled'); $("#snmp3_auth_method").removeAttr('disabled');
$("#snmp3_security_level").css({backgroundColor: '#fff'}); $("#snmp3_security_level").css({backgroundColor: '#fff'});
$("#snmp3_security_level").removeAttr('disabled'); $("#snmp3_security_level").removeAttr('disabled');
$("input[name=active_snmp_v3]").val(1); $("input[name=active_snmp_v3]").val(1);
$("input[name=snmp_community]").css({backgroundColor: '#ddd'}); $("input[name=snmp_community]").css({backgroundColor: '#ddd'});
$("input[name=snmp_community]").attr("disabled",true); $("input[name=snmp_community]").attr("disabled",true);
} }
else { else {
$("input[name=snmp3_auth_user]").val(""); $("input[name=snmp3_auth_user]").val("");
$("input[name=snmp3_auth_user]").css({backgroundColor: '#ddd'}); $("input[name=snmp3_auth_user]").css({backgroundColor: '#ddd'});
$("input[name=snmp3_auth_user]").attr("disabled", true); $("input[name=snmp3_auth_user]").attr("disabled", true);
$("input[name=snmp3_auth_pass]").val(""); $("input[name=snmp3_auth_pass]").val("");
$("input[name=snmp3_auth_pass]").css({backgroundColor: '#ddd'}); $("input[name=snmp3_auth_pass]").css({backgroundColor: '#ddd'});
$("input[name=snmp3_auth_pass]").attr("disabled", true); $("input[name=snmp3_auth_pass]").attr("disabled", true);
$("#snmp3_privacy_method").css({backgroundColor: '#ddd'}); $("#snmp3_privacy_method").css({backgroundColor: '#ddd'});
$("#snmp3_privacy_method").attr("disabled", true); $("#snmp3_privacy_method").attr("disabled", true);
$("input[name=snmp3_privacy_pass]").val(""); $("input[name=snmp3_privacy_pass]").val("");
$("input[name=snmp3_privacy_pass]").css({backgroundColor: '#ddd'}); $("input[name=snmp3_privacy_pass]").css({backgroundColor: '#ddd'});
$("input[name=snmp3_privacy_pass]").attr("disabled", true); $("input[name=snmp3_privacy_pass]").attr("disabled", true);
$("#snmp3_auth_method").css({backgroundColor: '#ddd'}); $("#snmp3_auth_method").css({backgroundColor: '#ddd'});
$("#snmp3_auth_method").attr("disabled", true); $("#snmp3_auth_method").attr("disabled", true);
$("#snmp3_security_level").css({backgroundColor: '#ddd'}); $("#snmp3_security_level").css({backgroundColor: '#ddd'});
$("#snmp3_security_level").attr("disabled", true); $("#snmp3_security_level").attr("disabled", true);
$("input[name=active_snmp_v3]").val(0); $("input[name=active_snmp_v3]").val(0);
$("input[name=snmp_community]").css({backgroundColor: '#fff'}); $("input[name=snmp_community]").css({backgroundColor: '#fff'});
$("input[name=snmp_community]").removeAttr('disabled'); $("input[name=snmp_community]").removeAttr('disabled');
} }
}); });
$("#type"). change(function () { $("#type"). change(function () {
if ($("#snmp_version").value == "3") { if ($("#snmp_version").value == "3") {
$("input[name=snmp3_auth_user]").css({backgroundColor: '#fff'}); $("input[name=snmp3_auth_user]").css({backgroundColor: '#fff'});
$("input[name=snmp3_auth_user]").removeAttr('disabled'); $("input[name=snmp3_auth_user]").removeAttr('disabled');
$("input[name=snmp3_auth_pass]").css({backgroundColor: '#fff'}); $("input[name=snmp3_auth_pass]").css({backgroundColor: '#fff'});
$("input[name=snmp3_auth_pass]").removeAttr('disabled'); $("input[name=snmp3_auth_pass]").removeAttr('disabled');
$("#snmp3_privacy_method").css({backgroundColor: '#fff'}); $("#snmp3_privacy_method").css({backgroundColor: '#fff'});
$("#snmp3_privacy_method").removeAttr('disabled'); $("#snmp3_privacy_method").removeAttr('disabled');
$("input[name=snmp3_privacy_pass]").css({backgroundColor: '#fff'}); $("input[name=snmp3_privacy_pass]").css({backgroundColor: '#fff'});
$("input[name=snmp3_privacy_pass]").removeAttr('disabled'); $("input[name=snmp3_privacy_pass]").removeAttr('disabled');
$("#snmp3_auth_method").css({backgroundColor: '#fff'}); $("#snmp3_auth_method").css({backgroundColor: '#fff'});
$("#snmp3_auth_method").removeAttr('disabled'); $("#snmp3_auth_method").removeAttr('disabled');
$("#snmp3_security_level").css({backgroundColor: '#fff'}); $("#snmp3_security_level").css({backgroundColor: '#fff'});
$("#snmp3_security_level").removeAttr('disabled'); $("#snmp3_security_level").removeAttr('disabled');
$("input[name=active_snmp_v3]").val(1); $("input[name=active_snmp_v3]").val(1);
$("input[name=snmp_community]").css({backgroundColor: '#ddd'}); $("input[name=snmp_community]").css({backgroundColor: '#ddd'});
$("input[name=snmp_community]").attr("disabled",true); $("input[name=snmp_community]").attr("disabled",true);
} }
else { else {
$("input[name=snmp3_auth_user]").val(""); $("input[name=snmp3_auth_user]").val("");
$("input[name=snmp3_auth_user]").css({backgroundColor: '#ddd'}); $("input[name=snmp3_auth_user]").css({backgroundColor: '#ddd'});
$("input[name=snmp3_auth_user]").attr("disabled", true); $("input[name=snmp3_auth_user]").attr("disabled", true);
$("input[name=snmp3_auth_pass]").val(""); $("input[name=snmp3_auth_pass]").val("");
$("input[name=snmp3_auth_pass]").css({backgroundColor: '#ddd'}); $("input[name=snmp3_auth_pass]").css({backgroundColor: '#ddd'});
$("input[name=snmp3_auth_pass]").attr("disabled", true); $("input[name=snmp3_auth_pass]").attr("disabled", true);
$("#snmp3_privacy_method").css({backgroundColor: '#ddd'}); $("#snmp3_privacy_method").css({backgroundColor: '#ddd'});
$("#snmp3_privacy_method").attr("disabled", true); $("#snmp3_privacy_method").attr("disabled", true);
$("input[name=snmp3_privacy_pass]").val(""); $("input[name=snmp3_privacy_pass]").val("");
$("input[name=snmp3_privacy_pass]").css({backgroundColor: '#ddd'}); $("input[name=snmp3_privacy_pass]").css({backgroundColor: '#ddd'});
$("input[name=snmp3_privacy_pass]").attr("disabled", true); $("input[name=snmp3_privacy_pass]").attr("disabled", true);
$("#snmp3_auth_method").css({backgroundColor: '#ddd'}); $("#snmp3_auth_method").css({backgroundColor: '#ddd'});
$("#snmp3_auth_method").attr("disabled", true); $("#snmp3_auth_method").attr("disabled", true);
$("#snmp3_security_level").css({backgroundColor: '#ddd'}); $("#snmp3_security_level").css({backgroundColor: '#ddd'});
$("#snmp3_security_level").attr("disabled", true); $("#snmp3_security_level").attr("disabled", true);
$("input[name=active_snmp_v3]").val(0); $("input[name=active_snmp_v3]").val(0);
$("input[name=snmp_community]").css({backgroundColor: '#fff'}); $("input[name=snmp_community]").css({backgroundColor: '#fff'});
$("input[name=snmp_community]").removeAttr('disabled'); $("input[name=snmp_community]").removeAttr('disabled');
} }
}); });
}); });
<?php if ($id_component_type == 2) :?> <?php
type_change (); if ($id_component_type == 2) {
<?php endif; ?> ?>
type_change ();
<?php
}
?>
//--> //-->
</script> </script>

View File

@ -296,7 +296,7 @@ if ($id_np > 0) {
echo '<div style="width:'.$table->width.'; text-align:right">'; echo '<div style="width:'.$table->width.'; text-align:right">';
html_print_submit_button (__('Add'), 'crtbutton', false, 'class="sub wand"'); html_print_submit_button (__('Add'), 'crtbutton', false, 'class="sub wand"');
echo '</div></form>'; echo '</div></form>';
} }
?> ?>

View File

@ -249,6 +249,10 @@ function flot_area_graph($chart_data, $width, $height, $color, $legend, $long_in
$legend_events = ''; $legend_events = '';
$legend_alerts = ''; $legend_alerts = '';
if (empty($chart_extra_data)) {
$chart_extra_data = array();
}
foreach ($chart_extra_data as $i => $data) { foreach ($chart_extra_data as $i => $data) {
switch ($i) { switch ($i) {
case 'legend_alerts': case 'legend_alerts':
@ -258,11 +262,11 @@ function flot_area_graph($chart_data, $width, $height, $color, $legend, $long_in
$legend_events = $data; $legend_events = $data;
break; break;
default: default:
if(isset($data['events'])) { if (isset($data['events'])) {
$event_ids[] = $i; $event_ids[] = $i;
$events[$i] = $data['events']; $events[$i] = $data['events'];
} }
if(isset($data['alerts'])) { if (isset($data['alerts'])) {
$alert_ids[] = $i; $alert_ids[] = $i;
$alerts[$i] = $data['alerts']; $alerts[$i] = $data['alerts'];
} }
@ -309,7 +313,7 @@ function flot_area_graph($chart_data, $width, $height, $color, $legend, $long_in
// Parent layer // Parent layer
$return .= "</div>"; $return .= "</div>";
return $return; return $return;
} }
/////////////////////////////// ///////////////////////////////
@ -461,7 +465,7 @@ function flot_hcolumn_chart ($graph_data, $width, $height, $water_mark) {
$return .= "</script>"; $return .= "</script>";
return $return; return $return;
} }
// Returns a 3D column chart // Returns a 3D column chart
@ -552,7 +556,7 @@ function flot_vcolumn_chart ($graph_data, $width, $height, $color, $legend, $lon
$values2 = array(); $values2 = array();
foreach($data as $jsvar => $values) { foreach ($data as $jsvar => $values) {
$values2[] = implode($separator,$values); $values2[] = implode($separator,$values);
} }
@ -567,7 +571,7 @@ function flot_vcolumn_chart ($graph_data, $width, $height, $color, $legend, $lon
$return .= "</script>"; $return .= "</script>";
return $return; return $return;
} }
function flot_slicesbar_graph ($graph_data, $period, $width, $height, $legend, $colors, $fontpath, $round_corner, $homeurl, $watermark = '', $adapt_key = '') { function flot_slicesbar_graph ($graph_data, $period, $width, $height, $legend, $colors, $fontpath, $round_corner, $homeurl, $watermark = '', $adapt_key = '') {
@ -604,8 +608,8 @@ function flot_slicesbar_graph ($graph_data, $period, $width, $height, $legend, $
$intervaltick = $period / $i; $intervaltick = $period / $i;
$leg_max_length = 0; $leg_max_length = 0;
foreach($legend as $l) { foreach ($legend as $l) {
if(strlen($l) > $leg_max_length) { if (strlen($l) > $leg_max_length) {
$leg_max_length = strlen($l); $leg_max_length = strlen($l);
} }
} }
@ -673,12 +677,12 @@ function flot_slicesbar_graph ($graph_data, $period, $width, $height, $legend, $
$values2 = array(); $values2 = array();
foreach($data as $jsvar => $values) { foreach ($data as $jsvar => $values) {
$values2[] = implode($separator,$values); $values2[] = implode($separator,$values);
$i ++; $i ++;
} }
$values = implode($separator2, $values2); $values = implode($separator2, $values2);
// Javascript code // Javascript code
$return .= "<script type='text/javascript'>"; $return .= "<script type='text/javascript'>";
@ -687,6 +691,6 @@ function flot_slicesbar_graph ($graph_data, $period, $width, $height, $legend, $
$return .= "\n//]]>"; $return .= "\n//]]>";
$return .= "</script>"; $return .= "</script>";
return $return; return $return;
} }
?> ?>