Working in the new networkmaps.

This commit is contained in:
mdtrooper 2016-02-01 16:02:43 +01:00
parent 7931b7f770
commit 8602d9eb4b
5 changed files with 57 additions and 15 deletions

View File

@ -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;
}
?>

View File

@ -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();
?>
<br />
<a href="index.php?sec=network&sec2=operation/maps/networkmap_list&migrate_open_networkmaps=1">(temp, this is for minor relases) migrate open networkmaps</a>
<br />
<br />
<?php
////////////////////////////////////////////////////////////////////////
ui_print_page_header(__('Network map'), "images/op_network.png", false, "network_map", false);
$id = (int)get_parameter('id_networkmap', 0);
$delete_networkmap = (bool)get_parameter('delete_networkmap', 0);
@ -147,12 +155,16 @@ else {
'id_networkmap=' . $networkmap['id'] .'">' .
$networkmap['name'] . '</a>';
$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'])) {
@ -188,7 +200,7 @@ else {
}
?>
<a href="index.php?sec=network&sec2=operation/maps/networkmap_list&migrate_open_networkmaps=1">(temp, this is for minor relases) migrate open networkmaps</a>
<script type="text/javascript">
</script>

View File

@ -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 '',
);

View File

@ -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
);

View File

@ -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;