mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-31 01:35:36 +02:00
2010-03-31 Miguel de Dios <miguel.dedios@artica.es>
* include/styles/pandora.css, include/functions_visual_map.php, include/ajax/visual_console_builder.ajax.php, godmode/reporting/visual_console_builder.editor.php, godmode/reporting/visual_console_builder.editor.js: cleaned source code and changed the buttons. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2530 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
c3e8829b33
commit
9feab70312
@ -31,7 +31,7 @@ function showAdvanceOptions(close) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Main function, execute in event documentReady
|
// Main function, execute in event documentReady
|
||||||
function editorMain2() {
|
function initJavascript() {
|
||||||
$(".label_color").attachColorPicker();
|
$(".label_color").attachColorPicker();
|
||||||
|
|
||||||
eventsBackground();
|
eventsBackground();
|
||||||
@ -198,7 +198,6 @@ function actionClick() {
|
|||||||
activeToolboxButton('percentile_bar', true);
|
activeToolboxButton('percentile_bar', true);
|
||||||
activeToolboxButton('module_graph', true);
|
activeToolboxButton('module_graph', true);
|
||||||
activeToolboxButton('simple_value', true);
|
activeToolboxButton('simple_value', true);
|
||||||
activeToolboxButton('delete_item', true);
|
|
||||||
|
|
||||||
$(".item").draggable("enable");
|
$(".item").draggable("enable");
|
||||||
$("#background").resizable('enable');
|
$("#background").resizable('enable');
|
||||||
@ -220,6 +219,7 @@ function actionClick() {
|
|||||||
activeToolboxButton('percentile_bar', false);
|
activeToolboxButton('percentile_bar', false);
|
||||||
activeToolboxButton('module_graph', false);
|
activeToolboxButton('module_graph', false);
|
||||||
activeToolboxButton('simple_value', false);
|
activeToolboxButton('simple_value', false);
|
||||||
|
activeToolboxButton('edit_item', false);
|
||||||
activeToolboxButton('delete_item', false);
|
activeToolboxButton('delete_item', false);
|
||||||
|
|
||||||
if (creationItem != null) {
|
if (creationItem != null) {
|
||||||
@ -309,7 +309,10 @@ function hiddenFields(item) {
|
|||||||
$("#label_row." + item).css('display', '');
|
$("#label_row." + item).css('display', '');
|
||||||
|
|
||||||
$("#image_row").css('display', 'none');
|
$("#image_row").css('display', 'none');
|
||||||
$("#image_row." + item).css('display', '');
|
$("#image_row." + item).css('display', '');
|
||||||
|
|
||||||
|
$("#preview_row").css('display', 'none');
|
||||||
|
$("#preview_row." + item).css('display', '');
|
||||||
|
|
||||||
$("#position_row").css('display', 'none');
|
$("#position_row").css('display', 'none');
|
||||||
$("#position_row." + item).css('display', '');
|
$("#position_row." + item).css('display', '');
|
||||||
@ -693,12 +696,14 @@ function deleteDB(idElement) {
|
|||||||
|
|
||||||
function activeToolboxButton(id, active) {
|
function activeToolboxButton(id, active) {
|
||||||
if (active) {
|
if (active) {
|
||||||
$("#" + id).attr('class', 'button_toolbox');
|
$("input." + id + "[name=button_toolbox2]").removeAttr('disabled');
|
||||||
$(".label", $("#" + id)).css('color','#000000');
|
// $("#" + id).attr('class', 'button_toolbox');
|
||||||
|
// $(".label", $("#" + id)).css('color','#000000');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$("#" + id).attr('class', 'button_toolbox disabled');
|
$("input." + id + "[name=button_toolbox2]").attr('disabled', 'disabled');
|
||||||
$(".label", $("#" + id)).css('color','#aaaaaa');
|
// $("#" + id).attr('class', 'button_toolbox disabled');
|
||||||
|
// $(".label", $("#" + id)).css('color','#aaaaaa');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -864,99 +869,126 @@ function unselectAll() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function eventsButtonsToolbox() {
|
function eventsButtonsToolbox() {
|
||||||
$('.button_toolbox').mouseover(function(event) {
|
// $('.button_toolbox').mouseover(function(event) {
|
||||||
event.stopPropagation();
|
// event.stopPropagation();
|
||||||
|
//
|
||||||
|
// // over label
|
||||||
|
// if ($(event.target).is('span')) {
|
||||||
|
// id = $(event.target).parent().attr('id');
|
||||||
|
// }
|
||||||
|
// else {
|
||||||
|
// id = $(event.target).attr('id');
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// if ($("#" + id).hasClass('disabled') == false) {
|
||||||
|
// $("#" + id).css('background', '#f5f5f5');
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
//
|
||||||
|
// $('.button_toolbox').mouseout(function(event) {
|
||||||
|
// event.stopPropagation();
|
||||||
|
// id = $(event.target).attr('id');
|
||||||
|
// if ($("#" + id).hasClass('disabled') == false) {
|
||||||
|
// $("#" + id).css('background', '#e5e5e5');
|
||||||
|
// }
|
||||||
|
// $("#" + id).css('border', '4px outset black');
|
||||||
|
// });
|
||||||
|
//
|
||||||
|
// $('.button_toolbox').mousedown(function(event) {
|
||||||
|
// event.stopPropagation();
|
||||||
|
//
|
||||||
|
// // over label
|
||||||
|
// if ($(event.target).is('span')) {
|
||||||
|
// id = $(event.target).parent().attr('id');
|
||||||
|
// }
|
||||||
|
// else {
|
||||||
|
// id = $(event.target).attr('id');
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// if ($("#" + id).hasClass('disabled') == false) {
|
||||||
|
// $("#" + id).css('border', '4px inset black');
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
//
|
||||||
|
// $('.button_toolbox').mouseup(function(event) {
|
||||||
|
// event.stopPropagation();
|
||||||
|
//
|
||||||
|
// // over label
|
||||||
|
// if ($(event.target).is('span')) {
|
||||||
|
// id = $(event.target).parent().attr('id');
|
||||||
|
// }
|
||||||
|
// else {
|
||||||
|
// id = $(event.target).attr('id');
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// $("#" + id).css('border', '4px outset black');
|
||||||
|
// });
|
||||||
|
//
|
||||||
|
// $('.button_toolbox').click(function(event) {
|
||||||
|
// event.stopPropagation();
|
||||||
|
//
|
||||||
|
// // over label
|
||||||
|
// if ($(event.target).is('span')) {
|
||||||
|
// id = $(event.target).parent().attr('id');
|
||||||
|
// }
|
||||||
|
// else {
|
||||||
|
// id = $(event.target).attr('id');
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// if ($("#" + id).hasClass('disabled') == false) {
|
||||||
|
// switch (id) {
|
||||||
|
// case 'edit_item':
|
||||||
|
// actionClick();
|
||||||
|
// break;
|
||||||
|
// case 'static_graph':
|
||||||
|
// creationItem = 'static_graph';
|
||||||
|
// actionClick();
|
||||||
|
// break;
|
||||||
|
// case 'percentile_bar':
|
||||||
|
// creationItem = 'percentile_bar';
|
||||||
|
// actionClick();
|
||||||
|
// break;
|
||||||
|
// case 'module_graph':
|
||||||
|
// creationItem = 'module_graph';
|
||||||
|
// actionClick();
|
||||||
|
// break;
|
||||||
|
// case 'simple_value':
|
||||||
|
// creationItem = 'simple_value';
|
||||||
|
// actionClick();
|
||||||
|
// break;
|
||||||
|
// case 'delete_item':
|
||||||
|
// deleteItem();
|
||||||
|
// break;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
}
|
||||||
|
|
||||||
// over label
|
function click2(id) {
|
||||||
if ($(event.target).is('span')) {
|
switch (id) {
|
||||||
id = $(event.target).parent().attr('id');
|
case 'edit_item':
|
||||||
}
|
actionClick();
|
||||||
else {
|
break;
|
||||||
id = $(event.target).attr('id');
|
case 'static_graph':
|
||||||
}
|
creationItem = 'static_graph';
|
||||||
|
actionClick();
|
||||||
if ($("#" + id).hasClass('disabled') == false) {
|
break;
|
||||||
$("#" + id).css('background', '#f5f5f5');
|
case 'percentile_bar':
|
||||||
}
|
creationItem = 'percentile_bar';
|
||||||
});
|
actionClick();
|
||||||
|
break;
|
||||||
$('.button_toolbox').mouseout(function(event) {
|
case 'module_graph':
|
||||||
event.stopPropagation();
|
creationItem = 'module_graph';
|
||||||
id = $(event.target).attr('id');
|
actionClick();
|
||||||
if ($("#" + id).hasClass('disabled') == false) {
|
break;
|
||||||
$("#" + id).css('background', '#e5e5e5');
|
case 'simple_value':
|
||||||
}
|
creationItem = 'simple_value';
|
||||||
$("#" + id).css('border', '4px outset black');
|
actionClick();
|
||||||
});
|
break;
|
||||||
|
case 'delete_item':
|
||||||
$('.button_toolbox').mousedown(function(event) {
|
deleteItem();
|
||||||
event.stopPropagation();
|
break;
|
||||||
|
}
|
||||||
// over label
|
|
||||||
if ($(event.target).is('span')) {
|
|
||||||
id = $(event.target).parent().attr('id');
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
id = $(event.target).attr('id');
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($("#" + id).hasClass('disabled') == false) {
|
|
||||||
$("#" + id).css('border', '4px inset black');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
$('.button_toolbox').mouseup(function(event) {
|
|
||||||
event.stopPropagation();
|
|
||||||
|
|
||||||
// over label
|
|
||||||
if ($(event.target).is('span')) {
|
|
||||||
id = $(event.target).parent().attr('id');
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
id = $(event.target).attr('id');
|
|
||||||
}
|
|
||||||
|
|
||||||
$("#" + id).css('border', '4px outset black');
|
|
||||||
});
|
|
||||||
|
|
||||||
$('.button_toolbox').click(function(event) {
|
|
||||||
event.stopPropagation();
|
|
||||||
|
|
||||||
// over label
|
|
||||||
if ($(event.target).is('span')) {
|
|
||||||
id = $(event.target).parent().attr('id');
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
id = $(event.target).attr('id');
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($("#" + id).hasClass('disabled') == false) {
|
|
||||||
switch (id) {
|
|
||||||
case 'edit_item':
|
|
||||||
actionClick();
|
|
||||||
break;
|
|
||||||
case 'static_graph':
|
|
||||||
creationItem = 'static_graph';
|
|
||||||
actionClick();
|
|
||||||
break;
|
|
||||||
case 'percentile_bar':
|
|
||||||
creationItem = 'percentile_bar';
|
|
||||||
actionClick();
|
|
||||||
break;
|
|
||||||
case 'module_graph':
|
|
||||||
creationItem = 'module_graph';
|
|
||||||
actionClick();
|
|
||||||
break;
|
|
||||||
case 'simple_value':
|
|
||||||
creationItem = 'simple_value';
|
|
||||||
actionClick();
|
|
||||||
break;
|
|
||||||
case 'delete_item':
|
|
||||||
deleteItem();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function showPreviewStaticGraph(staticGraph) {
|
function showPreviewStaticGraph(staticGraph) {
|
||||||
|
@ -46,13 +46,13 @@ foreach ($all_images as $image_file) {
|
|||||||
|
|
||||||
echo '<div id="editor">';
|
echo '<div id="editor">';
|
||||||
echo '<div id="toolbox">';
|
echo '<div id="toolbox">';
|
||||||
printButtonEditorVisualConsole('static_graph', __('Static Graph'));
|
printButtonEditorVisualConsole('static_graph', __('Static Graph'), 'left', false, 'camera');
|
||||||
printButtonEditorVisualConsole('percentile_bar', __('Percentile Bar'));
|
printButtonEditorVisualConsole('percentile_bar', __('Percentile Bar'), 'left', false, 'percentile');
|
||||||
printButtonEditorVisualConsole('module_graph', __('Module Graph'));
|
printButtonEditorVisualConsole('module_graph', __('Module Graph'), 'left', false, 'graph');
|
||||||
printButtonEditorVisualConsole('simple_value', __('Simple Value'));
|
printButtonEditorVisualConsole('simple_value', __('Simple Value'), 'left', false, 'binary');
|
||||||
|
|
||||||
printButtonEditorVisualConsole('edit_item', __('Edit item'), 'right', true);
|
printButtonEditorVisualConsole('edit_item', __('Edit item'), 'right', true, 'config');
|
||||||
printButtonEditorVisualConsole('delete_item', __('Delete item'), 'right', true);
|
printButtonEditorVisualConsole('delete_item', __('Delete item'), 'right', true, 'delete');
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
echo '<div style="clear:both;"></div>';
|
echo '<div style="clear:both;"></div>';
|
||||||
@ -246,110 +246,6 @@ require_jquery_file('ui.draggable');
|
|||||||
require_javascript_file('wz_jsgraphics');
|
require_javascript_file('wz_jsgraphics');
|
||||||
require_javascript_file('pandora_visual_console');
|
require_javascript_file('pandora_visual_console');
|
||||||
require_javascript_file('visual_console_builder.editor', 'godmode/reporting/');
|
require_javascript_file('visual_console_builder.editor', 'godmode/reporting/');
|
||||||
|
|
||||||
function printButtonEditorVisualConsole($idDiv, $label, $float = 'left', $disabled = false) {
|
|
||||||
if (!$disabled) $disableClass = '';
|
|
||||||
else $disableClass = 'disabled';
|
|
||||||
|
|
||||||
if ($float == 'left') {
|
|
||||||
$margin = 'margin-right';
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$margin = 'margin-left';
|
|
||||||
}
|
|
||||||
|
|
||||||
echo '<div class="button_toolbox ' . $disableClass . '" id="' . $idDiv . '"
|
|
||||||
style="font-weight: bolder; text-align: center; float: ' . $float . ';' .
|
|
||||||
'width: 80px; height: 50px; background: #e5e5e5; border: 4px outset black; ' . $margin . ': 5px;">';
|
|
||||||
if ($disabled) {
|
|
||||||
echo '<span class="label" style="color: #aaaaaa;">';
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
echo '<span class="label" style="color: #000000;">';
|
|
||||||
}
|
|
||||||
echo $label;
|
|
||||||
echo '</span>';
|
|
||||||
echo '</div>';
|
|
||||||
}
|
|
||||||
|
|
||||||
function printItemInVisualConsole($layoutData) {
|
|
||||||
$width = $layoutData['width'];
|
|
||||||
$height = $max_percentile = $layoutData['height'];
|
|
||||||
$top = $layoutData['pos_y'];
|
|
||||||
$left = $layoutData['pos_x'];
|
|
||||||
$id = $layoutData['id'];
|
|
||||||
$color = $layoutData['label_color'];
|
|
||||||
$label = $layoutData['label'];
|
|
||||||
$id_module = $layoutData['id_agente_modulo'];
|
|
||||||
$type = $layoutData['type'];
|
|
||||||
$period = $layoutData['period'];
|
|
||||||
|
|
||||||
switch ($type) {
|
|
||||||
case STATIC_GRAPH:
|
|
||||||
$img = getImageStatusElement($layoutData);
|
|
||||||
$imgSizes = getimagesize($img);
|
|
||||||
if (($width == 0) && ($height == 0)) {
|
|
||||||
$sizeStyle = '';
|
|
||||||
$imageSize = '';
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$sizeStyle = 'width: ' . $width . 'px; height: ' . $height . 'px;';
|
|
||||||
$imageSize = 'width="' . $width . '" height="' . $height . '"';
|
|
||||||
}
|
|
||||||
echo '<div id="' . $id . '" class="item static_graph" style="text-align: center; color: ' . $color . '; position: absolute; ' . $sizeStyle . ' margin-top: ' . $top . 'px; margin-left: ' . $left . 'px;">';
|
|
||||||
echo '<img class="image" id="image_' . $id . '" src="' . $img . '" ' . $imageSize . ' /><br />';
|
|
||||||
echo '<span id="text_' . $id . '" class="text">' . $label . '</span>';
|
|
||||||
echo "</div>";
|
|
||||||
break;
|
|
||||||
case PERCENTILE_BAR:
|
|
||||||
$sizeStyle = '';
|
|
||||||
$imageSize = '';
|
|
||||||
|
|
||||||
$module_value = get_db_sql ('SELECT datos FROM tagente_estado WHERE id_agente_modulo = ' . $id_module);
|
|
||||||
|
|
||||||
if ( $max_percentile > 0)
|
|
||||||
$percentile = $module_value / $max_percentile * 100;
|
|
||||||
else
|
|
||||||
$percentile = 100;
|
|
||||||
|
|
||||||
$img = '<img class="image" id="image_' . $id . '" src="include/fgraph.php?tipo=progress&height=15&width=' . $width . '&mode=1&percent=' . $percentile . '" />';
|
|
||||||
|
|
||||||
echo '<div id="' . $id . '" class="item percentile_bar" style="color: ' . $color . '; text-align: center; position: absolute; ' . $sizeStyle . ' margin-top: ' . $top . 'px; margin-left: ' . $left . 'px;">';
|
|
||||||
echo '<span id="text_' . $id . '" class="text">' . $label . '</span><br />';
|
|
||||||
echo $img;
|
|
||||||
echo '</div>';
|
|
||||||
|
|
||||||
break;
|
|
||||||
case MODULE_GRAPH:
|
|
||||||
$sizeStyle = '';
|
|
||||||
$imageSize = '';
|
|
||||||
|
|
||||||
$img = '<img class="image" id="image_' . $id . '" src="include/fgraph.php?tipo=sparse&id=' . $id_module . '&label=' . $label . '&height=' . $height . '&pure=1&width=' . $width . '&period=' . $period . '" />';
|
|
||||||
|
|
||||||
echo '<div id="' . $id . '" class="item module_graph" style="color: ' . $color . '; text-align: center; position: absolute; ' . $sizeStyle . ' margin-top: ' . $top . 'px; margin-left: ' . $left . 'px;">';
|
|
||||||
echo '<span id="text_' . $id . '" class="text">' . $label . '</span><br />';
|
|
||||||
echo $img;
|
|
||||||
echo '</div>';
|
|
||||||
break;
|
|
||||||
case SIMPLE_VALUE:
|
|
||||||
$sizeStyle = '';
|
|
||||||
$imageSize = '';
|
|
||||||
|
|
||||||
echo '<div id="' . $id . '" class="item simple_value" style="color: ' . $color . '; text-align: center; position: absolute; ' . $sizeStyle . ' margin-top: ' . $top . 'px; margin-left: ' . $left . 'px;">';
|
|
||||||
echo '<span id="text_' . $id . '" class="text">' . $label . '</span><br />';
|
|
||||||
echo '<strong>' . get_db_value ('datos', 'tagente_estado', 'id_agente_modulo', $id_module) . '</strong>';
|
|
||||||
echo '</div>';
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($layoutData['parent_item'] != 0) {
|
|
||||||
echo '<script type="text/javascript">';
|
|
||||||
echo '$(document).ready (function() {
|
|
||||||
lines.push({"id": "' . $id . '" , "node_begin":"' . $layoutData['parent_item'] . '","node_end":"' . $id . '","color":"' . getColorLineStatus($layoutData) . '"});
|
|
||||||
});';
|
|
||||||
echo '</script>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
?>
|
?>
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
.ui-resizable-handle {
|
.ui-resizable-handle {
|
||||||
@ -359,5 +255,5 @@ function printItemInVisualConsole($layoutData) {
|
|||||||
</style>
|
</style>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
id_visual_console = <?php echo $visualConsole['id']; ?>;
|
id_visual_console = <?php echo $visualConsole['id']; ?>;
|
||||||
$(document).ready (editorMain2);
|
$(document).ready (initJavascript);
|
||||||
</script>
|
</script>
|
@ -29,8 +29,11 @@ require_once('include/functions_visual_map.php');
|
|||||||
|
|
||||||
$action = get_parameter('action');
|
$action = get_parameter('action');
|
||||||
$type = get_parameter('type');
|
$type = get_parameter('type');
|
||||||
|
|
||||||
$id_visual_console = get_parameter('id_visual_console', null);
|
$id_visual_console = get_parameter('id_visual_console', null);
|
||||||
|
|
||||||
$id_element = get_parameter('id_element', null);
|
$id_element = get_parameter('id_element', null);
|
||||||
|
|
||||||
$image = get_parameter('image', null);
|
$image = get_parameter('image', null);
|
||||||
$background = get_parameter('background', null);
|
$background = get_parameter('background', null);
|
||||||
$label = get_parameter('label', null);
|
$label = get_parameter('label', null);
|
||||||
|
@ -19,6 +19,119 @@
|
|||||||
* @subpackage Reporting
|
* @subpackage Reporting
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
function printButtonEditorVisualConsole($idDiv, $label, $float = 'left', $disabled = false, $class= '') {
|
||||||
|
if ($float == 'left') {
|
||||||
|
$margin = 'margin-right';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$margin = 'margin-left';
|
||||||
|
}
|
||||||
|
|
||||||
|
print_button($label, 'button_toolbox2', $disabled, "click2('" . $idDiv . "');", 'class="sub ' . $idDiv . ' ' . $class . '" style="float: ' . $float . '; ' . $margin . ': 5px;"');
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (!$disabled) $disableClass = '';
|
||||||
|
else $disableClass = 'disabled';
|
||||||
|
|
||||||
|
echo '<div class="button_toolbox ' . $disableClass . '" id="' . $idDiv . '"
|
||||||
|
style="font-weight: bolder; text-align: center; float: ' . $float . ';' .
|
||||||
|
'width: 80px; height: 50px; background: #e5e5e5; border: 4px outset black; ' . $margin . ': 5px;">';
|
||||||
|
if ($disabled) {
|
||||||
|
echo '<span class="label" style="color: #aaaaaa;">';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
echo '<span class="label" style="color: #000000;">';
|
||||||
|
}
|
||||||
|
echo $label;
|
||||||
|
echo '</span>';
|
||||||
|
echo '</div>';
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function printItemInVisualConsole($layoutData) {
|
||||||
|
$width = $layoutData['width'];
|
||||||
|
$height = $max_percentile = $layoutData['height'];
|
||||||
|
$top = $layoutData['pos_y'];
|
||||||
|
$left = $layoutData['pos_x'];
|
||||||
|
$id = $layoutData['id'];
|
||||||
|
$color = $layoutData['label_color'];
|
||||||
|
$label = $layoutData['label'];
|
||||||
|
$id_module = $layoutData['id_agente_modulo'];
|
||||||
|
$type = $layoutData['type'];
|
||||||
|
$period = $layoutData['period'];
|
||||||
|
|
||||||
|
$sizeStyle = '';
|
||||||
|
$imageSize = '';
|
||||||
|
|
||||||
|
$text = '<span id="text_' . $id . '" class="text">' . $label . '</span>';
|
||||||
|
|
||||||
|
switch ($type) {
|
||||||
|
case STATIC_GRAPH:
|
||||||
|
$img = getImageStatusElement($layoutData);
|
||||||
|
$imgSizes = getimagesize($img);
|
||||||
|
if (($width != 0) && ($height != 0)) {
|
||||||
|
$sizeStyle = 'width: ' . $width . 'px; height: ' . $height . 'px;';
|
||||||
|
$imageSize = 'width="' . $width . '" height="' . $height . '"';
|
||||||
|
}
|
||||||
|
echo '<div id="' . $id . '" class="item static_graph" style="text-align: center; color: ' . $color . '; position: absolute; ' . $sizeStyle . ' margin-top: ' . $top . 'px; margin-left: ' . $left . 'px;">';
|
||||||
|
echo '<img class="image" id="image_' . $id . '" src="' . $img . '" ' . $imageSize . ' /><br />';
|
||||||
|
echo $text;
|
||||||
|
echo "</div>";
|
||||||
|
break;
|
||||||
|
case PERCENTILE_BAR:
|
||||||
|
$module_value = get_db_sql ('SELECT datos FROM tagente_estado WHERE id_agente_modulo = ' . $id_module);
|
||||||
|
|
||||||
|
if ( $max_percentile > 0)
|
||||||
|
$percentile = $module_value / $max_percentile * 100;
|
||||||
|
else
|
||||||
|
$percentile = 100;
|
||||||
|
|
||||||
|
$img = '<img class="image" id="image_' . $id . '" src="include/fgraph.php?tipo=progress&height=15&width=' . $width . '&mode=1&percent=' . $percentile . '" />';
|
||||||
|
|
||||||
|
echo '<div id="' . $id . '" class="item percentile_bar" style="color: ' . $color . '; text-align: center; position: absolute; ' . $sizeStyle . ' margin-top: ' . $top . 'px; margin-left: ' . $left . 'px;">';
|
||||||
|
echo $text . '<br />';
|
||||||
|
echo $img;
|
||||||
|
echo '</div>';
|
||||||
|
|
||||||
|
break;
|
||||||
|
case MODULE_GRAPH:
|
||||||
|
$img = '<img class="image" id="image_' . $id . '" src="include/fgraph.php?tipo=sparse&id=' . $id_module . '&label=' . $label . '&height=' . $height . '&pure=1&width=' . $width . '&period=' . $period . '" />';
|
||||||
|
|
||||||
|
echo '<div id="' . $id . '" class="item module_graph" style="color: ' . $color . '; text-align: center; position: absolute; ' . $sizeStyle . ' margin-top: ' . $top . 'px; margin-left: ' . $left . 'px;">';
|
||||||
|
echo $text . '<br />';
|
||||||
|
echo $img;
|
||||||
|
echo '</div>';
|
||||||
|
break;
|
||||||
|
case SIMPLE_VALUE:
|
||||||
|
echo '<div id="' . $id . '" class="item simple_value" style="color: ' . $color . '; text-align: center; position: absolute; ' . $sizeStyle . ' margin-top: ' . $top . 'px; margin-left: ' . $left . 'px;">';
|
||||||
|
echo $text . '<br />';
|
||||||
|
echo '<strong>' . get_db_value ('datos', 'tagente_estado', 'id_agente_modulo', $id_module) . '</strong>';
|
||||||
|
echo '</div>';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Add the line between elements.
|
||||||
|
if ($layoutData['parent_item'] != 0) {
|
||||||
|
echo '<script type="text/javascript">';
|
||||||
|
echo '$(document).ready (function() {
|
||||||
|
lines.push({"id": "' . $id . '" , "node_begin":"' . $layoutData['parent_item'] . '","node_end":"' . $id . '","color":"' . getColorLineStatus($layoutData) . '"});
|
||||||
|
});';
|
||||||
|
echo '</script>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The function to save the new elements of agents make as wizard.
|
||||||
|
*
|
||||||
|
* @param array $id_agents The list of id of agents.
|
||||||
|
* @param string $image The image to set the elements.
|
||||||
|
* @param integer $id_layout The id of visual console to insert the elements.
|
||||||
|
* @param integer $range The distance between elements.
|
||||||
|
* @param integer $width Width of image.
|
||||||
|
* @param integer $height Height of image.
|
||||||
|
*
|
||||||
|
* @return string Return the message status to insert DB.
|
||||||
|
*/
|
||||||
function process_wizard_add ($id_agents, $image, $id_layout, $range, $width = 0, $height = 0) {
|
function process_wizard_add ($id_agents, $image, $id_layout, $range, $width = 0, $height = 0) {
|
||||||
if (empty ($id_agents)) {
|
if (empty ($id_agents)) {
|
||||||
print_error_message (__('No agents selected'));
|
print_error_message (__('No agents selected'));
|
||||||
@ -37,16 +150,16 @@ function process_wizard_add ($id_agents, $image, $id_layout, $range, $width = 0,
|
|||||||
}
|
}
|
||||||
|
|
||||||
process_sql_insert ('tlayout_data',
|
process_sql_insert ('tlayout_data',
|
||||||
array ('id_layout' => $id_layout,
|
array ('id_layout' => $id_layout,
|
||||||
'pos_x' => $pos_x,
|
'pos_x' => $pos_x,
|
||||||
'pos_y' => $pos_y,
|
'pos_y' => $pos_y,
|
||||||
'label' => get_agent_name ($id_agent),
|
'label' => get_agent_name ($id_agent),
|
||||||
'image' => $image,
|
'image' => $image,
|
||||||
'id_agent' => $id_agent,
|
'id_agent' => $id_agent,
|
||||||
'width' => $width,
|
'width' => $width,
|
||||||
'height' => $height,
|
'height' => $height,
|
||||||
'label_color' => '#000000')
|
'label_color' => '#000000')
|
||||||
);
|
);
|
||||||
|
|
||||||
$pos_x = $pos_x + $range;
|
$pos_x = $pos_x + $range;
|
||||||
}
|
}
|
||||||
@ -56,9 +169,21 @@ function process_wizard_add ($id_agents, $image, $id_layout, $range, $width = 0,
|
|||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The function to save the new elements of modules make as wizard.
|
||||||
|
*
|
||||||
|
* @param array $id_modules The list of id of modules.
|
||||||
|
* @param string $image The image to set the elements.
|
||||||
|
* @param integer $id_layout The id of visual console to insert the elements.
|
||||||
|
* @param integer $range The distance between elements.
|
||||||
|
* @param integer $width Width of image.
|
||||||
|
* @param integer $height Height of image.
|
||||||
|
*
|
||||||
|
* @return string Return the message status to insert DB.
|
||||||
|
*/
|
||||||
function process_wizard_add_modules ($id_modules, $image, $id_layout, $range, $width = 0, $height = 0) {
|
function process_wizard_add_modules ($id_modules, $image, $id_layout, $range, $width = 0, $height = 0) {
|
||||||
if (empty ($id_modules)) {
|
if (empty ($id_modules)) {
|
||||||
print_error_message (__('No modules selected'));
|
$return = print_error_message (__('No modules selected'), '', true);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -77,17 +202,17 @@ function process_wizard_add_modules ($id_modules, $image, $id_layout, $range, $w
|
|||||||
$id_agent = get_agentmodule_agent ($id_module);
|
$id_agent = get_agentmodule_agent ($id_module);
|
||||||
|
|
||||||
process_sql_insert ('tlayout_data',
|
process_sql_insert ('tlayout_data',
|
||||||
array ('id_layout' => $id_layout,
|
array ('id_layout' => $id_layout,
|
||||||
'pos_x' => $pos_x,
|
'pos_x' => $pos_x,
|
||||||
'pos_y' => $pos_y,
|
'pos_y' => $pos_y,
|
||||||
'label' => get_agentmodule_name ($id_module),
|
'label' => get_agentmodule_name ($id_module),
|
||||||
'image' => $image,
|
'image' => $image,
|
||||||
'id_agent' => $id_agent,
|
'id_agent' => $id_agent,
|
||||||
'id_agente_modulo' => $id_module,
|
'id_agente_modulo' => $id_module,
|
||||||
'width' => $width,
|
'width' => $width,
|
||||||
'height' => $height,
|
'height' => $height,
|
||||||
'label_color' => '#000000')
|
'label_color' => '#000000')
|
||||||
);
|
);
|
||||||
|
|
||||||
$pos_x = $pos_x + $range;
|
$pos_x = $pos_x + $range;
|
||||||
}
|
}
|
||||||
@ -97,10 +222,17 @@ function process_wizard_add_modules ($id_modules, $image, $id_layout, $range, $w
|
|||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the color of line between elements in the visual map.
|
||||||
|
*
|
||||||
|
* @param array $layoutData The row of element in DB.
|
||||||
|
*
|
||||||
|
* @return string The color as hexadecimal color in html.
|
||||||
|
*/
|
||||||
function getColorLineStatus($layoutData) {
|
function getColorLineStatus($layoutData) {
|
||||||
switch (getStatusElement($layoutData)) {
|
switch (getStatusElement($layoutData)) {
|
||||||
case 3:
|
case 3:
|
||||||
$color = "#ccc"; // Gray
|
$color = "#cccccc"; // Gray
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
$color = "#20f6f6"; // Yellow
|
$color = "#20f6f6"; // Yellow
|
||||||
@ -117,6 +249,13 @@ function getColorLineStatus($layoutData) {
|
|||||||
return $color;
|
return $color;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get image of element in the visual console with status.
|
||||||
|
*
|
||||||
|
* @param array $layoutData The row of element in DB.
|
||||||
|
*
|
||||||
|
* @return string The image with the relative path to pandora console directory.
|
||||||
|
*/
|
||||||
function getImageStatusElement($layoutData) {
|
function getImageStatusElement($layoutData) {
|
||||||
$img = "images/console/icons/" . $layoutData["image"];
|
$img = "images/console/icons/" . $layoutData["image"];
|
||||||
switch (getStatusElement($layoutData)) {
|
switch (getStatusElement($layoutData)) {
|
||||||
@ -141,6 +280,14 @@ function getImageStatusElement($layoutData) {
|
|||||||
return $img;
|
return $img;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the status of element in visual console. Check the agent state or
|
||||||
|
* module or layout linked.
|
||||||
|
*
|
||||||
|
* @param array $layoutData The row of element in DB.
|
||||||
|
*
|
||||||
|
* @return integer
|
||||||
|
*/
|
||||||
function getStatusElement($layoutData) {
|
function getStatusElement($layoutData) {
|
||||||
//Linked to other layout ?? - Only if not module defined
|
//Linked to other layout ?? - Only if not module defined
|
||||||
if ($layoutData['id_layout_linked'] != 0) {
|
if ($layoutData['id_layout_linked'] != 0) {
|
||||||
|
@ -279,7 +279,8 @@ input.sub[disabled] {
|
|||||||
}
|
}
|
||||||
|
|
||||||
input.next, input.upd, input.ok, input.wand, input.delete, input.search,
|
input.next, input.upd, input.ok, input.wand, input.delete, input.search,
|
||||||
input.copy, input.add {
|
input.copy, input.add, input.graph, input.percentile, input.binary,
|
||||||
|
input.camera, input.config {
|
||||||
padding-right: 21px;
|
padding-right: 21px;
|
||||||
}
|
}
|
||||||
input.next {
|
input.next {
|
||||||
@ -306,6 +307,21 @@ input.ok {
|
|||||||
input.add {
|
input.add {
|
||||||
background: #e5e5e5 url(../../images/add.png) no-repeat right 3px;
|
background: #e5e5e5 url(../../images/add.png) no-repeat right 3px;
|
||||||
}
|
}
|
||||||
|
input.graph {
|
||||||
|
background: #e5e5e5 url(../../images/chart_curve.png) no-repeat right 3px;
|
||||||
|
}
|
||||||
|
input.percentile {
|
||||||
|
background: #e5e5e5 url(../../images/chart_bar.png) no-repeat right 3px;
|
||||||
|
}
|
||||||
|
input.binary {
|
||||||
|
background: #e5e5e5 url(../../images/binary.png) no-repeat right 3px;
|
||||||
|
}
|
||||||
|
input.camera {
|
||||||
|
background: #e5e5e5 url(../../images/camera.png) no-repeat right 3px;
|
||||||
|
}
|
||||||
|
input.config {
|
||||||
|
background: #e5e5e5 url(../../images/config.png) no-repeat right 3px;
|
||||||
|
}
|
||||||
table, img {
|
table, img {
|
||||||
border: 0px;
|
border: 0px;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user