Merge branch 'feature/ticket#1478-New_elements_visualmap' into develop

This commit is contained in:
mdtrooper 2014-11-26 16:12:38 +01:00
commit a8a1bade0d
18 changed files with 1242 additions and 180 deletions

View File

@ -10,7 +10,7 @@ ALTER TABLE tlayout DROP COLUMN fullscreen;
ALTER TABLE tlayout_data DROP COLUMN no_link_color;
ALTER TABLE tlayout_data DROP COLUMN label_color;
ALTER TABLE tlayout_data ADD COLUMN `border_width` INTEGER UNSIGNED NOT NULL default 0;
ALTER TABLE tlayout_data ADD COLUMN `border_color` varchar(200) DEFAULT "";
ALTER TABLE tlayout_data ADD COLUMN `fill_color` varchar(200) DEFAULT "";

View File

@ -9,4 +9,7 @@ ALTER TABLE tlayout DROP COLUMN fullscreen;
-- ---------------------------------------------------------------------
ALTER TABLE tlayout_data DROP COLUMN no_link_color;
ALTER TABLE tlayout_data DROP COLUMN label_color;
ALTER TABLE tlayout_data DROP COLUMN label_color;
ALTER TABLE tlayout_data ADD COLUMN border_width INTEGER NOT NULL default 0;
ALTER TABLE tlayout_data ADD COLUMN border_color varchar(200) DEFAULT "";
ALTER TABLE tlayout_data ADD COLUMN fill_color varchar(200) DEFAULT "";

View File

@ -9,4 +9,7 @@ ALTER TABLE "tlayout" DROP COLUMN "fullscreen";
-- ---------------------------------------------------------------------
ALTER TABLE "tlayout_data" DROP COLUMN "no_link_color";
ALTER TABLE "tlayout_data" DROP COLUMN "label_color";
ALTER TABLE "tlayout_data" DROP COLUMN "label_color";
ALTER TABLE "tlayout_data" ADD COLUMN "border_width" INTEGER NOT NULL default 0;
ALTER TABLE "tlayout_data" ADD COLUMN "border_color" varchar(200) DEFAULT "";
ALTER TABLE "tlayout_data" ADD COLUMN "fill_color" varchar(200) DEFAULT "";

View File

