diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index bacd3f2d3b..2f55634129 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,20 @@ +2010-09-09 Miguel de Dios + + * include/functions_networkmap.php: cleaned source code. + + * include/functions_ui.php: in function "print_os_icon" change the + directory to search os icon because it change for new feature. + + * images/os_icons, images/os_icons/*: copied the icons image files into this + dir for to use in new feature. + + * godmode/menu.php: added new item in submenu "Setup" for the management + the OS. + + * godmode/setup/os.php: added the page to management the list OS of agents. + + Pending task: #3057663 + 2010-09-09 Sancho Lerena * fgraph.php: Graph "Modules per agent" was not working properly diff --git a/pandora_console/godmode/menu.php b/pandora_console/godmode/menu.php index 2607bf8ee7..e5905e02cd 100644 --- a/pandora_console/godmode/menu.php +++ b/pandora_console/godmode/menu.php @@ -207,6 +207,7 @@ if (give_acl ($config['id_user'], 0, "PM")) { $sub["godmode/setup/gis"]["text"] = __('Map conections GIS'); $sub["godmode/setup/links"]["text"] = __('Links'); $sub["godmode/setup/news"]["text"] = __('Site news'); + $sub["godmode/setup/os"]["text"] = __('Edit OS'); enterprise_hook ('historydb_submenu'); enterprise_hook ('enterprise_acl_submenu'); diff --git a/pandora_console/godmode/setup/os.php b/pandora_console/godmode/setup/os.php new file mode 100644 index 0000000000..7e4931bf5f --- /dev/null +++ b/pandora_console/godmode/setup/os.php @@ -0,0 +1,228 @@ + $idOS)); + $name = $os['name']; + $description = $os['description']; + $icon = $os['icon_name']; +} +else { + $name = get_parameter('name', ''); + $description = get_parameter('description', ''); + $icon = get_parameter('icon',0); +} + +// Header +print_page_header(__('Edit OS'), "", false, "", true); + +switch ($action) { + default: + case 'new': + $actionHidden = 'save'; + $textButton = __('Create'); + $classButton = 'class="sub next"'; + break; + case 'edit': + $actionHidden = 'update'; + $textButton = __('Update'); + $classButton = 'class="sub upd"'; + break; + case 'save': + $values = array(); + $values['name'] = $name; + $values['description'] = $description; + + if (($icon !== 0) && ($icon != '')) { + $values['icon_name'] = $icon; + } + $resultOrId = process_sql_insert('tconfig_os', $values); + + if ($resultOrId === false) { + print_error_message(__('Fail to create OS')); + $actionHidden = 'save'; + $textButton = __('Create'); + $classButton = 'class="sub next"'; + } + else { + $idOs = $resultOrId; + print_success_message(__('Success to create OS')); + $actionHidden = 'update'; + $textButton = __('Update'); + $classButton = 'class="sub upd"'; + } + break; + case 'update': + $name = get_parameter('name', ''); + $description = get_parameter('description', ''); + $icon = get_parameter('icon',0); + + $values = array(); + $values['name'] = $name; + $values['description'] = $description; + + if (($icon !== 0) && ($icon != '')) { + $values['icon_name'] = $icon; + } + $result = process_sql_update('tconfig_os', $values, array('id_os' => $idOS)); + + print_result_message($result, __('Success to update OS'), __('Error to update OS')); + + $actionHidden = 'update'; + $textButton = __('Update'); + $classButton = 'class="sub upd"'; + break; + case 'delete': + $sql = 'SELECT COUNT(id_os) AS count FROM tagente WHERE id_os = ' . $idOS; + $count = get_db_all_rows_sql($sql); + $count = $count[0]['count']; + + if ($count > 0) { + print_error_message(__('There are agents with this OS.')); + } + else { + $result = (bool)process_sql_delete('tconfig_os', array('id_os' => $idOS)); + + print_result_message($result, __('Success to delete'), __('Error to delete')); + } + + $idOS = 0; + $name = get_parameter('name', ''); + $description = get_parameter('description', ''); + $icon = get_parameter('icon',0); + + $actionHidden = 'save'; + $textButton = __('Create'); + $classButton = 'class="sub next"'; + break; +} + +$table = null; + +$table->width = '80%'; +$table->head[0] = ''; +$table->head[1] = __('Name'); +$table->head[2] = __('Description'); +$table->head[3] = ''; +$table->align[0] = 'center'; +$table->align[3] = 'center'; +$table->size[0] = '20px'; +$table->size[3] = '20px'; + +$osList = get_db_all_rows_in_table('tconfig_os'); + +$table->data = array(); +foreach ($osList as $os) { + $data = array(); + $data[] = print_os_icon($os['id_os'], false, true); + $data[] = '' . safe_output($os['name']) . ''; + $data[] = printTruncateText(safe_output($os['description']), 25, true, true); + if ($os['id_os'] > 13) { + $data[] = ''; + } + else { + //The original icons of pandora don't delete. + $data[] = ''; + } + + $table->data[] = $data; +} + +$htmlListOS = print_table($table, true); + +toggle($htmlListOS,__('List of OS'), __('Toggle')); + +echo '
'; +unset($table->head); +unset($table->align); +unset($table->size); +unset($table->data); + +$table->width = '50%'; + +$table->style[0] = 'font-weight: bolder; vertical-align: top;'; + +$table->data[0][0] = __('Name:'); +$table->data[0][1] = print_input_text('name', $name, __('Name'), 20, 30, true); +$table->data[1][0] = __('Description'); +$table->data[1][1] = print_textarea('description', 5, 10, $description, '', true); +$icons = get_list_os_icons_dir(); +$table->data[2][0] = __('Icon'); +$table->data[2][1] = print_select($icons, 'icon', $icon, 'show_icon_OS();', __('None'), 0, true); +$table->data[2][1] .= ' ' . print_os_icon($idOS, false, true) . ''; + + +echo '
'; +print_button(__('New OS'), 'new_button', false, 'new_os();', 'class="sub add"'); +echo '
'; +echo ''; +print_table($table); + +print_input_hidden('id_os', $idOS); +print_input_hidden ('action', $actionHidden); + +echo '
'; +print_submit_button ($textButton, 'update_button', false, $classButton); +echo '
'; +echo '
'; + +function get_list_os_icons_dir() { + global $config; + + $return = array(); + + $items = scandir($config['homedir'] . '/images/os_icons'); + + foreach ($items as $item) { + if (strstr($item, '_small.png') || strstr($item, '_small.gif') + || strstr($item, '_small.jpg')) { + continue; + } + if (strstr($item, '.png') || strstr($item, '.gif') + || strstr($item, '.jpg')) { + $return[$item] = $item; + } + } + + return $return; +} +?> + \ No newline at end of file diff --git a/pandora_console/images/os_icons/network.png b/pandora_console/images/os_icons/network.png new file mode 100755 index 0000000000..eb6ee812cb Binary files /dev/null and b/pandora_console/images/os_icons/network.png differ diff --git a/pandora_console/images/os_icons/network_small.png b/pandora_console/images/os_icons/network_small.png new file mode 100755 index 0000000000..20b62042c0 Binary files /dev/null and b/pandora_console/images/os_icons/network_small.png differ diff --git a/pandora_console/images/os_icons/so_aix.png b/pandora_console/images/os_icons/so_aix.png new file mode 100755 index 0000000000..c18bed7e22 Binary files /dev/null and b/pandora_console/images/os_icons/so_aix.png differ diff --git a/pandora_console/images/os_icons/so_aix_small.png b/pandora_console/images/os_icons/so_aix_small.png new file mode 100755 index 0000000000..c5ce1922bc Binary files /dev/null and b/pandora_console/images/os_icons/so_aix_small.png differ diff --git a/pandora_console/images/os_icons/so_bsd.png b/pandora_console/images/os_icons/so_bsd.png new file mode 100755 index 0000000000..5b1759a231 Binary files /dev/null and b/pandora_console/images/os_icons/so_bsd.png differ diff --git a/pandora_console/images/os_icons/so_bsd_small.png b/pandora_console/images/os_icons/so_bsd_small.png new file mode 100755 index 0000000000..d5e2692d98 Binary files /dev/null and b/pandora_console/images/os_icons/so_bsd_small.png differ diff --git a/pandora_console/images/os_icons/so_cisco.png b/pandora_console/images/os_icons/so_cisco.png new file mode 100755 index 0000000000..8e14da3146 Binary files /dev/null and b/pandora_console/images/os_icons/so_cisco.png differ diff --git a/pandora_console/images/os_icons/so_cisco_small.png b/pandora_console/images/os_icons/so_cisco_small.png new file mode 100755 index 0000000000..e170c85d09 Binary files /dev/null and b/pandora_console/images/os_icons/so_cisco_small.png differ diff --git a/pandora_console/images/os_icons/so_hpux.png b/pandora_console/images/os_icons/so_hpux.png new file mode 100755 index 0000000000..0745eefdcd Binary files /dev/null and b/pandora_console/images/os_icons/so_hpux.png differ diff --git a/pandora_console/images/os_icons/so_hpux_small.png b/pandora_console/images/os_icons/so_hpux_small.png new file mode 100755 index 0000000000..6208c064d2 Binary files /dev/null and b/pandora_console/images/os_icons/so_hpux_small.png differ diff --git a/pandora_console/images/os_icons/so_linux.png b/pandora_console/images/os_icons/so_linux.png new file mode 100755 index 0000000000..bbefe2ec45 Binary files /dev/null and b/pandora_console/images/os_icons/so_linux.png differ diff --git a/pandora_console/images/os_icons/so_linux_small.png b/pandora_console/images/os_icons/so_linux_small.png new file mode 100755 index 0000000000..c198a0664e Binary files /dev/null and b/pandora_console/images/os_icons/so_linux_small.png differ diff --git a/pandora_console/images/os_icons/so_mac.png b/pandora_console/images/os_icons/so_mac.png new file mode 100755 index 0000000000..b0b4b60ae8 Binary files /dev/null and b/pandora_console/images/os_icons/so_mac.png differ diff --git a/pandora_console/images/os_icons/so_mac_small.png b/pandora_console/images/os_icons/so_mac_small.png new file mode 100755 index 0000000000..3ebbeecc84 Binary files /dev/null and b/pandora_console/images/os_icons/so_mac_small.png differ diff --git a/pandora_console/images/os_icons/so_other.png b/pandora_console/images/os_icons/so_other.png new file mode 100755 index 0000000000..0cac3d89d2 Binary files /dev/null and b/pandora_console/images/os_icons/so_other.png differ diff --git a/pandora_console/images/os_icons/so_other_small.png b/pandora_console/images/os_icons/so_other_small.png new file mode 100755 index 0000000000..d6767d7776 Binary files /dev/null and b/pandora_console/images/os_icons/so_other_small.png differ diff --git a/pandora_console/images/os_icons/so_solaris.png b/pandora_console/images/os_icons/so_solaris.png new file mode 100755 index 0000000000..edf45fca4d Binary files /dev/null and b/pandora_console/images/os_icons/so_solaris.png differ diff --git a/pandora_console/images/os_icons/so_solaris_small.png b/pandora_console/images/os_icons/so_solaris_small.png new file mode 100755 index 0000000000..e4b36f4d4f Binary files /dev/null and b/pandora_console/images/os_icons/so_solaris_small.png differ diff --git a/pandora_console/images/os_icons/so_win.png b/pandora_console/images/os_icons/so_win.png new file mode 100755 index 0000000000..1589e8aad0 Binary files /dev/null and b/pandora_console/images/os_icons/so_win.png differ diff --git a/pandora_console/images/os_icons/so_win_small.png b/pandora_console/images/os_icons/so_win_small.png new file mode 100755 index 0000000000..6ee55db823 Binary files /dev/null and b/pandora_console/images/os_icons/so_win_small.png differ diff --git a/pandora_console/include/functions_networkmap.php b/pandora_console/include/functions_networkmap.php index 16d86d3b56..e83284fe46 100644 --- a/pandora_console/include/functions_networkmap.php +++ b/pandora_console/include/functions_networkmap.php @@ -319,7 +319,7 @@ function create_group_node ($group, $simple = 0, $font_size = 10) { if ($simple == 0){ // Set node icon if (file_exists ('images/groups_small/'.$icon.'.png')) { - $img_node = ''; + $img_node = ''; } else { $img_node = '-'; } diff --git a/pandora_console/include/functions_ui.php b/pandora_console/include/functions_ui.php index 612518370a..88fca30077 100644 --- a/pandora_console/include/functions_ui.php +++ b/pandora_console/include/functions_ui.php @@ -276,7 +276,7 @@ function print_os_icon ($id_os, $name = true, $return = false) { return "-"; } - $output = ''.$os_name.''; + $output = ''.$os_name.''; if ($name === true) { $output .= ' - '.$os_name;