Working in the new elements for the visualmap. Ticket #1478

This commit is contained in:
mdtrooper 2014-11-25 13:15:51 +01:00
parent 018c5136c5
commit e48580c93a
4 changed files with 133 additions and 29 deletions

View File

@ -1828,15 +1828,49 @@ function updateDB(type, idElement , values, event) {
parameter.push({name: key, value: val}); parameter.push({name: key, value: val});
}); });
if ((typeof(values['mov_left']) != 'undefined') &&
(typeof(values['mov_top']) != 'undefined')) { switch (type) {
top = parseInt($("#" + idElement).css('top').replace('px', '')); // -- line_item --
left = parseInt($("#" + idElement).css('left').replace('px', '')); case 'handler_start':
} // ---------------
else if ((typeof(values['absolute_left']) != 'undefined') && if ((typeof(values['mov_left']) != 'undefined') &&
(typeof(values['absolute_top']) != 'undefined')) { (typeof(values['mov_top']) != 'undefined')) {
top = values['absolute_top']; top = parseInt($("#handler_start_" + idElement).css('top').replace('px', ''));
left = values['absolute_left']; left = parseInt($("#handler_start_" + idElement).css('left').replace('px', ''));
}
else if ((typeof(values['absolute_left']) != 'undefined') &&
(typeof(values['absolute_top']) != 'undefined')) {
top = values['absolute_top'];
left = values['absolute_left'];
}
break;
// -- line_item --
case 'handler_end':
// ---------------
if ((typeof(values['mov_left']) != 'undefined') &&
(typeof(values['mov_top']) != 'undefined')) {
top = parseInt($("#handler_end_" + idElement).css('top').replace('px', ''));
left = parseInt($("#handler_end_" + idElement).css('left').replace('px', ''));
}
else if ((typeof(values['absolute_left']) != 'undefined') &&
(typeof(values['absolute_top']) != 'undefined')) {
top = values['absolute_top'];
left = values['absolute_left'];
}
break;
default:
if ((typeof(values['mov_left']) != 'undefined') &&
(typeof(values['mov_top']) != 'undefined')) {
top = parseInt($("#" + idElement).css('top').replace('px', ''));
left = parseInt($("#" + idElement).css('left').replace('px', ''));
}
else if ((typeof(values['absolute_left']) != 'undefined') &&
(typeof(values['absolute_top']) != 'undefined')) {
top = values['absolute_top'];
left = values['absolute_left'];
}
break;
} }
if ((typeof(top) != 'undefined') && (typeof(left) != 'undefined')) { if ((typeof(top) != 'undefined') && (typeof(left) != 'undefined')) {
@ -1851,6 +1885,7 @@ function updateDB(type, idElement , values, event) {
} }
} }
success_update = false; success_update = false;
if (!autosave) { if (!autosave) {
list_actions_pending_save.push(parameter); list_actions_pending_save.push(parameter);
@ -2082,16 +2117,20 @@ function eventsItems(drag) {
activeToolboxButton('delete_item', true); activeToolboxButton('delete_item', true);
activeToolboxButton('show_grid', false); activeToolboxButton('show_grid', false);
} }
if ($(divParent).hasClass('handle_start')) { if ($(divParent).hasClass('handler_start')) {
idItem = $(divParent).attr('id')
.replace("handler_start_", "");
creationItem = null; creationItem = null;
selectedItem = 'handle_start'; selectedItem = 'handler_start';
activeToolboxButton('edit_item', true); activeToolboxButton('edit_item', true);
activeToolboxButton('delete_item', true); activeToolboxButton('delete_item', true);
activeToolboxButton('show_grid', false); activeToolboxButton('show_grid', false);
} }
if ($(divParent).hasClass('handle_end')) { if ($(divParent).hasClass('handler_end')) {
idItem = $(divParent).attr('id')
.replace("handler_end_", "");
creationItem = null; creationItem = null;
selectedItem = 'handle_end'; selectedItem = 'handler_end';
activeToolboxButton('edit_item', true); activeToolboxButton('edit_item', true);
activeToolboxButton('delete_item', true); activeToolboxButton('delete_item', true);
activeToolboxButton('show_grid', false); activeToolboxButton('show_grid', false);
@ -2149,11 +2188,11 @@ function eventsItems(drag) {
if ($(event.target).hasClass('icon')) { if ($(event.target).hasClass('icon')) {
selectedItem = 'icon'; selectedItem = 'icon';
} }
if ($(event.target).hasClass('handle_start')) { if ($(event.target).hasClass('handler_start')) {
selectedItem = 'handle_start'; selectedItem = 'handler_start';
} }
if ($(event.target).hasClass('handle_end')) { if ($(event.target).hasClass('handler_end')) {
selectedItem = 'handle_end'; selectedItem = 'handler_end';
} }
if (selectedItem == null) { if (selectedItem == null) {
@ -2165,7 +2204,28 @@ function eventsItems(drag) {
if (selectedItem != null) { if (selectedItem != null) {
creationItem = null; creationItem = null;
idItem = $(event.target).attr('id');
switch (selectedItem) {
// -- line_item --
case 'handler_start':
// ---------------
idItem = $(event.target).attr('id')
.replace("handler_end_", "");
idItem = $(event.target).attr('id')
.replace("handler_start_", "");
break;
// -- line_item --
case 'handler_end':
// ---------------
idItem = $(event.target).attr('id')
.replace("handler_end_", "");
idItem = $(event.target).attr('id')
.replace("handler_end_", "");
break;
default:
idItem = $(event.target).attr('id');
break;
}
activeToolboxButton('copy_item', true); activeToolboxButton('copy_item', true);
activeToolboxButton('edit_item', true); activeToolboxButton('edit_item', true);
activeToolboxButton('delete_item', true); activeToolboxButton('delete_item', true);

View File

@ -360,13 +360,30 @@ switch ($action) {
if ($label !== null) { if ($label !== null) {
$values['label'] = $label; $values['label'] = $label;
} }
if ($left !== null) {
$values['pos_x'] = $left; switch ($type) {
} // -- line_item --
if ($top !== null) { case 'handler_end':
$values['pos_y'] = $top; // ---------------
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 (defined('METACONSOLE') && $metaconsole) {
if ($server_name !== null) { if ($server_name !== null) {
$values['id_metaconsole'] = db_get_value('id', $values['id_metaconsole'] = db_get_value('id',
@ -394,7 +411,14 @@ switch ($action) {
if ($map_linked !== null) { if ($map_linked !== null) {
$values['id_layout_linked'] = $map_linked; $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': case 'box_item':
$values['border_width'] = $border_width; $values['border_width'] = $border_width;
$values['border_color'] = $border_color; $values['border_color'] = $border_color;
@ -469,7 +493,7 @@ switch ($action) {
unset($values['label']); unset($values['label']);
// Don't change background color in graphs when move // Don't change background color in graphs when move
switch($type) { switch ($type) {
case 'module_graph': case 'module_graph':
unset($values['image']); unset($values['image']);
break; break;
@ -480,6 +504,14 @@ switch ($action) {
unset($values['period']); unset($values['period']);
unset($values['width']); unset($values['width']);
unset($values['height']); unset($values['height']);
break;
// -- line_item --
case 'handler_start':
case 'handler_end':
// ---------------
unset($values['border_width']);
unset($values['border_color']);
break;
} }
} }
@ -501,6 +533,10 @@ switch ($action) {
array('background', 'height', 'width')); array('background', 'height', 'width'));
echo json_encode($backgroundFields); echo json_encode($backgroundFields);
break; break;
// -- line_item --
case 'handler_start':
case 'handler_end':
// ---------------
case 'box_item': case 'box_item':
case 'percentile_bar': case 'percentile_bar':
case 'percentile_item': case 'percentile_item':
@ -592,6 +628,14 @@ switch ($action) {
$elementFields['fill_color'] = $elementFields['fill_color']; $elementFields['fill_color'] = $elementFields['fill_color'];
break; 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 //Support for max, min and svg process on simple value items
if ($type == 'simple_value') { if ($type == 'simple_value') {

View File

@ -62,7 +62,7 @@ function visual_map_print_user_line_handles($layoutData) {
//Handle of start //Handle of start
echo '<div id="handler_start_' . $id . '" class="item handle_start" ' . echo '<div id="handler_start_' . $id . '" class="item handler_start" ' .
'style="z-index: ' .$z_index . ';' . 'style="z-index: ' .$z_index . ';' .
'position: absolute; top: ' . ($start_y - $radious_handle) . 'px; ' . 'position: absolute; top: ' . ($start_y - $radious_handle) . 'px; ' .
'left: ' . ($start_x - $radious_handle) . 'px;' . 'left: ' . ($start_x - $radious_handle) . 'px;' .
@ -74,7 +74,7 @@ function visual_map_print_user_line_handles($layoutData) {
echo "</div>"; echo "</div>";
//Handle of end //Handle of end
echo '<div id="handler_end_' . $id . '" class="item handle_end" ' . echo '<div id="handler_end_' . $id . '" class="item handler_end" ' .
'style="z-index: ' .$z_index . ';' . 'style="z-index: ' .$z_index . ';' .
'position: absolute; top: ' . ($end_y - $radious_handle) . 'px; ' . 'position: absolute; top: ' . ($end_y - $radious_handle) . 'px; ' .
'left: ' . ($end_x - $radious_handle) . 'px;' . 'left: ' . ($end_x - $radious_handle) . 'px;' .

View File

@ -79,7 +79,7 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) {
$form_items['line_width_row'] = array(); $form_items['line_width_row'] = array();
$form_items['line_width_row']['items'] = $form_items['line_width_row']['items'] =
array('datos', 'line_item', 'handle_start', 'handle_end'); array('datos', 'line_item', 'handler_start', 'handler_end');
$form_items['line_width_row']['html'] = '<td align="left">' . __('Width') . '</td> $form_items['line_width_row']['html'] = '<td align="left">' . __('Width') . '</td>
<td align="left">' . <td align="left">' .
html_print_input_text('line_width', 3, '', 3, 5, true) . html_print_input_text('line_width', 3, '', 3, 5, true) .
@ -88,7 +88,7 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) {
$form_items['line_color_row'] = array(); $form_items['line_color_row'] = array();
$form_items['line_color_row']['items'] = $form_items['line_color_row']['items'] =
array('datos', 'line_item', 'handle_start', 'handle_end'); array('datos', 'line_item', 'handler_start', 'handler_end');
$form_items['line_color_row']['html'] = $form_items['line_color_row']['html'] =
'<td align="left" valign="top" style="">' . '<td align="left" valign="top" style="">' .
__('Border color') . __('Border color') .