From 5e2a3e3c95bc8489bc8375cd9fd7d6e521c5dfc2 Mon Sep 17 00:00:00 2001 From: mdtrooper Date: Mon, 26 Jul 2010 11:56:04 +0000 Subject: [PATCH] 2010-07-26 Miguel de Dios * images/mimetypes/text.png: added lost image file in previous commits about collections. *images/tag_red.disabled.png, images/cross.disabled.png, images/chart_curve.disabled.png, images/config.disabled.png, images/chart_bar.disabled.png, images/photo.disabled.png, images/camera.disabled.png, images/binary.disabled.png: added image files for the new palete buttons (when it are disabled) in visual console editor. * include/styles/pandora.css: added the styles for the new buttons of visual console editor (label and icon), and some changes for new style for buttons of the palete in this page. * include/functions_html.php: in function "print_button" added new parameter $imageButton to set the button as image button, by default is false. * include/ajax/visual_console_builder.ajax.php, godmode/reporting/visual_console_builder.editor.js, godmode/reporting/visual_console_builder.editor.php, godmode/reporting/visual_console_builder.constans.php: change the buttons palete for a palete with more small buttons as icon buttons, added new items for visual map (icon and label). And fixed the dinamic change label color for any elements. * include/functions_visual_map.php: added the new items (label and icon) and cleaned the source code. Pending task: #3019641 git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@3061 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 33 +- .../visual_console_builder.constans.php | 2 + .../visual_console_builder.editor.js | 108 ++++++- .../visual_console_builder.editor.php | 33 +- pandora_console/images/binary.disabled.png | Bin 0 -> 264 bytes pandora_console/images/camera.disabled.png | Bin 0 -> 509 bytes pandora_console/images/chart_bar.disabled.png | Bin 0 -> 233 bytes .../images/chart_curve.disabled.png | Bin 0 -> 398 bytes pandora_console/images/config.disabled.png | Bin 0 -> 314 bytes pandora_console/images/cross.disabled.png | Bin 0 -> 457 bytes pandora_console/images/mimetypes/text.png | Bin 0 -> 574 bytes pandora_console/images/photo.disabled.png | Bin 0 -> 326 bytes pandora_console/images/tag_red.disabled.png | Bin 0 -> 448 bytes .../ajax/visual_console_builder.ajax.php | 14 + pandora_console/include/functions_html.php | 11 +- .../include/functions_visual_map.php | 284 ++++++++++++------ pandora_console/include/styles/pandora.css | 62 +++- 17 files changed, 436 insertions(+), 111 deletions(-) create mode 100644 pandora_console/images/binary.disabled.png create mode 100644 pandora_console/images/camera.disabled.png create mode 100644 pandora_console/images/chart_bar.disabled.png create mode 100644 pandora_console/images/chart_curve.disabled.png create mode 100755 pandora_console/images/config.disabled.png create mode 100755 pandora_console/images/cross.disabled.png create mode 100755 pandora_console/images/mimetypes/text.png create mode 100644 pandora_console/images/photo.disabled.png create mode 100644 pandora_console/images/tag_red.disabled.png diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index d6155b104e..fa7ec3f26e 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,34 @@ +2010-07-26 Miguel de Dios + * images/mimetypes/text.png: added lost image file in previous commits about + collections. + + *images/tag_red.disabled.png, images/cross.disabled.png, + images/chart_curve.disabled.png, images/config.disabled.png, + images/chart_bar.disabled.png, images/photo.disabled.png, + images/camera.disabled.png, images/binary.disabled.png: added image files + for the new palete buttons (when it are disabled) in visual console editor. + + * include/styles/pandora.css: added the styles for the new buttons of + visual console editor (label and icon), and some changes for new style for + buttons of the palete in this page. + + * include/functions_html.php: in function "print_button" added new + parameter $imageButton to set the button as image button, by default is + false. + + * include/ajax/visual_console_builder.ajax.php, + godmode/reporting/visual_console_builder.editor.js, + godmode/reporting/visual_console_builder.editor.php, + godmode/reporting/visual_console_builder.constans.php: change the buttons + palete for a palete with more small buttons as icon buttons, added new items + for visual map (icon and label). And fixed the dinamic change label color + for any elements. + + * include/functions_visual_map.php: added the new items (label and icon) + and cleaned the source code. + + Pending task: #3019641 + 2010-07-26 Dario Rodriguez * include/styles/pandora.css: Added css classes for separator. @@ -44,7 +75,7 @@ * godmode/agentes/massive_config.php: Use better text in title and button. -2010-07-21 Miguel de Dios +2010-07-22 Miguel de Dios * operation/snmpconsole/snmp_view.php: added the show more data when click in the icon eye. diff --git a/pandora_console/godmode/reporting/visual_console_builder.constans.php b/pandora_console/godmode/reporting/visual_console_builder.constans.php index 3a18a4cc62..b902bca610 100644 --- a/pandora_console/godmode/reporting/visual_console_builder.constans.php +++ b/pandora_console/godmode/reporting/visual_console_builder.constans.php @@ -17,4 +17,6 @@ define('STATIC_GRAPH', 0); define('PERCENTILE_BAR', 3); define('MODULE_GRAPH', 1); define('SIMPLE_VALUE', 2); +define('LABEL', 4); +define('ICON', 5); ?> \ No newline at end of file diff --git a/pandora_console/godmode/reporting/visual_console_builder.editor.js b/pandora_console/godmode/reporting/visual_console_builder.editor.js index f8d2514919..d185e1b141 100644 --- a/pandora_console/godmode/reporting/visual_console_builder.editor.js +++ b/pandora_console/godmode/reporting/visual_console_builder.editor.js @@ -128,6 +128,9 @@ function updateAction() { break; case 'static_graph': $("#text_" + idItem).html(values['label']); + + $("#" + idItem).css('color', values['label_color']); + $("#image_" + idItem).attr('src', getImageElement(idItem)); if ((values['width'] != 0) && (values['height'] != 0)) { $("#image_" + idItem).attr('width', values['width']); @@ -153,6 +156,26 @@ function updateAction() { case 'simple_value': $("#text_" + idItem).html(values['label']); break; + case 'label': + $("#" + idItem).css('color', values['label_color']); + + $("#text_" + idItem).html(values['label']); + break; + case 'icon': + $("#image_" + idItem).attr('src', getImageElement(idItem)); + if ((values['width'] != 0) && (values['height'] != 0)) { + $("#image_" + idItem).attr('width', values['width']); + $("#image_" + idItem).attr('height', values['height']); + $("#" + idItem).css('width', values['width'] + 'px'); + $("#" + idItem).css('height', values['height'] + 'px'); + } + else { + $("#image_" + idItem).removeAttr('width'); + $("#image_" + idItem).removeAttr('height'); + $("#" + idItem).css('width', ''); + $("#" + idItem).css('height', ''); + } + break; } updateDB(selectedItem, idItem , values); @@ -196,9 +219,21 @@ function createAction() { validate = false; } break; + case 'label': + if ((values['label'] == '')) { + alert($("#message_alert_no_label").html()); + validate = false; + } + break; + case 'icon': + if ((values['image'] == '')) { + alert($("#message_alert_no_image").html()); + validate = false; + } + break; } - if (validate) { + if (validate) { insertDB(creationItem, values); actionClick(); } @@ -212,6 +247,8 @@ function actionClick() { activeToolboxButton('percentile_bar', true); activeToolboxButton('module_graph', true); activeToolboxButton('simple_value', true); + activeToolboxButton('label', true); + activeToolboxButton('icon', true); $(".item").draggable("enable"); $("#background").resizable('enable'); @@ -233,6 +270,9 @@ function actionClick() { activeToolboxButton('percentile_bar', false); activeToolboxButton('module_graph', false); activeToolboxButton('simple_value', false); + activeToolboxButton('label', false); + activeToolboxButton('icon', false); + activeToolboxButton('edit_item', false); activeToolboxButton('delete_item', false); @@ -391,6 +431,7 @@ function cleanFields() { function getModuleGraph(id_data) { var parameter = Array(); + parameter.push ({name: "page", value: "include/ajax/visual_console_builder.ajax"}); parameter.push ({name: "action", value: "get_layout_data"}); parameter.push ({name: "id_element", value: id_data}); @@ -557,6 +598,26 @@ function createItem(type, values, id_data) { '' ); break; + case 'label': + var item = $('
' + + '' + values['label'] + '' + + '
' + ); + break; + case 'icon': + if ((values['width'] == 0) && (values['height'] == 0)) { + var sizeStyle = ''; + var imageSize = ''; + } + else { + var sizeStyle = 'width: ' + values['width'] + 'px; height: ' + values['height'] + 'px;'; + var imageSize = 'width="' + values['width'] + '" height="' + values['height'] + '"'; + } + var item = $('
' + + '
' + + '
' + ); + break; } $("#background").append(item); @@ -643,6 +704,8 @@ function updateDB(type, idElement , values) { case 'static_graph': case 'percentile_bar': case 'simple_value': + case 'label': + case 'icon': if ((typeof(values['mov_left']) != 'undefined') && (typeof(values['mov_top']) != 'undefined')) { $("#" + idElement).css('top', '0px').css('margin-top', top + 'px'); @@ -777,6 +840,20 @@ function eventsItems() { activeToolboxButton('edit_item', true); activeToolboxButton('delete_item', true); } + if ($(divParent).hasClass('label')) { + creationItem = null; + selectedItem = 'label'; + idItem = $(divParent).attr('id'); + activeToolboxButton('edit_item', true); + activeToolboxButton('delete_item', true); + } + if ($(divParent).hasClass('icon')) { + creationItem = null; + selectedItem = 'icon'; + idItem = $(divParent).attr('id'); + activeToolboxButton('edit_item', true); + activeToolboxButton('delete_item', true); + } } }); @@ -824,6 +901,20 @@ function eventsItems() { activeToolboxButton('edit_item', true); activeToolboxButton('delete_item', true); } + if ($(divParent).hasClass('label')) { + creationItem = null; + selectedItem = 'label'; + idItem = $(divParent).attr('id'); + activeToolboxButton('edit_item', true); + activeToolboxButton('delete_item', true); + } + if ($(divParent).hasClass('icon')) { + creationItem = null; + selectedItem = 'icon'; + idItem = $(divParent).attr('id'); + activeToolboxButton('edit_item', true); + activeToolboxButton('delete_item', true); + } } }); @@ -890,9 +981,6 @@ function unselectAll() { function click2(id) { switch (id) { - case 'edit_item': - actionClick(); - break; case 'static_graph': creationItem = 'static_graph'; actionClick(); @@ -909,6 +997,18 @@ function click2(id) { creationItem = 'simple_value'; actionClick(); break; + case 'label': + creationItem = 'label'; + actionClick(); + break; + case 'icon': + creationItem = 'icon'; + actionClick(); + break; + + case 'edit_item': + actionClick(); + break; case 'delete_item': deleteItem(); break; diff --git a/pandora_console/godmode/reporting/visual_console_builder.editor.php b/pandora_console/godmode/reporting/visual_console_builder.editor.php index 053a23ba34..07cd64392b 100644 --- a/pandora_console/godmode/reporting/visual_console_builder.editor.php +++ b/pandora_console/godmode/reporting/visual_console_builder.editor.php @@ -46,13 +46,15 @@ foreach ($all_images as $image_file) { echo '
'; echo '
'; - printButtonEditorVisualConsole('static_graph', __('Static Graph'), 'left', false, 'camera'); - printButtonEditorVisualConsole('percentile_bar', __('Percentile Bar'), 'left', false, 'percentile'); - printButtonEditorVisualConsole('module_graph', __('Module Graph'), 'left', false, 'graph'); - printButtonEditorVisualConsole('simple_value', __('Simple Value'), 'left', false, 'binary'); + printButtonEditorVisualConsole('static_graph', __('Static Graph'), 'left', false, 'camera_min', true); + printButtonEditorVisualConsole('percentile_bar', __('Percentile Bar'), 'left', false, 'percentile_min', true); + printButtonEditorVisualConsole('module_graph', __('Module Graph'), 'left', false, 'graph_min', true); + printButtonEditorVisualConsole('simple_value', __('Simple Value'), 'left', false, 'binary_min', true); + printButtonEditorVisualConsole('label', __('Label'), 'left', false, 'label_min', true); + printButtonEditorVisualConsole('icon', __('Icon'), 'left', false, 'icon_min', true); - printButtonEditorVisualConsole('edit_item', __('Edit item'), 'right', true, 'config'); - printButtonEditorVisualConsole('delete_item', __('Delete item'), 'right', true, 'delete'); + printButtonEditorVisualConsole('edit_item', __('Edit item'), 'right', true, 'config_min', true); + printButtonEditorVisualConsole('delete_item', __('Delete item'), 'right', true, 'delete_min', true); echo '
'; echo '
'; echo '
'; @@ -94,13 +96,16 @@ echo '"; } - // **************************************************************** - // SIMPLE DATA VALUE (type = 2) - // **************************************************************** switch ($layout_data['type']) { - case 2: - if ($resizedMap) - echo '
'; - else - echo '
'; - echo ''.$layout_data['label']. ' '; - echo get_db_value ('datos', 'tagente_estado', 'id_agente_modulo', $layout_data['id_agente_modulo']); - echo '
'; - break; - - // **************************************************************** - // Progress bar - // **************************************************************** - case 3: + case 4: + // **************************************************************** + // LABEL (type = 4) + // **************************************************************** + $z_index = 4; + if ($resizedMap) + echo '
'; + else + echo '
'; + + $endTagA = false; + if ($show_links) { + if (!isset($id_agent)) $id_agent = 0; + if (($id_agent > 0) && ($layout_data['id_layout_linked'] == "" || $layout_data['id_layout_linked'] == 0)) { + // Link to an agent + echo ''; + $endTagA = true; + } + elseif ($layout_data['id_layout_linked'] > 0) { + // Link to a map + echo ''; + $endTagA = true; + } + } + if ($layout_data['label_color'][0] == '#') { + echo "
"; + echo $layout_data['label']; + } + if ($endTagA) echo "
"; + echo "
"; + break; + case 5: + // **************************************************************** + // ICON (type = 5) + // **************************************************************** + $z_index = 4; + if ($resizedMap) + echo '
'; + else + echo '"; + break; + case 2: + // **************************************************************** + // SIMPLE DATA VALUE (type = 2) + // **************************************************************** + if ($resizedMap) + echo '
'; + else + echo '
'; + echo ''.$layout_data['label']. ' '; + echo get_db_value ('datos', 'tagente_estado', 'id_agente_modulo', $layout_data['id_agente_modulo']); + echo '
'; + break; + case 3: + // **************************************************************** + // Progress bar + // **************************************************************** if ($resizedMap) echo '
'; else @@ -577,13 +703,11 @@ function print_pandora_visual_map ($id_layout, $show_links = true, $draw_lines = echo ""; echo '
'; - //} - break; - - // **************************************************************** - // Single module graph - // **************************************************************** - case 1; + break; + case 1; + // **************************************************************** + // Single module graph + // **************************************************************** // SINGLE GRAPH (type = 1) if ($resizedMap) echo '
'; @@ -611,20 +735,8 @@ function print_pandora_visual_map ($id_layout, $show_links = true, $draw_lines = print_image ("include/fgraph.php?tipo=sparse&id=".$layout_data['id_agente_modulo']."&label=".safe_input ($layout_data['label'])."&height=".$layout_data['height']."&pure=1&width=".$layout_data['width']."&period=".$layout_data['period'], false, array ("title" => $layout_data['label'], "border" => 0)); echo ""; echo "
"; - break; + break; } - // Line, not implemented in editor - /* - } elseif ($layout_data['type'] == 2) { - $line['id'] = $layout_data['id']; - $line['x'] = $layout_data['pos_x']; - $line['y'] = $layout_data['pos_y']; - $line['width'] = $layout_data['width']; - $line['height'] = $layout_data['height']; - $line['color'] = $layout_data['label_color']; - array_push ($lines, $line); - } - */ // **************************************************************** // Lines joining objects diff --git a/pandora_console/include/styles/pandora.css b/pandora_console/include/styles/pandora.css index 5e3cd1064f..67056996f5 100644 --- a/pandora_console/include/styles/pandora.css +++ b/pandora_console/include/styles/pandora.css @@ -284,6 +284,10 @@ input.copy, input.add, input.graph, input.percentile, input.binary, input.camera, input.config, input.cancel { padding-right: 21px; } +input.delete_min, input.graph_min, input.percentile_min, input.binary_min, +input.camera_min, input.config_min, input.label_min, input.icon_min { + padding-right: 25px; +} input.next { background: #e5e5e5 url(../../images/go.png) no-repeat right 2px; } @@ -293,9 +297,6 @@ input.upd { input.wand { background: #e5e5e5 url(../../images/wand.png) no-repeat right 3px; } -input.delete { - background: #e5e5e5 url(../../images/cross.png) no-repeat right 3px; -} input.search { background: #e5e5e5 url(../../images/zoom.png) no-repeat right 3px; } @@ -308,6 +309,12 @@ input.ok { input.add { background: #e5e5e5 url(../../images/add.png) no-repeat right 3px; } +input.cancel { + background: #e5e5e5 url(../../images/cancel.png) no-repeat right 3px; +} +input.delete { + background: #e5e5e5 url(../../images/cross.png) no-repeat right 3px; +} input.graph { background: #e5e5e5 url(../../images/chart_curve.png) no-repeat right 3px; } @@ -323,8 +330,53 @@ input.camera { input.config { background: #e5e5e5 url(../../images/config.png) no-repeat right 3px; } -input.cancel { - background: #e5e5e5 url(../../images/cancel.png) no-repeat right 3px; +input.delete_min { + background: #e5e5e5 url(../../images/cross.png) no-repeat center; +} +input.delete_min[disabled] { + background: #e5e5e5 url(../../images/cross.disabled.png) no-repeat center; +} +input.graph_min { + background: #e5e5e5 url(../../images/chart_curve.png) no-repeat center; +} +input.graph_min[disabled] { + background: #e5e5e5 url(../../images/chart_curve.disabled.png) no-repeat center; +} +input.percentile_min { + background: #e5e5e5 url(../../images/chart_bar.png) no-repeat center; +} +input.percentile_min[disabled] { + background: #e5e5e5 url(../../images/chart_bar.disabled.png) no-repeat center; +} +input.binary_min { + background: #e5e5e5 url(../../images/binary.png) no-repeat center; +} +input.binary_min[disabled] { + background: #e5e5e5 url(../../images/binary.disabled.png) no-repeat center; +} +input.camera_min { + background: #e5e5e5 url(../../images/camera.png) no-repeat center; +} +input.camera_min[disabled] { + background: #e5e5e5 url(../../images/camera.disabled.png) no-repeat center; +} +input.config_min { + background: #e5e5e5 url(../../images/config.png) no-repeat center; +} +input.config_min[disabled] { + background: #e5e5e5 url(../../images/config.disabled.png) no-repeat center; +} +input.label_min { + background: #e5e5e5 url(../../images/tag_red.png) no-repeat center; +} +input.label_min[disabled] { + background: #e5e5e5 url(../../images/tag_red.disabled.png) no-repeat center; +} +input.icon_min { + background: #e5e5e5 url(../../images/photo.png) no-repeat center; +} +input.icon_min[disabled] { + background: #e5e5e5 url(../../images/photo.disabled.png) no-repeat center; } table, img { border: 0px;