2012-08-16 Vanessa Gil <vanessa.gil@artica.es>

* pandoradb.oracle.sql
	  pandoradb.postgreSQL.sql
	  pandoradb.sql
	  extras/pandoradb_migrate_4.0.x_to_5.0.mysql.sql
	  extras/pandoradb_migrate_4.0.x_to_5.0.oracle.sql
	  extras/pandoradb_migrate_4.0.x_to_5.0.postgreSQL.sql
	  godmode/reporting/visual_console_builder.editor.js
	  godmode/reporting/visual_console_builder.php
	  godmode/reporting/visual_console_builder.wizard.php
	  include/functions_visual_map.php
	  include/functions_visual_map_editor.php
	  include/ajax/visual_console_builder.ajax.php: Optional links to agent and
	services in visual console items. Fixed bug: links not works.


git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6893 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
vgilc 2012-08-21 08:52:44 +00:00
parent e9b2213a7b
commit 9369da7c80
13 changed files with 169 additions and 79 deletions

View File

@ -1,3 +1,19 @@
2012-08-16 Vanessa Gil <vanessa.gil@artica.es>
* pandoradb.oracle.sql
pandoradb.postgreSQL.sql
pandoradb.sql
extras/pandoradb_migrate_4.0.x_to_5.0.mysql.sql
extras/pandoradb_migrate_4.0.x_to_5.0.oracle.sql
extras/pandoradb_migrate_4.0.x_to_5.0.postgreSQL.sql
godmode/reporting/visual_console_builder.editor.js
godmode/reporting/visual_console_builder.php
godmode/reporting/visual_console_builder.wizard.php
include/functions_visual_map.php
include/functions_visual_map_editor.php
include/ajax/visual_console_builder.ajax.php: Optional links to agent and
services in visual console items. Fixed bug: links not works.
2012-08-20 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_html.php: fixed into the function

View File

@ -266,4 +266,9 @@ UPDATE trecon_script SET `description`='This&#x20;script&#x20;is&#x20;used&#x20;
-- Table `trecon_task
-- -----------------------------------------------------
ALTER TABLE trecon_task MODIFY subnet TEXT NOT NULL DEFAULT '';
ALTER TABLE trecon_task MODIFY field1 TEXT NOT NULL DEFAULT '';
ALTER TABLE trecon_task MODIFY field1 TEXT NOT NULL DEFAULT '';
-- -----------------------------------------------------
-- Table `tlayout_data
-- -----------------------------------------------------
ALTER TABLE tlayout_data ADD COLUMN `enable_link` tinyint(1) UNSIGNED NOT NULL default 1;

View File

@ -268,3 +268,8 @@ ALTER TABLE tplugin ADD (parameters CLOB default '');
-- -----------------------------------------------------
ALTER TABLE trecon_task MODIFY subnet TEXT NOT NULL;
ALTER TABLE trecon_task MODIFY field1 TEXT NOT NULL;
-- -----------------------------------------------------
-- Table `tlayout_data`
-- -----------------------------------------------------
ALTER TABLE tlayout_data ADD (enable_link NUMBER(5, 0) NOT NULL default 1);

View File

@ -268,3 +268,8 @@ ALTER TABLE "tplugin" ADD COLUMN "parameters" TEXT default '';
-- -----------------------------------------------------
ALTER TABLE "trecon_task" ALTER COLUMN "subnet" TYPE TEXT;
ALTER TABLE "trecon_task" ALTER COLUMN "field1" TYPE TEXT;
-- -----------------------------------------------------
-- Table `tlayout_data`
-- -----------------------------------------------------
ALTER TABLE "tlayout_data" ADD COLUMN "enable_link" SMALLINT NOT NULL default 1;

View File

