From e63212ce5a8f373201efe8fb4012f20dbe7a4d54 Mon Sep 17 00:00:00 2001 From: hkosaka Date: Wed, 12 Sep 2012 08:13:57 +0000 Subject: [PATCH] 2012-09-12 Hirofumi Kosaka * include/functions_users.php godmode/groups/configure_group.php godmode/groups/group_list.php pandoradb.sql pandoradb_data.sql pandoradb.postgreSQL.sql pandoradb.oracle.sql pandoradb.data.postgreSQL.sql pandoradb.data.oracle.sql extras/pandoradb_migrate_4.0.x_to_5.0.mysql.sql extras/pandoradb_migrate_4.0.x_to_5.0.postgreSQL.sql extras/pandoradb_migrate_4.0.x_to_5.0.oracle.sql: Added 'description' column to Group. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6961 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 16 ++++++++++++ .../pandoradb_migrate_4.0.x_to_5.0.mysql.sql | 5 ++++ .../pandoradb_migrate_4.0.x_to_5.0.oracle.sql | 5 ++++ ...doradb_migrate_4.0.x_to_5.0.postgreSQL.sql | 6 +++++ .../godmode/groups/configure_group.php | 4 +++ pandora_console/godmode/groups/group_list.php | 26 ++++++++++++------- pandora_console/include/functions_users.php | 2 +- pandora_console/pandoradb.data.oracle.sql | 16 ++++++------ pandora_console/pandoradb.data.postgreSQL.sql | 18 ++++++------- pandora_console/pandoradb.oracle.sql | 3 ++- pandora_console/pandoradb.postgreSQL.sql | 3 ++- pandora_console/pandoradb.sql | 1 + pandora_console/pandoradb_data.sql | 16 ++++++------ 13 files changed, 83 insertions(+), 38 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 9b5a2918bc..ccb941288d 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,19 @@ +2012-09-12 Hirofumi Kosaka + + * include/functions_users.php + godmode/groups/configure_group.php + godmode/groups/group_list.php + pandoradb.sql + pandoradb_data.sql + pandoradb.postgreSQL.sql + pandoradb.oracle.sql + pandoradb.data.postgreSQL.sql + pandoradb.data.oracle.sql + extras/pandoradb_migrate_4.0.x_to_5.0.mysql.sql + extras/pandoradb_migrate_4.0.x_to_5.0.postgreSQL.sql + extras/pandoradb_migrate_4.0.x_to_5.0.oracle.sql: Added + 'description' column to Group. + 2012-09-11 Juan Manuel Ramon * include/functions_reporting.php 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 a45c216c64..2f557a1b6a 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 @@ -122,6 +122,11 @@ CREATE TABLE IF NOT EXISTS `tplanned_downtime_modules` ( ALTER TABLE `tevento` ADD COLUMN (`source` tinytext NOT NULL, `id_extra` tinytext NOT NULL); +-- ----------------------------------------------------- +-- Table `tgrupo` +-- ----------------------------------------------------- +ALTER TABLE `tgrupo` ADD COLUMN `description` text; + -- ----------------------------------------------------- -- Table `talert_snmp` -- ----------------------------------------------------- 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 c046a1d594..4e8f3182d1 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 @@ -144,6 +144,11 @@ CREATE OR REPLACE TRIGGER tplanned_downtime_modules_inc BEFORE INSERT ON tplanne ALTER TABLE tevento ADD (source VARCHAR2(100) default '' NOT NULL); ALTER TABLE tevento ADD (id_extra VARCHAR2(100) default '' NOT NULL); +-- ----------------------------------------------------- +-- Table `tgrupo` +-- ----------------------------------------------------- +ALTER TABLE tgrupo ADD (description CLOB); + -- ----------------------------------------------------- -- Table `talert_snmp` -- ----------------------------------------------------- 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 2dcf0428aa..aa58fd1cb2 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 @@ -136,6 +136,12 @@ CREATE TABLE "tplanned_downtime_modules" ( ALTER TABLE "tevento" ADD COLUMN "source" text NULL default ''; ALTER TABLE "tevento" ADD COLUMN "id_extra" text NULL default ''; +-- ----------------------------------------------------- +-- Table `tgrupo` +-- ----------------------------------------------------- + +ALTER TABLE "tgrupo" ADD COLUMN "description" text; + -- ----------------------------------------------------- -- Table `talert_snmp` -- ----------------------------------------------------- diff --git a/pandora_console/godmode/groups/configure_group.php b/pandora_console/godmode/groups/configure_group.php index 4c620fbb68..9fdc495fb0 100644 --- a/pandora_console/godmode/groups/configure_group.php +++ b/pandora_console/godmode/groups/configure_group.php @@ -49,6 +49,7 @@ if ($id_group) { $custom_id = $group["custom_id"]; $propagate = $group["propagate"]; $skin = $group["id_skin"]; + $description = $group["description"]; } else { echo "

".__('There was a problem loading group')."

"; @@ -116,6 +117,9 @@ $table->data[4][1] = html_print_checkbox('propagate', 1, $propagate, true); $table->data[5][0] = __('Custom ID'); $table->data[5][1] = html_print_input_text ('custom_id', $custom_id, '', 16, 255, true); +$table->data[6][0] = __('Description'); +$table->data[6][1] = html_print_input_text ('description', $description, '', 60, 255, true); + $isFunctionSkins = enterprise_include_once ('include/functions_skins.php'); if ($isFunctionSkins !== ENTERPRISE_NOT_HOOK) { $table->data[6][0] = __('Skin'); diff --git a/pandora_console/godmode/groups/group_list.php b/pandora_console/godmode/groups/group_list.php index f254999ffc..432c0aa412 100644 --- a/pandora_console/godmode/groups/group_list.php +++ b/pandora_console/godmode/groups/group_list.php @@ -147,6 +147,7 @@ if ($create_group) { $alerts_disabled = (bool) get_parameter ('alerts_disabled'); $custom_id = (string) get_parameter ('custom_id'); $skin = (string) get_parameter ('skin'); + $description = (string) get_parameter ('description'); $check = db_get_value('nombre', 'tgrupo', 'nombre', $name); @@ -159,7 +160,8 @@ $check = db_get_value('nombre', 'tgrupo', 'nombre', $name); 'parent' => $id_parent, 'disabled' => $alerts_disabled, 'custom_id' => $custom_id, - 'id_skin' => $skin + 'id_skin' => $skin, + 'description' => $description ); $result = db_process_sql_insert('tgrupo', $values); @@ -186,26 +188,28 @@ if ($update_group) { $name = (string) get_parameter ('name'); $icon = (string) get_parameter ('icon'); $id_parent = (int) get_parameter ('id_parent'); + $description = (string) get_parameter ('description'); $alerts_enabled = (bool) get_parameter ('alerts_enabled'); $custom_id = (string) get_parameter ('custom_id'); $propagate = (bool) get_parameter('propagate'); $skin = (string) get_parameter ('skin'); + $description = (string) get_parameter ('description'); /*Check if name field is empty*/ if( $name != "") { switch ($config["dbtype"]) { case "mysql": $sql = sprintf ('UPDATE tgrupo SET nombre = "%s", - icon = "%s", disabled = %d, parent = %d, custom_id = "%s", propagate = %d, id_skin = %d + icon = "%s", disabled = %d, parent = %d, custom_id = "%s", propagate = %d, id_skin = %d, description = "%s" WHERE id_grupo = %d', - $name, substr ($icon, 0, -4), !$alerts_enabled, $id_parent, $custom_id, $propagate, $skin, $id_group); + $name, substr ($icon, 0, -4), !$alerts_enabled, $id_parent, $custom_id, $propagate, $skin, $description, $id_group); break; case "postgresql": case "oracle": $sql = sprintf ('UPDATE tgrupo SET nombre = \'%s\', - icon = \'%s\', disabled = %d, parent = %d, custom_id = \'%s\', propagate = %d, id_skin = %d + icon = \'%s\', disabled = %d, parent = %d, custom_id = \'%s\', propagate = %d, id_skin = %d, description = \'%s\' WHERE id_grupo = %d', - $name, substr ($icon, 0, -4), !$alerts_enabled, $id_parent, $custom_id, $propagate, $skin, $id_group); + $name, substr ($icon, 0, -4), !$alerts_enabled, $id_parent, $custom_id, $propagate, $skin, $description, $id_group); break; } $result = db_process_sql ($sql); @@ -260,10 +264,11 @@ if (!empty($groups)) { $table->head[1] = __('ID'); $table->head[2] = __('Icon'); $table->head[3] = __('Alerts'); - $table->head[4] = __('Actions'); + $table->head[4] = __('Description'); + $table->head[5] = __('Actions'); $table->align = array (); $table->align[2] = 'center'; - $table->align[4] = 'center'; + $table->align[5] = 'center'; $table->data = array (); $iterator = 0; @@ -347,14 +352,15 @@ if (!empty($groups)) { $data[1] = $group['id_grupo']; $data[2] = ui_print_group_icon($group['id_grupo'], true); $data[3] = $group['disabled'] ? __('Disabled') : __('Enabled'); + $data[4] = $group['description']; if ($group['id_grupo'] == 0) { - $data[4] = ''; + $data[5] = ''; } else { - $data[4] = '' . html_print_image("images/config.png", true, array("alt" => __('Edit'), "title" => __('Edit'), "border" => '0')); + $data[5] = '' . html_print_image("images/config.png", true, array("alt" => __('Edit'), "title" => __('Edit'), "border" => '0')); //Check if there is only a group to unable delete it if ((count($groups) > 3) || (count($groups) <= 3 && $group['parent'] != 0)) { - $data[4] .= '  ' . html_print_image("images/cross.png", true, array("alt" => __('Delete'), "border" => '0')); + $data[5] .= '  ' . html_print_image("images/cross.png", true, array("alt" => __('Delete'), "border" => '0')); } } diff --git a/pandora_console/include/functions_users.php b/pandora_console/include/functions_users.php index b9a5339c5b..864e930999 100644 --- a/pandora_console/include/functions_users.php +++ b/pandora_console/include/functions_users.php @@ -165,7 +165,7 @@ function users_get_groups ($id_user = false, $privilege = "AR", $returnAllGroup if ($returnAllColumns) { $groupall = array('id_grupo' => 0, 'nombre' => __('All'), 'icon' => 'world', 'parent' => 0, 'disabled' => 0, - 'custom_id' => null, 'propagate' => 0); + 'custom_id' => null, 'description' => '', 'propagate' => 0); } else { $groupall = array('id_grupo' => 0, 'nombre' => __("All")); diff --git a/pandora_console/pandoradb.data.oracle.sql b/pandora_console/pandoradb.data.oracle.sql index 0ffc45b246..5831f04d0e 100644 --- a/pandora_console/pandoradb.data.oracle.sql +++ b/pandora_console/pandoradb.data.oracle.sql @@ -151,14 +151,14 @@ END;; -- BEGIN LOCK TABLE tgrupo IN EXCLUSIVE MODE; -INSERT INTO tgrupo (id_grupo, nombre, icon, parent, propagate, disabled, custom_id, id_skin) VALUES (2,'Servers','server_database',0,0,0,'',1); -INSERT INTO tgrupo (id_grupo, nombre, icon, parent, propagate, disabled, custom_id, id_skin) VALUES (4,'Firewalls','firewall',0,0,0,'',1); -INSERT INTO tgrupo (id_grupo, nombre, icon, parent, propagate, disabled, custom_id, id_skin) VALUES (8,'Databases','database_gear',0,0,0,'',1); -INSERT INTO tgrupo (id_grupo, nombre, icon, parent, propagate, disabled, custom_id, id_skin) VALUES (9,'Network','transmit',0,0,0,'',1); -INSERT INTO tgrupo (id_grupo, nombre, icon, parent, propagate, disabled, custom_id, id_skin) VALUES (10,'Unknown','world',0,0,0,'',1); -INSERT INTO tgrupo (id_grupo, nombre, icon, parent, propagate, disabled, custom_id, id_skin) VALUES (11,'Workstations','computer',0,0,0,'',1); -INSERT INTO tgrupo (id_grupo, nombre, icon, parent, propagate, disabled, custom_id, id_skin) VALUES (12,'Applications','applications',0,0,0,'',1); -INSERT INTO tgrupo (id_grupo, nombre, icon, parent, propagate, disabled, custom_id, id_skin) VALUES (13,'Web','world',0,0,0,'',1); +INSERT INTO tgrupo (id_grupo, nombre, icon, parent, propagate, disabled, custom_id, id_skin, description) VALUES (2,'Servers','server_database',0,0,0,'',1,''); +INSERT INTO tgrupo (id_grupo, nombre, icon, parent, propagate, disabled, custom_id, id_skin, description) VALUES (4,'Firewalls','firewall',0,0,0,'',1,''); +INSERT INTO tgrupo (id_grupo, nombre, icon, parent, propagate, disabled, custom_id, id_skin, description) VALUES (8,'Databases','database_gear',0,0,0,'',1,''); +INSERT INTO tgrupo (id_grupo, nombre, icon, parent, propagate, disabled, custom_id, id_skin, description) VALUES (9,'Network','transmit',0,0,0,'',1,''); +INSERT INTO tgrupo (id_grupo, nombre, icon, parent, propagate, disabled, custom_id, id_skin, description) VALUES (10,'Unknown','world',0,0,0,'',1,''); +INSERT INTO tgrupo (id_grupo, nombre, icon, parent, propagate, disabled, custom_id, id_skin, description) VALUES (11,'Workstations','computer',0,0,0,'',1,''); +INSERT INTO tgrupo (id_grupo, nombre, icon, parent, propagate, disabled, custom_id, id_skin, description) VALUES (12,'Applications','applications',0,0,0,'',1,''); +INSERT INTO tgrupo (id_grupo, nombre, icon, parent, propagate, disabled, custom_id, id_skin, description) VALUES (13,'Web','world',0,0,0,'',1,''); COMMIT; END;; diff --git a/pandora_console/pandoradb.data.postgreSQL.sql b/pandora_console/pandoradb.data.postgreSQL.sql index 70e4fc4a8b..602fdea1c7 100644 --- a/pandora_console/pandoradb.data.postgreSQL.sql +++ b/pandora_console/pandoradb.data.postgreSQL.sql @@ -133,16 +133,16 @@ SELECT setval('tconfig_os_id_os_seq', (SELECT (SELECT MAX(id_os) FROM tconfig_os -- BEGIN WORK; LOCK TABLE "tgrupo"; -INSERT INTO "tgrupo" ("id_grupo", "nombre", "icon", "parent", "propagate", "disabled", "custom_id", "id_skin") +INSERT INTO "tgrupo" ("id_grupo", "nombre", "icon", "parent", "propagate", "disabled", "custom_id", "id_skin", "description") VALUES -(2,'Servers','server_database',0,0,0,'',1), -(4,'Firewalls','firewall',0,0,0,'',1), -(8,'Databases','database_gear',0,0,0,'',1), -(9,'Network','transmit',0,0,0,'',1), -(10,'Unknown','world',0,0,0,'',1), -(11,'Workstations','computer',0,0,0,'',1), -(12,'Applications','applications',0,0,0,'',1), -(13,'Web','world',0,0,0,'',1); +(2,'Servers','server_database',0,0,0,'',1,''), +(4,'Firewalls','firewall',0,0,0,'',1,''), +(8,'Databases','database_gear',0,0,0,'',1,''), +(9,'Network','transmit',0,0,0,'',1,''), +(10,'Unknown','world',0,0,0,'',1,''), +(11,'Workstations','computer',0,0,0,'',1,''), +(12,'Applications','applications',0,0,0,'',1,''), +(13,'Web','world',0,0,0,'',1,''); COMMIT WORK; SELECT setval('tgrupo_id_grupo_seq', (SELECT (SELECT MAX(id_grupo) FROM tgrupo))); diff --git a/pandora_console/pandoradb.oracle.sql b/pandora_console/pandoradb.oracle.sql index d6b16f55e9..cc2800087d 100644 --- a/pandora_console/pandoradb.oracle.sql +++ b/pandora_console/pandoradb.oracle.sql @@ -565,7 +565,8 @@ CREATE TABLE tgrupo ( propagate NUMBER(5, 0) default 0, disabled NUMBER(5, 0) default 0, custom_id VARCHAR2(255) default '', - id_skin NUMBER(10, 0) DEFAULT 0 NOT NULL + id_skin NUMBER(10, 0) DEFAULT 0 NOT NULL, + description CLOB ); CREATE SEQUENCE tgrupo_s INCREMENT BY 1 START WITH 1; diff --git a/pandora_console/pandoradb.postgreSQL.sql b/pandora_console/pandoradb.postgreSQL.sql index 2774182e86..8395a249e1 100644 --- a/pandora_console/pandoradb.postgreSQL.sql +++ b/pandora_console/pandoradb.postgreSQL.sql @@ -461,7 +461,8 @@ CREATE TABLE "tgrupo" ( "propagate" SMALLINT default 0, "disabled" SMALLINT default 0, "custom_id" varchar(255) default '', - "id_skin" INTEGER NOT NULL DEFAULT 0 + "id_skin" INTEGER NOT NULL DEFAULT 0, + "description" text ); CREATE TABLE "tincidencia" ( diff --git a/pandora_console/pandoradb.sql b/pandora_console/pandoradb.sql index cf76b5fe55..ac92b387f8 100644 --- a/pandora_console/pandoradb.sql +++ b/pandora_console/pandoradb.sql @@ -546,6 +546,7 @@ CREATE TABLE IF NOT EXISTS `tgrupo` ( `disabled` tinyint(3) unsigned NOT NULL default '0', `custom_id` varchar(255) default '', `id_skin` int(10) unsigned NOT NULL default '0', + `description` text, PRIMARY KEY (`id_grupo`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; diff --git a/pandora_console/pandoradb_data.sql b/pandora_console/pandoradb_data.sql index 4567769bba..7d6071d0b0 100644 --- a/pandora_console/pandoradb_data.sql +++ b/pandora_console/pandoradb_data.sql @@ -133,14 +133,14 @@ UNLOCK TABLES; LOCK TABLES `tgrupo` WRITE; INSERT INTO `tgrupo` VALUES -(2,'Servers','server_database',0,0,0,'',1), -(4,'Firewalls','firewall',0,0,0,'',1), -(8,'Databases','database_gear',0,0,0,'',1), -(9,'Network','transmit',0,0,0,'',1), -(10,'Unknown','world',0,0,0,'',1), -(11,'Workstations','computer',0,0,0,'',1), -(12,'Applications','applications',0,0,0,'',1), -(13,'Web','world',0,0,0,'',1); +(2,'Servers','server_database',0,0,0,'',1,''), +(4,'Firewalls','firewall',0,0,0,'',1,''), +(8,'Databases','database_gear',0,0,0,'',1,''), +(9,'Network','transmit',0,0,0,'',1,''), +(10,'Unknown','world',0,0,0,'',1,''), +(11,'Workstations','computer',0,0,0,'',1,''), +(12,'Applications','applications',0,0,0,'',1,''), +(13,'Web','world',0,0,0,'',1,''); UNLOCK TABLES;