From 3ef6758d5eaea2b8cee8971ac0620df1f21c27fb Mon Sep 17 00:00:00 2001 From: ramonn Date: Tue, 3 Sep 2013 08:50:25 +0000 Subject: [PATCH] 2013-09-03 Ramon Novoa * extras/pandoradb_migrate_4.0.x_to_5.0.postgreSQL.sql, extras/pandoradb_migrate_4.0.x_to_5.0.mysql.sql, extras/pandoradb_migrate_4.0.x_to_5.0.oracle.sql, godmode/tag/tag.php, godmode/tag/edit_tag.php, pandoradb.sql, pandoradb.postgreSQL.sql, pandoradb.oracle.sql, pandoradb_data.sql: Added support for tag phone information. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@8731 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 12 +++++++ .../pandoradb_migrate_4.0.x_to_5.0.mysql.sql | 1 + .../pandoradb_migrate_4.0.x_to_5.0.oracle.sql | 1 + ...doradb_migrate_4.0.x_to_5.0.postgreSQL.sql | 1 + pandora_console/godmode/tag/edit_tag.php | 15 ++++++++- pandora_console/godmode/tag/tag.php | 32 +++++++++++++++++-- pandora_console/pandoradb.oracle.sql | 3 +- pandora_console/pandoradb.postgreSQL.sql | 3 +- pandora_console/pandoradb.sql | 1 + pandora_console/pandoradb_data.sql | 2 +- 10 files changed, 64 insertions(+), 7 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index c6b05e2521..0dbff09ab9 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,15 @@ +2013-09-03 Ramon Novoa + + * extras/pandoradb_migrate_4.0.x_to_5.0.postgreSQL.sql, + extras/pandoradb_migrate_4.0.x_to_5.0.mysql.sql, + extras/pandoradb_migrate_4.0.x_to_5.0.oracle.sql, + godmode/tag/tag.php, + godmode/tag/edit_tag.php, + pandoradb.sql, + pandoradb.postgreSQL.sql, + pandoradb.oracle.sql, + pandoradb_data.sql: Added support for tag phone information. + 2013-09-03 Miguel de Dios * operation/tree.php, include/functions_treeview.php: improved the diff --git a/pandora_console/extras/pandoradb_migrate_4.0.x_to_5.0.mysql.sql b/pandora_console/extras/pandoradb_migrate_4.0.x_to_5.0.mysql.sql index 3e064677c9..afa50b178b 100644 --- a/pandora_console/extras/pandoradb_migrate_4.0.x_to_5.0.mysql.sql +++ b/pandora_console/extras/pandoradb_migrate_4.0.x_to_5.0.mysql.sql @@ -453,6 +453,7 @@ ALTER TABLE `tusuario_perfil` ADD COLUMN `tags` TEXT NOT NULL; -- Table `ttag` -- --------------------------------------------------------------------- ALTER TABLE `ttag` ADD COLUMN `email` text NULL; +ALTER TABLE `ttag` ADD COLUMN `phone` text NULL; -- --------------------------------------------------------------------- -- Add more fields in snmp alerts (05/03/13) diff --git a/pandora_console/extras/pandoradb_migrate_4.0.x_to_5.0.oracle.sql b/pandora_console/extras/pandoradb_migrate_4.0.x_to_5.0.oracle.sql index b7ca6d12af..5c636cf90a 100644 --- a/pandora_console/extras/pandoradb_migrate_4.0.x_to_5.0.oracle.sql +++ b/pandora_console/extras/pandoradb_migrate_4.0.x_to_5.0.oracle.sql @@ -482,6 +482,7 @@ ALTER TABLE tusuario_perfil ADD (tags CLOB NOT NULL default ''); -- Table `ttag` -- --------------------------------------------------------------------- ALTER TABLE ttag ADD (email CLOB NULL); +ALTER TABLE ttag ADD (phone CLOB NULL); -- --------------------------------------------------------------------- -- Add more fields in snmp alerts (05/03/13) diff --git a/pandora_console/extras/pandoradb_migrate_4.0.x_to_5.0.postgreSQL.sql b/pandora_console/extras/pandoradb_migrate_4.0.x_to_5.0.postgreSQL.sql index 11ded7c5e0..b357607252 100644 --- a/pandora_console/extras/pandoradb_migrate_4.0.x_to_5.0.postgreSQL.sql +++ b/pandora_console/extras/pandoradb_migrate_4.0.x_to_5.0.postgreSQL.sql @@ -467,6 +467,7 @@ ALTER TABLE "tusuario_perfil" ADD COLUMN "tags" text default ''; -- Table "ttag" -- --------------------------------------------------------------------- ALTER TABLE "ttag" ADD COLUMN "email" TEXT NULL; +ALTER TABLE "ttag" ADD COLUMN "phone" TEXT NULL; -- --------------------------------------------------------------------- -- Add more fields in snmp alerts (05/03/13) diff --git a/pandora_console/godmode/tag/edit_tag.php b/pandora_console/godmode/tag/edit_tag.php index 5d1f69252f..fa2b9cdd9d 100644 --- a/pandora_console/godmode/tag/edit_tag.php +++ b/pandora_console/godmode/tag/edit_tag.php @@ -35,6 +35,7 @@ $description_tag = (string) get_parameter ("description_tag", ""); $description_tag = io_safe_input(strip_tags(io_safe_output($description_tag))); $url_tag = (string) get_parameter ("url_tag", ""); $email_tag = (string) get_parameter ("email_tag", ""); +$phone_tag = (string) get_parameter ("phone_tag", ""); $tab = (string) get_parameter ("tab", "list"); if (defined('METACONSOLE')) @@ -73,6 +74,7 @@ if ($update_tag && $id_tag != 0) { $values['description'] = $description_tag; $values['url'] = $url_tag; $values['email'] = $email_tag; + $values['phone'] = $phone_tag; $result = false; if ($values['name'] != '') @@ -101,6 +103,7 @@ if ($create_tag) { $data['description'] = $description_tag; $data['url'] = $url_tag; $data['email'] = $email_tag; + $data['phone'] = $phone_tag; // DB insert $return_create = false; @@ -129,12 +132,14 @@ if ($action == "update" && $id_tag != 0) { $description_tag = $result_tag["description"]; $url_tag = $result_tag["url"]; $email_tag = $result_tag["email"]; + $phone_tag = $result_tag["phone"]; } // If current action is create (new) or somethig goes wrong fields are filled with void value else { $name_tag = ""; $description_tag = ""; $url_tag = ""; $email_tag = ""; + $phone_tag = ""; } // Create/Update tag form @@ -175,7 +180,15 @@ echo ""; echo ""; echo ""; + echo ""; + echo ""; + echo ""; + echo ""; echo ""; echo ""; diff --git a/pandora_console/godmode/tag/tag.php b/pandora_console/godmode/tag/tag.php index 4f3be23535..5cda0af950 100644 --- a/pandora_console/godmode/tag/tag.php +++ b/pandora_console/godmode/tag/tag.php @@ -163,7 +163,8 @@ if (!empty($result)) { $table->head[2] = __('Detail information'); $table->head[3] = __('Number of modules affected'); $table->head[4] = __('Email'); - $table->head[5] = __('Actions'); + $table->head[5] = __('Phone'); + $table->head[6] = __('Actions'); foreach ($result as $tag) { if ($rowPair) @@ -198,9 +199,24 @@ if (!empty($result)) { "" . html_print_image("images/rosette.png", true) . "" . ""; } $data[4] = $output; + + $phone_large = io_safe_output($tag["phone"]); + $phone_small = substr($phone_large,0, 24); + if ($phone_large == $phone_small) { + $output = $phone_large; + } + else { + $output = + "" . + '' . + $phone_small . ' ' . + "" . html_print_image("images/rosette.png", true) . "" . ""; + } + $data[5] = $output; - $data[5] = "" . html_print_image("images/config.png", true, array("title" => "Edit")) . "  "; - $data[5] .= '' . html_print_image("images/cross.png", true, array("title" => "Delete")) . ''; + $data[6] = "" . html_print_image("images/config.png", true, array("title" => "Edit")) . "  "; + $data[6] .= '' . html_print_image("images/cross.png", true, array("title" => "Delete")) . ''; array_push ($table->data, $data); } @@ -234,8 +250,18 @@ ui_require_jquery_file ('cluetip'); width: 400, height: 200 }); + $(".phone_large").dialog( + { + autoOpen: false, + resizable: true, + width: 400, + height: 200 + }); }); function show_dialog(id) { $("#email_large_" + id).dialog("open"); } + function show_phone_dialog(id) { + $("#phone_large_" + id).dialog("open"); + } diff --git a/pandora_console/pandoradb.oracle.sql b/pandora_console/pandoradb.oracle.sql index 9bf651763c..9f2a4e1dae 100644 --- a/pandora_console/pandoradb.oracle.sql +++ b/pandora_console/pandoradb.oracle.sql @@ -1606,7 +1606,8 @@ CREATE TABLE ttag ( name VARCHAR2(100) default '' NOT NULL, description CLOB default '' NOT NULL, url CLOB default '' NOT NULL, - email CLOB NULL + email CLOB NULL, + phone CLOB NULL ); CREATE SEQUENCE ttag_s INCREMENT BY 1 START WITH 1; diff --git a/pandora_console/pandoradb.postgreSQL.sql b/pandora_console/pandoradb.postgreSQL.sql index 92a928709d..9b51c86659 100644 --- a/pandora_console/pandoradb.postgreSQL.sql +++ b/pandora_console/pandoradb.postgreSQL.sql @@ -1410,7 +1410,8 @@ CREATE TABLE "ttag" ( "name" VARCHAR(100) NOT NULL default '', "description" text NOT NULL default '', "url" text NOT NULL default '', - "email" text NULL + "email" text NULL, + "phone" text NULL ); -- --------------------------------------------------------------------- diff --git a/pandora_console/pandoradb.sql b/pandora_console/pandoradb.sql index 7a0e9d0a83..d05dfd7609 100644 --- a/pandora_console/pandoradb.sql +++ b/pandora_console/pandoradb.sql @@ -1494,6 +1494,7 @@ CREATE TABLE IF NOT EXISTS `ttag` ( `description` text NOT NULL, `url` mediumtext NOT NULL, `email` text NULL, + `phone` text NULL, PRIMARY KEY (`id_tag`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; diff --git a/pandora_console/pandoradb_data.sql b/pandora_console/pandoradb_data.sql index 0fca76ea96..000899dacb 100644 --- a/pandora_console/pandoradb_data.sql +++ b/pandora_console/pandoradb_data.sql @@ -1016,7 +1016,7 @@ INSERT INTO `tplugin` (`id`, `name`, `description`, `max_timeout`, `execute`, `p INSERT INTO `tagent_custom_fields` VALUES (1,'Serial Number',0),(2,'Department',0),(3,'Additional ID',0); -INSERT INTO `ttag` VALUES (1,'network','Network equipment','http://artica.es',''),(2,'critical','Critical modules','',''),(3,'dmz','DMZ Network Zone','',''),(4,'performance','Performance anda capacity modules','',''),(5,'configuration','','',''); +INSERT INTO `ttag` VALUES (1,'network','Network equipment','http://artica.es','',''),(2,'critical','Critical modules','','',''),(3,'dmz','DMZ Network Zone','','',''),(4,'performance','Performance anda capacity modules','','',''),(5,'configuration','','','',''); INSERT INTO `tevent_response` VALUES (1,'Ping to host','Ping to the agent host','ping -c 5 _agent_address_','command',0,620,500,0,''),(2,'SSH to host','Connect via SSH to the agent','http://192.168.70.164:8022/anyterm.html?param=_User_@_agent_address_','url',0,800,450,0,'User'),(3,'Create incident from event','Create a incident from the event with the standard incidents system of Pandora FMS','index.php?sec=workspace&sec2=operation/incidents/incident_detail&insert_form&from_event=_event_id_','url',0,0,0,1,''),(4,'Create Integria IMS incident from event','Create a incident from the event with integria incidents system of Pandora FMS. Is necessary to enable and configure the Integria incidents in Pandora FMS setup.','index.php?sec=workspace&sec2=operation/integria_incidents/incident&tab=editor&from_event=_event_id_','url',0,0,0,1,''),(5,'Restart agent','Restart the agent with using UDP protocol. To use this response is necessary to have installed Pandora FMS server and console in the same machine.','/usr/share/pandora_server/util/udp_client.pl _agent_address_ 41122 "REFRESH AGENT"','command',0,620,500,0,'');
"; html_print_textarea('email_tag', 5, 20, $email_tag); - //html_print_input_text ('email_tag', $email_tag); + echo "
"; + echo '' . __("Phone") . ''; + echo ui_print_help_tip (__("Associated phone number to use later in alerts associated to Tags."), true); + echo ""; + html_print_textarea('phone_tag', 5, 20, $phone_tag); echo "