mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-29 08:45:12 +02:00
Merge branch '1378-donut-graph-in-visual-console-dev' into 'develop'
1378 donut graph in visual console dev See merge request artica/pandorafms!939
This commit is contained in:
commit
25baa801da
@ -445,14 +445,12 @@ function update_button_palette_callback() {
|
|||||||
|
|
||||||
setEventsBar(idItem, values);
|
setEventsBar(idItem, values);
|
||||||
break;
|
break;
|
||||||
|
case 'donut_graph':
|
||||||
|
$("#image_" + idItem).attr("src", "images/spinner.gif");
|
||||||
|
|
||||||
|
setDonutsGraph(idItem, values);
|
||||||
|
break;
|
||||||
case 'simple_value':
|
case 'simple_value':
|
||||||
//checkpoint
|
|
||||||
// if(($('#text-label_ifr').contents().find('#tinymce p').html() == '_VALUE_' ||
|
|
||||||
// $('#text-label_ifr').contents().find('#tinymce').html() == '_VALUE_')
|
|
||||||
// && $('#data_image_check').html() != 'On'){
|
|
||||||
// alert('_VALUE_ exactly value is only enable for data image. Please change label text or select a data image module.');
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
$("#" + idItem).html(values['label']);
|
$("#" + idItem).html(values['label']);
|
||||||
if( (values['label'].replace( /<.*?>/g, '' ) != '_VALUE_')
|
if( (values['label'].replace( /<.*?>/g, '' ) != '_VALUE_')
|
||||||
&& (values['label'].replace( /<.*?>/g, '' ) != '(_VALUE_)') ){
|
&& (values['label'].replace( /<.*?>/g, '' ) != '(_VALUE_)') ){
|
||||||
@ -467,12 +465,7 @@ function update_button_palette_callback() {
|
|||||||
$("#" + idItem).html(
|
$("#" + idItem).html(
|
||||||
'<table><tbody><tr><td></td></tr><tr><td><span style="" id="text_21" class="text">'+values["label"]+'</span></td></tr><tr><td></td></tr></tbody></table>'
|
'<table><tbody><tr><td></td></tr><tr><td><span style="" id="text_21" class="text">'+values["label"]+'</span></td></tr><tr><td></td></tr></tbody></table>'
|
||||||
)
|
)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//$("#simplevalue_" + idItem)
|
|
||||||
//.html($('<img></img>').attr('src', "images/spinner.gif"));
|
|
||||||
setModuleValue(idItem,values['process_simple_value'], values['period'],values['width']);
|
setModuleValue(idItem,values['process_simple_value'], values['period'],values['width']);
|
||||||
break;
|
break;
|
||||||
case 'label':
|
case 'label':
|
||||||
@ -711,6 +704,12 @@ console.log(values);
|
|||||||
validate = false;
|
validate = false;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case 'donut_graph':
|
||||||
|
if ((values['agent'] == '')) {
|
||||||
|
alert($("#message_alert_no_agent").html());
|
||||||
|
validate = false;
|
||||||
|
}
|
||||||
|
break;
|
||||||
case 'label':
|
case 'label':
|
||||||
if ((values['label'] == '')) {
|
if ((values['label'] == '')) {
|
||||||
alert($("#message_alert_no_label").html());
|
alert($("#message_alert_no_label").html());
|
||||||
@ -998,6 +997,7 @@ function toggle_item_palette() {
|
|||||||
activeToolboxButton('box_item', true);
|
activeToolboxButton('box_item', true);
|
||||||
activeToolboxButton('line_item', true);
|
activeToolboxButton('line_item', true);
|
||||||
activeToolboxButton('auto_sla_graph', true);
|
activeToolboxButton('auto_sla_graph', true);
|
||||||
|
activeToolboxButton('donut_graph', true);
|
||||||
|
|
||||||
if (typeof(enterprise_activeToolboxButton) == 'function') {
|
if (typeof(enterprise_activeToolboxButton) == 'function') {
|
||||||
enterprise_activeToolboxButton(true);
|
enterprise_activeToolboxButton(true);
|
||||||
@ -1019,6 +1019,7 @@ function toggle_item_palette() {
|
|||||||
activeToolboxButton('module_graph', false);
|
activeToolboxButton('module_graph', false);
|
||||||
activeToolboxButton('bars_graph', false);
|
activeToolboxButton('bars_graph', false);
|
||||||
activeToolboxButton('auto_sla_graph', false);
|
activeToolboxButton('auto_sla_graph', false);
|
||||||
|
activeToolboxButton('donut_graph', false);
|
||||||
activeToolboxButton('simple_value', false);
|
activeToolboxButton('simple_value', false);
|
||||||
activeToolboxButton('label', false);
|
activeToolboxButton('label', false);
|
||||||
activeToolboxButton('icon', false);
|
activeToolboxButton('icon', false);
|
||||||
@ -2075,6 +2076,53 @@ function setEventsBar(id_data, values) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function setDonutsGraph (id_data, values) {
|
||||||
|
var url_hack_metaconsole = '';
|
||||||
|
if (is_metaconsole()) {
|
||||||
|
url_hack_metaconsole = '../../';
|
||||||
|
}
|
||||||
|
|
||||||
|
width_percentile = values['width_percentile'];
|
||||||
|
|
||||||
|
parameter = Array();
|
||||||
|
|
||||||
|
parameter.push ({name: "page", value: "include/ajax/visual_console_builder.ajax"});
|
||||||
|
parameter.push ({name: "action", value: "get_module_type_string"});
|
||||||
|
parameter.push ({name: "id_agent", value: values['id_agent']});
|
||||||
|
parameter.push ({name: "id_agent_module", value: values['module']});
|
||||||
|
parameter.push ({name: "id_element", value: id_data});
|
||||||
|
parameter.push ({name: "id_visual_console", value: id_visual_console});
|
||||||
|
jQuery.ajax({
|
||||||
|
url: get_url_ajax(),
|
||||||
|
data: parameter,
|
||||||
|
type: "POST",
|
||||||
|
dataType: 'json',
|
||||||
|
success: function (data) {
|
||||||
|
if (data['no_data'] == true) {
|
||||||
|
if (values['width'] == "0") {
|
||||||
|
$("#" + id_data + " img").attr('src', url_hack_metaconsole + 'images/console/signes/wrong_donut_graph.png');
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$("#" + id_data + " img").attr('src', url_hack_metaconsole + 'images/console/signes/wrong_donut_graph.png');
|
||||||
|
$("#" + id_data + " img").css('width', width_percentile + 'px');
|
||||||
|
$("#" + id_data + " img").css('height', width_percentile + 'px');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$("#" + id_data + " img").attr('src', url_hack_metaconsole + 'images/console/signes/donut-graph.png');
|
||||||
|
|
||||||
|
if($('#text-width').val() == 0 || $('#text-height').val() == 0){
|
||||||
|
// Image size
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
$("#" + id_data + " img").css('width', $('#text-width_percentile').val()+'px');
|
||||||
|
$("#" + id_data + " img").css('height', $('#text-width_percentile').val()+'px');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function setPercentileBubble(id_data, values) {
|
function setPercentileBubble(id_data, values) {
|
||||||
metaconsole = $("input[name='metaconsole']").val();
|
metaconsole = $("input[name='metaconsole']").val();
|
||||||
|
|
||||||
@ -2422,6 +2470,16 @@ function createItem(type, values, id_data) {
|
|||||||
|
|
||||||
setEventsBar(id_data, values);
|
setEventsBar(id_data, values);
|
||||||
break;
|
break;
|
||||||
|
case 'donut_graph':
|
||||||
|
var sizeStyle = '';
|
||||||
|
var imageSize = '';
|
||||||
|
item = $('<div id="' + id_data + '" class="item donut_graph" style="text-align: left; position: absolute; display: inline-block; ' + sizeStyle + ' top: ' + values['top'] + 'px; left: ' + values['left'] + 'px;">' +
|
||||||
|
'<img class="image" id="image_' + id_data + '" src="images/spinner.gif" />' +
|
||||||
|
'</div>'
|
||||||
|
);
|
||||||
|
|
||||||
|
setDonutsGraph(id_data, values);
|
||||||
|
break;
|
||||||
case 'percentile_bar':
|
case 'percentile_bar':
|
||||||
case 'percentile_item':
|
case 'percentile_item':
|
||||||
var sizeStyle = '';
|
var sizeStyle = '';
|
||||||
@ -2790,6 +2848,7 @@ function updateDB_visual(type, idElement , values, event, top, left) {
|
|||||||
case 'module_graph':
|
case 'module_graph':
|
||||||
case 'bars_graph':
|
case 'bars_graph':
|
||||||
case 'auto_sla_graph':
|
case 'auto_sla_graph':
|
||||||
|
case 'donut_graph':
|
||||||
if (type == 'simple_value') {
|
if (type == 'simple_value') {
|
||||||
setModuleValue(idElement,
|
setModuleValue(idElement,
|
||||||
values.process_simple_value,
|
values.process_simple_value,
|
||||||
@ -3201,6 +3260,15 @@ function eventsItems(drag) {
|
|||||||
activeToolboxButton('delete_item', true);
|
activeToolboxButton('delete_item', true);
|
||||||
activeToolboxButton('show_grid', false);
|
activeToolboxButton('show_grid', false);
|
||||||
}
|
}
|
||||||
|
if ($(divParent).hasClass('donut_graph')) {
|
||||||
|
creationItem = null;
|
||||||
|
selectedItem = 'donut_graph';
|
||||||
|
idItem = $(divParent).attr('id');
|
||||||
|
activeToolboxButton('copy_item', true);
|
||||||
|
activeToolboxButton('edit_item', true);
|
||||||
|
activeToolboxButton('delete_item', true);
|
||||||
|
activeToolboxButton('show_grid', false);
|
||||||
|
}
|
||||||
if ($(divParent).hasClass('group_item')) {
|
if ($(divParent).hasClass('group_item')) {
|
||||||
creationItem = null;
|
creationItem = null;
|
||||||
selectedItem = 'group_item';
|
selectedItem = 'group_item';
|
||||||
@ -3410,6 +3478,9 @@ function eventsItems(drag) {
|
|||||||
if ($(event.target).hasClass('auto_sla_graph')) {
|
if ($(event.target).hasClass('auto_sla_graph')) {
|
||||||
selectedItem = 'auto_sla_graph';
|
selectedItem = 'auto_sla_graph';
|
||||||
}
|
}
|
||||||
|
if ($(event.target).hasClass('donut_graph')) {
|
||||||
|
selectedItem = 'donut_graph';
|
||||||
|
}
|
||||||
if ($(event.target).hasClass('group_item')) {
|
if ($(event.target).hasClass('group_item')) {
|
||||||
selectedItem = 'group_item';
|
selectedItem = 'group_item';
|
||||||
}
|
}
|
||||||
@ -3733,6 +3804,10 @@ function click_button_toolbox(id) {
|
|||||||
toolbuttonActive = creationItem = 'auto_sla_graph';
|
toolbuttonActive = creationItem = 'auto_sla_graph';
|
||||||
toggle_item_palette();
|
toggle_item_palette();
|
||||||
break;
|
break;
|
||||||
|
case 'donut_graph':
|
||||||
|
toolbuttonActive = creationItem = 'donut_graph';
|
||||||
|
toggle_item_palette();
|
||||||
|
break;
|
||||||
case 'simple_value':
|
case 'simple_value':
|
||||||
toolbuttonActive = creationItem = 'simple_value';
|
toolbuttonActive = creationItem = 'simple_value';
|
||||||
toggle_item_palette();
|
toggle_item_palette();
|
||||||
@ -3791,6 +3866,7 @@ function click_button_toolbox(id) {
|
|||||||
activeToolboxButton('service', false);
|
activeToolboxButton('service', false);
|
||||||
activeToolboxButton('group_item', false);
|
activeToolboxButton('group_item', false);
|
||||||
activeToolboxButton('auto_sla_graph', false);
|
activeToolboxButton('auto_sla_graph', false);
|
||||||
|
activeToolboxButton('donut_graph', false);
|
||||||
activeToolboxButton('copy_item', false);
|
activeToolboxButton('copy_item', false);
|
||||||
activeToolboxButton('edit_item', false);
|
activeToolboxButton('edit_item', false);
|
||||||
activeToolboxButton('delete_item', false);
|
activeToolboxButton('delete_item', false);
|
||||||
@ -3822,6 +3898,7 @@ function click_button_toolbox(id) {
|
|||||||
activeToolboxButton('icon', true);
|
activeToolboxButton('icon', true);
|
||||||
activeToolboxButton('group_item', true);
|
activeToolboxButton('group_item', true);
|
||||||
activeToolboxButton('auto_sla_graph', true);
|
activeToolboxButton('auto_sla_graph', true);
|
||||||
|
activeToolboxButton('donut_graph', true);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'save_visualmap':
|
case 'save_visualmap':
|
||||||
|
BIN
pandora_console/images/console/signes/donut-graph.png
Normal file
BIN
pandora_console/images/console/signes/donut-graph.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 10 KiB |
BIN
pandora_console/images/console/signes/wrong_donut_graph.png
Normal file
BIN
pandora_console/images/console/signes/wrong_donut_graph.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 14 KiB |
BIN
pandora_console/images/icono-quesito.disabled.png
Normal file
BIN
pandora_console/images/icono-quesito.disabled.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 563 B |
BIN
pandora_console/images/icono-quesito.png
Normal file
BIN
pandora_console/images/icono-quesito.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 562 B |
@ -104,7 +104,6 @@ $width_percentile = get_parameter('width_percentile', null);
|
|||||||
$max_percentile = get_parameter('max_percentile', null);
|
$max_percentile = get_parameter('max_percentile', null);
|
||||||
$height_module_graph = get_parameter('height_module_graph', null);
|
$height_module_graph = get_parameter('height_module_graph', null);
|
||||||
$width_module_graph = get_parameter('width_module_graph', null);
|
$width_module_graph = get_parameter('width_module_graph', null);
|
||||||
$bars_graph_type = get_parameter('bars_graph_type', null);
|
|
||||||
$id_agent_module = get_parameter('id_agent_module', 0);
|
$id_agent_module = get_parameter('id_agent_module', 0);
|
||||||
$process_simple_value = get_parameter('process_simple_value', PROCESS_VALUE_NONE);
|
$process_simple_value = get_parameter('process_simple_value', PROCESS_VALUE_NONE);
|
||||||
$type_percentile = get_parameter('type_percentile', 'percentile');
|
$type_percentile = get_parameter('type_percentile', 'percentile');
|
||||||
@ -142,39 +141,6 @@ switch ($action) {
|
|||||||
echo json_encode($return);
|
echo json_encode($return);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'get_module_type_string':
|
|
||||||
$data = array ();
|
|
||||||
|
|
||||||
$layoutData = db_get_row_filter('tlayout_data', array('id' => $id_element));
|
|
||||||
|
|
||||||
if ($layoutData['id_metaconsole'] != 0) {
|
|
||||||
$connection = db_get_row_filter ('tmetaconsole_setup', $layoutData['id_metaconsole']);
|
|
||||||
|
|
||||||
if (metaconsole_load_external_db($connection) != NOERR) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$is_string = db_get_value_filter ('id_tipo_modulo', 'tagente_modulo',
|
|
||||||
array ('id_agente' => $id_agent,
|
|
||||||
'id_agente_modulo' => $id_module));
|
|
||||||
|
|
||||||
if ($layoutData['id_metaconsole'] != 0) {
|
|
||||||
metaconsole_restore_db();
|
|
||||||
}
|
|
||||||
|
|
||||||
$return = array();
|
|
||||||
if (($is_string == 17) || ($is_string == 23) || ($is_string == 3) ||
|
|
||||||
($is_string == 10) || ($is_string == 33)) {
|
|
||||||
$return['no_data'] = false;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$return['no_data'] = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
echo json_encode($return);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'get_module_events':
|
case 'get_module_events':
|
||||||
$data = array ();
|
$data = array ();
|
||||||
|
|
||||||
@ -500,6 +466,7 @@ switch ($action) {
|
|||||||
case 'icon':
|
case 'icon':
|
||||||
case 'auto_sla_graph':
|
case 'auto_sla_graph':
|
||||||
case 'bars_graph':
|
case 'bars_graph':
|
||||||
|
case 'donut_graph':
|
||||||
default:
|
default:
|
||||||
if ($type == 'label') {
|
if ($type == 'label') {
|
||||||
$values['type'] = LABEL;
|
$values['type'] = LABEL;
|
||||||
@ -550,11 +517,11 @@ switch ($action) {
|
|||||||
$values['id_agent'] = $id_agent;
|
$values['id_agent'] = $id_agent;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ($agent !== null) {
|
else if (!empty($id_agent)) {
|
||||||
$id_agent = agents_get_agent_id($agent);
|
|
||||||
$values['id_agent'] = $id_agent;
|
$values['id_agent'] = $id_agent;
|
||||||
}
|
}
|
||||||
else {
|
else if ($agent !== null) {
|
||||||
|
$id_agent = agents_get_agent_id($agent);
|
||||||
$values['id_agent'] = $id_agent;
|
$values['id_agent'] = $id_agent;
|
||||||
}
|
}
|
||||||
if ($id_module !== null) {
|
if ($id_module !== null) {
|
||||||
@ -623,17 +590,6 @@ switch ($action) {
|
|||||||
$values['id_custom_graph'] = $id_custom_graph;
|
$values['id_custom_graph'] = $id_custom_graph;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'bars_graph':
|
|
||||||
if ($width_percentile !== null) {
|
|
||||||
$values['width'] = $width_percentile;
|
|
||||||
}
|
|
||||||
if ($bars_graph_type !== null) {
|
|
||||||
$values['type_graph'] = $bars_graph_type;
|
|
||||||
}
|
|
||||||
if ($background_color !== null) {
|
|
||||||
$values['image'] = $background_color;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case 'percentile_item':
|
case 'percentile_item':
|
||||||
case 'percentile_bar':
|
case 'percentile_bar':
|
||||||
if ($action == 'update') {
|
if ($action == 'update') {
|
||||||
@ -696,10 +652,6 @@ switch ($action) {
|
|||||||
unset($values['image']);
|
unset($values['image']);
|
||||||
unset($values['type_graph']);
|
unset($values['type_graph']);
|
||||||
break;
|
break;
|
||||||
case 'bars_graph':
|
|
||||||
unset($values['image']);
|
|
||||||
unset($values['type_graph']);
|
|
||||||
break;
|
|
||||||
case 'box_item':
|
case 'box_item':
|
||||||
unset($values['border_width']);
|
unset($values['border_width']);
|
||||||
unset($values['border_color']);
|
unset($values['border_color']);
|
||||||
@ -757,7 +709,6 @@ switch ($action) {
|
|||||||
case 'static_graph':
|
case 'static_graph':
|
||||||
case 'group_item':
|
case 'group_item':
|
||||||
case 'module_graph':
|
case 'module_graph':
|
||||||
case 'bars_graph':
|
|
||||||
case 'simple_value':
|
case 'simple_value':
|
||||||
case 'label':
|
case 'label':
|
||||||
case 'icon':
|
case 'icon':
|
||||||
@ -838,10 +789,6 @@ switch ($action) {
|
|||||||
$elementFields['width_module_graph'] = $elementFields['width'];
|
$elementFields['width_module_graph'] = $elementFields['width'];
|
||||||
$elementFields['height_module_graph'] = $elementFields['height'];
|
$elementFields['height_module_graph'] = $elementFields['height'];
|
||||||
break;
|
break;
|
||||||
case 'bars_graph':
|
|
||||||
$elementFields['width_percentile'] = $elementFields['width'];
|
|
||||||
$elementFields['bars_graph_type'] = $elementFields['type_graph'];
|
|
||||||
break;
|
|
||||||
case 'box_item':
|
case 'box_item':
|
||||||
$elementFields['width_box'] = $elementFields['width'];
|
$elementFields['width_box'] = $elementFields['width'];
|
||||||
$elementFields['height_box'] = $elementFields['height'];
|
$elementFields['height_box'] = $elementFields['height'];
|
||||||
@ -978,17 +925,6 @@ switch ($action) {
|
|||||||
}
|
}
|
||||||
$values['period'] = $period;
|
$values['period'] = $period;
|
||||||
break;
|
break;
|
||||||
case 'bars_graph':
|
|
||||||
$values['type'] = BARS_GRAPH;
|
|
||||||
if ($width_percentile == null) {
|
|
||||||
$values['width'] = 0;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$values['width'] = $width_percentile;
|
|
||||||
}
|
|
||||||
$values['type_graph'] = $bars_graph_type;
|
|
||||||
$values['image'] = $background_color;
|
|
||||||
break;
|
|
||||||
case 'auto_sla_graph':
|
case 'auto_sla_graph':
|
||||||
$values['type'] = AUTO_SLA_GRAPH;
|
$values['type'] = AUTO_SLA_GRAPH;
|
||||||
$values['period'] = $event_max_time_row;
|
$values['period'] = $event_max_time_row;
|
||||||
@ -1012,9 +948,6 @@ switch ($action) {
|
|||||||
$values['image'] = $image;
|
$values['image'] = $image;
|
||||||
$values['width'] = $width;
|
$values['width'] = $width;
|
||||||
$values['height'] = $height;
|
$values['height'] = $height;
|
||||||
if(defined('METACONSOLE') && $values['id_agent'] == 0){
|
|
||||||
$values['id_metaconsole'] = 1;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case 'group_item':
|
case 'group_item':
|
||||||
$values['type'] = GROUP_ITEM;
|
$values['type'] = GROUP_ITEM;
|
||||||
@ -1033,18 +966,12 @@ switch ($action) {
|
|||||||
case 'label':
|
case 'label':
|
||||||
$values['type'] = LABEL;
|
$values['type'] = LABEL;
|
||||||
$values['label'] = $label;
|
$values['label'] = $label;
|
||||||
if(defined('METACONSOLE') && $values['id_agent'] == 0){
|
|
||||||
$values['id_metaconsole'] = 1;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case 'icon':
|
case 'icon':
|
||||||
$values['type'] = ICON;
|
$values['type'] = ICON;
|
||||||
$values['image'] = $image;
|
$values['image'] = $image;
|
||||||
$values['width'] = $width;
|
$values['width'] = $width;
|
||||||
$values['height'] = $height;
|
$values['height'] = $height;
|
||||||
if(defined('METACONSOLE') && $values['id_agent'] == 0){
|
|
||||||
$values['id_metaconsole'] = 1;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
if (enterprise_installed()) {
|
if (enterprise_installed()) {
|
||||||
|
@ -197,6 +197,7 @@ define('SERVICE', 10); //Enterprise Item.
|
|||||||
define('GROUP_ITEM', 11);
|
define('GROUP_ITEM', 11);
|
||||||
define('BOX_ITEM', 12);
|
define('BOX_ITEM', 12);
|
||||||
define('LINE_ITEM', 13);
|
define('LINE_ITEM', 13);
|
||||||
|
define('DONUT_GRAPH', 17);
|
||||||
define('BARS_GRAPH', 18);
|
define('BARS_GRAPH', 18);
|
||||||
//Some styles
|
//Some styles
|
||||||
define('MIN_WIDTH', 300);
|
define('MIN_WIDTH', 300);
|
||||||
@ -459,7 +460,7 @@ define("STATWIN_DEFAULT_CHART_WIDTH", 555);
|
|||||||
define("STATWIN_DEFAULT_CHART_HEIGHT", 245);
|
define("STATWIN_DEFAULT_CHART_HEIGHT", 245);
|
||||||
|
|
||||||
/* Dashboard */
|
/* Dashboard */
|
||||||
define("DASHBOARD_DEFAULT_COUNT_CELLS", 1);
|
define("DASHBOARD_DEFAULT_COUNT_CELLS", 4);
|
||||||
|
|
||||||
define("OPTION_TEXT", 1);
|
define("OPTION_TEXT", 1);
|
||||||
define("OPTION_SINGLE_SELECT", 2);
|
define("OPTION_SINGLE_SELECT", 2);
|
||||||
|
@ -375,9 +375,6 @@ function visual_map_print_item($mode = "read", $layoutData,
|
|||||||
$link = true;
|
$link = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
|
||||||
case BARS_GRAPH:
|
|
||||||
$link = true;
|
|
||||||
break;
|
break;
|
||||||
case AUTO_SLA_GRAPH:
|
case AUTO_SLA_GRAPH:
|
||||||
$link = true;
|
$link = true;
|
||||||
@ -424,7 +421,7 @@ function visual_map_print_item($mode = "read", $layoutData,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ($is_a_link_to_other_visualconsole) {
|
else if ($is_a_link_to_other_visualconsole) {
|
||||||
if (empty($layoutData['id_metaconsole'])) {
|
if (empty($layout_data['id_metaconsole'])) {
|
||||||
$url = $config['homeurl'] . "index.php?sec=reporting&sec2=operation/visual_console/render_view&pure=" . $config["pure"] . "&id=" . $layoutData["id_layout_linked"];
|
$url = $config['homeurl'] . "index.php?sec=reporting&sec2=operation/visual_console/render_view&pure=" . $config["pure"] . "&id=" . $layoutData["id_layout_linked"];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -491,6 +488,17 @@ function visual_map_print_item($mode = "read", $layoutData,
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case DONUT_GRAPH:
|
||||||
|
if (empty($layout_data['id_metaconsole'])) {
|
||||||
|
$url = $config['homeurl'] . "index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente=" . $layoutData['id_agent'] .
|
||||||
|
"&tab=module&edit_module=1&id_agent_module=" . $layoutData['id_agente_modulo'];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$url = "index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente=" . $layoutData['id_agent'] .
|
||||||
|
"&tab=module&edit_module=1&id_agent_module=" . $layoutData['id_agente_modulo'];
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case BARS_GRAPH:
|
case BARS_GRAPH:
|
||||||
if (empty($layout_data['id_metaconsole'])) {
|
if (empty($layout_data['id_metaconsole'])) {
|
||||||
$url = $config['homeurl'] . "index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente=" . $layoutData['id_agent'] .
|
$url = $config['homeurl'] . "index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&id_agente=" . $layoutData['id_agent'] .
|
||||||
@ -501,6 +509,7 @@ function visual_map_print_item($mode = "read", $layoutData,
|
|||||||
"&tab=module&edit_module=1&id_agent_module=" . $layoutData['id_agente_modulo'];
|
"&tab=module&edit_module=1&id_agent_module=" . $layoutData['id_agente_modulo'];
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GROUP_ITEM:
|
case GROUP_ITEM:
|
||||||
$is_a_link_to_other_visualconsole = false;
|
$is_a_link_to_other_visualconsole = false;
|
||||||
if ($layoutData['id_layout_linked'] != 0) {
|
if ($layoutData['id_layout_linked'] != 0) {
|
||||||
@ -524,20 +533,15 @@ function visual_map_print_item($mode = "read", $layoutData,
|
|||||||
case LABEL:
|
case LABEL:
|
||||||
if ($layoutData['id_layout_linked'] != 0) {
|
if ($layoutData['id_layout_linked'] != 0) {
|
||||||
// Link to a map
|
// Link to a map
|
||||||
if ($layoutData['id_metaconsole'] == 0) {
|
$url = $config['homeurl'] .
|
||||||
$url = $config['homeurl'] .
|
'index.php?sec=reporting&sec2=operation/visual_console/render_view&pure='.$config["pure"].'&id='.$layoutData["id_layout_linked"];
|
||||||
'index.php?sec=reporting&sec2=operation/visual_console/render_view&pure='.$config["pure"].'&id='.$layoutData["id_layout_linked"];
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
$url = "index.php?sec=screen&sec2=screens/screens&action=visualmap&pure=0&id_visualmap=" . $layoutData["id_layout_linked"] . "&refr=0";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ICON:
|
case ICON:
|
||||||
$url_icon = "";
|
$url_icon = "";
|
||||||
if ($layoutData['id_layout_linked'] != 0) {
|
if ($layoutData['id_layout_linked'] != 0) {
|
||||||
// Link to a map
|
// Link to a map
|
||||||
if ($layoutData['id_metaconsole'] == 0) {
|
if (empty($layoutData['id_metaconsole'])) {
|
||||||
$url = 'index.php?sec=reporting&sec2=operation/visual_console/render_view&pure='.$config["pure"].'&id='.$layoutData["id_layout_linked"];
|
$url = 'index.php?sec=reporting&sec2=operation/visual_console/render_view&pure='.$config["pure"].'&id='.$layoutData["id_layout_linked"];
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -1085,274 +1089,6 @@ function visual_map_print_item($mode = "read", $layoutData,
|
|||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BARS_GRAPH:
|
|
||||||
|
|
||||||
$imgpos = '';
|
|
||||||
|
|
||||||
if($layoutData['label_position']=='left'){
|
|
||||||
$imgpos = 'float:right';
|
|
||||||
}
|
|
||||||
else if($layoutData['label_position']=='right'){
|
|
||||||
$imgpos = 'float:left';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!empty($proportion)) {
|
|
||||||
$width =
|
|
||||||
((integer)($proportion['proportion_width'] * $width));
|
|
||||||
$height =
|
|
||||||
((integer)($proportion['proportion_height'] * $height));
|
|
||||||
}
|
|
||||||
//Metaconsole db connection
|
|
||||||
if ($layoutData['id_metaconsole'] != 0) {
|
|
||||||
$connection = db_get_row_filter ('tmetaconsole_setup',
|
|
||||||
array('id' => $layoutData['id_metaconsole']));
|
|
||||||
if (metaconsole_load_external_db($connection) != NOERR) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($isExternalLink)
|
|
||||||
$homeurl = $config['homeurl'];
|
|
||||||
else
|
|
||||||
$homeurl = '';
|
|
||||||
|
|
||||||
$is_string = db_get_value_filter ('id_tipo_modulo', 'tagente_modulo',
|
|
||||||
array ('id_agente' => $layoutData['id_agent'],
|
|
||||||
'id_agente_modulo' => $id_module));
|
|
||||||
|
|
||||||
if ( (get_parameter('action') == 'edit') || (get_parameter('operation') == 'edit_visualmap') ) {
|
|
||||||
if($width == 0){
|
|
||||||
if (($is_string == 17) || ($is_string == 23) || ($is_string == 3) ||
|
|
||||||
($is_string == 10) || ($is_string == 33)) {
|
|
||||||
if ($layoutData['id_metaconsole'] != 0) {
|
|
||||||
$img = '<img src="../../images/console/signes/barras.png" style="width:400px;height:400px;'.$imgpos.'">';
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
$img = '<img src="images/console/signes/barras.png" style="width:400px;height:400px;'.$imgpos.'">';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if ($layoutData['id_metaconsole'] != 0) {
|
|
||||||
$img = '<img src="../../images/console/signes/barras-no.png" style="width:400px;height:400px;'.$imgpos.'">';
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
$img = '<img src="images/console/signes/barras-no.png" style="width:400px;height:400px;'.$imgpos.'">';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
if (($is_string == 17) || ($is_string == 23) || ($is_string == 3) ||
|
|
||||||
($is_string == 10) || ($is_string == 33)) {
|
|
||||||
if ($layoutData['id_metaconsole'] != 0) {
|
|
||||||
$img = '<img src="../../images/console/signes/barras.png" style="width:'.$width.'px;height:'.$width.'px;'.$imgpos.'">';
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
$img = '<img src="images/console/signes/barras.png" style="width:'.$width.'px;height:'.$width.'px;'.$imgpos.'">';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if ($layoutData['id_metaconsole'] != 0) {
|
|
||||||
$img = '<img src="../../images/console/signes/barras-no.png" style="width:'.$width.'px;height:'.$width.'px;'.$imgpos.'">';
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
$img = '<img src="images/console/signes/barras-no.png" style="width:'.$width.'px;height:'.$width.'px;'.$imgpos.'">';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if (($is_string == 17) || ($is_string == 23) || ($is_string == 3) ||
|
|
||||||
($is_string == 10) || ($is_string == 33)) {
|
|
||||||
|
|
||||||
$color = array();
|
|
||||||
|
|
||||||
$color[0] = array('border' => '#000000',
|
|
||||||
'color' => $config['graph_color1'],
|
|
||||||
'alpha' => CHART_DEFAULT_ALPHA);
|
|
||||||
$color[1] = array('border' => '#000000',
|
|
||||||
'color' => $config['graph_color2'],
|
|
||||||
'alpha' => CHART_DEFAULT_ALPHA);
|
|
||||||
$color[2] = array('border' => '#000000',
|
|
||||||
'color' => $config['graph_color3'],
|
|
||||||
'alpha' => CHART_DEFAULT_ALPHA);
|
|
||||||
$color[3] = array('border' => '#000000',
|
|
||||||
'color' => $config['graph_color4'],
|
|
||||||
'alpha' => CHART_DEFAULT_ALPHA);
|
|
||||||
$color[4] = array('border' => '#000000',
|
|
||||||
'color' => $config['graph_color5'],
|
|
||||||
'alpha' => CHART_DEFAULT_ALPHA);
|
|
||||||
$color[5] = array('border' => '#000000',
|
|
||||||
'color' => $config['graph_color6'],
|
|
||||||
'alpha' => CHART_DEFAULT_ALPHA);
|
|
||||||
$color[6] = array('border' => '#000000',
|
|
||||||
'color' => $config['graph_color7'],
|
|
||||||
'alpha' => CHART_DEFAULT_ALPHA);
|
|
||||||
$color[7] = array('border' => '#000000',
|
|
||||||
'color' => $config['graph_color8'],
|
|
||||||
'alpha' => CHART_DEFAULT_ALPHA);
|
|
||||||
$color[8] = array('border' => '#000000',
|
|
||||||
'color' => $config['graph_color9'],
|
|
||||||
'alpha' => CHART_DEFAULT_ALPHA);
|
|
||||||
$color[9] = array('border' => '#000000',
|
|
||||||
'color' => $config['graph_color10'],
|
|
||||||
'alpha' => CHART_DEFAULT_ALPHA);
|
|
||||||
$color[11] = array('border' => '#000000',
|
|
||||||
'color' => COL_GRAPH9,
|
|
||||||
'alpha' => CHART_DEFAULT_ALPHA);
|
|
||||||
$color[12] = array('border' => '#000000',
|
|
||||||
'color' => COL_GRAPH10,
|
|
||||||
'alpha' => CHART_DEFAULT_ALPHA);
|
|
||||||
$color[13] = array('border' => '#000000',
|
|
||||||
'color' => COL_GRAPH11,
|
|
||||||
'alpha' => CHART_DEFAULT_ALPHA);
|
|
||||||
$color[14] = array('border' => '#000000',
|
|
||||||
'color' => COL_GRAPH12,
|
|
||||||
'alpha' => CHART_DEFAULT_ALPHA);
|
|
||||||
$color[15] = array('border' => '#000000',
|
|
||||||
'color' => COL_GRAPH13,
|
|
||||||
'alpha' => CHART_DEFAULT_ALPHA);
|
|
||||||
|
|
||||||
$module_data = get_bars_module_data($id_module);
|
|
||||||
$water_mark = array('file' => '/var/www/html/pandora_console/images/logo_vertical_water.png',
|
|
||||||
'url' => 'http://localhost/pandora_console/images/logo_vertical_water.png');
|
|
||||||
|
|
||||||
if ($width == 0) {
|
|
||||||
if ($layoutData['label_position']=='left') {
|
|
||||||
if ($layoutData['type_graph'] == 'horizontal') {
|
|
||||||
$img = '<div style="float:right;height:'.$himg.'px;">'.
|
|
||||||
hbar_graph(true, $module_data,
|
|
||||||
400, 400, $color, array(), array(),
|
|
||||||
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
|
|
||||||
"", "", $water_mark, $config['fontpath'], 6,
|
|
||||||
"", 0, $config['homeurl'], $layoutData['image']) . '</div>';
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$img = '<div style="float:right;height:'.$himg.'px;">'.
|
|
||||||
vbar_graph(true, $module_data,
|
|
||||||
400, 400, $color, array(), array(),
|
|
||||||
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
|
|
||||||
"", "", $water_mark, $config['fontpath'], 6,
|
|
||||||
"", 0, $config['homeurl'], $layoutData['image'], true) . '</div>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
elseif($layoutData['label_position']=='right') {
|
|
||||||
if ($layoutData['type_graph'] == 'horizontal') {
|
|
||||||
$img = '<div style="float:left;height:'.$himg.'px;">'.
|
|
||||||
hbar_graph(true, $module_data,
|
|
||||||
400, 400, $color, array(), array(),
|
|
||||||
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
|
|
||||||
"", "", $water_mark, $config['fontpath'], 6,
|
|
||||||
"", 0, $config['homeurl'], $layoutData['image']) . '</div>';
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$img = '<div style="float:left;height:'.$himg.'px;">'.
|
|
||||||
vbar_graph(true, $module_data,
|
|
||||||
400, 400, $color, array(), array(),
|
|
||||||
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
|
|
||||||
"", "", $water_mark, $config['fontpath'], 6,
|
|
||||||
"", 0, $config['homeurl'], $layoutData['image'], true) . '</div>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if ($layoutData['type_graph'] == 'horizontal') {
|
|
||||||
$img = hbar_graph(true, $module_data,
|
|
||||||
400, 400, $color, array(), array(),
|
|
||||||
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
|
|
||||||
"", "", $water_mark, $config['fontpath'], 6,
|
|
||||||
"", 0, $config['homeurl'], $layoutData['image']);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$img = vbar_graph(true, $module_data,
|
|
||||||
400, 400, $color, array(), array(),
|
|
||||||
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
|
|
||||||
"", "", $water_mark, $config['fontpath'], 6,
|
|
||||||
"", 0, $config['homeurl'], $layoutData['image'], true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
if ($layoutData['label_position']=='left') {
|
|
||||||
if ($layoutData['type_graph'] == 'horizontal') {
|
|
||||||
$img = '<div style="float:right;height:'.$himg.'px;">'.
|
|
||||||
hbar_graph(true, $module_data,
|
|
||||||
$width, $width, $color, array(), array(),
|
|
||||||
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
|
|
||||||
"", "", $water_mark, $config['fontpath'], 6,
|
|
||||||
"", 0, $config['homeurl'], $layoutData['image']) . '</div>';
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$img = '<div style="float:right;height:'.$himg.'px;">'.
|
|
||||||
vbar_graph(true, $module_data,
|
|
||||||
$width, $width, $color, array(), array(),
|
|
||||||
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
|
|
||||||
"", "", $water_mark, $config['fontpath'], 6,
|
|
||||||
"", 0, $config['homeurl'], $layoutData['image'], true) . '</div>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
elseif($layoutData['label_position']=='right') {
|
|
||||||
if ($layoutData['type_graph'] == 'horizontal') {
|
|
||||||
$img = '<div style="float:left;height:'.$himg.'px;">'.
|
|
||||||
hbar_graph(true, $module_data,
|
|
||||||
$width, $width, $color, array(), array(),
|
|
||||||
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
|
|
||||||
"", "", $water_mark, $config['fontpath'], 6,
|
|
||||||
"", 0, $config['homeurl'], $layoutData['image']) . '</div>';
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$img = '<div style="float:left;height:'.$himg.'px;">'.
|
|
||||||
vbar_graph(true, $module_data,
|
|
||||||
$width, $width, $color, array(), array(),
|
|
||||||
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
|
|
||||||
"", "", $water_mark, $config['fontpath'], 6,
|
|
||||||
"", 0, $config['homeurl'], $layoutData['image'], true) . '</div>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if ($layoutData['type_graph'] == 'horizontal') {
|
|
||||||
$img = hbar_graph(true, $module_data,
|
|
||||||
$width, $width, $color, array(), array(),
|
|
||||||
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
|
|
||||||
"", "", $water_mark, $config['fontpath'], 6,
|
|
||||||
"", 0, $config['homeurl'], $layoutData['image']);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$img = vbar_graph(true, $module_data,
|
|
||||||
$width, $width, $color, array(), array(),
|
|
||||||
ui_get_full_url("images/image_problem.opaque.png", false, false, false),
|
|
||||||
"", "", $water_mark, $config['fontpath'], 6,
|
|
||||||
"", 0, $config['homeurl'], $layoutData['image'], true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if($width == 0){
|
|
||||||
if ($layoutData['id_metaconsole'] != 0) {
|
|
||||||
$img = '<img src="../../images/console/signes/barras-no.png" style="width:400px;height:400px;'.$imgpos.'">';
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
$img = '<img src="images/console/signes/barras-no.png" style="width:400px;height:400px;'.$imgpos.'">';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
if ($layoutData['id_metaconsole'] != 0) {
|
|
||||||
$img = '<img src="../../images/console/signes/barras-no.png" style="width:'.$width.'px;height:'.$width.'px;'.$imgpos.'">';
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
$img = '<img src="images/console/signes/barras-no.png" style="width:'.$width.'px;height:'.$width.'px;'.$imgpos.'">';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//Restore db connection
|
|
||||||
if ($layoutData['id_metaconsole'] != 0) {
|
|
||||||
metaconsole_restore_db();
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
|
|
||||||
case LABEL:
|
case LABEL:
|
||||||
$z_index = 4 + 1;
|
$z_index = 4 + 1;
|
||||||
break;
|
break;
|
||||||
@ -1363,10 +1099,10 @@ function visual_map_print_item($mode = "read", $layoutData,
|
|||||||
if ((get_parameter('action') == 'edit') || (get_parameter('operation') == 'edit_visualmap')) {
|
if ((get_parameter('action') == 'edit') || (get_parameter('operation') == 'edit_visualmap')) {
|
||||||
if($width == 0 || $height == 0){
|
if($width == 0 || $height == 0){
|
||||||
if ($layoutData['id_metaconsole'] != 0) {
|
if ($layoutData['id_metaconsole'] != 0) {
|
||||||
$img = '<img src="../../images/console/signes/module-events.png" style="width:500px;height:40px;">';
|
$img = '<img src="../../images/console/signes/module-events.png">';
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
$img = '<img src="images/console/signes/module-events.png" style="width:500px;height:40px;">';
|
$img = '<img src="images/console/signes/module-events.png">';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
@ -1430,9 +1166,6 @@ function visual_map_print_item($mode = "read", $layoutData,
|
|||||||
case MODULE_GRAPH:
|
case MODULE_GRAPH:
|
||||||
$class .= "module_graph";
|
$class .= "module_graph";
|
||||||
break;
|
break;
|
||||||
case BARS_GRAPH:
|
|
||||||
$class .= "bars_graph";
|
|
||||||
break;
|
|
||||||
case SIMPLE_VALUE:
|
case SIMPLE_VALUE:
|
||||||
case SIMPLE_VALUE_MAX:
|
case SIMPLE_VALUE_MAX:
|
||||||
case SIMPLE_VALUE_MIN:
|
case SIMPLE_VALUE_MIN:
|
||||||
@ -1466,11 +1199,6 @@ function visual_map_print_item($mode = "read", $layoutData,
|
|||||||
echo "<a href=\"$url\">";
|
echo "<a href=\"$url\">";
|
||||||
}
|
}
|
||||||
|
|
||||||
//for clean link text from bbdd
|
|
||||||
if (get_parameter('action') == 'edit' || get_parameter('operation') == 'edit_visualmap') {
|
|
||||||
$text = preg_replace("/<\/*a.*?>/", '', $text);
|
|
||||||
}
|
|
||||||
|
|
||||||
switch ($type) {
|
switch ($type) {
|
||||||
case BOX_ITEM:
|
case BOX_ITEM:
|
||||||
if ($width == 0 || $width == 0) {
|
if ($width == 0 || $width == 0) {
|
||||||
@ -1563,12 +1291,9 @@ function visual_map_print_item($mode = "read", $layoutData,
|
|||||||
$imgpos = 'float:left';
|
$imgpos = 'float:left';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($layoutData['id_metaconsole'] != 0) {
|
|
||||||
$img = "../../" . $img;
|
|
||||||
}
|
|
||||||
|
|
||||||
$varsize = getimagesize($img);
|
$varsize = getimagesize($img);
|
||||||
|
|
||||||
|
|
||||||
if($layoutData['show_statistics'] == 1){
|
if($layoutData['show_statistics'] == 1){
|
||||||
|
|
||||||
if (get_parameter('action') == 'edit') {
|
if (get_parameter('action') == 'edit') {
|
||||||
@ -1662,35 +1387,34 @@ function visual_map_print_item($mode = "read", $layoutData,
|
|||||||
else{
|
else{
|
||||||
|
|
||||||
if ($width == 0 || $height == 0) {
|
if ($width == 0 || $height == 0) {
|
||||||
|
|
||||||
if($varsize[0] > 150 || $varsize[1] > 150){
|
if($varsize[0] > 150 || $varsize[1] > 150){
|
||||||
echo html_print_image($img, true,
|
echo html_print_image($img, true,
|
||||||
array("class" => "image",
|
array("class" => "image",
|
||||||
"id" => "image_" . $id,
|
"id" => "image_" . $id,
|
||||||
"width" => "70px",
|
"width" => "70px",
|
||||||
"height" => "70px",
|
"height" => "70px",
|
||||||
"title" => $img_style_title,
|
"title" => $img_style_title,
|
||||||
"style" => $borderStyle.$imgpos), false,
|
"style" => $borderStyle.$imgpos), false,
|
||||||
false, false, $isExternalLink);
|
false, false, $isExternalLink);
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
echo html_print_image($img, true,
|
echo html_print_image($img, true,
|
||||||
array("class" => "image",
|
array("class" => "image",
|
||||||
"id" => "image_" . $id,
|
"id" => "image_" . $id,
|
||||||
"title" => $img_style_title,
|
"title" => $img_style_title,
|
||||||
"style" => $borderStyle.$imgpos), false,
|
"style" => $borderStyle.$imgpos), false,
|
||||||
false, false, $isExternalLink);
|
false, false, $isExternalLink);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
echo html_print_image($img, true,
|
echo html_print_image($img, true,
|
||||||
array("class" => "image",
|
array("class" => "image",
|
||||||
"id" => "image_" . $id,
|
"id" => "image_" . $id,
|
||||||
"width" => $width,
|
"width" => $width,
|
||||||
"height" => $height,
|
"height" => $height,
|
||||||
"title" => $img_style_title,
|
"title" => $img_style_title,
|
||||||
"style" => $borderStyle.$imgpos), false,
|
"style" => $borderStyle.$imgpos), false,
|
||||||
false, false, $isExternalLink);
|
false, false, $isExternalLink);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -1853,20 +1577,6 @@ function visual_map_print_item($mode = "read", $layoutData,
|
|||||||
|
|
||||||
echo $img;
|
echo $img;
|
||||||
|
|
||||||
if ($layoutData['label_position']=='down') {
|
|
||||||
echo io_safe_output($text);
|
|
||||||
}
|
|
||||||
elseif($layoutData['label_position']=='left' || $layoutData['label_position']=='right') {
|
|
||||||
echo io_safe_output($text);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case BARS_GRAPH:
|
|
||||||
if ($layoutData['label_position']=='up') {
|
|
||||||
echo io_safe_output($text);
|
|
||||||
}
|
|
||||||
|
|
||||||
echo $img;
|
|
||||||
|
|
||||||
if ($layoutData['label_position']=='down') {
|
if ($layoutData['label_position']=='down') {
|
||||||
echo io_safe_output($text);
|
echo io_safe_output($text);
|
||||||
}
|
}
|
||||||
@ -2039,29 +1749,6 @@ function visual_map_print_item($mode = "read", $layoutData,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_bars_module_data ($id_module) {
|
|
||||||
$mod_values = db_get_value_filter('datos', 'tagente_estado', array('id_agente_modulo' => $id_module));
|
|
||||||
|
|
||||||
if (preg_match("/\r\n/", $mod_values)) {
|
|
||||||
$values = explode("\r\n", $mod_values);
|
|
||||||
}
|
|
||||||
elseif (preg_match("/\n/", $mod_values)) {
|
|
||||||
$values = explode("\n", $mod_values);
|
|
||||||
}
|
|
||||||
|
|
||||||
$values_to_return = array();
|
|
||||||
$index = 0;
|
|
||||||
$color_index = 0;
|
|
||||||
$total = 0;
|
|
||||||
foreach ($values as $val) {
|
|
||||||
$data = explode(":", $val);
|
|
||||||
$values_to_return[$data[0]] = array('g' =>$data[1]);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $values_to_return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The function to get simple value type from the value of process type in the form
|
* The function to get simple value type from the value of process type in the form
|
||||||
*
|
*
|
||||||
@ -3014,10 +2701,9 @@ function visual_map_print_visual_map ($id_layout, $show_links = true,
|
|||||||
$mapWidth = $layout["width"];
|
$mapWidth = $layout["width"];
|
||||||
$mapHeight = $layout["height"];
|
$mapHeight = $layout["height"];
|
||||||
$backgroundImage = '';
|
$backgroundImage = '';
|
||||||
if ($layout["background"] != 'None.png' ){
|
if ($layout["background"] != 'None.png' )
|
||||||
$backgroundImage = $metaconsole_hack . 'images/console/background/' .
|
$backgroundImage = $metaconsole_hack . 'images/console/background/' .
|
||||||
$layout["background"];
|
$layout["background"];
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (defined('METACONSOLE')) {
|
if (defined('METACONSOLE')) {
|
||||||
@ -3112,32 +2798,13 @@ function visual_map_print_visual_map ($id_layout, $show_links = true,
|
|||||||
* @return array A list of layouts the user can see.
|
* @return array A list of layouts the user can see.
|
||||||
*/
|
*/
|
||||||
function visual_map_get_user_layouts ($id_user = 0, $only_names = false, $filter = false, $returnAllGroup = true) {
|
function visual_map_get_user_layouts ($id_user = 0, $only_names = false, $filter = false, $returnAllGroup = true) {
|
||||||
if (! is_array ($filter)){
|
if (! is_array ($filter))
|
||||||
$filter = array ();
|
$filter = array ();
|
||||||
} else {
|
|
||||||
if(!empty($filter['name'])){
|
|
||||||
$where .= "name LIKE '%".io_safe_output($filter['name'])."%'";
|
|
||||||
unset($filter['name']);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($returnAllGroup){
|
if ($returnAllGroup)
|
||||||
$groups = users_get_groups ($id_user, 'VR');
|
$groups = users_get_groups ($id_user, 'VR');
|
||||||
} else {
|
else
|
||||||
if(!empty($filter['group'])){
|
$groups = users_get_groups ($id_user, 'VR', false);
|
||||||
$permissions_group = users_get_groups ($id_user, 'VR', false);
|
|
||||||
if(empty($permissions_group)){
|
|
||||||
$permissions_group = users_get_groups ($id_user, 'VM', false);
|
|
||||||
}
|
|
||||||
$groups = array_intersect_key($filter['group'], $permissions_group);
|
|
||||||
unset($filter['group']);
|
|
||||||
} else {
|
|
||||||
$groups = users_get_groups ($id_user, 'VR', false);
|
|
||||||
if(empty($groups)){
|
|
||||||
$groups = users_get_groups ($id_user, 'VM', false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!empty($groups)) {
|
if (!empty($groups)) {
|
||||||
if (empty($where))
|
if (empty($where))
|
||||||
@ -3303,10 +2970,6 @@ function visual_map_create_internal_name_item($label = null, $type, $image, $age
|
|||||||
case MODULE_GRAPH:
|
case MODULE_GRAPH:
|
||||||
$text = __('Module graph');
|
$text = __('Module graph');
|
||||||
break;
|
break;
|
||||||
case 'bars_graph':
|
|
||||||
case BARS_GRAPH:
|
|
||||||
$text = __('Bars graph');
|
|
||||||
break;
|
|
||||||
case 'auto_sla_graph':
|
case 'auto_sla_graph':
|
||||||
case AUTO_SLA_GRAPH:
|
case AUTO_SLA_GRAPH:
|
||||||
$text = __('Auto SLA Graph');
|
$text = __('Auto SLA Graph');
|
||||||
@ -3422,9 +3085,6 @@ function visual_map_type_in_js($type) {
|
|||||||
case MODULE_GRAPH:
|
case MODULE_GRAPH:
|
||||||
return 'module_graph';
|
return 'module_graph';
|
||||||
break;
|
break;
|
||||||
case BARS_GRAPH:
|
|
||||||
return 'bars_graph';
|
|
||||||
break;
|
|
||||||
case AUTO_SLA_GRAPH:
|
case AUTO_SLA_GRAPH:
|
||||||
return 'auto_sla_graph';
|
return 'auto_sla_graph';
|
||||||
break;
|
break;
|
||||||
|
@ -163,8 +163,7 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) {
|
|||||||
'simple_value',
|
'simple_value',
|
||||||
'datos',
|
'datos',
|
||||||
'group_item',
|
'group_item',
|
||||||
'auto_sla_graph',
|
'auto_sla_graph');
|
||||||
'bars_graph');
|
|
||||||
$form_items['label_row']['html'] =
|
$form_items['label_row']['html'] =
|
||||||
'<td align="left" valign="top" style="">' . __('Label') . '
|
'<td align="left" valign="top" style="">' . __('Label') . '
|
||||||
|
|
||||||
@ -215,8 +214,7 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) {
|
|||||||
'module_graph',
|
'module_graph',
|
||||||
'simple_value',
|
'simple_value',
|
||||||
'datos',
|
'datos',
|
||||||
'icon',
|
'icon');
|
||||||
'bars_graph');
|
|
||||||
|
|
||||||
if (!is_metaconsole())
|
if (!is_metaconsole())
|
||||||
$form_items['enable_link_row']['items'][] = 'group_item';
|
$form_items['enable_link_row']['items'][] = 'group_item';
|
||||||
@ -224,7 +222,7 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) {
|
|||||||
$form_items['enable_link_row']['html'] =
|
$form_items['enable_link_row']['html'] =
|
||||||
'<td align="left" style="">' . __('Enable link') . '</td>
|
'<td align="left" style="">' . __('Enable link') . '</td>
|
||||||
<td align="left" style="">' .
|
<td align="left" style="">' .
|
||||||
html_print_checkbox('enable_link', '', 1, true) . '</td>';
|
html_print_checkbox('enable_link', '', !is_metaconsole(), true) . '</td>';
|
||||||
|
|
||||||
|
|
||||||
$form_items['preview_row'] = array();
|
$form_items['preview_row'] = array();
|
||||||
@ -239,8 +237,7 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) {
|
|||||||
$form_items['background_color'] = array();
|
$form_items['background_color'] = array();
|
||||||
$form_items['background_color']['items'] = array(
|
$form_items['background_color']['items'] = array(
|
||||||
'module_graph',
|
'module_graph',
|
||||||
'datos',
|
'datos');
|
||||||
'bars_graph');
|
|
||||||
$form_items['background_color']['html'] = '<td align="left"><span>' .
|
$form_items['background_color']['html'] = '<td align="left"><span>' .
|
||||||
__('Background color') . '</span></td>
|
__('Background color') . '</span></td>
|
||||||
<td align="left">'. html_print_select (
|
<td align="left">'. html_print_select (
|
||||||
@ -280,7 +277,7 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) {
|
|||||||
$form_items['agent_row'] = array();
|
$form_items['agent_row'] = array();
|
||||||
$form_items['agent_row']['items'] = array('static_graph',
|
$form_items['agent_row']['items'] = array('static_graph',
|
||||||
'percentile_bar', 'percentile_item', 'module_graph',
|
'percentile_bar', 'percentile_item', 'module_graph',
|
||||||
'simple_value', 'datos', 'auto_sla_graph', 'bars_graph');
|
'simple_value', 'datos', 'auto_sla_graph', 'bars_graph', 'donut_graph');
|
||||||
$form_items['agent_row']['html'] = '<td align="left">' .
|
$form_items['agent_row']['html'] = '<td align="left">' .
|
||||||
__('Agent') . '</td>';
|
__('Agent') . '</td>';
|
||||||
$params = array();
|
$params = array();
|
||||||
@ -313,7 +310,7 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) {
|
|||||||
$form_items['module_row'] = array();
|
$form_items['module_row'] = array();
|
||||||
$form_items['module_row']['items'] = array('static_graph',
|
$form_items['module_row']['items'] = array('static_graph',
|
||||||
'percentile_bar', 'percentile_item', 'module_graph',
|
'percentile_bar', 'percentile_item', 'module_graph',
|
||||||
'simple_value', 'datos', 'auto_sla_graph', 'bars_graph');
|
'simple_value', 'datos', 'auto_sla_graph', 'donut_graph', 'bars_graph');
|
||||||
$form_items['module_row']['html'] = '<td align="left">' .
|
$form_items['module_row']['html'] = '<td align="left">' .
|
||||||
__('Module') . '</td>
|
__('Module') . '</td>
|
||||||
<td align="left">' .
|
<td align="left">' .
|
||||||
@ -399,7 +396,7 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) {
|
|||||||
|
|
||||||
|
|
||||||
$form_items['percentile_bar_row_1'] = array();
|
$form_items['percentile_bar_row_1'] = array();
|
||||||
$form_items['percentile_bar_row_1']['items'] = array('percentile_bar', 'percentile_item', 'datos', 'bars_graph');
|
$form_items['percentile_bar_row_1']['items'] = array('percentile_bar', 'percentile_item', 'datos', 'donut_graph', 'bars_graph');
|
||||||
$form_items['percentile_bar_row_1']['html'] = '<td align="left">' .
|
$form_items['percentile_bar_row_1']['html'] = '<td align="left">' .
|
||||||
__('Width') . '</td>
|
__('Width') . '</td>
|
||||||
<td align="left">' . html_print_input_text('width_percentile', 0, '', 3, 5, true) . '</td>';
|
<td align="left">' . html_print_input_text('width_percentile', 0, '', 3, 5, true) . '</td>';
|
||||||
@ -476,13 +473,6 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) {
|
|||||||
'<span id="dir_items"></span> item/s
|
'<span id="dir_items"></span> item/s
|
||||||
</td>';
|
</td>';
|
||||||
|
|
||||||
$bars_graph_types = array('vertical' => __('Vertical'), 'horizontal' => __('Horizontal'));
|
|
||||||
$form_items['bars_graph_type'] = array();
|
|
||||||
$form_items['bars_graph_type']['items'] = array('bars_graph');
|
|
||||||
$form_items['bars_graph_type']['html'] = '<td align="left">' .
|
|
||||||
__('Type') . '</td>
|
|
||||||
<td align="left">' . html_print_select($bars_graph_types, 'bars_graph_type', 'vertical', '', '', '', true) . '</td>';
|
|
||||||
|
|
||||||
|
|
||||||
//Insert and modify before the buttons to create or update.
|
//Insert and modify before the buttons to create or update.
|
||||||
if (enterprise_installed()) {
|
if (enterprise_installed()) {
|
||||||
@ -528,7 +518,7 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) {
|
|||||||
$form_items_advance['position_row']['items'] = array('static_graph',
|
$form_items_advance['position_row']['items'] = array('static_graph',
|
||||||
'percentile_bar', 'percentile_item', 'module_graph',
|
'percentile_bar', 'percentile_item', 'module_graph',
|
||||||
'simple_value', 'label', 'icon', 'datos', 'box_item',
|
'simple_value', 'label', 'icon', 'datos', 'box_item',
|
||||||
'auto_sla_graph', 'bars_graph');
|
'auto_sla_graph');
|
||||||
$form_items_advance['position_row']['html'] = '
|
$form_items_advance['position_row']['html'] = '
|
||||||
<td align="left">' . __('Position') . '</td>
|
<td align="left">' . __('Position') . '</td>
|
||||||
<td align="left">(' . html_print_input_text('left', '0', '', 3, 5, true) .
|
<td align="left">(' . html_print_input_text('left', '0', '', 3, 5, true) .
|
||||||
@ -557,8 +547,7 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) {
|
|||||||
$form_items_advance['parent_row']['items'] = array(
|
$form_items_advance['parent_row']['items'] = array(
|
||||||
'group_item', 'static_graph',
|
'group_item', 'static_graph',
|
||||||
'percentile_bar', 'percentile_item', 'module_graph',
|
'percentile_bar', 'percentile_item', 'module_graph',
|
||||||
'simple_value', 'label', 'icon', 'datos', 'auto_sla_graph',
|
'simple_value', 'label', 'icon', 'datos', 'auto_sla_graph');
|
||||||
'bars_graph');
|
|
||||||
$form_items_advance['parent_row']['html'] = '<td align="left">' .
|
$form_items_advance['parent_row']['html'] = '<td align="left">' .
|
||||||
__('Parent') . '</td>
|
__('Parent') . '</td>
|
||||||
<td align="left">' .
|
<td align="left">' .
|
||||||
@ -567,11 +556,12 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) {
|
|||||||
'</td>';
|
'</td>';
|
||||||
|
|
||||||
$form_items_advance['map_linked_row'] = array();
|
$form_items_advance['map_linked_row'] = array();
|
||||||
$form_items_advance['map_linked_row']['items'] = array('static_graph', 'label', 'icon');
|
$form_items_advance['map_linked_row']['items'] = array(
|
||||||
|
'group_item', 'static_graph', 'percentile_bar',
|
||||||
|
'percentile_item', 'module_graph', 'simple_value',
|
||||||
|
'icon', 'label', 'datos');
|
||||||
$form_items_advance['map_linked_row']['html'] = '<td align="left">'.
|
$form_items_advance['map_linked_row']['html'] = '<td align="left">'.
|
||||||
__('Map linked') . ui_print_help_tip (
|
__('Map linked') . '</td>' .
|
||||||
__("If a parent visual console is selected here, an agent or module cannot be selected and will be removed if a previous selection was done."), true) .
|
|
||||||
'</td>' .
|
|
||||||
'<td align="left">' . html_print_select_from_sql (
|
'<td align="left">' . html_print_select_from_sql (
|
||||||
'SELECT id, name
|
'SELECT id, name
|
||||||
FROM tlayout
|
FROM tlayout
|
||||||
@ -582,6 +572,7 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) {
|
|||||||
$form_items_advance['line_case']['html'] = '
|
$form_items_advance['line_case']['html'] = '
|
||||||
<td align="left">' . __('Lines haven\'t advanced options') . '</td>';
|
<td align="left">' . __('Lines haven\'t advanced options') . '</td>';
|
||||||
|
|
||||||
|
|
||||||
//Insert and modify before the buttons to create or update.
|
//Insert and modify before the buttons to create or update.
|
||||||
if (enterprise_installed()) {
|
if (enterprise_installed()) {
|
||||||
enterprise_visual_map_editor_modify_form_items_advance_palette($form_items_advance);
|
enterprise_visual_map_editor_modify_form_items_advance_palette($form_items_advance);
|
||||||
@ -683,6 +674,7 @@ function visual_map_editor_print_toolbox() {
|
|||||||
visual_map_print_button_editor('static_graph', __('Static Graph'), 'left', false, 'camera_min', true);
|
visual_map_print_button_editor('static_graph', __('Static Graph'), 'left', false, 'camera_min', true);
|
||||||
visual_map_print_button_editor('percentile_item', __('Percentile Item'), 'left', false, 'percentile_item_min', true);
|
visual_map_print_button_editor('percentile_item', __('Percentile Item'), 'left', false, 'percentile_item_min', true);
|
||||||
visual_map_print_button_editor('module_graph', __('Module Graph'), 'left', false, 'graph_min', true);
|
visual_map_print_button_editor('module_graph', __('Module Graph'), 'left', false, 'graph_min', true);
|
||||||
|
visual_map_print_button_editor('donut_graph', __('Donut Graph'), 'left', false, 'donut_graph_min', true);
|
||||||
visual_map_print_button_editor('bars_graph', __('Bars Graph'), 'left', false, 'bars_graph_min', true);
|
visual_map_print_button_editor('bars_graph', __('Bars Graph'), 'left', false, 'bars_graph_min', true);
|
||||||
visual_map_print_button_editor('auto_sla_graph', __('Auto SLA Graph'), 'left', false, 'auto_sla_graph_min', true);
|
visual_map_print_button_editor('auto_sla_graph', __('Auto SLA Graph'), 'left', false, 'auto_sla_graph_min', true);
|
||||||
visual_map_print_button_editor('simple_value', __('Simple Value'), 'left', false, 'binary_min', true);
|
visual_map_print_button_editor('simple_value', __('Simple Value'), 'left', false, 'binary_min', true);
|
||||||
@ -758,17 +750,3 @@ function visual_map_editor_print_hack_translate_strings() {
|
|||||||
__('Could not be save') .'</span>';
|
__('Could not be save') .'</span>';
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<script type="text/javascript">
|
|
||||||
$(document).ready (function () {
|
|
||||||
$("#map_linked").change(function () {
|
|
||||||
$("#text-agent").val("");
|
|
||||||
$("input[name=id_agent]").val(0);
|
|
||||||
$("#module").empty();
|
|
||||||
$("#module")
|
|
||||||
.append($("<option>")
|
|
||||||
.attr("value", 0)
|
|
||||||
.html("<?php echo __('Any'); ?>"));
|
|
||||||
})
|
|
||||||
});
|
|
||||||
</script>
|
|
@ -24,9 +24,14 @@ function include_javascript_d3 ($return = false) {
|
|||||||
if (!$is_include_javascript) {
|
if (!$is_include_javascript) {
|
||||||
$is_include_javascript = true;
|
$is_include_javascript = true;
|
||||||
|
|
||||||
$output .= '<script type="text/javascript" src="' . $config['homeurl'] . 'include/javascript/d3.3.5.14.js" charset="utf-8"></script>';
|
if (is_metaconsole()) {
|
||||||
$output .= '<script type="text/javascript" src="' . $config['homeurl'] . 'include/graphs/pandora.d3.js" charset="utf-8"></script>';
|
$output .= '<script type="text/javascript" src="' . '../../' . 'include/javascript/d3.3.5.14.js" charset="utf-8"></script>';
|
||||||
|
$output .= '<script type="text/javascript" src="' . '../../' . 'include/graphs/pandora.d3.js" charset="utf-8"></script>';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$output .= '<script type="text/javascript" src="' . $config['homeurl'] . 'include/javascript/d3.3.5.14.js" charset="utf-8"></script>';
|
||||||
|
$output .= '<script type="text/javascript" src="' . $config['homeurl'] . 'include/graphs/pandora.d3.js" charset="utf-8"></script>';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (!$return)
|
if (!$return)
|
||||||
echo $output;
|
echo $output;
|
||||||
@ -309,4 +314,29 @@ function ux_console_phases_donut ($phases, $id, $return = false) {
|
|||||||
|
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function d3_donut_graph ($id, $width, $height, $module_data) {
|
||||||
|
global $config;
|
||||||
|
|
||||||
|
$module_data = json_encode($module_data);
|
||||||
|
|
||||||
|
$recipient_name = "donut_graph_" . $id;
|
||||||
|
$recipient_name_to_js = "#donut_graph_" . $id;
|
||||||
|
|
||||||
|
$output = "<div id=" . $recipient_name . " style='overflow: hidden;'></div>";
|
||||||
|
$output .= include_javascript_d3(true);
|
||||||
|
$output .= "<style type=\"text/css\">
|
||||||
|
path {
|
||||||
|
stroke: #fff;
|
||||||
|
fill-rule: evenodd;
|
||||||
|
}
|
||||||
|
</style>";
|
||||||
|
|
||||||
|
$output .= "<script language=\"javascript\" type=\"text/javascript\">
|
||||||
|
print_donut_graph('" . $recipient_name_to_js . "', " . $width . ", " . $height . ", " . $module_data . ");
|
||||||
|
</script>";
|
||||||
|
|
||||||
|
return $output;
|
||||||
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
@ -1493,3 +1493,119 @@ function print_phases_donut (recipient, phases) {
|
|||||||
.remove();
|
.remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function print_donut_graph (recipient, width, height, module_data) {
|
||||||
|
var svg = d3.select(recipient)
|
||||||
|
.append("svg")
|
||||||
|
.attr("width", width)
|
||||||
|
.attr("height", height)
|
||||||
|
.append("g");
|
||||||
|
|
||||||
|
svg.append("g")
|
||||||
|
.attr("class", "slices");
|
||||||
|
|
||||||
|
var radius = 120;
|
||||||
|
var increment_y = 60;
|
||||||
|
var increment_y_padding = 25;
|
||||||
|
var text_size = 15;
|
||||||
|
var decrement_x_padding = 150;
|
||||||
|
if (width >= 500) {
|
||||||
|
radius = 160;
|
||||||
|
increment_y = 60;
|
||||||
|
text_size = 25;
|
||||||
|
increment_y_padding = 25;
|
||||||
|
decrement_x_padding = 75;
|
||||||
|
}
|
||||||
|
else if (width >= 400) {
|
||||||
|
radius = 120;
|
||||||
|
increment_y = 60;
|
||||||
|
text_size = 22;
|
||||||
|
increment_y_padding = 25;
|
||||||
|
decrement_x_padding = 75;
|
||||||
|
}
|
||||||
|
else if (width >= 300) {
|
||||||
|
radius = 80;
|
||||||
|
increment_y = 40;
|
||||||
|
text_size = 14;
|
||||||
|
increment_y_padding = 20;
|
||||||
|
decrement_x_padding = 60;
|
||||||
|
}
|
||||||
|
else if (width >= 200) {
|
||||||
|
radius = 50;
|
||||||
|
increment_y = 40;
|
||||||
|
text_size = 14;
|
||||||
|
increment_y_padding = 15;
|
||||||
|
decrement_x_padding = 45;
|
||||||
|
}
|
||||||
|
else if (width >= 100) {
|
||||||
|
radius = 20;
|
||||||
|
increment_y = 20;
|
||||||
|
text_size = 10;
|
||||||
|
increment_y_padding = 8;
|
||||||
|
decrement_x_padding = 25;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
radius = 10;
|
||||||
|
increment_y = 10;
|
||||||
|
text_size = 4;
|
||||||
|
increment_y_padding = 3;
|
||||||
|
decrement_x_padding = 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
var arc = d3.svg.arc()
|
||||||
|
.outerRadius(radius * 0.8)
|
||||||
|
.innerRadius(radius * 0.4);
|
||||||
|
|
||||||
|
var key = function(d){ return d.data.label; };
|
||||||
|
|
||||||
|
var pie = d3.layout.pie()
|
||||||
|
.sort(null)
|
||||||
|
.value(function(d) {
|
||||||
|
return parseFloat(d.percent);
|
||||||
|
});
|
||||||
|
|
||||||
|
jQuery.each(module_data, function (key, m_d) {
|
||||||
|
svg.append("g")
|
||||||
|
.append("text")
|
||||||
|
.attr("transform", "translate(" + (((width / 2) - (radius + decrement_x_padding))) + "," + (((height / 2) - radius) - increment_y) + ")")
|
||||||
|
.text(m_d.tag_name)
|
||||||
|
.style("font-family", "Verdana")
|
||||||
|
.style("font-size", text_size + "px");
|
||||||
|
|
||||||
|
increment_y -= increment_y_padding;
|
||||||
|
});
|
||||||
|
|
||||||
|
function donutData (){
|
||||||
|
return module_data.map(function(m_data){
|
||||||
|
return { label: m_data.tag_name, percent: m_data.percent, color : m_data.color}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
print_phases(donutData());
|
||||||
|
|
||||||
|
function print_phases(data) {
|
||||||
|
var slice = svg.select(".slices").selectAll("path.slice")
|
||||||
|
.data(pie(data), key);
|
||||||
|
|
||||||
|
slice.enter()
|
||||||
|
.insert("path")
|
||||||
|
.style("fill", function(d) {
|
||||||
|
return d.data.color;
|
||||||
|
})
|
||||||
|
.attr("class", "slice")
|
||||||
|
.attr("transform", "translate(" + width / 2 + "," + (height - radius) + ")");
|
||||||
|
|
||||||
|
slice.transition()
|
||||||
|
.duration(0)
|
||||||
|
.attrTween("d", function(d) {
|
||||||
|
this._current = this._current || d;
|
||||||
|
var interpolate = d3.interpolate(this._current, d);
|
||||||
|
this._current = interpolate(0);
|
||||||
|
return function(t) {
|
||||||
|
return arc(interpolate(t));
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
slice.exit().remove();
|
||||||
|
}
|
||||||
|
}
|
@ -793,6 +793,12 @@ input.auto_sla_graph_min {
|
|||||||
input.auto_sla_graph_min[disabled] {
|
input.auto_sla_graph_min[disabled] {
|
||||||
background: #fefefe url(../../images/auto_sla_graph.disabled.png) no-repeat center !important;
|
background: #fefefe url(../../images/auto_sla_graph.disabled.png) no-repeat center !important;
|
||||||
}
|
}
|
||||||
|
input.donut_graph_min {
|
||||||
|
background: #fefefe url(../../images/icono-quesito.png) no-repeat center !important;
|
||||||
|
}
|
||||||
|
input.donut_graph_min[disabled] {
|
||||||
|
background: #fefefe url(../../images/icono-quesito.disabled.png) no-repeat center !important;
|
||||||
|
}
|
||||||
input.binary_min {
|
input.binary_min {
|
||||||
background: #fefefe url(../../images/binary.png) no-repeat center !important;
|
background: #fefefe url(../../images/binary.png) no-repeat center !important;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user