2013-09-03 Ramon Novoa <rnovoa@artica.es>

* 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
This commit is contained in:
Ramon Novoa 2013-09-03 08:50:25 +00:00
parent 956ad866f2
commit a8f275a175
10 changed files with 64 additions and 7 deletions

View File

@ -1,3 +1,15 @@
2013-09-03 Ramon Novoa <rnovoa@artica.es>
* 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 <miguel.dedios@artica.es>
* operation/tree.php, include/functions_treeview.php: improved the

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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 "<table border=0 cellpadding=4 cellspacing=4 class=databox width=98%>";
echo "</td>";
echo "<td align='left'>";
html_print_textarea('email_tag', 5, 20, $email_tag);
//html_print_input_text ('email_tag', $email_tag);
echo "</td>";
echo "</tr>";
echo "<tr>";
echo "<td align='left'>";
echo '<b>' . __("Phone") . '</b>';
echo ui_print_help_tip (__("Associated phone number to use later in alerts associated to Tags."), true);
echo "</td>";
echo "<td align='left'>";
html_print_textarea('phone_tag', 5, 20, $phone_tag);
echo "</td>";
echo "</tr>";
echo "<tr>";

View File

@ -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)) {
"<a href='javascript: show_dialog(" . $tag["id_tag"] . ")'>" . html_print_image("images/rosette.png", true) . "" . "</a></span>";
}
$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 =
"<div title='" . sprintf(__('Phones for the tag: %s'), $tag['name']) . "' style='display: none;' class='phone_large' id='phone_large_" . $tag["id_tag"] . "'>" .
$phone_large . "</div>" .
'<span id="value_' . $tag["id_tag"] . '">' .
$phone_small . '</span> ' .
"<a href='javascript: show_phone_dialog(" . $tag["id_tag"] . ")'>" . html_print_image("images/rosette.png", true) . "" . "</a></span>";
}
$data[5] = $output;
$data[5] = "<a href='index.php?sec=".$sec."&sec2=godmode/tag/edit_tag&action=update&id_tag=".$tag["id_tag"] . "'>" . html_print_image("images/config.png", true, array("title" => "Edit")) . "</a>&nbsp;&nbsp;";
$data[5] .= '<a href="index.php?sec='.$sec.'&sec2=godmode/tag/tag&delete_tag='.$tag["id_tag"] . '"onclick="if (! confirm (\''.__('Are you sure?').'\')) return false">' . html_print_image("images/cross.png", true, array("title" => "Delete")) . '</a>';
$data[6] = "<a href='index.php?sec=".$sec."&sec2=godmode/tag/edit_tag&action=update&id_tag=".$tag["id_tag"] . "'>" . html_print_image("images/config.png", true, array("title" => "Edit")) . "</a>&nbsp;&nbsp;";
$data[6] .= '<a href="index.php?sec='.$sec.'&sec2=godmode/tag/tag&delete_tag='.$tag["id_tag"] . '"onclick="if (! confirm (\''.__('Are you sure?').'\')) return false">' . html_print_image("images/cross.png", true, array("title" => "Delete")) . '</a>';
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");
}
</script>

View File

@ -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;

View File

@ -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
);
-- ---------------------------------------------------------------------

View File

@ -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;

View File

@ -1016,7 +1016,7 @@ INSERT INTO `tplugin` (`id`, `name`, `description`, `max_timeout`, `execute`, `p
INSERT INTO `tagent_custom_fields` VALUES (1,'Serial&#x20;Number',0),(2,'Department',0),(3,'Additional&#x20;ID',0);
INSERT INTO `ttag` VALUES (1,'network','Network&#x20;equipment','http://artica.es',''),(2,'critical','Critical&#x20;modules','',''),(3,'dmz','DMZ&#x20;Network&#x20;Zone','',''),(4,'performance','Performance&#x20;anda&#x20;capacity&#x20;modules','',''),(5,'configuration','','','');
INSERT INTO `ttag` VALUES (1,'network','Network&#x20;equipment','http://artica.es','',''),(2,'critical','Critical&#x20;modules','','',''),(3,'dmz','DMZ&#x20;Network&#x20;Zone','','',''),(4,'performance','Performance&#x20;anda&#x20;capacity&#x20;modules','','',''),(5,'configuration','','','','');
INSERT INTO `tevent_response` VALUES (1,'Ping&#x20;to&#x20;host','Ping&#x20;to&#x20;the&#x20;agent&#x20;host','ping&#x20;-c&#x20;5&#x20;_agent_address_','command',0,620,500,0,''),(2,'SSH&#x20;to&#x20;host','Connect&#x20;via&#x20;SSH&#x20;to&#x20;the&#x20;agent','http://192.168.70.164:8022/anyterm.html?param=_User_@_agent_address_','url',0,800,450,0,'User'),(3,'Create&#x20;incident&#x20;from&#x20;event','Create&#x20;a&#x20;incident&#x20;from&#x20;the&#x20;event&#x20;with&#x20;the&#x20;standard&#x20;incidents&#x20;system&#x20;of&#x20;Pandora&#x20;FMS','index.php?sec=workspace&amp;sec2=operation/incidents/incident_detail&amp;insert_form&amp;from_event=_event_id_','url',0,0,0,1,''),(4,'Create&#x20;Integria&#x20;IMS&#x20;incident&#x20;from&#x20;event','Create&#x20;a&#x20;incident&#x20;from&#x20;the&#x20;event&#x20;with&#x20;integria&#x20;incidents&#x20;system&#x20;of&#x20;Pandora&#x20;FMS.&#x20;&#x0d;&#x0a;&#x0d;&#x0a;Is&#x20;necessary&#x20;to&#x20;enable&#x20;and&#x20;configure&#x20;the&#x20;Integria&#x20;incidents&#x20;in&#x20;Pandora&#x20;FMS&#x20;setup.','index.php?sec=workspace&amp;sec2=operation/integria_incidents/incident&amp;tab=editor&amp;from_event=_event_id_','url',0,0,0,1,''),(5,'Restart&#x20;agent','Restart&#x20;the&#x20;agent&#x20;with&#x20;using&#x20;UDP&#x20;protocol.&#x0d;&#x0a;&#x0d;&#x0a;To&#x20;use&#x20;this&#x20;response&#x20;is&#x20;necessary&#x20;to&#x20;have&#x20;installed&#x20;Pandora&#x20;FMS&#x20;server&#x20;and&#x20;console&#x20;in&#x20;the&#x20;same&#x20;machine.','/usr/share/pandora_server/util/udp_client.pl&#x20;_agent_address_&#x20;41122&#x20;&quot;REFRESH&#x20;AGENT&quot;','command',0,620,500,0,'');