From 8602d9eb4bdabed9247ed33c9f6faeadd67ecdb1 Mon Sep 17 00:00:00 2001 From: mdtrooper Date: Mon, 1 Feb 2016 16:02:43 +0100 Subject: [PATCH] Working in the new networkmaps. --- pandora_console/include/functions_maps.php | 27 ++++++++++++ .../operation/maps/networkmap_list.php | 42 ++++++++++++------- pandora_console/pandoradb.oracle.sql | 1 + pandora_console/pandoradb.postgreSQL.sql | 1 + pandora_console/pandoradb.sql | 1 + 5 files changed, 57 insertions(+), 15 deletions(-) diff --git a/pandora_console/include/functions_maps.php b/pandora_console/include/functions_maps.php index 17272aa171..f109d5ba01 100644 --- a/pandora_console/include/functions_maps.php +++ b/pandora_console/include/functions_maps.php @@ -28,4 +28,31 @@ function maps_save_map($values) { function maps_get_maps($filter) { return db_get_all_rows_filter('tmap', $filter); } + +function maps_get_subtype_string($subtype) { + switch ($subtype) { + case MAP_SUBTYPE_TOPOLOGY: + return __('Topology'); + break; + case MAP_SUBTYPE_POLICIES: + return __('Policies'); + break; + case MAP_SUBTYPE_GROUPS: + return __('Groups'); + break; + case MAP_SUBTYPE_RADIAL_DYNAMIC: + return __('Dynamic'); + break; + default: + return __('Unknown'); + break; + } +} + +function maps_get_count_nodes($id) { + $result = db_get_sql( + "SELECT COUNT(*) FROM titem WHERE id_map = " . $id); + + return (int)$result; +} ?> diff --git a/pandora_console/operation/maps/networkmap_list.php b/pandora_console/operation/maps/networkmap_list.php index b312d6e580..e176be0bd2 100644 --- a/pandora_console/operation/maps/networkmap_list.php +++ b/pandora_console/operation/maps/networkmap_list.php @@ -38,6 +38,8 @@ if (!$networkmaps_read && !$networkmaps_write && !$networkmaps_manage) { require_once('include/functions_migration.php'); +ui_print_page_header(__('Network map'), "images/op_network.png", false, "network_map", false); + //////////////////////////////////////////////////////////////////////// // It is dirty but at the moment (minor release is not) // this place is the place for migration @@ -48,9 +50,15 @@ $migrate_open_networkmaps = (int)get_parameter('migrate_open_networkmaps'); if ($migrate_open_networkmaps) migration_open_networkmaps(); +?> +
+(temp, this is for minor relases) migrate open networkmaps +
+
+' . $networkmap['name'] . ''; - - $data['type'] = $networkmap['type']; - + + $data['type'] = maps_get_subtype_string($networkmap['subtype']); + + if (enterprise_installed()) { - //FUNCION - //$data['nodes'] = networkmap_get_nodes(); - $data['nodes'] = 0; + if ($networkmap['generated']) { + $data['nodes'] = maps_get_count_nodes($networkmap['id']); + } + else { + $data['nodes'] = __('Pending to generate'); + } } - + if (!empty($networkmap['id_user'])) { $data['group'] = __('Private for (%s)', $networkmap['id_user']); } @@ -162,33 +174,33 @@ else { $data['groups'] = ui_print_group_icon($networkmap['id_group'], true); } - + $data['copy'] = '' . html_print_image("images/copy.png", true) . ''; - + $data['edit'] = '' . html_print_image("images/edit.png", true) . ''; - + $data['delete'] = '' . html_print_image('images/cross.png', true) . ''; - + $table->data[] = $data; } html_print_table($table); } ?> -(temp, this is for minor relases) migrate open networkmaps + diff --git a/pandora_console/pandoradb.oracle.sql b/pandora_console/pandoradb.oracle.sql index 921107608b..f137271988 100644 --- a/pandora_console/pandoradb.oracle.sql +++ b/pandora_console/pandoradb.oracle.sql @@ -2077,6 +2077,7 @@ CREATE TABLE IF NOT EXISTS tmap ( source NUMBER(10, 0) DEFAULT 0, source_data VARCHAR2(250) DEFAULT '', generation_method NUMBER(10, 0) DEFAULT 0, + generated NUMBER(10, 0) DEFAULT 0, filter CLOB DEFAULT '', ); diff --git a/pandora_console/pandoradb.postgreSQL.sql b/pandora_console/pandoradb.postgreSQL.sql index c5cd327c7f..dc4104f9d5 100644 --- a/pandora_console/pandoradb.postgreSQL.sql +++ b/pandora_console/pandoradb.postgreSQL.sql @@ -1737,6 +1737,7 @@ CREATE TABLE IF NOT EXISTS "tmap" ( "source" SMALLINT NOT NULL default 0, "source_data" varchar(250) default '', "generation_method" SMALLINT NOT NULL default 0, + "generated" SMALLINT NOT NULL default 0, "filter" TEXT ); diff --git a/pandora_console/pandoradb.sql b/pandora_console/pandoradb.sql index 0325ed6635..0c849dda75 100644 --- a/pandora_console/pandoradb.sql +++ b/pandora_console/pandoradb.sql @@ -1845,6 +1845,7 @@ CREATE TABLE IF NOT EXISTS `tmap` ( `source` INTEGER UNSIGNED NOT NULL default 0, `source_data` varchar(250) default '', `generation_method` INTEGER UNSIGNED NOT NULL default 0, + `generated` INTEGER UNSIGNED NOT NULL default 0, `filter` TEXT, PRIMARY KEY(`id`) ) ENGINE = InnoDB DEFAULT CHARSET=utf8;