$name, 'type' => $activeTab, 'layout' => $layout, 'nooverlap' => $nooverlap, 'simple' => $simple, 'regenerate' => $regen, 'font_size' => $font_size, 'id_group' => $group, 'id_module_group' => $module_group, 'depth' => $depth, 'only_modules_with_alerts' => $modwithalerts, 'hide_policy_modules' => $hidepolicymodules, 'zoom' => $zoom, 'distance_nodes' => $ranksep, 'center' => $center)); $message = print_result_message ($result, __('Network map saved successfully'), __('Could not save network map'), '', true); } } $networkmaps = get_networkmaps(); $nomaps = false; if($networkmaps === false) { $nomaps = true; } /*// When is the first map, we create one if($nomaps && $id_networkmap == 0) { $add_networkmap = 1; }*/ // If the map id is not defined, we set the first id of the active type if(!$nomaps && $id_networkmap == 0) { $networkmaps_of_type = get_networkmaps('', $activeTab); if($networkmaps_of_type !== false){ $id_networkmap = reset(array_keys($networkmaps_of_type)); } } if(!$update_networkmap && !$save_networkmap && $id_networkmap != 0) { $networkmap_data = get_networkmap($id_networkmap); $layout = $networkmap_data['layout']; $depth = $networkmap_data['depth']; $nooverlap = (bool)$networkmap_data['nooverlap']; $modwithalerts = $networkmap_data['only_modules_with_alerts']; $hidepolicymodules = $networkmap_data['hide_policy_modules']; $zoom = $networkmap_data['zoom']; $ranksep = $networkmap_data['distance_nodes']; $simple = $networkmap_data['simple']; $regen = $networkmap_data['regenerate']; $font_size = $networkmap_data['font_size']; $group = $networkmap_data['id_group']; $module_group = $networkmap_data['id_module_group']; $center = $networkmap_data['center']; $name = $networkmap_data['name']; $activeTab = $networkmap_data['type']; } if($recenter_networkmap) { $center = (int) get_parameter ('center', 0); } /* Main code */ if ($pure == 1) { $buttons['screen'] = array('active' => false, 'text' => '' . print_image("images/normalscreen.png", true, array ('title' => __('Normal screen'))) .''); } else { $buttons['screen'] = array('active' => false, 'text' => '' . print_image("images/fullscreen.png", true, array ('title' => __('Full screen'))) .''); } if($config['enterprise_installed']) { $buttons['policies'] = array('active' => $activeTab == 'policies', 'text' => '' . print_image("images/policies.png", true, array ("title" => __('Policies view'))) .''); } $buttons['groups'] = array('active' => $activeTab == 'groups', 'text' => '' . print_image("images/group.png", true, array ("title" => __('Groups view'))) .''); $buttons['topology'] = array('active' => $activeTab == 'topology', 'text' => '' . print_image("images/recon.png", true, array ("title" => __('Topology view'))) .''); $buttons['separator'] = array('separator' => ''); $combolist = '
'; $combolist .= print_select($networkmaps, 'id_networkmap', $id_networkmap, 'onchange:this.form.submit()', __('No selected'), 0, true, false, false, '', false, 'margin-top:4px; margin-left:3px; width:150px;'); $combolist .= print_input_hidden('hidden_options',$hidden_options, true); $combolist .= '
'; $buttons['combolist'] = $combolist; $buttons['addmap'] = array('active' => $activeTab == false, 'text' => '' . print_image("images/add.png", true, array ("title" => __('Add map'))) .''); if(!$nomaps && $id_networkmap != 0) { $buttons['deletemap'] = array('active' => $activeTab == false, 'text' => '' . print_image("images/cross.png", true, array ("title" => __('Delete map'))) .''); $buttons['savemap'] = array('active' => $activeTab == false, 'text' => '' . print_image("images/file.png", true, array ("title" => __('Save map'))) .''); } switch($activeTab){ case 'topology': $title = __('Topology view'); break; case 'groups': $title = __('Groups view'); break; case 'policies': $title = __('Policies view'); break; } if(!empty($name)) { $title .= " » ".$name; } print_page_header (__('Network map')." - ".$title, "images/bricks.png", false, "network_map", false, $buttons); if($delete_networkmap || $add_networkmap || $save_networkmap) { echo $message; } if($id_networkmap == 0) { echo "
".__('There are no defined maps in this view')."
"; return; } // CONFIGURATION FORM // Layout selection $layout_array = array ( 'circular' => 'circular', 'radial' => 'radial', 'spring1' => 'spring 1', 'spring2' => 'spring 2', 'flat' => 'flat'); $options_form = '
'; $options_form .= ''; $options_form .= '
'; $options_form .= ''; $options_form .= ''; $options_form .= ''; $options_form .= ''; if($activeTab == 'groups' || $activeTab == 'policies'){ $options_form .= ''; } $options_form .= ''; if($activeTab == 'groups'){ $options_form .= ''; } if($activeTab == 'policies'){ $options_form .= ''; } $options_form .= '
'; $options_form .= __('Name') . '
'; $options_form .= print_input_text ('name', $name, '', 10, 25, true); $options_form .= '
' . __('Group') . '
'; $options_form .= print_select_groups(false, 'AR', false, 'group', $group, '', 'All', 0, true); $options_form .= '
' . __('Module group') . '
'; $options_form .= print_select_from_sql ('SELECT id_mg, name FROM tmodule_group', 'module_group', $module_group, '', 'All', 0, true); $options_form .= '
' . __('Layout') . '
'; $options_form .= print_select ($layout_array, 'layout', $layout, '', '', '', true); $options_form .= '
' . __('Depth') . '
'; $depth_levels = array('all' => __('All'), 'agent' => __('Agents'), 'group' => __('Groups')); $options_form .= print_select ($depth_levels, 'depth', $depth, '', '', '', true, false, false); $options_form .= '
' . __('Depth') . '
'; $depth_levels = array('all' => __('All'), 'agent' => __('Agents'), 'policy' => __('Policies')); $options_form .= print_select ($depth_levels, 'depth', $depth, '', '', '', true, false, false); $options_form .= '
'; $options_form .= '
'; $options_form .= ''; $options_form .= ''; if(($activeTab == 'groups' || $activeTab == 'policies') && $depth == 'all') { $options_form .= ''; if($activeTab == 'groups') { if($config['enterprise_installed']) { $options_form .= ''; } } } $options_form .= ''; $options_form .= ''; if ($pure == "1") { // Zoom $zoom_array = array ( '1' => 'x1', '1.2' => 'x2', '1.6' => 'x3', '2' => 'x4', '2.5' => 'x5', '5' => 'x10', ); $options_form .= ''; } if ($nooverlap == 1){ $options_form .= ""; } $options_form .= ""; $options_form .= ''; $options_form .= '
' . __('No Overlap') . '
'; $options_form .= print_checkbox ('nooverlap', '1', $nooverlap, true); $options_form .= '
' . __('Only modules with alerts') . '
'; $options_form .= print_checkbox ('modwithalerts', '1', $modwithalerts, true); $options_form .= '
' . __('Hide policy modules') . '
'; $options_form .= print_checkbox ('hidepolicymodules', '1', $hidepolicymodules, true); $options_form .= '
' . __('Simple') . '
'; $options_form .= print_checkbox ('simple', '1', $simple, true); $options_form .= '
' . __('Regenerate') . '
'; $options_form .= print_checkbox ('regen', '1', $regen, true); $options_form .= '
' . __('Zoom') . '
'; $options_form .= print_select ($zoom_array, 'zoom', $zoom, '', '', '', true, false, false, false); $options_form .= '
"; $options_form .= __('Distance between nodes') . '
'; $options_form .= print_input_text ('ranksep', $ranksep, __('Separation between elements in the map (in Non-overlap mode)'), 3, 4, true); $options_form .= "
"; $options_form .= __('Font') . '
'; $options_form .= print_input_text ('font_size', $font_size, $alt = 'Font size (in pt)', 2, 4, true); $options_form .= "
'; $options_form .= print_input_hidden('update_networkmap',1, true); $options_form .= print_input_hidden('hidden_options',0, true); $options_form .= print_submit_button (__('Update'), "updbutton", false, 'class="sub upd"', true); $options_form .= '
'; toggle($options_form, __('Map options'), '', $hidden_options); if($id_networkmap != 0) { switch ($activeTab) { case 'groups': require_once('operation/agentes/networkmap.groups.php'); break; case 'policies': require_once(''.ENTERPRISE_DIR.'/operation/policies/networkmap.policies.php'); break; default: case 'topology': require_once('operation/agentes/networkmap.topology.php'); break; } } ?>