mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-27 07:44:35 +02:00
Working in the fusion of code of edition and view.
This commit is contained in:
parent
3b00d4df58
commit
7ba791f787
@ -61,7 +61,7 @@ function visual_map_print_item($mode = "read", $layoutData,
|
|||||||
$top = $layoutData['pos_y'];
|
$top = $layoutData['pos_y'];
|
||||||
$left = $layoutData['pos_x'];
|
$left = $layoutData['pos_x'];
|
||||||
$id = $layoutData['id'];
|
$id = $layoutData['id'];
|
||||||
$label = $layoutData['label'];
|
$label = io_safe_output($layoutData['label']);
|
||||||
$id_module = $layoutData['id_agente_modulo'];
|
$id_module = $layoutData['id_agente_modulo'];
|
||||||
$type = $layoutData['type'];
|
$type = $layoutData['type'];
|
||||||
$period = $layoutData['period'];
|
$period = $layoutData['period'];
|
||||||
@ -728,7 +728,7 @@ function visual_map_print_item($mode = "read", $layoutData,
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
$img_style_title = strip_tags($layoutData["label"]);
|
$img_style_title = strip_tags($label);
|
||||||
if ($layoutData['type'] == STATIC_GRAPH) {
|
if ($layoutData['type'] == STATIC_GRAPH) {
|
||||||
if ($layoutData['id_agente_modulo'] != 0) {
|
if ($layoutData['id_agente_modulo'] != 0) {
|
||||||
$unit_text = trim(io_safe_output(
|
$unit_text = trim(io_safe_output(
|
||||||
@ -1621,7 +1621,6 @@ function visual_map_print_visual_map ($id_layout, $show_links = true,
|
|||||||
|
|
||||||
enterprise_include_once('include/functions_visual_map.php');
|
enterprise_include_once('include/functions_visual_map.php');
|
||||||
|
|
||||||
//TODO: USE THE SAME CODE THAT THE VISUAL MAP EDITOR
|
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
$metaconsole_hack = '/';
|
$metaconsole_hack = '/';
|
||||||
@ -1678,7 +1677,7 @@ function visual_map_print_visual_map ($id_layout, $show_links = true,
|
|||||||
echo "<div style='width: 920px; overflow:auto; margin: 0 auto;'>";
|
echo "<div style='width: 920px; overflow:auto; margin: 0 auto;'>";
|
||||||
}
|
}
|
||||||
|
|
||||||
echo '<div id="layout_map"
|
echo '<div id="background"
|
||||||
style="margin:0px auto;
|
style="margin:0px auto;
|
||||||
text-align:center;
|
text-align:center;
|
||||||
z-index: 0;
|
z-index: 0;
|
||||||
@ -1700,7 +1699,8 @@ function visual_map_print_visual_map ($id_layout, $show_links = true,
|
|||||||
if ($resizedMap) {
|
if ($resizedMap) {
|
||||||
//Hack to resize the text
|
//Hack to resize the text
|
||||||
$layout_data["label"] = str_replace(
|
$layout_data["label"] = str_replace(
|
||||||
'visual_font_size', 'resize_visual_font_size', $layout_data["label"]);
|
'visual_font_size', 'resize_visual_font_size',
|
||||||
|
$layout_data["label"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Check the items are from disabled or pending delete modules
|
//Check the items are from disabled or pending delete modules
|
||||||
@ -1719,156 +1719,10 @@ function visual_map_print_visual_map ($id_layout, $show_links = true,
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$layout_data['label'] = io_safe_output($layout_data['label']);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// *************************************************************
|
|
||||||
// Get parent status (Could be an agent, module, map,
|
|
||||||
// others doesnt have parent info)
|
|
||||||
// *************************************************************
|
|
||||||
|
|
||||||
|
|
||||||
if ($layout_data["parent_item"] != 0) {
|
|
||||||
$layout_data_parent = db_get_row_filter('tlayout_data',
|
|
||||||
array('id' => $layout_data["parent_item"]));
|
|
||||||
|
|
||||||
$status_parent =
|
|
||||||
visual_map_get_status_element($layout_data_parent);
|
|
||||||
|
|
||||||
$line['id'] = $layout_data['id'];
|
|
||||||
$line['node_begin'] = 'layout-data-' . $layout_data["parent_item"];
|
|
||||||
$line['node_end'] = 'layout-data-' . $layout_data["id"];
|
|
||||||
$line['thickness'] = empty($config["vc_line_thickness"]) ? 2 : $config["vc_line_thickness"];
|
|
||||||
switch ($status_parent) {
|
|
||||||
default:
|
|
||||||
case VISUAL_MAP_STATUS_UNKNOWN:
|
|
||||||
$line["color"] = COL_UNKNOWN; // Gray
|
|
||||||
break;
|
|
||||||
case VISUAL_MAP_STATUS_WARNING:
|
|
||||||
$line["color"] = COL_WARNING; // Yellow
|
|
||||||
break;
|
|
||||||
case VISUAL_MAP_STATUS_NORMAL:
|
|
||||||
$line["color"] = COL_NORMAL; // Green
|
|
||||||
break;
|
|
||||||
case VISUAL_MAP_STATUS_CRITICAL_ALERT:
|
|
||||||
case VISUAL_MAP_STATUS_CRITICAL_BAD:
|
|
||||||
$line["color"] = COL_CRITICAL; // Red
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
array_push ($lines, $line);
|
|
||||||
}
|
|
||||||
|
|
||||||
// *************************************************************
|
|
||||||
// Get STATUS of current object
|
|
||||||
// *************************************************************
|
|
||||||
$status = visual_map_get_status_element($layout_data);
|
|
||||||
|
|
||||||
|
|
||||||
//~ switch ($status) {
|
|
||||||
//~ case VISUAL_MAP_STATUS_CRITICAL_BAD:
|
|
||||||
//~ //Critical (BAD)
|
|
||||||
//~ $colorStatus = COL_CRITICAL;
|
|
||||||
//~ break;
|
|
||||||
//~ case VISUAL_MAP_STATUS_CRITICAL_ALERT:
|
|
||||||
//~ //Critical (ALERT)
|
|
||||||
//~ $colorStatus = COL_ALERTFIRED;
|
|
||||||
//~ break;
|
|
||||||
//~ case VISUAL_MAP_STATUS_NORMAL:
|
|
||||||
//~ //Normal (OK)
|
|
||||||
//~ $colorStatus = COL_NORMAL;
|
|
||||||
//~ break;
|
|
||||||
//~ case VISUAL_MAP_STATUS_WARNING:
|
|
||||||
//~ //Warning
|
|
||||||
//~ $colorStatus = COL_WARNING;
|
|
||||||
//~ break;
|
|
||||||
//~ case VISUAL_MAP_STATUS_UNKNOWN:
|
|
||||||
//~ default:
|
|
||||||
//~ //Unknown
|
|
||||||
//~ $colorStatus = COL_UNKNOWN;
|
|
||||||
//~ // Default is Grey (Other)
|
|
||||||
//~ break;
|
|
||||||
//~ }
|
|
||||||
|
|
||||||
visual_map_print_item("read", $layout_data,
|
visual_map_print_item("read", $layout_data,
|
||||||
$proportion, $show_links);
|
$proportion, $show_links);
|
||||||
|
|
||||||
//~ switch ($layout_data['type']) {
|
|
||||||
//~ case GROUP_ITEM:
|
|
||||||
//~ case STATIC_GRAPH:
|
|
||||||
//~ visual_map_print_item("read", $layout_data,
|
|
||||||
//~ $proportion, $show_links);
|
|
||||||
//~ break;
|
|
||||||
//~
|
|
||||||
//~
|
|
||||||
//~
|
|
||||||
//~ case LABEL:
|
|
||||||
//~ visual_map_print_item("read", $layout_data,
|
|
||||||
//~ $proportion, $show_links);
|
|
||||||
//~ break;
|
|
||||||
//~
|
|
||||||
//~
|
|
||||||
//~
|
|
||||||
//~ case ICON:
|
|
||||||
//~ visual_map_print_item("read", $layout_data,
|
|
||||||
//~ $proportion, $show_links);
|
|
||||||
//~ break;
|
|
||||||
//~
|
|
||||||
//~
|
|
||||||
//~
|
|
||||||
//~ case SIMPLE_VALUE:
|
|
||||||
//~ case SIMPLE_VALUE_MAX:
|
|
||||||
//~ case SIMPLE_VALUE_MIN:
|
|
||||||
//~ case SIMPLE_VALUE_AVG:
|
|
||||||
//~ visual_map_print_item("read", $layout_data,
|
|
||||||
//~ $proportion, $show_links);
|
|
||||||
//~ break;
|
|
||||||
//~
|
|
||||||
//~
|
|
||||||
//~
|
|
||||||
//~ case PERCENTILE_BAR:
|
|
||||||
//~ case PERCENTILE_BUBBLE:
|
|
||||||
//~ visual_map_print_item("read", $layout_data,
|
|
||||||
//~ $proportion, $show_links);
|
|
||||||
//~ break;
|
|
||||||
//~
|
|
||||||
//~
|
|
||||||
//~
|
|
||||||
//~ case MODULE_GRAPH:
|
|
||||||
//~ visual_map_print_item("read", $layout_data,
|
|
||||||
//~ $proportion, $show_links);
|
|
||||||
//~ break;
|
|
||||||
//~
|
|
||||||
//~
|
|
||||||
//~
|
|
||||||
//~ default:
|
|
||||||
//~ enterprise_hook("enterprise_visual_map_print_item",
|
|
||||||
//~ array($layout_data, $status, $colorStatus,
|
|
||||||
//~ 'operation', $resizedMap, $proportion));
|
|
||||||
//~ break;
|
|
||||||
//~ }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($draw_lines) {
|
|
||||||
/* If you want lines in the map, call using Javascript:
|
|
||||||
draw_lines (lines, id_div);
|
|
||||||
on body load, where id_div is the id of the div which holds the map */
|
|
||||||
echo '<script type="text/javascript">/* <![CDATA[ */'."\n";
|
|
||||||
|
|
||||||
if ($resizedMap) {
|
|
||||||
echo 'var resize_map = 1;'."\n";
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
echo 'var resize_map = 0;'."\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
echo 'var lines = Array ();'."\n";
|
|
||||||
|
|
||||||
foreach ($lines as $line) {
|
|
||||||
echo 'lines.push (eval (' . json_encode ($line) . '));' . "\n";
|
|
||||||
}
|
|
||||||
echo '/* ]]> */</script>';
|
|
||||||
}
|
|
||||||
// End main div
|
// End main div
|
||||||
echo "</div>";
|
echo "</div>";
|
||||||
|
|
||||||
@ -1877,7 +1731,20 @@ function visual_map_print_visual_map ($id_layout, $show_links = true,
|
|||||||
if (defined('METACONSOLE')) {
|
if (defined('METACONSOLE')) {
|
||||||
echo "</div>";
|
echo "</div>";
|
||||||
}
|
}
|
||||||
|
?>
|
||||||
|
<script language="javascript" type="text/javascript">
|
||||||
|
/* <![CDATA[ */
|
||||||
|
|
||||||
|
var lines = Array();
|
||||||
|
|
||||||
|
//Fixed to wait the load of images.
|
||||||
|
$(window).load(function() {
|
||||||
|
draw_lines(lines, 'background');
|
||||||
|
}
|
||||||
|
);
|
||||||
|
/* ]]> */
|
||||||
|
</script>
|
||||||
|
<?php
|
||||||
}
|
}
|
||||||
//End function
|
//End function
|
||||||
|
|
||||||
|
17
pandora_console/include/javascript/pandora_visual_console.js
Normal file → Executable file
17
pandora_console/include/javascript/pandora_visual_console.js
Normal file → Executable file
@ -16,14 +16,8 @@
|
|||||||
* @param id_div Div to draw the lines in
|
* @param id_div Div to draw the lines in
|
||||||
* @param editor Boolean variable to set other css selector in editor (when true).
|
* @param editor Boolean variable to set other css selector in editor (when true).
|
||||||
*/
|
*/
|
||||||
function draw_line (line, id_div, editor) {
|
function draw_line (line, id_div) {
|
||||||
if (typeof(editor) == 'undefined') {
|
selector = '';
|
||||||
editor = false;
|
|
||||||
selector = 'margin-';
|
|
||||||
}
|
|
||||||
if (editor) {
|
|
||||||
selector = '';
|
|
||||||
}
|
|
||||||
|
|
||||||
//Check if the global var resize_map is defined
|
//Check if the global var resize_map is defined
|
||||||
if (typeof(resize_map) == 'undefined') {
|
if (typeof(resize_map) == 'undefined') {
|
||||||
@ -35,6 +29,8 @@ function draw_line (line, id_div, editor) {
|
|||||||
lineThickness = line['thickness'];
|
lineThickness = line['thickness'];
|
||||||
|
|
||||||
div = document.getElementById (id_div);
|
div = document.getElementById (id_div);
|
||||||
|
console.log(id_div);
|
||||||
|
console.log(div);
|
||||||
brush = new jsGraphics (div);
|
brush = new jsGraphics (div);
|
||||||
brush.setStroke (lineThickness);
|
brush.setStroke (lineThickness);
|
||||||
brush.setColor (line['color']);
|
brush.setColor (line['color']);
|
||||||
@ -84,6 +80,7 @@ function draw_line (line, id_div, editor) {
|
|||||||
y2 = parseInt($('#'+line['node_end']).css (selector + 'top')) + (height / 2);
|
y2 = parseInt($('#'+line['node_end']).css (selector + 'top')) + (height / 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
brush.drawLine (x1, y1, x2, y2);
|
brush.drawLine (x1, y1, x2, y2);
|
||||||
brush.paint ();
|
brush.paint ();
|
||||||
}
|
}
|
||||||
@ -96,8 +93,8 @@ function draw_line (line, id_div, editor) {
|
|||||||
* @param editor Boolean variable to set other css selector in editor (when true).
|
* @param editor Boolean variable to set other css selector in editor (when true).
|
||||||
*/
|
*/
|
||||||
function draw_lines (lines, id_div, editor) {
|
function draw_lines (lines, id_div, editor) {
|
||||||
jQuery.each (lines, function () {
|
jQuery.each (lines, function (i, line) {
|
||||||
draw_line (this, id_div, editor);
|
draw_line (line, id_div, editor);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
1
pandora_console/operation/visual_console/public_console.php
Normal file → Executable file
1
pandora_console/operation/visual_console/public_console.php
Normal file → Executable file
@ -159,7 +159,6 @@ $(document).ready (function () {
|
|||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
draw_lines (lines, 'layout_map');
|
|
||||||
});
|
});
|
||||||
/* ]]> */
|
/* ]]> */
|
||||||
</script>
|
</script>
|
||||||
|
47
pandora_console/operation/visual_console/render_view.php
Normal file → Executable file
47
pandora_console/operation/visual_console/render_view.php
Normal file → Executable file
@ -243,31 +243,30 @@ ui_require_javascript_file ('wz_jsgraphics');
|
|||||||
ui_require_javascript_file ('pandora_visual_console');
|
ui_require_javascript_file ('pandora_visual_console');
|
||||||
?>
|
?>
|
||||||
<script language="javascript" type="text/javascript">
|
<script language="javascript" type="text/javascript">
|
||||||
/* <![CDATA[ */
|
/* <![CDATA[ */
|
||||||
$(document).ready (function () {
|
|
||||||
$("#refr").change(function () {
|
|
||||||
$("#hidden-vc_refr").val($("#refr option:selected").val());
|
|
||||||
});
|
|
||||||
|
|
||||||
<?php
|
|
||||||
if ($config["pure"] && ((int)get_parameter('refr', 0)) > 0) {
|
$(document).ready (function () {
|
||||||
?>
|
$("#refr").change(function () {
|
||||||
t = new Date();
|
$("#hidden-vc_refr").val($("#refr option:selected").val());
|
||||||
t.setTime (t.getTime() + <?php
|
});
|
||||||
echo ((int)get_parameter('refr', 0)) * 1000;
|
|
||||||
?>);
|
|
||||||
$("#countdown").countdown({
|
|
||||||
until: t,
|
|
||||||
format: 'MS',
|
|
||||||
description: '<?php echo __('Until refresh'); ?>'
|
|
||||||
});
|
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
}
|
if ($config["pure"] && ((int)get_parameter('refr', 0)) > 0) {
|
||||||
?>
|
?>
|
||||||
if (typeof(lines) != 'undefined') {
|
t = new Date();
|
||||||
draw_lines (lines, 'layout_map');
|
t.setTime (t.getTime() + <?php
|
||||||
}
|
echo ((int)get_parameter('refr', 0)) * 1000;
|
||||||
});
|
?>);
|
||||||
/* ]]> */
|
$("#countdown").countdown({
|
||||||
|
until: t,
|
||||||
|
format: 'MS',
|
||||||
|
description: '<?php echo __('Until refresh'); ?>'
|
||||||
|
});
|
||||||
|
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
});
|
||||||
|
/* ]]> */
|
||||||
</script>
|
</script>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user