2012-07-06 Miguel de Dios <miguel.dedios@artica.es>

* godmode/reporting/visual_console_builder.editor.js,
	godmode/reporting/visual_console_builder.elements.php,
	include/functions_visual_map.php,
	include/ajax/visual_console_builder.ajax.php,
	include/functions_visual_map_editor.php: uploaded some fixes and
	changes for the visualmap, for example refactored some part of
	print the visualmap in operation.
	
	* include/functions_html.php: fixed when included from standarlone
	file from enterprise structure directory.
	
	* include/constants.php: added constants for avoid magic numbers
	into the code of Visualmaps.
	
	* include/graphs/functions_gd.php, include/functions.php,
	include/functions_io.php, include/functions_modules.php,
	include/functions_ui.php: cleaned source code style.




git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6747 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2012-07-06 11:45:02 +00:00
parent 8bf7d40fc2
commit a489b4800e
13 changed files with 579 additions and 586 deletions

View File

@ -1,3 +1,23 @@
2012-07-06 Miguel de Dios <miguel.dedios@artica.es>
* godmode/reporting/visual_console_builder.editor.js,
godmode/reporting/visual_console_builder.elements.php,
include/functions_visual_map.php,
include/ajax/visual_console_builder.ajax.php,
include/functions_visual_map_editor.php: uploaded some fixes and
changes for the visualmap, for example refactored some part of
print the visualmap in operation.
* include/functions_html.php: fixed when included from standarlone
file from enterprise structure directory.
* include/constants.php: added constants for avoid magic numbers
into the code of Visualmaps.
* include/graphs/functions_gd.php, include/functions.php,
include/functions_io.php, include/functions_modules.php,
include/functions_ui.php: cleaned source code style.
2012-07-06 Sergio Martin <sergio.martin@artica.es>
* pandoradb.sql

View File