@ -85,8 +85,17 @@ foreach ($layoutDatas as $layoutData) {
if ($delete_pending_module == 1 || $disabled_module == 1)
continue;
switch ($layoutData['type']) {
case LINE_ITEM:
visual_map_print_user_line_handles($layoutData);
visual_map_print_user_lines("write", $layoutData);
break;
default:
visual_map_print_item("write", $layoutData);
break;
}
visual_map_print_item("write", $layoutData);
html_print_input_hidden('status_' . $layoutData['id'], $layoutData['status_calculated']);

View File

@ -143,6 +143,15 @@ foreach ($layoutDatas as $layoutData) {
$table->data[$i + 1]['icon'] =
html_print_image('images/photo.png', true, array('title' => __('Icon')));
break;
case BOX_ITEM:
$table->data[$i + 1]['icon'] =
html_print_image('images/box_item.png', true, array('title' => __('Box')));
break;
case LINE_ITEM:
$table->data[$i + 1]['icon'] =
html_print_image('images/line_item.png', true,
array('title' => __('Line')));
break;
default:
if (enterprise_installed()) {
$table->data[$i + 1]['icon'] =
@ -158,44 +167,76 @@ foreach ($layoutDatas as $layoutData) {
//First row
//Label
if ($layoutData['type'] != ICON) {
$table->data[$i + 1][0] = '<span style="width: 150px; display: block;">' .
html_print_input_hidden('label_' . $idLayoutData, $layoutData['label'], true) .
'<a href="javascript: show_dialog_label_editor(' . $idLayoutData . ');">' . __('Edit label') .'</a>' .
'</span>';
//Label
switch ($layoutData['type']) {
case ICON:
case BOX_ITEM:
case LINE_ITEM:
// hasn't the label.
$table->data[$i + 1][0] = '';
break;
default:
$table->data[$i + 1][0] = '<span style="width: 150px; display: block;">' .
html_print_input_hidden('label_' . $idLayoutData, $layoutData['label'], true) .
'<a href="javascript: show_dialog_label_editor(' . $idLayoutData . ');">' . __('Edit label') .'</a>' .
'</span>';
break;
}
else {
//Icon haven't the label.
$table->data[$i + 1][0] = '';
}
//Image
if (($layoutData['type'] == STATIC_GRAPH) || ($layoutData['type'] == ICON)) {
$table->data[$i + 1][1] = html_print_select ($images_list, 'image_' . $idLayoutData, $layoutData['image'], '', 'None', '', true, false, true, '', false, "width: 120px");
}
else {
$table->data[$i + 1][1] = '';
switch ($layoutData['type']) {
case STATIC_GRAPH:
case ICON:
$table->data[$i + 1][1] =
html_print_select ($images_list,
'image_' . $idLayoutData, $layoutData['image'], '',
'None', '', true, false, true, '', false,
"width: 120px");
break;
default:
$table->data[$i + 1][1] = '';
break;
}
//Width and height
$table->data[$i + 1][2] = html_print_input_text('width_' . $idLayoutData, $layoutData['width'], '', 2, 5, true) .
'x' .
html_print_input_text('height_' . $idLayoutData, $layoutData['height'], '', 2, 5, true);
switch ($layoutData['type']) {
case LINE_ITEM:
// hasn't the width and height.
$table->data[$i + 1][2] = '';
break;
default:
$table->data[$i + 1][2] = html_print_input_text('width_' . $idLayoutData, $layoutData['width'], '', 2, 5, true) .
'x' .
html_print_input_text('height_' . $idLayoutData, $layoutData['height'], '', 2, 5, true);
break;
}
//Position
$table->data[$i + 1][3] = '(' . html_print_input_text('left_' . $idLayoutData, $layoutData['pos_x'], '', 2, 5, true) .
',' . html_print_input_text('top_' . $idLayoutData, $layoutData['pos_y'], '', 2, 5, true) .
')';
switch ($layoutData['type']) {
case LINE_ITEM:
// hasn't the width and height.
$table->data[$i + 1][3] = '';
break;
default:
$table->data[$i + 1][3] = '(' . html_print_input_text('left_' . $idLayoutData, $layoutData['pos_x'], '', 2, 5, true) .
',' . html_print_input_text('top_' . $idLayoutData, $layoutData['pos_y'], '', 2, 5, true) .
')';
break;
}
//Parent
$table->data[$i + 1][4] = html_print_select_from_sql ('SELECT id, label FROM tlayout_data WHERE id_layout = '. $idVisualConsole . ' AND id !=' . $idLayoutData,
'parent_' . $idLayoutData, $layoutData['parent_item'], '', 'None', 0, true, false, true, false, 'width: 120px;');
switch ($layoutData['type']) {
case BOX_ITEM:
case LINE_ITEM:
$table->data[$i + 1][4] = "";
break;
default:
$table->data[$i + 1][4] = html_print_select_from_sql ('SELECT id, label FROM tlayout_data WHERE id_layout = '. $idVisualConsole . ' AND id !=' . $idLayoutData,
'parent_' . $idLayoutData, $layoutData['parent_item'], '', 'None', 0, true, false, true, false, 'width: 120px;');
}
//Delete row button
if (!defined('METACONSOLE')) {
@ -217,8 +258,10 @@ foreach ($layoutDatas as $layoutData) {
//Agent
switch ($layoutData['type']) {
case BOX_ITEM:
case ICON:
case LABEL:
case LINE_ITEM:
$table->data[$i + 2][0] = '';
break;
default:
@ -268,6 +311,8 @@ foreach ($layoutDatas as $layoutData) {
switch ($layoutData['type']) {
case ICON:
case LABEL:
case BOX_ITEM:
case LINE_ITEM:
$table->data[$i + 2][1] = '';
break;
default:
@ -328,9 +373,18 @@ foreach ($layoutDatas as $layoutData) {
}
//Map linked
$table->data[$i + 2][4] = html_print_select_from_sql(
'SELECT id, name FROM tlayout WHERE id != ' . $idVisualConsole,
'map_linked_' . $idLayoutData, $layoutData['id_layout_linked'], '', 'None', '', true, false, true, '', false, "width: 120px");
switch ($layoutData['type']) {
case LINE_ITEM:
case BOX_ITEM:
$table->data[$i + 2][4] = "";
break;
default:
$table->data[$i + 2][4] = html_print_select_from_sql(
'SELECT id, name FROM tlayout WHERE id != ' . $idVisualConsole,
'map_linked_' . $idLayoutData, $layoutData['id_layout_linked'], '', 'None', '', true, false, true, '', false, "width: 120px");
break;
}
$table->data[$i + 2][5] = '';
if ($alternativeStyle) {

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@ -71,6 +71,19 @@ $id_agent = get_parameter('id_agent', null);
$id_metaconsole = get_parameter('id_metaconsole', null);
$id_group = (int)get_parameter('id_group', 0);
$id_custom_graph = get_parameter('id_custom_graph', null);
$height_module_graph = get_parameter('id_custom_graph', null);
$width_module_graph = get_parameter('id_custom_graph', null);
$border_width = get_parameter('border_width', 0);
$border_color = get_parameter('border_color', '');
$fill_color = get_parameter('fill_color', '');
$width_box = get_parameter('width_box', 0);
$height_box = get_parameter('height_box', 0);
$line_start_x = (int)get_parameter('line_start_x', 0);
$line_start_y = (int)get_parameter('line_start_y', 0);
$line_end_x = (int)get_parameter('line_end_x', 0);
$line_end_y = (int)get_parameter('line_end_y', 0);
$line_width = (int)get_parameter('line_width', 0);
$line_color = get_parameter('line_color', '');
$get_element_status = get_parameter('get_element_status', 0);
$get_image_path_status = get_parameter('get_image_path_status', 0);
@ -347,13 +360,30 @@ switch ($action) {
if ($label !== null) {
$values['label'] = $label;
}
if ($left !== null) {
$values['pos_x'] = $left;
}
if ($top !== null) {
$values['pos_y'] = $top;
switch ($type) {
// -- line_item --
case 'handler_end':
// ---------------
if ($left !== null) {
$values['width'] = $left;
}
if ($top !== null) {
$values['height'] = $top;
}
break;
default:
if ($left !== null) {
$values['pos_x'] = $left;
}
if ($top !== null) {
$values['pos_y'] = $top;
}
break;
}
if (defined('METACONSOLE') && $metaconsole) {
if ($server_name !== null) {
$values['id_metaconsole'] = db_get_value('id',
@ -381,7 +411,22 @@ switch ($action) {
if ($map_linked !== null) {
$values['id_layout_linked'] = $map_linked;
}
switch($type) {
switch ($type) {
// -- line_item --
case 'handler_start':
case 'handler_end':
// ---------------
$values['border_width'] = $line_width;
$values['border_color'] = $line_color;
break;
case 'box_item':
$values['border_width'] = $border_width;
$values['border_color'] = $border_color;
$values['fill_color'] = $fill_color;
$values['period'] = $period;
$values['width'] = $width_box;
$values['height'] = $height_box;
break;
case 'group_item':
$values['id_group'] = $id_group;
break;
@ -447,8 +492,26 @@ switch ($action) {
// Don't change the label because only change the positions
unset($values['label']);
// Don't change background color in graphs when move
if ($type == 'module_graph') {
unset($values['image']);
switch ($type) {
case 'module_graph':
unset($values['image']);
break;
case 'box_item':
unset($values['border_width']);
unset($values['border_color']);
unset($values['fill_color']);
unset($values['period']);
unset($values['width']);
unset($values['height']);
break;
// -- line_item --
case 'handler_start':
case 'handler_end':
// ---------------
unset($values['border_width']);
unset($values['border_color']);
break;
}
}
@ -464,9 +527,17 @@ switch ($action) {
case 'load':
switch ($type) {
case 'background':
$backgroundFields = db_get_row_filter('tlayout', array('id' => $id_visual_console), array('background', 'height', 'width'));
$backgroundFields = db_get_row_filter(
'tlayout',
array('id' => $id_visual_console),
array('background', 'height', 'width'));
echo json_encode($backgroundFields);
break;
// -- line_item --
case 'handler_start':
case 'handler_end':
// ---------------
case 'box_item':
case 'percentile_bar':
case 'percentile_item':
case 'static_graph':
@ -549,6 +620,21 @@ switch ($action) {
$elementFields['width_module_graph'] = $elementFields['width'];
$elementFields['height_module_graph'] = $elementFields['height'];
break;
case 'box_item':
$elementFields['width_box'] = $elementFields['width'];
$elementFields['height_box'] = $elementFields['height'];
$elementFields['border_color'] = $elementFields['border_color'];
$elementFields['border_width'] = $elementFields['border_width'];
$elementFields['fill_color'] = $elementFields['fill_color'];
break;
// -- line_item --
case 'handler_start':
case 'handler_end':
// ---------------
$elementFields['line_width'] = $elementFields['border_width'];
$elementFields['line_color'] = $elementFields['border_color'];
break;
}
//Support for max, min and svg process on simple value items
@ -612,6 +698,24 @@ switch ($action) {
$values['id_custom_graph'] = $id_custom_graph;
switch ($type) {
case 'line_item':
$values['type'] = LINE_ITEM;
$values['border_width'] = $line_width;
$values['border_color'] = $line_color;
$values['pos_x'] = $line_start_x;
$values['pos_y'] = $line_start_y;
$values['width'] = $line_end_x;
$values['height'] = $line_end_y;
break;
case 'box_item':
$values['type'] = BOX_ITEM;
$values['border_width'] = $border_width;
$values['border_color'] = $border_color;
$values['fill_color'] = $fill_color;
$values['period'] = $period;
$values['width'] = $width_box;
$values['height'] = $height_box;
break;
case 'module_graph':
$values['type'] = MODULE_GRAPH;
$values['height'] = $height_module_graph;
@ -710,10 +814,15 @@ switch ($action) {
$return['id_data'] = $idData;
$return['text'] = $text;
$return['type'] = visual_map_type_in_js($values['type']);
switch ($values['type']) {
case BOX_ITEM:
$return['values']['width_box'] = $values['width'];
$return['values']['height_box'] = $values['height'];
break;
}
}
html_debug_print($return, true);
echo json_encode($return);
break;

View File

@ -61,38 +61,38 @@ define ('ERR_ACL', -110000);
define ('ERR_AUTH', -120000);
/* Event status code */
define ('EVENT_STATUS_NEW',0);
define ('EVENT_STATUS_INPROCESS',2);
define ('EVENT_STATUS_VALIDATED',1);
define ('EVENT_STATUS_NEW', 0);
define ('EVENT_STATUS_INPROCESS', 2);
define ('EVENT_STATUS_VALIDATED', 1);
/* Seconds in a time unit constants */
define('SECONDS_1MINUTE', 60);
define('SECONDS_2MINUTES', 120);
define('SECONDS_5MINUTES', 300);
define('SECONDS_10MINUTES', 600);
define('SECONDS_15MINUTES', 900);
define('SECONDS_30MINUTES', 1800);
define('SECONDS_1HOUR', 3600);
define('SECONDS_2HOUR', 7200);
define('SECONDS_3HOUR', 10800);
define('SECONDS_5HOUR', 18000);
define('SECONDS_6HOURS', 21600);
define('SECONDS_12HOURS', 43200);
define('SECONDS_1DAY', 86400);
define('SECONDS_2DAY', 172800);
define('SECONDS_4DAY', 345600);
define('SECONDS_5DAY', 432000);
define('SECONDS_1WEEK', 604800);
define('SECONDS_10DAY', 864000);
define('SECONDS_2WEEK', 1209600);
define('SECONDS_15DAYS', 1296000);
define('SECONDS_1MONTH', 2592000);
define('SECONDS_2MONTHS', 5184000);
define('SECONDS_3MONTHS', 7776000);
define('SECONDS_6MONTHS', 15552000);
define('SECONDS_1YEAR', 31104000);
define('SECONDS_2YEARS', 62208000);
define('SECONDS_3YEARS', 93312000);
define('SECONDS_1MINUTE', 60);
define('SECONDS_2MINUTES', 120);
define('SECONDS_5MINUTES', 300);
define('SECONDS_10MINUTES', 600);
define('SECONDS_15MINUTES', 900);
define('SECONDS_30MINUTES', 1800);
define('SECONDS_1HOUR', 3600);
define('SECONDS_2HOUR', 7200);
define('SECONDS_3HOUR', 10800);
define('SECONDS_5HOUR', 18000);
define('SECONDS_6HOURS', 21600);
define('SECONDS_12HOURS', 43200);
define('SECONDS_1DAY', 86400);
define('SECONDS_2DAY', 172800);
define('SECONDS_4DAY', 345600);
define('SECONDS_5DAY', 432000);
define('SECONDS_1WEEK', 604800);
define('SECONDS_10DAY', 864000);
define('SECONDS_2WEEK', 1209600);
define('SECONDS_15DAYS', 1296000);
define('SECONDS_1MONTH', 2592000);
define('SECONDS_2MONTHS', 5184000);
define('SECONDS_3MONTHS', 7776000);
define('SECONDS_6MONTHS', 15552000);
define('SECONDS_1YEAR', 31104000);
define('SECONDS_2YEARS', 62208000);
define('SECONDS_3YEARS', 93312000);
@ -178,38 +178,40 @@ define('AGENT_STATUS_WARNING', 2);
/* Visual maps contants */
//The items kind
define('STATIC_GRAPH', 0);
define('PERCENTILE_BAR', 3);
define('MODULE_GRAPH', 1);
define('SIMPLE_VALUE', 2);
define('LABEL', 4);
define('ICON', 5);
define('SIMPLE_VALUE_MAX', 6);
define('SIMPLE_VALUE_MIN', 7);
define('SIMPLE_VALUE_AVG', 8);
define('PERCENTILE_BUBBLE', 9);
define('SERVICE', 10); //Enterprise Item.
define('GROUP_ITEM', 11);
define('STATIC_GRAPH', 0);
define('PERCENTILE_BAR', 3);
define('MODULE_GRAPH', 1);
define('SIMPLE_VALUE', 2);
define('LABEL', 4);
define('ICON', 5);
define('SIMPLE_VALUE_MAX', 6);
define('SIMPLE_VALUE_MIN', 7);
define('SIMPLE_VALUE_AVG', 8);
define('PERCENTILE_BUBBLE', 9);
define('SERVICE', 10); //Enterprise Item.
define('GROUP_ITEM', 11);
define('BOX_ITEM', 12);
define('LINE_ITEM', 13);
//Some styles
define('MIN_WIDTH',300);
define('MIN_HEIGHT',120);
define('MIN_WIDTH_CAPTION',420);
define('MIN_WIDTH', 300);
define('MIN_HEIGHT', 120);
define('MIN_WIDTH_CAPTION', 420);
//The process for simple value
define('PROCESS_VALUE_NONE', 0);
define('PROCESS_VALUE_MIN', 1);
define('PROCESS_VALUE_MAX', 2);
define('PROCESS_VALUE_AVG', 3);
define('PROCESS_VALUE_NONE', 0);
define('PROCESS_VALUE_MIN', 1);
define('PROCESS_VALUE_MAX', 2);
define('PROCESS_VALUE_AVG', 3);
//Status
define('VISUAL_MAP_STATUS_CRITICAL_BAD', 1);
define('VISUAL_MAP_STATUS_CRITICAL_ALERT', 4);
define('VISUAL_MAP_STATUS_NORMAL', 0);
define('VISUAL_MAP_STATUS_WARNING', 2);
define('VISUAL_MAP_STATUS_UNKNOWN', 3);
define('VISUAL_MAP_STATUS_WARNING_ALERT', 10);
define('VISUAL_MAP_STATUS_CRITICAL_BAD', 1);
define('VISUAL_MAP_STATUS_CRITICAL_ALERT', 4);
define('VISUAL_MAP_STATUS_NORMAL', 0);
define('VISUAL_MAP_STATUS_WARNING', 2);
define('VISUAL_MAP_STATUS_UNKNOWN', 3);
define('VISUAL_MAP_STATUS_WARNING_ALERT', 10);
//Wizard
define('VISUAL_MAP_WIZARD_PARENTS_NONE', 0);
define('VISUAL_MAP_WIZARD_PARENTS_ITEM_MAP', 1);
define('VISUAL_MAP_WIZARD_PARENTS_AGENT_RELANTIONSHIP', 2);
define('VISUAL_MAP_WIZARD_PARENTS_NONE', 0);
define('VISUAL_MAP_WIZARD_PARENTS_ITEM_MAP', 1);
define('VISUAL_MAP_WIZARD_PARENTS_AGENT_RELANTIONSHIP', 2);

View File

@ -47,6 +47,45 @@ function visual_map_print_item_toolbox($idDiv, $text, $float) {
echo '</div>';
}
function visual_map_print_user_line_handles($layoutData) {
$id = $layoutData['id'];
$start_x = $layoutData['pos_x'];
$start_y = $layoutData['pos_y'];
$end_x = $layoutData['width'];
$end_y = $layoutData['height'];
$z_index = 2;
$sizeStyle = "";
$radious_handle = 12 / 2;
//Handle of start
echo '<div id="handler_start_' . $id . '" class="item handler_start" ' .
'style="z-index: ' .$z_index . ';' .
'position: absolute; top: ' . ($start_y - $radious_handle) . 'px; ' .
'left: ' . ($start_x - $radious_handle) . 'px;' .
'text-align: center;' .
'display: inline-block; ' . $sizeStyle . '">';
html_print_image("images/dot_red.png");
echo "</div>";
//Handle of end
echo '<div id="handler_end_' . $id . '" class="item handler_end" ' .
'style="z-index: ' .$z_index . ';' .
'position: absolute; top: ' . ($end_y - $radious_handle) . 'px; ' .
'left: ' . ($end_x - $radious_handle) . 'px;' .
'text-align: center;' .
'display: inline-block; ' . $sizeStyle . '">';
html_print_image("images/dot_green.png");
echo "</div>";
}
function visual_map_print_item($mode = "read", $layoutData,
$proportion = 1, $show_links = true) {
global $config;
@ -65,6 +104,9 @@ function visual_map_print_item($mode = "read", $layoutData,
$id_module = $layoutData['id_agente_modulo'];
$type = $layoutData['type'];
$period = $layoutData['period'];
$border_width = $layoutData['border_width'];
$border_color = $layoutData['border_color'];
$fill_color = $layoutData['fill_color'];
$sizeStyle = '';
$borderStyle = '';
@ -553,7 +595,9 @@ function visual_map_print_item($mode = "read", $layoutData,
}
}
$z_index = 1;
// + 1 for to avoid the box and lines items are on the top of
// others
$z_index = 1 + 1;
switch ($type) {
case STATIC_GRAPH:
@ -573,13 +617,13 @@ function visual_map_print_item($mode = "read", $layoutData,
}
if ($status == VISUAL_MAP_STATUS_CRITICAL_BAD)
$z_index = 3;
$z_index = 3 + 1;
elseif ($status == VISUAL_MAP_STATUS_WARNING)
$z_index = 2;
$z_index = 2 + 1;
elseif ($status == VISUAL_MAP_STATUS_CRITICAL_ALERT)
$z_index = 4;
$z_index = 4 + 1;
else
$z_index = 1;
$z_index = 1 + 1;
break;
case ICON:
if ($layoutData['image'] != null) {
@ -592,7 +636,7 @@ function visual_map_print_item($mode = "read", $layoutData,
$imageSize = 'width="' . $width . '" height="' . $height . '"';
}
$z_index = 4;
$z_index = 4 + 1;
break;
case PERCENTILE_BAR:
case PERCENTILE_BUBBLE:
@ -669,7 +713,10 @@ function visual_map_print_item($mode = "read", $layoutData,
$img = str_replace('>', 'class="image" id="image_' . $id . '" />', $img);
break;
case LABEL:
$z_index = 4;
$z_index = 4 + 1;
break;
case BOX_ITEM:
$z_index = 1;
break;
}
@ -701,6 +748,9 @@ function visual_map_print_item($mode = "read", $layoutData,
case ICON:
$class .= "icon";
break;
case BOX_ITEM:
$class .= "box_item";
break;
default:
if (!empty($element_enterprise)) {
$class .= $element_enterprise['class'];
@ -723,6 +773,16 @@ function visual_map_print_item($mode = "read", $layoutData,
}
switch ($type) {
case BOX_ITEM:
$style = "";
$style .= "width: " . ($width * $proportion) . "px; ";
$style .= "height: " . ($height * $proportion) . "px; ";
$style .= "border-style: solid; ";
$style .= "border-width: " . $border_width . "px; ";
$style .= "border-color: " . $border_color . "; ";
$style .= "background-color: " . $fill_color . "; ";
echo "<div style='" . $style . "'></div>";
break;
case STATIC_GRAPH:
case GROUP_ITEM:
if ($layoutData['image'] != null) {
@ -907,7 +967,8 @@ function visual_map_print_item($mode = "read", $layoutData,
//Add the line between elements.
if ($layoutData['parent_item'] != 0) {
$parent = db_get_row_filter('tlayout_data', array('id' => $layoutData['parent_item']));
$parent = db_get_row_filter('tlayout_data',
array('id' => $layoutData['parent_item']));
echo '<script type="text/javascript">';
echo '$(document).ready (function() {
@ -1610,6 +1671,24 @@ function visual_map_get_status_element($layoutData) {
return $status;
}
function visual_map_print_user_lines($mode = "read", $layout_data, $proportion = 1) {
$line = array();
$line["id"] = $layout_data['id'];
$line["start_x"] = $layout_data['pos_x'] * $proportion;
$line["start_y"] = $layout_data['pos_y'] * $proportion;
$line["end_x"] = $layout_data['width'] * $proportion;
$line["end_y"] = $layout_data['height'] * $proportion;
$line["line_width"] = $layout_data['border_width'] * $proportion;
$line["line_color"] = $layout_data['border_color'];
echo '<script type="text/javascript">';
echo '$(document).ready (function() {
user_lines.push(' . json_encode($line) . ');
});';
echo '</script>';
}
/**
* Prints visual map
*
@ -1720,8 +1799,16 @@ function visual_map_print_visual_map ($id_layout, $show_links = true,
continue;
}
visual_map_print_item("read", $layout_data,
$proportion, $show_links);
switch ($layout_data['type']) {
case LINE_ITEM:
visual_map_print_user_lines("read", $layout_data,
$proportion);
break;
default:
visual_map_print_item("read", $layout_data,
$proportion, $show_links);
break;
}
}
// End main div
@ -1738,9 +1825,12 @@ function visual_map_print_visual_map ($id_layout, $show_links = true,
var lines = Array();
var user_lines = Array();
//Fixed to wait the load of images.
$(window).load(function() {
draw_lines(lines, 'background');
draw_user_lines_read();
}
);
/* ]]> */
@ -1881,6 +1971,10 @@ function visual_map_create_internal_name_item($label = null, $type, $image, $age
if (empty($label))
{
switch ($type) {
case 'box_item':
case BOX_ITEM:
$text = __('Box');
break;
case 'module_graph':
case MODULE_GRAPH:
$text = __('Module graph');
@ -2008,7 +2102,13 @@ function visual_map_type_in_js($type) {
break;
case GROUP_ITEM:
return 'group_item';
break;
break;
case BOX_ITEM:
return 'box_item';
break;
case LINE_ITEM:
return 'line_item';
break;
}
}

View File

@ -57,7 +57,9 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) {
'simple_value' => __('Simple value'),
'label' => __('Label'),
'icon' => __('Icon'),
'group_item' => __('Group'));
'group_item' => __('Group'),
'box_item' => __('Box'),
'line_item' => __('Line'));
if (enterprise_installed()) {
enterprise_visual_map_editor_add_title_palette($titles);
@ -75,6 +77,81 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) {
<?php
$form_items = array();
$form_items['line_width_row'] = array();
$form_items['line_width_row']['items'] =
array('datos', 'line_item', 'handler_start', 'handler_end');
$form_items['line_width_row']['html'] = '<td align="left">' . __('Width') . '</td>
<td align="left">' .
html_print_input_text('line_width', 3, '', 3, 5, true) .
'</td>';
$form_items['line_color_row'] = array();
$form_items['line_color_row']['items'] =
array('datos', 'line_item', 'handler_start', 'handler_end');
$form_items['line_color_row']['html'] =
'<td align="left" valign="top" style="">' .
__('Border color') .
'</td>' .
'<td align="left" style="">' .
html_print_input_text_extended ('line_color',
'#000000', 'text-line_color', '', 7, 7, false,
'', 'class="line_color"', true) .
'</td>';
$form_items['box_size_row'] = array();
$form_items['box_size_row']['items'] = array('datos', 'box_item');
$form_items['box_size_row']['html'] =
'<td align="left">' . __('Size') . '</td>
<td align="left">' .
html_print_input_text('width_box', 300, '', 3, 5, true) .
' X ' .
html_print_input_text('height_box', 180, '', 3, 5, true) .
'</td>';
$form_items['border_color_row'] = array();
$form_items['border_color_row']['items'] = array('datos', 'box_item');
$form_items['border_color_row']['html'] =
'<td align="left" valign="top" style="">' .
__('Border color') .
'</td>' .
'<td align="left" style="">' .
html_print_input_text_extended ('border_color',
'#000000', 'text-border_color', '', 7, 7, false,
'', 'class="border_color"', true) .
'</td>';
$form_items['border_width_row'] = array();
$form_items['border_width_row']['items'] = array('datos', 'box_item');
$form_items['border_width_row']['html'] =
'<td align="left">' . __('Border width') . '</td>
<td align="left">' .
html_print_input_text('border_width', 3, '', 3, 5, true) .
'</td>';
$form_items['fill_color_row'] = array();
$form_items['fill_color_row']['items'] = array('datos', 'box_item');
$form_items['fill_color_row']['html'] =
'<td align="left" valign="top" style="">' . __('Fill color') . '</td>' .
'<td align="left" style="">' .
html_print_input_text_extended ('fill_color', '#ffffff',
'text-fill_color', '', 7, 7, false, '',
'class="fill_color"', true) .
'</td>';
$form_items['module_graph_size_row'] = array();
$form_items['module_graph_size_row']['items'] = array('module_graph', 'datos');
$form_items['module_graph_size_row']['html'] = '<td align="left">' . __('Size') . '</td>
<td align="left">' .
html_print_input_text('width_module_graph', 300, '', 3, 5, true) .
' X ' .
html_print_input_text('height_module_graph', 180, '', 3, 5, true) .
'</td>';
$form_items['label_row'] = array();
$form_items['label_row']['items'] = array('label',
@ -358,7 +435,7 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) {
$form_items_advance['position_row'] = array();
$form_items_advance['position_row']['items'] = array('static_graph',
'percentile_bar', 'percentile_item', 'module_graph',
'simple_value', 'label', 'icon', 'datos');
'simple_value', 'label', 'icon', 'datos', 'box_item');
$form_items_advance['position_row']['html'] = '
<td align="left">' . __('Position') . '</td>
<td align="left">(' . html_print_input_text('left', '0', '', 3, 5, true) .
@ -419,7 +496,35 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) {
</table>
<?php
//------------------------------------------------------------------------------
echo '</div>';
echo '<div id="div_step_1" class="forced_title_layer"
style="display: none; position: absolute; z-index: 99;">' .
__('Click start point<br />of the line') .
'</div>';
echo '<div id="div_step_2" class="forced_title_layer"
style="display: none; position: absolute; z-index: 99;">' .
__('Click end point<br />of the line') .
'</div>';
ui_require_css_file ('color-picker');
ui_require_jquery_file ('colorpicker');
?>
<script type="text/javascript">
$(document).ready (function () {
$(".border_color").attachColorPicker();
$(".fill_color").attachColorPicker();
$(".line_color").attachColorPicker();
});
</script>
<?php
}
function visual_map_editor_print_toolbox() {
@ -434,6 +539,8 @@ function visual_map_editor_print_toolbox() {
visual_map_print_button_editor('label', __('Label'), 'left', false, 'label_min', true);
visual_map_print_button_editor('icon', __('Icon'), 'left', false, 'icon_min', true);
visual_map_print_button_editor('group_item', __('Group'), 'left', false, 'group_item_min', true);
visual_map_print_button_editor('box_item', __('Box'), 'left', false, 'box_item_min', true);
visual_map_print_button_editor('line_item', __('Line'), 'left', false, 'line_item_min', true);
enterprise_hook("enterprise_visual_map_editor_print_toolbox");
@ -443,7 +550,7 @@ function visual_map_editor_print_toolbox() {
visual_map_print_button_editor('show_grid', __('Show grid'), 'right', true, 'grid_min', true);
visual_map_print_button_editor('edit_item', __('Update item'), 'right', true, 'config_min', true);
visual_map_print_button_editor('delete_item', __('Delete item'), 'right', true, 'delete_min', true);
visual_map_print_button_editor('copy_item', __('Copy item'), 'right', true, 'delete_min', true);
visual_map_print_button_editor('copy_item', __('Copy item'), 'right', true, 'copy_item', true);
echo '</div>';
echo '</div>';
echo '<div style="clear: right; margin-bottom: 10px;"></div>';

View File

@ -123,3 +123,25 @@ function refresh_lines (lines, id_div, editor) {
delete_lines (id_div);
draw_lines (lines, id_div, editor);
}
function draw_user_lines_read() {
var obj_js_user_lines = new jsGraphics("background");
obj_js_user_lines.clear();
// Draw the previous lines
for (iterator = 0; iterator < user_lines.length; iterator++) {
console.log(user_lines[iterator]);
obj_js_user_lines.setStroke(parseInt(user_lines[iterator]['line_width']));
obj_js_user_lines.setColor(user_lines[iterator]['line_color']);
obj_js_user_lines.drawLine(
parseInt(user_lines[iterator]['start_x']),
parseInt(user_lines[iterator]['start_y']),
parseInt(user_lines[iterator]['end_x']),
parseInt(user_lines[iterator]['end_y']));
}
obj_js_user_lines.paint();
}

View File

@ -758,6 +758,18 @@ input.icon_min {
input.icon_min[disabled] {
background: #fefefe url(../../images/photo.disabled.png) no-repeat center !important;
}
input.box_item {
background: #fefefe url(../../images/box_item.png) no-repeat center !important;
}
input.box_item[disabled] {
background: #fefefe url(../../images/box_item.disabled.png) no-repeat center !important;
}
input.line_item {
background: #fefefe url(../../images/line_item.png) no-repeat center !important;
}
input.line_item[disabled] {
background: #fefefe url(../../images/line_item.disabled.png) no-repeat center !important;
}
input.copy_item {
background: #fefefe url(../../images/copy_visualmap.png) no-repeat center !important;
}

View File

@ -1100,7 +1100,10 @@ CREATE TABLE "tlayout_data" (
"enable_link" SMALLINT NOT NULL default 1,
"id_metaconsole" INTEGER NOT NULL default 0,
"id_group" INTEGER NOT NULL default 0,
"id_custom_graph" INTEGER NOT NULL default 0
"id_custom_graph" INTEGER NOT NULL default 0,
"border_width" INTEGER NOT NULL default 0,
"border_color" varchar(200) DEFAULT "",
"fill_color" varchar(200) DEFAULT ""
);
-- ---------------------------------------------------------------------

View File

@ -1189,6 +1189,9 @@ CREATE TABLE IF NOT EXISTS `tlayout_data` (
`id_metaconsole` int(10) NOT NULL default 0,
`id_group` INTEGER UNSIGNED NOT NULL default 0,
`id_custom_graph` INTEGER UNSIGNED NOT NULL default 0,
`border_width` INTEGER UNSIGNED NOT NULL default 0,
`border_color` varchar(200) DEFAULT "",
`fill_color` varchar(200) DEFAULT "",
PRIMARY KEY(`id`)
) ENGINE = InnoDB DEFAULT CHARSET=utf8;