From 141e5dd424e74f89dd8eed7a20d6bc204f44890f Mon Sep 17 00:00:00 2001 From: juanmanuelr Date: Mon, 23 Jan 2012 18:36:22 +0000 Subject: [PATCH] 2012-01-23 Juan Manuel Ramon * pandoradb.sql pandoradb.postgreSQL.sql pandoradb.oracle.sql extras/pandoradb_migrate_4.0.x_to_4.1.mysql.sql extras/pandoradb_migrate_4.0.x_to_4.1.oracle.sql extras/pandoradb_migrate_4.0.x_to_4.1.postgreSQL.sql: Modified tagente table. * operation/agentes/estado_generalagente.php operation/agentes/url_address.php operation/agentes/ver_agente.php godmode/agentes/agent_incidents.php godmode/agentes/configurar_agente.php godmode/agentes/agent_manager.php: Added url_address functionality. Pending task: #3472445 git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@5409 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 19 ++++++++++++ .../pandoradb_migrate_4.0.x_to_4.1.mysql.sql | 6 ++++ .../pandoradb_migrate_4.0.x_to_4.1.oracle.sql | 5 +++ ...doradb_migrate_4.0.x_to_4.1.postgreSQL.sql | 6 ++++ .../godmode/agentes/agent_incidents.php | 3 -- .../godmode/agentes/agent_manager.php | 3 ++ .../godmode/agentes/configurar_agente.php | 16 +++++++--- .../agentes/estado_generalagente.php | 7 +++++ .../operation/agentes/url_address.php | 31 +++++++++++++++++++ .../operation/agentes/ver_agente.php | 29 ++++++++++++++++- pandora_console/pandoradb.oracle.sql | 3 +- pandora_console/pandoradb.postgreSQL.sql | 3 +- pandora_console/pandoradb.sql | 1 + 13 files changed, 122 insertions(+), 10 deletions(-) create mode 100644 pandora_console/operation/agentes/url_address.php diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 1003063d85..2124e1f147 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,22 @@ +2012-01-23 Juan Manuel Ramon + + * pandoradb.sql + pandoradb.postgreSQL.sql + pandoradb.oracle.sql + extras/pandoradb_migrate_4.0.x_to_4.1.mysql.sql + extras/pandoradb_migrate_4.0.x_to_4.1.oracle.sql + extras/pandoradb_migrate_4.0.x_to_4.1.postgreSQL.sql: Modified + tagente table. + + * operation/agentes/estado_generalagente.php + operation/agentes/url_address.php + operation/agentes/ver_agente.php + godmode/agentes/agent_incidents.php + godmode/agentes/configurar_agente.php + godmode/agentes/agent_manager.php: Added url_address functionality. + + Pending task: #3472445 + 2012-01-23 Ramon Novoa * include/functions_netflow.php: Aesthetic fixes to netflow report diff --git a/pandora_console/extras/pandoradb_migrate_4.0.x_to_4.1.mysql.sql b/pandora_console/extras/pandoradb_migrate_4.0.x_to_4.1.mysql.sql index 760e26c37a..034d782d8f 100644 --- a/pandora_console/extras/pandoradb_migrate_4.0.x_to_4.1.mysql.sql +++ b/pandora_console/extras/pandoradb_migrate_4.0.x_to_4.1.mysql.sql @@ -58,3 +58,9 @@ ALTER TABLE `tusuario` ADD COLUMN `disabled` int(4) NOT NULL DEFAULT 0; -- ----------------------------------------------------- ALTER TABLE `tincidencia` ADD COLUMN `id_agent` int(10) unsigned NULL default 0; + +-- ----------------------------------------------------- +-- Table `tagente` +-- ----------------------------------------------------- + +ALTER TABLE `tagente` ADD COLUMN `url_address` mediumtext NULL default ''; diff --git a/pandora_console/extras/pandoradb_migrate_4.0.x_to_4.1.oracle.sql b/pandora_console/extras/pandoradb_migrate_4.0.x_to_4.1.oracle.sql index 1ebfe2ed9f..0717af406e 100644 --- a/pandora_console/extras/pandoradb_migrate_4.0.x_to_4.1.oracle.sql +++ b/pandora_console/extras/pandoradb_migrate_4.0.x_to_4.1.oracle.sql @@ -60,3 +60,8 @@ CREATE OR REPLACE TRIGGER tnetflow_report_content_inc BEFORE INSERT ON tnetflow_ -- ----------------------------------------------------- alter table tincidencia add (id_agent NUMBER(10,0) default 0 NULL); + +-- ----------------------------------------------------- +-- Table `tagente` +-- ----------------------------------------------------- +alter table tagente add (url_address CLOB default '' NULL); diff --git a/pandora_console/extras/pandoradb_migrate_4.0.x_to_4.1.postgreSQL.sql b/pandora_console/extras/pandoradb_migrate_4.0.x_to_4.1.postgreSQL.sql index d4b648af7f..f3b983bf35 100644 --- a/pandora_console/extras/pandoradb_migrate_4.0.x_to_4.1.postgreSQL.sql +++ b/pandora_console/extras/pandoradb_migrate_4.0.x_to_4.1.postgreSQL.sql @@ -48,3 +48,9 @@ CREATE TABLE "tnetflow_report_content" ( -- ----------------------------------------------------- ALTER TABLE "tincidencia" ADD COLUMN "id_agent" INTEGER(10) NULL DEFAULT 0; + +-- ----------------------------------------------------- +-- Table `tagente` +-- ----------------------------------------------------- + +ALTER TABLE "tagente" ADD COLUMN "url_address" text NULL default ''; diff --git a/pandora_console/godmode/agentes/agent_incidents.php b/pandora_console/godmode/agentes/agent_incidents.php index b822d96c1f..b4f889e808 100644 --- a/pandora_console/godmode/agentes/agent_incidents.php +++ b/pandora_console/godmode/agentes/agent_incidents.php @@ -17,9 +17,6 @@ global $config; require_once ('include/functions_incidents.php'); -/*enterprise_include ('include/functions_policies.php'); -enterprise_include ('include/functions_modules.php'); -include_once($config['homedir'] . "/include/functions_agents.php");*/ check_login (); diff --git a/pandora_console/godmode/agentes/agent_manager.php b/pandora_console/godmode/agentes/agent_manager.php index 534021e490..29a1decf93 100644 --- a/pandora_console/godmode/agentes/agent_manager.php +++ b/pandora_console/godmode/agentes/agent_manager.php @@ -312,6 +312,9 @@ if ($config['activate_gis']) { $table->data[5][1] .= __('Enabled').' '.html_print_radio_button_extended ("update_gis_data", 0, '', $update_gis_data, false, '', 'style="margin-right: 40px;"', true); } +$table->data[6][0] = __('Url address:'); +$table->data[6][1] = html_print_input_text ('url_description', $url_description, '', 45, 255, true); + ui_toggle(html_print_table ($table, true), __('Advanced options')); unset($table); diff --git a/pandora_console/godmode/agentes/configurar_agente.php b/pandora_console/godmode/agentes/configurar_agente.php index 01afa63fc6..be43f048aa 100644 --- a/pandora_console/godmode/agentes/configurar_agente.php +++ b/pandora_console/godmode/agentes/configurar_agente.php @@ -120,6 +120,7 @@ $update_gis_data = 0; $unit = ""; $id_tag = array(); $tab_description = ''; +$url_description = ''; $create_agent = (bool) get_parameter ('create_agent'); @@ -140,6 +141,7 @@ if ($create_agent) { $cascade_protection = (int) get_parameter_post ("cascade_protection", 0); $icon_path = (string) get_parameter_post ("icon_path",''); $update_gis_data = (int) get_parameter_post("update_gis_data", 0); + $url_description = (string) get_parameter("url_description"); $fields = db_get_all_fields_in_table('tagent_custom_fields'); @@ -172,7 +174,8 @@ if ($create_agent) { 'server_name' => $server_name, 'id_parent' => $id_parent, 'custom_id' => $custom_id, 'icon_path' => $icon_path, - 'update_gis_data' => $update_gis_data)); + 'update_gis_data' => $update_gis_data, + 'url_address' => $url_description)); enterprise_hook ('update_agent', array ($id_agente)); if ($id_agente !== false) { // Create custom fields for this agent @@ -191,7 +194,8 @@ if ($create_agent) { ' ID_parent: ' . $id_parent . ' Server: ' . $server_name . ' ID os: ' . $id_os . ' Disabled: ' . $disabled . ' Custom ID: ' . $custom_id . ' Cascade protection: ' . $cascade_protection . - ' Icon path: ' . $icon_path . ' Update GIS data: ' . $update_gis_data; + ' Icon path: ' . $icon_path . ' Update GIS data: ' . $update_gis_data . + ' Url description: ' . $url_description; db_pandora_audit("Agent management", "Created agent $nombre_agente", false, false, $info); @@ -472,6 +476,7 @@ if ($update_agent) { // if modified some agent paramenter $cascade_protection = (int) get_parameter_post ("cascade_protection", 0); $icon_path = (string) get_parameter_post ("icon_path",''); $update_gis_data = (int) get_parameter_post("update_gis_data", 0); + $url_description = (string) get_parameter("url_description"); $fields = db_get_all_fields_in_table('tagent_custom_fields'); @@ -532,7 +537,8 @@ if ($update_agent) { // if modified some agent paramenter 'server_name' => $server_name, 'custom_id' => $custom_id, 'icon_path' => $icon_path, - 'update_gis_data' => $update_gis_data), + 'update_gis_data' => $update_gis_data, + 'url_address' => $url_description), array ('id_agente' => $id_agente)); if ($result === false) { @@ -544,7 +550,8 @@ if ($update_agent) { // if modified some agent paramenter ' ID OS: ' . $id_os . ' Disabled: ' . $disabled . ' Server Name: ' . $server_name . ' ID parent: ' . $id_parent . ' Custom ID: ' . $custom_id . ' Cascade Protection: ' . $cascade_protection . - ' Icon Path: ' . $icon_path . 'Update GIS data: ' .$update_gis_data; + ' Icon Path: ' . $icon_path . 'Update GIS data: ' .$update_gis_data . + ' Url description: ' . $url_description; enterprise_hook ('update_agent', array ($id_agente)); ui_print_success_message (__('Successfully updated')); @@ -593,6 +600,7 @@ if ($id_agente) { $cascade_protection = $agent["cascade_protection"]; $icon_path = $agent["icon_path"]; $update_gis_data = $agent["update_gis_data"]; + $url_description = $agent["url_address"]; } $update_module = (bool) get_parameter ('update_module'); diff --git a/pandora_console/operation/agentes/estado_generalagente.php b/pandora_console/operation/agentes/estado_generalagente.php index 7e1727682c..807d0def8d 100644 --- a/pandora_console/operation/agentes/estado_generalagente.php +++ b/pandora_console/operation/agentes/estado_generalagente.php @@ -165,6 +165,13 @@ if ($config['activate_gis']) { echo ''; } + +// If the url description is setted +if ($agent['url_address'] != ''){ + echo ''.__('Url address').''; + echo '' . $agent["url_address"] . ''; +} + // Last contact echo ''.__('Last contact')." / ".__('Remote').''; ui_print_timestamp ($agent["ultimo_contacto"]); diff --git a/pandora_console/operation/agentes/url_address.php b/pandora_console/operation/agentes/url_address.php new file mode 100644 index 0000000000..c3c48341f6 --- /dev/null +++ b/pandora_console/operation/agentes/url_address.php @@ -0,0 +1,31 @@ +"; +echo ""; + +?> diff --git a/pandora_console/operation/agentes/ver_agente.php b/pandora_console/operation/agentes/ver_agente.php index 16d23f562e..47f2f95a2b 100644 --- a/pandora_console/operation/agentes/ver_agente.php +++ b/pandora_console/operation/agentes/ver_agente.php @@ -582,7 +582,7 @@ if ($config['activate_gis']) { $total_incidents = agents_get_count_incidents($id_agente); - /* Incident tab */ +/* Incident tab */ if ($config['integria_enabled'] == 0 and $total_incidents > 0){ $incidenttab['text'] = '' . html_print_image ("images/book_edit.png", true, array ("title" =>__('Incidents'))) @@ -598,6 +598,23 @@ $custom_fields['text']= ' __('Custom fields'))) . ''; +/* Url address tab */ +if ($agent['url_address'] != ''){ + $urladdresstab['text'] = '' + . html_print_image ("images/link2.png", true, array ("title" =>__('Url address'))) + . ''; +} + +if($tab == 'url_address') + $urladdresstab['active'] = true; +else + $urladdresstab['active'] = false; + +$custom_fields['text']= '' + . html_print_image("images/note.png", true, array("title" => __('Custom fields'))) + . ''; + + if ($tab == 'custom_fields') { $custom_fields['active'] = true; } @@ -626,6 +643,10 @@ if ($total_incidents){ $onheader['incident'] = $incidenttab; } +if ($agent['url_address'] != ''){ + $onheader['url_address'] = $urladdresstab; +} + foreach($config['extensions'] as $extension) { if (isset($extension['extension_ope_tab'])) { @@ -700,6 +721,9 @@ switch($tab) { case "incident": $header_description = ' - ' . __('Incident'); break; + case "url_address": + $header_description = ' - ' . __('Url address'); + break; } ui_print_page_header (__('Agent').' - '.mb_substr(agents_get_name($id_agente),0,25) . $header_description, $icon, false, "", false, $onheader); @@ -748,6 +772,9 @@ switch ($tab) { case "incident": require("godmode/agentes/agent_incidents.php"); break; + case "url_address": + require("operation/agentes/url_address.php"); + break; case "extension": $found = false; foreach($config['extensions'] as $extension) { diff --git a/pandora_console/pandoradb.oracle.sql b/pandora_console/pandoradb.oracle.sql index 006dc2f05a..5b59609911 100644 --- a/pandora_console/pandoradb.oracle.sql +++ b/pandora_console/pandoradb.oracle.sql @@ -72,7 +72,8 @@ CREATE TABLE tagente ( --path in the server to the image of the icon representing the agent icon_path VARCHAR2(127) DEFAULT NULL NULL , --set it to one to update the position data (altitude, longitude, latitude) when getting information from the agent or to 0 to keep the last value and don\'t update it - update_gis_data NUMBER(5, 0) DEFAULT 1 NOT NULL + update_gis_data NUMBER(5, 0) DEFAULT 1 NOT NULL, + url_address CLOB DEFAULT '' NULL ); CREATE INDEX tagente_nombre_idx ON tagente(nombre); CREATE INDEX tagente_direccion_idx ON tagente(direccion); diff --git a/pandora_console/pandoradb.postgreSQL.sql b/pandora_console/pandoradb.postgreSQL.sql index c37cc7851f..c5eba39c3c 100644 --- a/pandora_console/pandoradb.postgreSQL.sql +++ b/pandora_console/pandoradb.postgreSQL.sql @@ -58,7 +58,8 @@ CREATE TABLE "tagente" ( --path in the server to the image of the icon representing the agent "icon_path" VARCHAR(127) NULL DEFAULT NULL, --set it to one to update the position data (altitude, longitude, latitude) when getting information from the agent or to 0 to keep the last value and don\'t update it - "update_gis_data" SMALLINT NOT NULL DEFAULT 1 + "update_gis_data" SMALLINT NOT NULL DEFAULT 1, + "url_address" TEXT NULL default '' ); CREATE INDEX "tagente_nombre_idx" ON "tagente"("nombre"); CREATE INDEX "tagente_direccion_idx" ON "tagente"("direccion"); diff --git a/pandora_console/pandoradb.sql b/pandora_console/pandoradb.sql index 059881e9f5..84815891fb 100644 --- a/pandora_console/pandoradb.sql +++ b/pandora_console/pandoradb.sql @@ -59,6 +59,7 @@ CREATE TABLE IF NOT EXISTS `tagente` ( `timezone_offset` TINYINT(2) NULL DEFAULT '0' COMMENT 'nuber of hours of diference with the server timezone' , `icon_path` VARCHAR(127) NULL DEFAULT NULL COMMENT 'path in the server to the image of the icon representing the agent' , `update_gis_data` TINYINT(1) NOT NULL DEFAULT '1' COMMENT 'set it to one to update the position data (altitude, longitude, latitude) when getting information from the agent or to 0 to keep the last value and don\'t update it' , + `url_address` mediumtext NULL default '', PRIMARY KEY (`id_agente`), KEY `nombre` (`nombre`), KEY `direccion` (`direccion`),