@ -289,6 +289,7 @@ function readFields() {
values['height_module_graph'] = $("input[name=height_module_graph]").val();
values['type_percentile'] = $("input[name=type_percentile]:checked").val();
values['value_show'] = $("input[name=value_show]:checked").val();
values['enable_link'] = $("input[name=enable_link]").is(':checked') ? 1 : 0;
if (typeof(enterprise_readFields) == 'function') {
//The parameter is a object and the function can change or add
@ -476,6 +477,8 @@ function loadFieldsFromDB(item) {
if (key == 'width') $("input[name=width]").val(val);
if (key == 'height') $("input[name=height]").val(val);
if (key == 'label') $("input[name=label]").val(val);
if (key == 'enable_link') $("input[name=enable_link]").val(val);
if (key == 'image') {
//Load image preview
$("select[name=image]").val(val);
@ -624,6 +627,9 @@ function hiddenFields(item) {
$("#image_row").css('display', 'none');
$("#image_row." + item).css('display', '');
$("#enable_link_row").css('display', 'none');
$("#enable_link_row." + item).css('display', '');
$("#preview_row").css('display', 'none');
$("#preview_row." + item).css('display', '');

View File

@ -192,6 +192,7 @@ switch ($activeTab) {
$type_percentile = get_parameter ("type_percentile", 'percentile');
$value_show = get_parameter ("value_show", 'percent');
$label_type = get_parameter ("label_type", 'agent_module');
$enable_link = get_parameter ("enable_link", 'enable_link');
// This var switch between creation of items, item_per_agent = 0 => item per module; item_per_agent <> 0 => item per agent
$item_per_agent = get_parameter ("item_per_agent", 0);
@ -206,7 +207,7 @@ switch ($activeTab) {
$message .= visual_map_process_wizard_add_agents($id_agents_result,
$image, $idVisualConsole, $range, $width, $height,
$period, $process_value, $percentileitem_width,
$max_value, $type_percentile, $value_show, $label_type, $type);
$max_value, $type_percentile, $value_show, $label_type, $type, $enable_link);
$statusProcessInDB = array('flag' => true, 'message' => $message);
@ -232,7 +233,7 @@ switch ($activeTab) {
$message .= visual_map_process_wizard_add_modules($id_modules,
$image, $idVisualConsole, $range, $width, $height,
$period, $process_value, $percentileitem_width,
$max_value, $type_percentile, $value_show, $label_type, $type);
$max_value, $type_percentile, $value_show, $label_type, $type, $enable_link);
}
else {
$id_modules = array();
@ -257,7 +258,7 @@ switch ($activeTab) {
$message .= visual_map_process_wizard_add_modules($id_modules,
$image, $idVisualConsole, $range, $width, $height,
$period, $process_value, $percentileitem_width,
$max_value, $type_percentile, $value_show, $label_type, $type);
$max_value, $type_percentile, $value_show, $label_type, $type, $enable_link);
}
$statusProcessInDB = array('flag' => true, 'message' => $message);
}

View File

@ -136,6 +136,10 @@ $label_type = array ('agent_module' => __('Agent - Module'),
'none' => __('None'));
$table->data["all_5"][1] = html_print_select ($label_type, 'label_type', 'agent_module', '', '', '', true);
$table->data["all_6"][0] = __('Enable link agent');
$table->data["all_6"][1] = __('Yes').'&nbsp;&nbsp;&nbsp;'.html_print_radio_button_extended ('enable_link', 1, '', 1, false, '', '', true).'&nbsp;&nbsp;';
$table->data["all_6"][1] .= __('No').'&nbsp;&nbsp;&nbsp;'.html_print_radio_button_extended ('enable_link', 0, '', 1, false, '', '', true);
echo '<form method="post"
action="index.php?sec=reporting&sec2=godmode/reporting/visual_console_builder&tab=' . $activeTab . '&id_visual_console=' . $visualConsole["id"] . '"
onsubmit="if (! confirm(\''.__('Are you sure to add many elements\nin visual map?').'\')) return false; else return check_fields();">';

View File

@ -66,6 +66,8 @@ $value_show = get_parameter('value_show', 'percent');
$get_element_status = get_parameter('get_element_status', 0);
$get_image_path_status = get_parameter('get_image_path_status', 0);
$enable_link = get_parameter('enable_link', 1);
switch ($action) {
case 'get_font':
$return = array();
@ -236,6 +238,9 @@ switch ($action) {
case 'label':
case 'icon':
default:
if ($enable_link !== null) {
$values['enable_link'] = $enable_link;
}
if ($label !== null) {
$values['label'] = $label;
}

View File

@ -397,7 +397,7 @@ function visual_map_process_wizard_add ($id_agents, $image, $id_layout, $range,
*/
function visual_map_process_wizard_add_modules ($id_modules, $image, $id_layout,
$range, $width = 0, $height = 0, $period, $process_value, $percentileitem_width,
$max_value, $type_percentile, $value_show, $label_type, $type) {
$max_value, $type_percentile, $value_show, $label_type, $type, $enable_link = true) {
if (empty ($id_modules)) {
$return = ui_print_error_message (__('No modules selected'), '', true);
return $return;
@ -486,7 +486,8 @@ function visual_map_process_wizard_add_modules ($id_modules, $image, $id_layout,
'width' => $value_width,
'period' => $period,
'height' => $value_height,
'label_color' => '#000000');
'label_color' => '#000000',
'enable_link' => $enable_link);
db_process_sql_insert ('tlayout_data', $values);
@ -512,7 +513,7 @@ function visual_map_process_wizard_add_modules ($id_modules, $image, $id_layout,
*/
function visual_map_process_wizard_add_agents ($id_agents, $image, $id_layout,
$range, $width = 0, $height = 0, $period, $process_value, $percentileitem_width,
$max_value, $type_percentile, $value_show, $label_type, $type) {
$max_value, $type_percentile, $value_show, $label_type, $type, $enable_link = 1) {
if (empty ($id_agents)) {
$return = ui_print_error_message (__('No agents selected'), '', true);
@ -590,7 +591,8 @@ function visual_map_process_wizard_add_agents ($id_agents, $image, $id_layout,
'width' => $value_width,
'period' => $period,
'height' => $value_height,
'label_color' => '#000000');
'label_color' => '#000000',
'enable_link' => $enable_link);
db_process_sql_insert ('tlayout_data', $values);
@ -780,6 +782,8 @@ function visual_map_print_visual_map ($id_layout, $show_links = true, $draw_line
$lines = array ();
foreach ($layout_datas as $layout_data) {
$enable_link = db_get_value('enable_link', 'tlayout_data', 'id', $layout_data['id']);
switch ($layout_data['type']) {
case STATIC_GRAPH:
case PERCENTILE_BAR:
@ -874,33 +878,47 @@ function visual_map_print_visual_map ($id_layout, $show_links = true, $draw_line
echo '<div style="left: 0px; top: 0px; text-align: center; z-index: '.$z_index.'; '.($layout_data['label_color'][0] == '#' ? 'color: '.$layout_data['label_color'].';' : '').' position: absolute; margin-left: '.((integer)($proportion * $layout_data['pos_x'])).'px; margin-top:'.((integer)($proportion * $layout_data['pos_y'])).'px;" id="layout-data-'.$layout_data['id'].'" class="layout-data">';
else
echo '<div style="left: 0px; top: 0px; text-align: center; z-index: '.$z_index.'; '.($layout_data['label_color'][0] == '#' ? 'color: '.$layout_data['label_color'].';' : '').' position: absolute; margin-left: '.$layout_data['pos_x'].'px; margin-top:'.$layout_data['pos_y'].'px;" id="layout-data-'.$layout_data['id'].'" class="layout-data">';
if ($layout_data['id_agente_modulo'] != 0) {
$id_agent = db_get_value ("id_agente", "tagente_estado", "id_agente_modulo", $layout_data['id_agente_modulo']);
}
elseif ($layout_data['id_agent'] != 0) {
$id_agent = $layout_data["id_agent"];
}
else {
$id_agent = 0;
}
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)) {
//Extract id service if it is a prediction module.
$id_service = db_get_value_filter('custom_integer_1',
'tagente_modulo',
array('id_agente_modulo' => $layout_data['id_agente_modulo'],
'prediction_module' => 1));
if ($id_service === false) {
$id_service = 0;
}
if ($id_service != 0) {
//Link to an service page
echo '<a href="'.$config['homeurl'].'/index.php?sec=services&sec2=enterprise/operation/services/services&id_service=' .
$id_service . '&offset=0">';
}
else {
// Link to an agent
echo '<a href="'.$config['homeurl'].'/index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;id_agente='.$id_agent.'">';
if (($id_agent > 0) && ($layout_data['id_layout_linked'] == "" || $layout_data['id_layout_linked'] == 0)) {
if ($enable_link) {
//Extract id service if it is a prediction module.
$id_service = db_get_value_filter('custom_integer_1',
'tagente_modulo',
array('id_agente_modulo' => $layout_data['id_agente_modulo'],
'prediction_module' => 1));
if ($id_service === false) {
$id_service = 0;
}
if ($id_service != 0) {
//Link to an service page
echo '<a href="'.$config['homeurl'].'/index.php?sec=services&sec2=enterprise/operation/services/services&id_service=' .
$id_service . '&offset=0">';
}
else {
// Link to an agent
echo '<a href="'.$config['homeurl'].'/index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;id_agente='.$id_agent.'">';
}
}
}
elseif ($layout_data['id_layout_linked'] > 0) {
elseif ($layout_data['id_layout_linked'] > 0) {
// Link to a map
echo '<a href="index.php?sec=visualc&amp;sec2=operation/visual_console/render_view&amp;pure='.$config["pure"].'&amp;id='.$layout_data["id_layout_linked"].'">';
@ -996,9 +1014,11 @@ function visual_map_print_visual_map ($id_layout, $show_links = true, $draw_line
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 '<a style="' . ($layout_data['label_color'][0] == '#' ? 'color: '.$layout_data['label_color'].';' : '') . '" href="index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;id_agente='.$id_agent.'">';
$endTagA = true;
if ($enable_link) {
// Link to an agent
echo '<a style="' . ($layout_data['label_color'][0] == '#' ? 'color: '.$layout_data['label_color'].';' : '') . '" href="index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;id_agente='.$id_agent.'">';
$endTagA = true;
}
}
elseif ($layout_data['id_layout_linked'] > 0) {
// Link to a map
@ -1024,9 +1044,12 @@ function visual_map_print_visual_map ($id_layout, $show_links = true, $draw_line
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 '<a style="' . ($layout_data['label_color'][0] == '#' ? 'color: '.$layout_data['label_color'].';' : '') . '" href="index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;id_agente='.$id_agent.'">';
$endTagA = true;
if ($enable_link) {
// Link to an agent
echo '<a style="' . ($layout_data['label_color'][0] == '#' ? 'color: '.$layout_data['label_color'].';' : '') . '" href="index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;id_agente='.$id_agent.'">';
$endTagA = true;
}
}
elseif ($layout_data['id_layout_linked'] > 0) {
// Link to a map
@ -1104,11 +1127,14 @@ function visual_map_print_visual_map ($id_layout, $show_links = true, $draw_line
$id_service = 0;
}
if ($id_service != 0) {
//Link to an service page
echo '<a href="index.php?sec=services&sec2=enterprise/operation/services/services&id_service=' .
$id_service . '&offset=0">';
$endTagA = true;
if ($id_service != 0) {
if ($enable_link) {
//Link to an service page
echo '<a href="index.php?sec=services&sec2=enterprise/operation/services/services&id_service=' .
$id_service . '&offset=0">';
$endTagA = true;
}
}
elseif ($layout_data['id_layout_linked'] > 0) {
@ -1194,26 +1220,30 @@ function visual_map_print_visual_map ($id_layout, $show_links = true, $draw_line
if ($show_links) {
if (($id_agent > 0) && ($layout_data['id_layout_linked'] == "" || $layout_data['id_layout_linked'] == 0)) {
//Extract id service if it is a prediction module.
$id_service = db_get_value_filter('custom_integer_1',
'tagente_modulo',
array('id_agente_modulo' => $layout_data['id_agente_modulo'],
'prediction_module' => 1));
if ($id_service === false) {
$id_service = 0;
}
if ($enable_link) {
if ($id_service != 0) {
//Link to an service page
echo '<a href="index.php?sec=services&sec2=enterprise/operation/services/services&id_service=' .
$id_service . '&offset=0">';
$endTagA = true;
}
else {
// Link to an agent
echo '<a href="index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;id_agente='.$id_agent.'">';
$endTagA = true;
//Extract id service if it is a prediction module.
$id_service = db_get_value_filter('custom_integer_1',
'tagente_modulo',
array('id_agente_modulo' => $layout_data['id_agente_modulo'],
'prediction_module' => 1));
if ($id_service === false) {
$id_service = 0;
}
if ($id_service != 0) {
//Link to an service page
echo '<a href="index.php?sec=services&sec2=enterprise/operation/services/services&id_service=' .
$id_service . '&offset=0">';
$endTagA = true;
}
else {
// Link to an agent
echo '<a href="index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;id_agente='.$id_agent.'">';
$endTagA = true;
}
}
}
elseif ($layout_data['id_layout_linked'] > 0) {
@ -1278,23 +1308,26 @@ function visual_map_print_visual_map ($id_layout, $show_links = true, $draw_line
if ($show_links) {
if (($layout_data['id_layout_linked'] == "") || ($layout_data['id_layout_linked'] == 0)) {
//Extract id service if it is a prediction module.
$id_service = db_get_value_filter('custom_integer_1',
'tagente_modulo',
array('id_agente_modulo' => $layout_data['id_agente_modulo'],
'prediction_module' => 1));
if ($enable_link) {
if ($id_service === false) {
$id_service = 0;
}
if ($id_service != 0) {
//Link to an service page
echo '<a href="index.php?sec=services&sec2=enterprise/operation/services/services&id_service=' .
$id_service . '&offset=0">';
}
else {
echo '<a href="index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;id_agente='.$layout_data["id_agent"].'&amp;tab=data">';
//Extract id service if it is a prediction module.
$id_service = db_get_value_filter('custom_integer_1',
'tagente_modulo',
array('id_agente_modulo' => $layout_data['id_agente_modulo'],
'prediction_module' => 1));
if ($id_service === false) {
$id_service = 0;
}
if ($id_service != 0) {
//Link to an service page
echo '<a href="index.php?sec=services&sec2=enterprise/operation/services/services&id_service=' .
$id_service . '&offset=0">';
}
else {
echo '<a href="index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;id_agente='.$layout_data["id_agent"].'&amp;tab=data">';
}
}
}
else {

View File

@ -85,7 +85,14 @@ function visual_map_editor_print_item_palette($visualConsole_id, $background) {
$form_items['image_row']['items'] = array('static_graph', 'icon', 'datos');
$form_items['image_row']['html'] = '<td>' . __('Image') . '</td>
<td>'. html_print_select ($images_list, 'image', '', 'showPreview(this.value);', 'None', '', true) .'</td>';
$form_items['enable_link_row'] = array();
$form_items['enable_link_row']['items'] = array('static_graph',
'percentile_bar', 'percentile_item', 'module_graph',
'simple_value', 'label', 'datos'. 'icon');
$form_items['enable_link_row']['html'] = '<td style="">' . __('Enable link') .'</td>
<td style="">'. html_print_checkbox('enable_link', '', 'enable_link', true) .'</td>';
$form_items['preview_row'] = array();
$form_items['preview_row']['items'] = array('static_graph', 'datos icon');
$form_items['preview_row']['html'] = '<td colspan="2" style="text-align: right;"><div id="preview" style="text-align: right;"></div></td>';

View File

@ -1112,7 +1112,8 @@ CREATE TABLE tlayout_data (
id_layout_linked NUMBER(10, 0) default 0 NOT NULL,
parent_item NUMBER(10, 0) default 0 NOT NULL,
label_color varchar(20) DEFAULT '',
no_link_color NUMBER(5, 0) default 0 NOT NULL
no_link_color NUMBER(5, 0) default 0 NOT NULL,
enable_link NUMBER(5, 0) default 1 NOT NULL
);
CREATE SEQUENCE tlayout_data_s INCREMENT BY 1 START WITH 1;

View File

@ -937,7 +937,8 @@ CREATE TABLE "tlayout_data" (
"id_layout_linked" INTEGER NOT NULL default 0,
"parent_item" INTEGER NOT NULL default 0,
"label_color" varchar(20) DEFAULT '',
"no_link_color" SMALLINT NOT NULL default 0
"no_link_color" SMALLINT NOT NULL default 0,
"enable_link" SMALLINT NOT NULL default 1
);
CREATE TABLE "tplugin" (

View File

@ -1034,6 +1034,7 @@ CREATE TABLE IF NOT EXISTS `tlayout_data` (
`parent_item` INTEGER UNSIGNED NOT NULL default 0,
`label_color` varchar(20) DEFAULT "",
`no_link_color` tinyint(1) UNSIGNED NOT NULL default 0,
`enable_link` tinyint(1) UNSIGNED NOT NULL default 1,
PRIMARY KEY(`id`)
) ENGINE = InnoDB DEFAULT CHARSET=utf8;