@ -49,7 +49,6 @@ function visual_map_main() {
draw_lines(lines, 'background', true);
}
);
}
function eventsTextAgent() {
@ -681,6 +680,10 @@ function hiddenFields(item) {
$("#module_graph_size_row").css('display', 'none');
$("#module_graph_size_row." + item).css('display', '');
if (typeof(enterprise_hiddenFields) == 'function') {
enterprise_hiddenFields(item);
}
}
function cleanFields() {

View File

@ -45,9 +45,6 @@ foreach ($all_images as $image_file) {
$images_list[$image_file] = $image_file;
}
$layoutDataTypes = visual_map_get_layout_data_types();
$table->width = '100%';
$table->head = array ();
$table->head['icon'] = '';

View File

@ -499,6 +499,9 @@ switch ($action) {
echo json_encode($size);
break;
default:
enterprise_hook("enterprise_visualmap_ajax");
break;
}
/* visual map element status check */

View File

@ -131,4 +131,19 @@ define('PROCESS_VALUE_NONE', 0);
define('PROCESS_VALUE_MIN', 1);
define('PROCESS_VALUE_MAX', 2);
define('PROCESS_VALUE_AVG', 3);
//Status
define('VISUAL_MAP_STATUS_CRITICAL_BAD', 1);
define('VISUAL_MAP_STATUS_CRITICAL_ALERT', 4);
define('VISUAL_MAP_STATUS_NORMAL', 0);
define('VISUAL_MAP_STATUS_WARNING', 2);
define('VISUAL_MAP_STATUS_UNKNOW', 3);
/* Service constants */
//Status
define('SERVICE_STATUS_UNKNOW', -1);
define('SERVICE_STATUS_NORMAL', 0);
define('SERVICE_STATUS_CRITICAL', 1);
define('SERVICE_STATUS_WARNING', 2);
?>

View File

@ -136,6 +136,7 @@ function safe_url_extraclean ($string, $default_string = '') {
*/
function no_permission () {
require ("config.php");
echo "<h3 class='error'>".__('You don\'t have access')."</h3>";
echo html_print_image('images/noaccess.png', true, array("alt" => 'No access', "width" => '120')) . "<br /><br />";
echo "<table width=550>";
@ -144,6 +145,7 @@ function no_permission () {
echo "</table>";
echo "<tr><td><td><td><td>";
include "general/footer.php";
exit;
}
@ -155,6 +157,7 @@ function no_permission () {
*/
function unmanaged_error ($error = "") {
require_once ("config.php");
echo "<h3 class='error'>".__('Unmanaged error')."</h3>";
echo html_print_image('images/error.png', true, array("alt" => 'error')) . "<br /><br />";
echo "<table width=550>";
@ -165,6 +168,7 @@ function unmanaged_error ($error = "") {
echo "</table>";
echo "<tr><td><td><td><td>";
include "general/footer.php";
exit;
}
@ -656,29 +660,31 @@ function get_parameter_post ($name, $default = "") {
*/
function get_alert_priority ($priority = 0) {
global $config;
switch ($priority) {
case 0:
return __('Maintenance');
break;
case 1:
return __('Informational');
break;
case 2:
return __('Normal');
break;
case 3:
return __('Warning');
break;
case 4:
return __('Critical');
break;
case 5:
return __('Minor');
break;
case 6:
return __('Major');
break;
case 0:
return __('Maintenance');
break;
case 1:
return __('Informational');
break;
case 2:
return __('Normal');
break;
case 3:
return __('Warning');
break;
case 4:
return __('Critical');
break;
case 5:
return __('Minor');
break;
case 6:
return __('Major');
break;
}
return '';
}
@ -697,7 +703,8 @@ function get_alert_days ($row) {
if ($check == 7) {
return __('All');
} elseif ($check == 0) {
}
elseif ($check == 0) {
return __('None');
}
@ -731,14 +738,16 @@ function get_alert_days ($row) {
* @return string A string with the concatenated values
*/
function get_alert_times ($row2) {
if ($row2["time_from"]){
if ($row2["time_from"]) {
$time_from_table = $row2["time_from"];
} else {
}
else {
$time_from_table = __('N/A');
}
if ($row2["time_to"]){
if ($row2["time_to"]) {
$time_to_table = $row2["time_to"];
} else {
}
else {
$time_to_table = __('N/A');
}
if ($time_to_table == $time_from_table)
@ -960,12 +969,12 @@ function enterprise_include ($filename) {
global $config;
// Load enterprise extensions
$filepath = realpath ($config["homedir"].'/'.ENTERPRISE_DIR.'/'.$filename);
$filepath = realpath ($config["homedir"] . '/' . ENTERPRISE_DIR . '/' . $filename);
if ($filepath === false)
return ENTERPRISE_NOT_HOOK;
if (strncmp ($config["homedir"], $filepath, strlen ($config["homedir"])) != 0){
if (strncmp ($config["homedir"], $filepath, strlen ($config["homedir"])) != 0) {
return ENTERPRISE_NOT_HOOK;
}
@ -1188,8 +1197,8 @@ function array_key_to_offset($array, $key) {
* @return array SNMP result.
*/
function get_snmpwalk($ip_target, $snmp_version, $snmp_community = '', $snmp3_auth_user = '',
$snmp3_security_level = '', $snmp3_auth_method = '', $snmp3_auth_pass = '',
$snmp3_privacy_method = '', $snmp3_privacy_pass = '', $quick_print = 0, $base_oid = "", $snmp_port = '') {
$snmp3_security_level = '', $snmp3_auth_method = '', $snmp3_auth_pass = '',
$snmp3_privacy_method = '', $snmp3_privacy_pass = '', $quick_print = 0, $base_oid = "", $snmp_port = '') {
snmp_set_quick_print ($quick_print);

View File

@ -28,6 +28,11 @@ if (!isset($config)) {
require_once(str_repeat("../", $i) . "config.php");
break; // Skip config.php loading after load the first one
}
else if(file_exists(str_repeat("../", $i) . 'include/config.php')) {
//For path from the enterprise structure dirs.
require_once(str_repeat("../", $i) . "include/config.php");
break; // Skip config.php loading after load the first one
}
}
}

View File

@ -153,7 +153,8 @@ function io_ascii_to_html($num) {
if ($num <= 15) {
return "&#x0".dechex($num).";";
} else {
}
else {
return "&#x".dechex($num).";";
}
}

View File

@ -19,7 +19,7 @@
* @subpackage UI
*/
require_once($config['homedir'].'/include/functions_agents.php');
require_once($config['homedir'] . '/include/functions_agents.php');
require_once($config['homedir'] . '/include/functions_modules.php');
require_once($config['homedir'] . '/include/functions.php');
require_once($config['homedir'] . '/include/functions_groups.php');

File diff suppressed because it is too large Load Diff

View File

@ -43,7 +43,7 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) {
echo '<div id="properties_panel" style="display: none; position: absolute; border: 2px solid #114105; padding: 5px; background: white; z-index: 90;">';
//----------------------------Hiden Form----------------------------------------
//----------------------------Hiden Form----------------------------
?>
<table class="databox" border="0" cellpadding="4" cellspacing="4" width="300">
<caption>

View File

@ -12,13 +12,14 @@
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
// If is called from index
if(file_exists('include/functions.php')) {
if (file_exists('include/functions.php')) {
// If is called from index
include_once('include/functions.php');
include_once('include/functions_html.php');
include_once('include/graphs/functions_utils.php');
} // If is called through url
else if(file_exists('../functions.php')) {
}
else if (file_exists('../functions.php')) {
// If is called through url
include_once('../functions.php');
include_once('../functions_html.php');
include_once('functions_utils.php');
@ -45,7 +46,7 @@ if($id_graph && in_array($graph_type, $types)) {
$graph['fontsize'] = 6;
}
switch($graph_type) {
switch ($graph_type) {
case 'histogram':
gd_histogram ($graph['width'],
$graph['height'],
@ -86,7 +87,7 @@ function gd_histogram ($width, $height, $mode, $data, $max_value, $font, $title,
// $title is for future use
$nvalues = count($data);
Header("Content-type: image/png");
Header("Content-type: image/png");
$image = imagecreate($width,$height);
$white = ImageColorAllocate($image,255,255,255);
imagecolortransparent ($image, $white);
@ -105,7 +106,8 @@ function gd_histogram ($width, $height, $mode, $data, $max_value, $font, $title,
if ($mode != 2) {
$size_per = ($max_value / ($width-40));
} else {
}
else {
$size_per = ($max_value / ($width));
}