2012-09-07 Juan Manuel Ramon <juanmanuel.ramon@artica.es>

* include/functions_html.php
	include/graphs/fgraph.php
	include/functions_reporting.php
	include/javascript/pandora.js
	include/ajax/reporting.ajax.php
	include/ajax/agent.php
	pandoradb.sql
	pandoradb.postgreSQL.sql
	pandoradb.oracle.sql
	operation/agentes/ver_agente.php
	operation/reporting/reporting_viewer.php
	extras/pandoradb_migrate_4.0.x_to_5.0.mysql.sql
	extras/pandoradb_migrate_4.0.x_to_5.0.oracle.sql
	extras/pandoradb_migrate_4.0.x_to_5.0.postgreSQL.sql
	general/header.php
	godmode/reporting/reporting_builder.list_items.php
	godmode/reporting/reporting_builder.php
	godmode/reporting/reporting_builder.item_editor.php: Integration of reports
	in metaconsole.




git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6938 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
juanmanuelr 2012-09-07 12:01:23 +00:00
parent 92e1468724
commit e302839db0
19 changed files with 547 additions and 205 deletions

View File

@ -1,3 +1,25 @@
2012-09-07 Juan Manuel Ramon <juanmanuel.ramon@artica.es>
* include/functions_html.php
include/graphs/fgraph.php
include/functions_reporting.php
include/javascript/pandora.js
include/ajax/reporting.ajax.php
include/ajax/agent.php
pandoradb.sql
pandoradb.postgreSQL.sql
pandoradb.oracle.sql
operation/agentes/ver_agente.php
operation/reporting/reporting_viewer.php
extras/pandoradb_migrate_4.0.x_to_5.0.mysql.sql
extras/pandoradb_migrate_4.0.x_to_5.0.oracle.sql
extras/pandoradb_migrate_4.0.x_to_5.0.postgreSQL.sql
general/header.php
godmode/reporting/reporting_builder.list_items.php
godmode/reporting/reporting_builder.php
godmode/reporting/reporting_builder.item_editor.php: Integration of reports
in metaconsole.
2012-09-07 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_ui.php: fixed the ui_get_full_url function,
because sometimes added two times the php script name.

View File

@ -190,6 +190,7 @@ ALTER TABLE treport_content_item ADD FOREIGN KEY (`id_report_content`) REFERENCE
-- -----------------------------------------------------
ALTER TABLE treport ADD COLUMN `id_template` INTEGER UNSIGNED DEFAULT 0;
ALTER TABLE treport ADD COLUMN `id_group_edit` mediumint(8) unsigned NULL DEFAULT 0;
ALTER TABLE treport ADD COLUMN `metaconsole` tinyint(1) DEFAULT 0;
-- -----------------------------------------------------
-- Table `tgraph`

View File

@ -194,6 +194,7 @@ ALTER TABLE treport_content_item ADD FOREIGN KEY (id_report_content) REFERENCES
-- -----------------------------------------------------
ALTER TABLE treport ADD (id_template NUMBER(10, 0) default 0 NOT NULL);
ALTER TABLE treport ADD (id_group_edit NUMBER(19, 0) default 0 NOT NULL);
ALTER TABLE treport ADD (metaconsole NUMBER(5, 0) DEFAULT 0);
-- -----------------------------------------------------
-- Table `tgraph`

View File

@ -194,6 +194,7 @@ INSERT INTO "tconfig" ("token", "value") VALUES ('event_fields', 'evento,id_agen
-- -----------------------------------------------------
ALTER TABLE "treport" ADD COLUMN "id_template" INTEGER NOT NULL default 0;
ALTER TABLE "treport" ADD COLUMN "id_group_edit" BIGINT NOT NULL default 0;
ALTER TABLE "treport" ADD COLUMN "metaconsole" SMALLINT DEFAULT 0;
-- -----------------------------------------------------
-- Table `tgraph`

View File

@ -103,7 +103,7 @@ config_check();
</td>
<td width="20%">
<?php
if ($config["metaconsole"] == 0) {
//if ($config["metaconsole"] == 0) {
echo '<a class="white_bold" href="index.php?sec=gservers&amp;sec2=godmode/servers/modificar_server&amp;refr=60">';
$servers["all"] = (int) db_get_value ('COUNT(id_server)','tserver');
@ -123,7 +123,7 @@ config_check();
}
unset ($servers); // Since this is the header, we don't like to trickle down variables.
echo '</a>';
}
//}
?>
</td>
<td width="20%">
@ -182,7 +182,7 @@ config_check();
<tr>
<td colspan="2">
<?php
if ($config["metaconsole"] == 0) {
//if ($config["metaconsole"] == 0) {
?>
<form method="get" style="" name="quicksearch" action="">
<script type="text/javascript">
@ -206,7 +206,7 @@ config_check();
?>
</form>
<?php
}
//}
?>
</td>
<td>

View File

@ -95,7 +95,7 @@ switch ($action) {
$server_name = $item ['server_name'];
// Metaconsole db connection
if (($config ['metaconsole'] == 1) && ($server_name != '')) {
if (($config ['metaconsole'] == 1) && ($server_name != '') && defined('METACONSOLE')) {
$connection = metaconsole_get_connection($server_name);
if (metaconsole_load_external_db($connection) != NOERR) {
//ui_print_error_message ("Error connecting to ".$server_name);
@ -342,14 +342,20 @@ switch ($action) {
}
//Restore db connection
if (($config ['metaconsole'] == 1) && ($server_name != '')) {
if (($config ['metaconsole'] == 1) && ($server_name != '') && defined('METACONSOLE')) {
metaconsole_restore_db();
}
break;
}
$urlForm = 'index.php?sec=reporting&sec2=godmode/reporting/reporting_builder&tab=item_editor&action=' . $actionParameter . '&id_report=' . $idReport;
// Build link for sort actions: metaconsole and normal console
$variable_link = ui_get_full_url(false);
// Metaconsole
if ($config['metaconsole'] == 1 and defined('METACONSOLE'))
$variable_link .= '/enterprise/meta/';
$urlForm = $variable_link . 'index.php?sec=reporting&sec2=' . $config['homedir'] . '/godmode/reporting/reporting_builder&tab=item_editor&action=' . $actionParameter . '&id_report=' . $idReport;
echo '<form action="' . $urlForm . '" method="post">';
html_print_input_hidden('id_item', $idItem);
@ -364,7 +370,11 @@ html_print_input_hidden('id_item', $idItem);
html_print_select(reports_get_report_types(), 'type', $type, 'chooseType();', '', '');
}
else {
echo reports_get_report_types($type);
$report_type = reports_get_report_types($type);
if (!empty($report_type) and isset($report_type[$type]['name']))
echo $report_type[$type]['name'];
else
echo __('Not valid');
echo '<input type="hidden" id="type" name="type" value="' . $type . '" />';
}
?>
@ -477,7 +487,7 @@ html_print_input_hidden('id_item', $idItem);
<td style="vertical-align: top;"><?php echo __('Agent'); ?></td>
<td style="">
<?php
if ($config['metaconsole'] == 1) {
if ($config['metaconsole'] == 1 && defined('METACONSOLE')) {
$connection = metaconsole_get_connection($server_name);
$agent_name = '';
@ -508,7 +518,7 @@ html_print_input_hidden('id_item', $idItem);
if($idAgent) {
$sql = "SELECT id_agente_modulo, nombre FROM tagente_modulo WHERE id_agente = " . $idAgent . " AND delete_pending = 0";
if ($config['metaconsole'] == 1) {
if ($config['metaconsole'] == 1 && defined('METACONSOLE')) {
$connection = metaconsole_get_connection($server_name);
if (metaconsole_load_external_db($connection) == NOERR) {
@ -582,7 +592,7 @@ html_print_input_hidden('id_item', $idItem);
<td style="vertical-align: top;"><?php echo __('Custom graph'); ?></td>
<td style="">
<?php
if ($config['metaconsole'] == 1) {
if ($config['metaconsole'] == 1 && defined('METACONSOLE')) {
$graphs = array();
$graphs = metaconsole_get_custom_graphs();
$value_selected = $idCustomGraph . '|' . $server_name;
@ -607,7 +617,7 @@ html_print_input_hidden('id_item', $idItem);
$style_button_create_custom_graph = '';
$style_button_edit_custom_graph = 'style="display: none;"';
// Select the target server
if ($config['metaconsole'] == 1) {
if ($config['metaconsole'] == 1 && defined('METACONSOLE')) {
$metaconsole_connections = enterprise_hook('metaconsole_get_connection_names');
if ($metaconsole_connections === false) {
$metaconsole_connections = array();
@ -650,7 +660,7 @@ html_print_input_hidden('id_item', $idItem);
<tr id="row_servers" style="" class="datos">
<td style="vertical-align: top;"><?php echo __('Server'); ?></td>
<td style=""><?php
if ($config ['metaconsole'] != 1)
if ($config ['metaconsole'] != 1 or !defined('METACONSOLE'))
html_print_select ($servers, 'combo_server', $server_name, '', __('Select server'), 0, false, false, true, '', true);
else
html_print_select ($servers, 'combo_server', $server_name, '', __('Select server'), 0);
@ -773,7 +783,7 @@ if ($enterpriseEnable) {
reporting_enterprise_text_box();
}
//Restore db connection
if ($config ['metaconsole'] == 1) {
if ($config ['metaconsole'] == 1 && defined('METACONSOLE')) {
metaconsole_restore_db();
}
@ -811,7 +821,7 @@ function print_SLA_list($width, $action, $idItem = null) {
foreach ($itemsSLA as $item) {
$server_name = $item ['server_name'];
// Metaconsole db connection
if (($config ['metaconsole'] == 1) && ($server_name != '')) {
if (($config ['metaconsole'] == 1) && ($server_name != '') && defined('METACONSOLE')) {
$connection = metaconsole_get_connection($server_name);
if (metaconsole_load_external_db($connection) != NOERR) {
//ui_print_error_message ("Error connecting to ".$server_name);
@ -822,8 +832,12 @@ function print_SLA_list($width, $action, $idItem = null) {
$nameAgent = agents_get_name ($idAgent);
$nameModule = db_get_value_filter('nombre', 'tagente_modulo', array('id_agente_modulo' => $item['id_agent_module']));
$server_name_element = '';
if (($config ['metaconsole'] == 1) && ($server_name != '') && defined('METACONSOLE'))
$server_name_element .= ' (' . $server_name . ')';
echo '<tr id="sla_' . $item['id'] . '" style="" class="datos">
<td>' . printSmallFont($nameAgent) . '</td>
<td>' . printSmallFont($nameAgent) . $server_name_element . '</td>
<td>' . printSmallFont($nameModule) . '</td>
<td>' . $item['sla_min'] . '</td>
<td>' . $item['sla_max'] . '</td>
@ -832,7 +846,7 @@ function print_SLA_list($width, $action, $idItem = null) {
<a href="javascript: deleteSLARow(' . $item['id'] . ');">' . html_print_image("images/cross.png", true) . '</a>
</td>
</tr>';
if ($config ['metaconsole'] == 1) {
if ($config ['metaconsole'] == 1 && defined('METACONSOLE')) {
//Restore db connection
metaconsole_restore_db();
}
@ -875,7 +889,7 @@ function print_SLA_list($width, $action, $idItem = null) {
function print_General_list($width, $action, $idItem = null) {
global $config;
include_once('include/functions_html.php');
include_once($config['homedir'] . '/include/functions_html.php');
?>
<table class="databox" id="general_list" border="0" cellpadding="4" cellspacing="4" width="98%">
<thead>
@ -906,7 +920,7 @@ function print_General_list($width, $action, $idItem = null) {
foreach ($itemsGeneral as $item) {
$server_name = $item ['server_name'];
// Metaconsole db connection
if (($config ['metaconsole'] == 1) && ($server_name != '')) {
if (($config ['metaconsole'] == 1) && ($server_name != '') && defined('METACONSOLE')) {
$connection = metaconsole_get_connection($server_name);
if (metaconsole_load_external_db($connection) != NOERR) {
//ui_print_error_message ("Error connecting to ".$server_name);
@ -917,15 +931,19 @@ function print_General_list($width, $action, $idItem = null) {
$nameAgent = agents_get_name ($idAgent);
$nameModule = db_get_value_filter('nombre', 'tagente_modulo', array('id_agente_modulo' => $item['id_agent_module']));
$server_name_element = '';
if (($config ['metaconsole'] == 1) && ($server_name != '') && defined('METACONSOLE'))
$server_name_element .= ' (' . $server_name . ')';
echo '<tr id="general_' . $item['id'] . '" style="" class="datos">
<td>' . printSmallFont($nameAgent) . '</td>
<td>' . printSmallFont($nameAgent) . $server_name_element . '</td>
<td>' . printSmallFont($nameModule) . '</td>
<td>' . printSmallFont($item['operation']) . '</td>
<td style="text-align: center;">
<a href="javascript: deleteGeneralRow(' . $item['id'] . ');">' . html_print_image("images/cross.png", true) . '</a>
</td>
</tr>';
if ($config ['metaconsole'] == 1) {
if ($config ['metaconsole'] == 1 && defined('METACONSOLE')) {
//Restore db connection
metaconsole_restore_db();
}
@ -968,9 +986,9 @@ ui_require_javascript_file ('pandora_inventory', ENTERPRISE_DIR.'/include/javasc
?>
<script type="text/javascript">
$(document).ready (function () {
agent_module_autocomplete('#text-agent', '#hidden-id_agent', '#id_agent_module', '#hidden-server_name');
agent_module_autocomplete('#text-agent_sla', '#hidden-id_agent_sla', '#id_agent_module_sla', '#hidden-server_name');
agent_module_autocomplete('#text-agent_general', '#hidden-id_agent_general', '#id_agent_module_general', '#hidden-server_name_general', '#id_operation_module_general');
agent_module_autocomplete('#text-agent', '#hidden-id_agent', '#id_agent_module', '#hidden-server_name', undefined, <?php echo '"' . $config['homeurl'] . '"'; ?>);
agent_module_autocomplete('#text-agent_sla', '#hidden-id_agent_sla', '#id_agent_module_sla', '#hidden-server_name', undefined, <?php echo '"' . $config['homeurl'] . '"'; ?>);
agent_module_autocomplete('#text-agent_general', '#hidden-id_agent_general', '#id_agent_module_general', '#hidden-server_name_general', '#id_operation_module_general', <?php echo '"' . $config['homeurl'] . '"'; ?>);
chooseType();
chooseSQLquery();
@ -988,7 +1006,7 @@ function create_custom_graph() {
global $config;
// Metaconsole activated
if ($config['metaconsole'] == 1) {
if ($config['metaconsole'] == 1 && defined('METACONSOLE')) {
?>
var target_server = $("#meta_servers").val();
// If target server is not selected
@ -1007,7 +1025,7 @@ function create_custom_graph() {
jQuery.ajax ({
data: params1.join ("&"),
type: 'POST',
url: action="ajax.php",
url: action= <?php echo '"' . $config['homeurl'] . '"'; ?> + "/ajax.php",
async: false,
timeout: 10000,
success: function (data) {
@ -1023,7 +1041,7 @@ function create_custom_graph() {
jQuery.ajax ({
data: params1.join ("&"),
type: 'POST',
url: action="ajax.php",
url: action= <?php echo '"' . $config['homeurl'] . '"'; ?> + "/ajax.php",
async: false,
timeout: 10000,
success: function (data) {
@ -1049,7 +1067,7 @@ function edit_custom_graph() {
global $config;
// Metaconsole activated
if ($config['metaconsole'] == 1) {
if ($config['metaconsole'] == 1 && defined('METACONSOLE')) {
?>
var agent_server_temp;
var id_element_graph;
@ -1069,7 +1087,7 @@ function edit_custom_graph() {
jQuery.ajax ({
data: params1.join ("&"),
type: 'POST',
url: action="ajax.php",
url: action= <?php echo '"' . $config['homeurl'] . '"'; ?> + "/ajax.php",
async: false,
timeout: 10000,
success: function (data) {
@ -1085,7 +1103,7 @@ function edit_custom_graph() {
jQuery.ajax ({
data: params1.join ("&"),
type: 'POST',
url: action="ajax.php",
url: action= <?php echo '"' . $config['homeurl'] . '"'; ?> + "/ajax.php",
async: false,
timeout: 10000,
success: function (data) {
@ -1134,7 +1152,7 @@ function chooseSQLquery() {
jQuery.ajax ({
data: params1.join ("&"),
type: 'POST',
url: action="ajax.php",
url: action= <?php echo '"' . $config['homeurl'] . '"'; ?> + "/ajax.php",
async: false,
timeout: 10000,
success: function (data) {
@ -1149,7 +1167,7 @@ function chooseSQLquery() {
jQuery.ajax ({
data: params.join ("&"),
type: 'POST',
url: action="ajax.php",
url: action= <?php echo '"' . $config['homeurl'] . '"'; ?> + "/ajax.php",
timeout: 10000,
dataType: 'json',
success: function (data) {
@ -1170,7 +1188,7 @@ function deleteSLARow(id_row) {
jQuery.ajax ({
data: params.join ("&"),
type: 'POST',
url: action="ajax.php",
url: action= <?php echo '"' . $config['homeurl'] . '"'; ?> + "/ajax.php",
timeout: 10000,
dataType: 'json',
success: function (data) {
@ -1190,7 +1208,7 @@ function deleteGeneralRow(id_row) {
jQuery.ajax ({
data: params.join ("&"),
type: 'POST',
url: action="ajax.php",
url: action= <?php echo '"' . $config['homeurl'] . '"'; ?> + "/ajax.php",
timeout: 10000,
dataType: 'json',
success: function (data) {
@ -1221,7 +1239,7 @@ function addSLARow() {
jQuery.ajax ({
data: params.join ("&"),
type: 'POST',
url: action="ajax.php",
url: action= <?php echo '"' . $config['homeurl'] . '"'; ?> + "/ajax.php",
async: false,
timeout: 10000,
success: function (data) {
@ -1236,7 +1254,7 @@ function addSLARow() {
jQuery.ajax ({
data: params.join ("&"),
type: 'POST',
url: action="ajax.php",
url: action= <?php echo '"' . $config['homeurl'] . '"'; ?> + "/ajax.php",
async: false,
timeout: 10000,
success: function (data) {
@ -1257,7 +1275,7 @@ function addSLARow() {
jQuery.ajax ({
data: params.join ("&"),
type: 'POST',
url: action="ajax.php",
url: action= <?php echo '"' . $config['homeurl'] . '"'; ?> + "/ajax.php",
timeout: 10000,
dataType: 'json',
success: function (data) {
@ -1309,7 +1327,7 @@ function addGeneralRow() {
jQuery.ajax ({
data: params.join ("&"),
type: 'POST',
url: action="ajax.php",
url: action= <?php echo '"' . $config['homeurl'] . '"'; ?> + "/ajax.php",
async: false,
timeout: 10000,
success: function (data) {
@ -1324,7 +1342,7 @@ function addGeneralRow() {
jQuery.ajax ({
data: params.join ("&"),
type: 'POST',
url: action="ajax.php",
url: action= <?php echo '"' . $config['homeurl'] . '"'; ?> + "/ajax.php",
async: false,
timeout: 10000,
success: function (data) {
@ -1339,7 +1357,7 @@ function addGeneralRow() {
jQuery.ajax ({
data: params.join ("&"),
type: 'POST',
url: action="ajax.php",
url: action= <?php echo '"' . $config['homeurl'] . '"'; ?> + "/ajax.php",
async: false,
timeout: 10000,
success: function (data) {
@ -1357,7 +1375,7 @@ function addGeneralRow() {
jQuery.ajax ({
data: params.join ("&"),
type: 'POST',
url: action="ajax.php",
url: action= <?php echo '"' . $config['homeurl'] . '"'; ?> + "/ajax.php",
timeout: 10000,
dataType: 'json',
success: function (data) {

View File

@ -26,7 +26,7 @@ if (! check_acl ($config['id_user'], 0, "IW")) {
include_once($config['homedir'] . "/include/functions_agents.php");
enterprise_include_once ('include/functions_metaconsole.php');
if ($config ['metaconsole'] == 1) {
if ($config ['metaconsole'] == 1 and defined('METACONSOLE')) {
$agents = array();
$agents = metaconsole_get_report_agents($idReport);
$modules = array();
@ -105,10 +105,17 @@ else {
$modules[$row['id_agent_module']] = $row['nombre'];
}
// Filter report items created from metaconsole in normal console list and the opposite
if (defined('METACONSOLE') and $config['metaconsole'] == 1) {
$where_types = ' AND ((server_name IS NOT NULL AND length(server_name) != 0) OR type IN (\'general\',\'SLA\',\'exception\',\'top_n\'))';
}
else
$where_types = ' AND ((server_name IS NULL OR length(server_name) = 0) OR type IN (\'general\',\'SLA\',\'exception\',\'top_n\'))';
$rows = db_get_all_rows_sql('
SELECT DISTINCT(type)
FROM treport_content
WHERE id_report = ' . $idReport);
WHERE id_report = ' . $idReport . $where_types);
if ($rows === false) {
$rows = array();
}
@ -143,7 +150,7 @@ $table->data[1][0] = __('Type');
$table->data[1][1] = html_print_select($types, 'type_filter', $typeFilter, '', __('All'), 0, true);
echo '<div id="form_filter" style="display: none;">';
echo '<form method="post" action ="index.php?sec=reporting&sec2=godmode/reporting/reporting_builder&tab=list_items&action=filter&id_report=' . $idReport . '">';
echo '<form method="post" action ="index.php?sec=reporting&sec2=' . $config['homedir'] . '/godmode/reporting/reporting_builder&tab=list_items&action=filter&id_report=' . $idReport . '">';
html_print_table ($table);
@ -165,6 +172,13 @@ if ($moduleFilter != 0) {
$where .= ' AND id_agent_module = ' . $moduleFilter;
}
// Filter report items created from metaconsole in normal console list and the opposite
if (defined('METACONSOLE') and $config['metaconsole'] == 1) {
$where .= ' AND ((server_name IS NOT NULL AND length(server_name) != 0) OR type IN (\'general\',\'SLA\',\'exception\',\'top_n\'))';
}
else
$where .= ' AND ((server_name IS NULL OR length(server_name) = 0) OR type IN (\'general\',\'SLA\',\'exception\',\'top_n\'))';
switch ($config["dbtype"]) {
case "mysql":
$items = db_get_all_rows_sql('SELECT *
@ -198,6 +212,12 @@ $table = null;
$table->style[0] = 'text-align: right;';
// Build link for sort actions: metaconsole and normal console
$variable_link = ui_get_full_url(false);
// Metaconsole
if ($config['metaconsole'] == 1 and defined('METACONSOLE'))
$variable_link .= '/enterprise/meta/';
if ($items) {
$table->width = '100%';
@ -211,18 +231,19 @@ if ($items) {
$table->head[0] = '<span title="' . __('Position') . '">' . __('P.') . '</span>';
$table->head[1] = __('Type');
if (!$filterEnable) {
$table->head[1] .= ' <a onclick="return message_check_sort_items();" href="index.php?sec=reporting&sec2=godmode/reporting/reporting_builder&tab=list_items&action=order&dir=up&field=type&id_report=' . $idReport . $urlFilter . '">' . html_print_image("images/sort_up.png", true, array("title" => __('Ascendent'))) . '</a>' .
'<a onclick="return message_check_sort_items();" href="index.php?sec=reporting&sec2=godmode/reporting/reporting_builder&tab=list_items&action=order&dir=down&field=type&id_report=' . $idReport . $urlFilter . '">' . html_print_image("images/sort_down.png", true, array("title" => __('Descent'))) . '</a>';
$table->head[1] .= ' <a onclick="return message_check_sort_items();" href="' . $variable_link . 'index.php?sec=reporting&sec2=' . $config['homedir'] . '/godmode/reporting/reporting_builder&tab=list_items&action=order&dir=up&field=type&id_report=' . $idReport . $urlFilter . '">' . html_print_image("images/sort_up.png", true, array("title" => __('Ascendent'))) . '</a>' .
'<a onclick="return message_check_sort_items();" href="' . $variable_link . 'index.php?sec=reporting&sec2=' . $config['homedir'] . '/godmode/reporting/reporting_builder&tab=list_items&action=order&dir=down&field=type&id_report=' . $idReport . $urlFilter . '">' . html_print_image("images/sort_down.png", true, array("title" => __('Descent'))) . '</a>';
}
$table->head[2] = __('Agent');
if (!$filterEnable) {
$table->head[2] .= ' <a onclick="return message_check_sort_items();" href="index.php?sec=reporting&sec2=godmode/reporting/reporting_builder&tab=list_items&action=order&dir=up&field=agent&id_report=' . $idReport . $urlFilter . '">' . html_print_image("images/sort_up.png", true, array("title" => __('Ascendent'))) . '</a>' .
'<a onclick="return message_check_sort_items();" href="index.php?sec=reporting&sec2=godmode/reporting/reporting_builder&tab=list_items&action=order&dir=down&field=agent&id_report=' . $idReport . $urlFilter . '">' . html_print_image("images/sort_down.png", true, array("title" => __('Descent'))) . '</a>';
$table->head[2] .= ' <a onclick="return message_check_sort_items();" href="' . $variable_link . 'index.php?sec=reporting&sec2=' . $config['homedir'] . '/godmode/reporting/reporting_builder&tab=list_items&action=order&dir=up&field=agent&id_report=' . $idReport . $urlFilter . '">' . html_print_image("images/sort_up.png", true, array("title" => __('Ascendent'))) . '</a>' .
'<a onclick="return message_check_sort_items();" href="' . $variable_link . 'index.php?sec=reporting&sec2=' . $config['homedir'] . '/godmode/reporting/reporting_builder&tab=list_items&action=order&dir=down&field=agent&id_report=' . $idReport . $urlFilter . '">' . html_print_image("images/sort_down.png", true, array("title" => __('Descent'))) . '</a>';
}
$table->head[3] = __('Module');
if (!$filterEnable) {
$table->head[3] .= ' <a onclick="return message_check_sort_items();" href="index.php?sec=reporting&sec2=godmode/reporting/reporting_builder&tab=list_items&action=order&dir=up&field=module&id_report=' . $idReport . $urlFilter . '">' . html_print_image("images/sort_up.png", true, array("title" => __('Ascendent'))) . '</a>' .
'<a onclick="return message_check_sort_items();" href="index.php?sec=reporting&sec2=godmode/reporting/reporting_builder&tab=list_items&action=order&dir=down&field=module&id_report=' . $idReport . $urlFilter . '">' . html_print_image("images/sort_down.png", true, array("title" => __('Descent'))) . '</a>';
$table->head[3] .= ' <a onclick="return message_check_sort_items();" href="' . $variable_link . 'index.php?sec=reporting&sec2=' . $config['homedir'] . '/godmode/reporting/reporting_builder&tab=list_items&action=order&dir=up&field=module&id_report=' . $idReport . $urlFilter . '">' . html_print_image("images/sort_up.png", true, array("title" => __('Ascendent'))) . '</a>' .
'<a onclick="return message_check_sort_items();" href="' . $variable_link . 'index.php?sec=reporting&sec2=' . $config['homedir'] . '/godmode/reporting/reporting_builder&tab=list_items&action=order&dir=down&field=module&id_report=' . $idReport . $urlFilter . '">' . html_print_image("images/sort_down.png", true, array("title" => __('Descent'))) . '</a>';
}
$table->head[4] = __('Period');
$table->head[5] = __('Description');
@ -270,7 +291,7 @@ foreach ($items as $item) {
$server_name = $item ['server_name'];
if (($config ['metaconsole'] == 1) && ($server_name != '')) {
if (($config ['metaconsole'] == 1) && ($server_name != '') && defined('METACONSOLE')) {
$connection = metaconsole_get_connection($server_name);
if (metaconsole_load_external_db($connection) != NOERR) {
@ -320,9 +341,9 @@ foreach ($items as $item) {
$row[6] = '';
$row[6] .= '<a href="index.php?sec=reporting&sec2=godmode/reporting/reporting_builder&tab=item_editor&action=edit&id_report=' . $idReport . '&id_item=' . $item['id_rc'] . '">' . html_print_image("images/wrench_orange.png", true, array("title" => __('Edit'))) . '</a>';
$row[6] .= '<a href="' . $variable_link . 'index.php?sec=reporting&sec2=' . $config['homedir'] . '/godmode/reporting/reporting_builder&tab=item_editor&action=edit&id_report=' . $idReport . '&id_item=' . $item['id_rc'] . '">' . html_print_image("images/wrench_orange.png", true, array("title" => __('Edit'))) . '</a>';
$row[6] .= '&nbsp;&nbsp;';
$row[6] .= '<a onClick="if (!confirm (\'Are you sure?\')) return false;" href="index.php?sec=reporting&sec2=godmode/reporting/reporting_builder&tab=list_items&action=delete&id_report=' . $idReport . '&id_item=' . $item['id_rc'] . $urlFilter . '">' . html_print_image("images/cross.png", true, array("title" => __('Delete'))) .'</a>';
$row[6] .= '<a onClick="if (!confirm (\'Are you sure?\')) return false;" href="' . $variable_link . 'index.php?sec=reporting&sec2=' . $config['homedir'] . '/godmode/reporting/reporting_builder&tab=list_items&action=delete&id_report=' . $idReport . '&id_item=' . $item['id_rc'] . $urlFilter . '">' . html_print_image("images/cross.png", true, array("title" => __('Delete'))) .'</a>';
$row[6] .= html_print_checkbox_extended ('delete_multiple[]', $item['id_rc'], false, false, '', 'class="check_delete"', true);
$row[7] = '';
@ -333,15 +354,15 @@ foreach ($items as $item) {
$table->data[] = $row;
$count++;
//Restore db connection
if (($config ['metaconsole'] == 1) && ($server_name != '') ) {
if (($config ['metaconsole'] == 1) && ($server_name != '') && defined('METACONSOLE')) {
metaconsole_restore_db();
}
}
ui_pagination ($countItems, 'index.php?sec=reporting&sec2=godmode/reporting/reporting_builder&tab=list_items&action=edit&id_report=' . $idReport . $urlFilter);
ui_pagination ($countItems, $variable_link . 'index.php?sec=reporting&sec2=' . $config['homedir'] . '/godmode/reporting/reporting_builder&tab=list_items&action=edit&id_report=' . $idReport . $urlFilter);
html_print_table($table);
ui_pagination ($countItems, 'index.php?sec=reporting&sec2=godmode/reporting/reporting_builder&tab=list_items&action=edit&id_report=' . $idReport . $urlFilter);
ui_pagination ($countItems, $variable_link . 'index.php?sec=reporting&sec2=' . $config['homedir'] . '/godmode/reporting/reporting_builder&tab=list_items&action=edit&id_report=' . $idReport . $urlFilter);
echo "<form action='index.php?sec=reporting&sec2=godmode/reporting/reporting_builder&tab=list_items&action=delete_items&id_report=" . $idReport . "'
echo "<form action='" . $variable_link . "index.php?sec=reporting&sec2=" . $config['homedir'] . "/godmode/reporting/reporting_builder&tab=list_items&action=delete_items&id_report=" . $idReport . "'
method='post' onSubmit='return added_ids_deleted_items_to_hidden_input();'>";
echo "<div style='padding-bottom: 20px; text-align: right; width:100%'>";
html_print_input_hidden('ids_items_to_delete', '');
@ -350,8 +371,13 @@ echo "<form action='index.php?sec=reporting&sec2=godmode/reporting/reporting_bui
echo "</form>";
$table = null;
$table->width = '60%';
$table->width = '100%';
$table->colspan[0][0] = 3;
$table->size = array();
$table->size[0] = '25%';
$table->size[1] = '25%';
$table->size[2] = '25%';
$table->size[3] = '25%';
$table->data[0][0] = "<b>". __("Sort items") . "</b>";
$table->data[1][0] = __('Sort selected items from position: ');
$table->data[1][1] = html_print_select_style(
@ -362,14 +388,19 @@ $table->data[1][2] = html_print_input_text_extended('position_to_sort', 1,
$table->data[1][2] .= html_print_input_hidden('ids_items_to_sort', '', true);
$table->data[1][3] = html_print_submit_button(__('Sort'), 'sort_submit', false, 'class="sub upd"', true);
echo "<form action='index.php?sec=reporting&sec2=godmode/reporting/reporting_builder&tab=list_items&action=sort_items&id_report=" . $idReport . "'
echo "<form action='" . $variable_link . "index.php?sec=reporting&sec2=" . $config['homedir'] . "/godmode/reporting/reporting_builder&tab=list_items&action=sort_items&id_report=" . $idReport . "'
method='post' onsubmit='return added_ids_sorted_items_to_hidden_input();'>";
html_print_table($table);
echo "</form>";
$table = null;
$table->width = '60%';
$table->width = '100%';
$table->colspan[0][0] = 3;
$table->size = array();
$table->size[0] = '25%';
$table->size[1] = '25%';
$table->size[2] = '25%';
$table->size[3] = '25%';
$table->data[0][0] = "<b>". __("Delete items") . "</b>";
$table->data[1][0] = __('Delete selected items from position: ');
$table->data[1][1] = html_print_select_style(
@ -380,7 +411,7 @@ $table->data[1][2] = html_print_input_text_extended('position_to_delete', 1,
$table->data[1][2] .= html_print_input_hidden('ids_items_to_delete', '', true);
$table->data[1][3] = html_print_submit_button(__('Delete'), 'delete_submit', false, 'class="sub upd"', true);
echo "<form action='index.php?sec=reporting&sec2=godmode/reporting/reporting_builder&tab=list_items&action=delete_items_pos&id_report=" . $idReport . "'
echo "<form action='" . $variable_link . "index.php?sec=reporting&sec2=" . $config['homedir'] . "/godmode/reporting/reporting_builder&tab=list_items&action=delete_items_pos&id_report=" . $idReport . "'
method='post'>";
html_print_table($table);
echo "</form>";

View File

@ -13,6 +13,10 @@
// GNU General Public License for more details.
global $config;
// IMPORTANT NOTE: All reporting pages are used also for metaconsole reporting functionality
// So, it's very important to specify full url and paths to resources because metaconsole has a different
// entry point: enterprise/meta/index.php than normal console !!!
// Login check
check_login ();
@ -23,10 +27,11 @@ if (! check_acl ($config['id_user'], 0, "IW")) {
exit;
}
require_once ("include/functions_reports.php");
require_once ($config['homedir'] . "/include/functions_reports.php");
// Load enterprise extensions
enterprise_include ('operation/reporting/custom_reporting.php');
enterprise_include_once ('include/functions_metaconsole.php');
$enterpriseEnable = false;
if (enterprise_include_once('include/functions_reporting.php') !== ENTERPRISE_NOT_HOOK) {
@ -188,7 +193,7 @@ switch ($action) {
$sql = "SELECT id_rc FROM treport_content WHERE id_report=$idReport ORDER BY '`order`'";
$items = db_get_all_rows_sql($sql);
switch ($pos_delete) {
case 'below':
case 'above':
if ($position_to_delete == 1) {
$resultOperationDB = false;
} else {
@ -201,7 +206,7 @@ switch ($action) {
}
}
break;
case 'above':
case 'below':
if ($position_to_delete == $countItems) {
$resultOperationDB = false;
} else {
@ -221,11 +226,11 @@ switch ($action) {
case 'list':
$buttons = array(
'list_reports' => array('active' => false,
'text' => '<a href="index.php?sec=reporting&sec2=godmode/reporting/reporting_builder">' .
'text' => '<a href="index.php?sec=reporting&sec2=' . $config['homedir'] . '/godmode/reporting/reporting_builder">' .
html_print_image("images/god6.png", true, array ("title" => __('Main'))) .'</a>')
);
if ($enterpriseEnable){
if ($enterpriseEnable and !defined('METACONSOLE')) {
$buttons = reporting_enterprise_add_main_Tabs($buttons);
}
@ -240,7 +245,18 @@ switch ($action) {
break;
}
// Report LIST
// Page header for metaconsole
if ($enterpriseEnable and defined('METACONSOLE')) {
// Bread crumbs
ui_meta_add_breadcrumb(array('link' => 'index.php?sec=reporting&sec2=' . $config['homedir'] . '/godmode/reporting/reporting_builder', 'text' => __('Reporting')));
ui_meta_print_page_header($nav_bar);
// Print header
ui_meta_print_header(__('Reporting'), "", $buttons);
}
// Page header for normal console
else
ui_print_page_header (__('Reporting').' &raquo; '.__('Custom reporting'), "images/reporting.png", false, "",false, $buttons);
if ($action == 'delete_report') {
@ -274,7 +290,7 @@ switch ($action) {
$table_aux->data[0][6] = html_print_submit_button(__('Search'), 'search_submit', false, 'class="sub upd"', true);
echo "<form action='index.php?sec=reporting&sec2=godmode/reporting/reporting_builder&id_group='.$id_group'
echo "<form action='index.php?sec=reporting&sec2=" . $config['homedir'] . "/godmode/reporting/reporting_builder&id_group='.$id_group'
method='post'>";
html_print_table($table_aux);
echo "</form>";
@ -310,6 +326,12 @@ switch ($action) {
);
}
// Filter normal and metaconsole reports
if ($config['metaconsole'] == 1 and defined('METACONSOLE'))
$filter['metaconsole'] = 1;
else
$filter['metaconsole'] = 0;
$reports = reports_get_reports ($filter,
array ('name', 'id_report', 'description', 'private',
'id_user', 'id_group'), $return_all_group, 'IR', $group);
@ -362,7 +384,7 @@ switch ($action) {
$data = array ();
if (check_acl ($config["id_user"], $report["id_group"], "AW")) {
$data[0] = '<a href="index.php?sec=reporting&sec2=godmode/reporting/reporting_builder&action=edit&id_report='.
$data[0] = '<a href="index.php?sec=reporting&sec2=' . $config['homedir'] . '/godmode/reporting/reporting_builder&action=edit&id_report='.
$report['id_report'].'">'.$report['name'].'</a>';
}
else {
@ -372,9 +394,9 @@ switch ($action) {
$data[1] = $report['description'];
$data[2] = '<a href="index.php?sec=reporting&sec2=operation/reporting/reporting_viewer&id='.$report['id_report'].'">' .
$data[2] = '<a href="index.php?sec=reporting&sec2=' . $config['homedir'] . '/operation/reporting/reporting_viewer&id='.$report['id_report'].'">' .
html_print_image("images/reporting.png", true) . '</a>';
$data[3] = '<a href="ajax.php?page=operation/reporting/reporting_xml&id='.$report['id_report'].'">' . html_print_image("images/database_lightning.png", true) . '</a>'; //I chose ajax.php because it's supposed to give XML anyway
$data[3] = '<a href="'. $config['homeurl'] . '/ajax.php?page=' . $config['homedir'] . '/operation/reporting/reporting_xml&id='.$report['id_report'].'">' . html_print_image("images/database_lightning.png", true) . '</a>'; //I chose ajax.php because it's supposed to give XML anyway
//Calculate dinamically the number of the column
@ -413,7 +435,7 @@ switch ($action) {
}
if ($edit) {
$data[$next] = '<form method="post" action="index.php?sec=reporting&sec2=godmode/reporting/reporting_builder&action=edit" style="display:inline">';
$data[$next] = '<form method="post" action="index.php?sec=reporting&sec2=' . $config['homedir'] . '/godmode/reporting/reporting_builder&action=edit" style="display:inline">';
$data[$next] .= html_print_input_hidden ('id_report', $report['id_report'], true);
$data[$next] .= html_print_input_image ('edit', 'images/config.png', 1, '', true, array ('title' => __('Edit')));
$data[$next] .= '</form>';
@ -433,12 +455,12 @@ switch ($action) {
html_print_table ($table);
}
else {
echo "<div class='nf'>".__('There are no defined reportings')."</div>";
ui_print_error_message(__('There are no defined reportings'));
}
if (check_acl ($config['id_user'], 0, "IW")) {
echo '<form method="post" action="index.php?sec=reporting&sec2=godmode/reporting/reporting_builder&tab=main&action=new">';
echo '<form method="post" action="index.php?sec=reporting&sec2=' . $config['homedir'] . '/godmode/reporting/reporting_builder&tab=main&action=new">';
echo '<div class="action-buttons" style="width: 98%;">';
html_print_submit_button (__('Create report'), 'create', false, 'class="sub next"');
echo "</div>";
@ -525,13 +547,21 @@ switch ($action) {
}
else if ($action == 'save') {
if ($reportName != "" && $idGroupReport != "") {
// This flag allow to differentiate between normal console and metaconsole reports
if (defined('METACONSOLE') and $config['metaconsole'] == 1)
$metaconsole_report = 1;
else
$metaconsole_report = 0;
$idOrResult = db_process_sql_insert('treport',
array('name' => $reportName,
'id_group' => $idGroupReport,
'description' => $description,
'private' => $private,
'id_group_edit' => $id_group_edit,
'id_user' => $config['id_user']));
'id_user' => $config['id_user'],
'metaconsole' => $metaconsole_report));
if ($idOrResult !== false)
db_pandora_audit( "Report management", "Create report #$idOrResult");
else
@ -833,7 +863,7 @@ switch ($action) {
break;
}
if ($config['metaconsole'] == 1) {
if ($config['metaconsole'] == 1 && defined('METACONSOLE')) {
if ($values['type'] == 'custom_graph') {
$id_gs = substr ($values['id_gs'], 0, strpos ($values['id_gs'], '|'));
if ($id_gs !== false && $id_gs !== '') {
@ -914,7 +944,8 @@ switch ($action) {
}
break;
default:
if ($enterpriseEnable) {
if ($enterpriseEnable and $activeTab != 'advanced') {
$resultOperationDB = reporting_enterprise_update_action();
}
break;
@ -964,6 +995,9 @@ switch ($action) {
case 'module':
case 'agent':
case 'type':
// Sort functionality for normal console
if (!defined('METACONSOLE')) {
switch ($field) {
case 'module':
$sql = "
@ -995,6 +1029,104 @@ switch ($action) {
$sql = "SELECT id_rc FROM treport_content WHERE %s ORDER BY type %s";
break;
}
$sql = sprintf($sql, 'id_report = ' . $idReport, '%s');
switch ($dir) {
case 'up':
$sql = sprintf($sql, 'ASC');
break;
case 'down':
$sql = sprintf($sql, 'DESC');
break;
}
echo $sql;
$ids = db_get_all_rows_sql($sql);
}
// Sort functionality for metaconsole
else if ($config['metaconsole'] == 1) {
switch ($field) {
case 'agent':
case 'module':
$sql = "SELECT id_rc, id_agent, id_agent_module, server_name FROM treport_content WHERE %s ORDER BY server_name";
$sql = sprintf($sql, 'id_report = ' . $idReport, '%s');
$report_items = db_get_all_rows_sql($sql);
$ids = array();
$temp_sort = array();
$i = 0;
if (!empty($report_items)) {
foreach ($report_items as $report_item) {
$connection = metaconsole_get_connection($report_item['server_name']);
if (metaconsole_load_external_db($connection) != NOERR) {
//ui_print_error_message ("Error connecting to ".$server_name);
}
switch ($field) {
case 'agent':
$agents_name = agents_get_agents(array('id_agente' => $report_item['id_agent']), 'nombre');
// Item without agent
if (!$agents_name)
$element_name = '';
else {
$agent_name = array_shift($agents_name);
$element_name = $agent_name['nombre'];
}
break;
case 'module':
$module_name = modules_get_agentmodule_name($report_item['id_agent_module']);
// Item without module
if (!$module_name)
$element_name = '';
else {
$element_name = $module_name;
}
break;
}
metaconsole_restore_db_force();
$temp_sort[$report_item['id_rc']] = $element_name;
}
// Performes sorting
switch ($dir) {
case 'up':
asort($temp_sort);
break;
case 'down':
arsort($temp_sort);
break;
}
foreach ($temp_sort as $temp_element_key => $temp_element_val) {
$ids[$i]['id_rc'] = $temp_element_key;
$ids[$i]['element_name'] = $temp_element_val;
$i++;
}
// Free resources
unset($temp_sort);
unset($report_items);
}
break;
// Type case only depends of local database
case 'type':
$sql = "SELECT id_rc FROM treport_content WHERE %s ORDER BY type %s";
$sql = sprintf($sql, 'id_report = ' . $idReport, '%s');
switch ($dir) {
case 'up':
@ -1007,6 +1139,12 @@ switch ($action) {
$ids = db_get_all_rows_sql($sql);
break;
}
}
$count = 1;
$resultOperationDB = true;
foreach($ids as $id) {
@ -1019,6 +1157,7 @@ switch ($action) {
$count = $count + 1;
}
break;
default:
switch ($config["dbtype"]) {
@ -1122,13 +1261,13 @@ if ($enterpriseEnable) {
$buttons = array(
'main' => array('active' => false,
'text' => '<a href="index.php?sec=reporting&sec2=godmode/reporting/reporting_builder&tab=main&action=edit&id_report=' . $idReport . '">' .
'text' => '<a href="index.php?sec=reporting&sec2=' . $config['homedir'] . '/godmode/reporting/reporting_builder&tab=main&action=edit&id_report=' . $idReport . '">' .
html_print_image("images/reporting_edit.png", true, array ("title" => __('Main'))) .'</a>'),
'list_items' => array('active' => false,
'text' => '<a href="index.php?sec=reporting&sec2=godmode/reporting/reporting_builder&tab=list_items&action=edit&id_report=' . $idReport . '">' .
'text' => '<a href="index.php?sec=reporting&sec2=' . $config['homedir'] . '/godmode/reporting/reporting_builder&tab=list_items&action=edit&id_report=' . $idReport . '">' .
html_print_image("images/god6.png", true, array ("title" => __('List items'))) .'</a>'),
'item_editor' => array('active' => false,
'text' => '<a href="index.php?sec=reporting&sec2=godmode/reporting/reporting_builder&tab=item_editor&action=new&id_report=' . $idReport . '">' .
'text' => '<a href="index.php?sec=reporting&sec2=' . $config['homedir'] . '/godmode/reporting/reporting_builder&tab=item_editor&action=new&id_report=' . $idReport . '">' .
html_print_image("images/config.png", true, array ("title" => __('Item editor'))) .'</a>')
);
@ -1137,7 +1276,7 @@ if ($enterpriseEnable) {
}
$buttons['view'] = array('active' => false,
'text' => '<a href="index.php?sec=reporting&sec2=operation/reporting/reporting_viewer&id=' . $idReport . '">' .
'text' => '<a href="index.php?sec=reporting&sec2=' . $config['homedir'] . '/operation/reporting/reporting_viewer&id=' . $idReport . '">' .
html_print_image("images/reporting.png", true, array ("title" => __('View report'))) .'</a>');
$buttons[$activeTab]['active'] = true;
@ -1153,6 +1292,17 @@ else {
$textReportName = '';
}
// Page header for metaconsole
if ($enterpriseEnable and defined('METACONSOLE')) {
// Bread crumbs
ui_meta_add_breadcrumb(array('link' => 'index.php?sec=reporting&sec2=' . $config['homedir'] . '/godmode/reporting/reporting_builder', 'text' => __('Reporting')));
ui_meta_print_page_header($nav_bar);
// Print header
ui_meta_print_header(__('Reporting'). $textReportName, "", $buttons);
}
else
ui_print_page_header(__('Reporting') . $textReportName, "images/reporting_edit.png", false, "reporting_" . $activeTab . "_tab", true, $buttons);
if ($resultOperationDB !== null) {
@ -1161,13 +1311,13 @@ if ($resultOperationDB !== null) {
switch ($activeTab) {
case 'main':
require_once('godmode/reporting/reporting_builder.main.php');
require_once($config['homedir'] . '/godmode/reporting/reporting_builder.main.php');
break;
case 'list_items':
require_once('godmode/reporting/reporting_builder.list_items.php');
require_once($config['homedir'] . '/godmode/reporting/reporting_builder.list_items.php');
break;
case 'item_editor':
require_once('godmode/reporting/reporting_builder.item_editor.php');
require_once($config['homedir'] . '/godmode/reporting/reporting_builder.item_editor.php');
break;
default:
reporting_enterprise_select_tab($activeTab);

View File

@ -135,7 +135,7 @@ elseif ($search_agents && ($config['metaconsole'] == 1)) {
return;
}
if ($search_agents_2 && ($config['metaconsole'] == 0)) {
if ($search_agents_2 && (!defined('METACONSOLE'))) {
require_once ('include/functions_agents.php');
@ -187,7 +187,7 @@ if ($search_agents_2 && ($config['metaconsole'] == 0)) {
return;
}
elseif ($search_agents_2 && ($config['metaconsole'] == 1)) {
elseif ($search_agents_2 && ($config['metaconsole'] == 1) && defined('METACONSOLE')) {
$servers = db_get_all_rows_sql ("SELECT * FROM tmetaconsole_setup");
if (!isset($servers)) {
return;

View File

@ -147,7 +147,25 @@ if ($get_metaconsole_hash_data) {
$server = enterprise_hook('metaconsole_get_connection', array($server_name));
$pwd = $server["auth_token"]; // Create HASH login info
// Bad data
if (empty($server)){
echo '';
return;
}
// Deserialization of auth_token
$auth_serialized = json_decode($server['auth_token'] ,true);
$auth_token = '';
if (is_array($auth_serialized)) {
$auth_token = $auth_serialized["auth_token"];
$api_password = $auth_serialized["api_password"];
$console_user = $auth_serialized["console_user"];
$console_password = $auth_serialized["console_password"];
}
$pwd = $auth_token; // Create HASH login info
$user = $config["id_user"];
$hashdata = $user.$pwd;
$hashdata = md5($hashdata);

View File

@ -1227,7 +1227,7 @@ function html_print_image ($src, $return = false, $options = false, $return_src
if (!$relative) {
if (defined('METACONSOLE'))
$src .= ENTERPRISE_DIR . '/meta/' . $src;
$src = ENTERPRISE_DIR . '/meta/' . $src;
$src = ui_get_full_url($src);
}

View File

@ -1318,7 +1318,7 @@ function reporting_alert_reporting ($id_group, $period = 0, $date = 0, $return =
$data[__('Alerts not fired')] = $not_fired_percentage;
$output .= pie3d_graph(false, $data, 280, 150,
__("other"), "", $config['homedir'] . "/images/logo_vertical_water.png",
__("other"), $config['homeurl'] . '/', $config['homedir'] . "/images/logo_vertical_water.png",
$config['fontpath'], $config['font_size']);
$output .= '<strong>'.__('Alerts fired').': '.sizeof ($alerts_fired).'</strong><br />';
@ -1394,7 +1394,7 @@ function reporting_monitor_health ($id_group, $period = 0, $date = 0, $return =
$data[__('Monitors BAD')] = $not_down_percentage;
$output .= pie3d_graph(false, $data, 280, 150,
__("other"), "", $config['homedir'] . "/images/logo_vertical_water.png",
__("other"), $config['homeurl'] . '/', $config['homedir'] . "/images/logo_vertical_water.png",
$config['fontpath'], $config['font_size']);
if (!$return)
@ -2105,7 +2105,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
}
$server_name = $content ['server_name'];
if (($config ['metaconsole'] == 1) && $server_name != '') {
if (($config ['metaconsole'] == 1) && $server_name != '' && defined('METACONSOLE')) {
$connection = metaconsole_get_connection($server_name);
if (metaconsole_load_external_db($connection) != NOERR) {
//ui_print_error_message ("Error connecting to ".$server_name);
@ -2143,7 +2143,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
$data[0] = grafico_modulo_sparse($content['id_agent_module'], $content['period'],
false, $sizgraph_w, $sizgraph_h, '', '', false, true, true,
$report["datetime"], '', 0, 0, true, true);
$report["datetime"], '', 0, 0, true, true, $config['homeurl'] . '/');
array_push ($table->data, $data);
break;
@ -2189,7 +2189,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
0,
$report["datetime"],
true,
'',
$config['homedir'] . '/',
1,
// Important parameter, this tell to graphic_combined_module function that is a projection graph
$output_projection,
@ -2250,7 +2250,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
$data = array ();
$data[0] = grafico_modulo_sparse($content['id_agent_module'], $content['period'],
false, $sizgraph_w, $sizgraph_h, '', '', false, true, true,
$report["datetime"], '', true, 0, true, true);
$report["datetime"], '', true, 0, true, true, $config['homedir'] . '/');
/*$data[0] = graphic_combined_module(
$modules,
@ -2316,7 +2316,8 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
0,
$graph["stacked"],
$report["datetime"],
true);
true,
$config['homeurl'] . "/");
array_push ($table->data, $data);
break;
@ -2398,7 +2399,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
foreach ($slas as $sla) {
$server_name = $sla ['server_name'];
//Metaconsole connection
if (($config ['metaconsole'] == 1) && $server_name != '') {
if (($config ['metaconsole'] == 1) && $server_name != '' && defined('METACONSOLE')) {
$connection = metaconsole_get_connection($server_name);
if (!metaconsole_load_external_db($connection)) {
//ui_print_error_message ("Error connecting to ".$server_name);
@ -2439,7 +2440,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
$server_name = $sla ['server_name'];
//Metaconsole connection
if (($config ['metaconsole'] == 1) && $server_name != '') {
if (($config ['metaconsole'] == 1) && $server_name != '' && defined('METACONSOLE')) {
$connection = metaconsole_get_connection($server_name);
if (!metaconsole_load_external_db($connection)) {
//ui_print_error_message ("Error connecting to ".$server_name);
@ -2530,12 +2531,12 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
$dataslice[1] = graph_sla_slicebar ($sla['id_agent_module'], $content['period'],
$sla['sla_min'], $sla['sla_max'], $report['datetime'], $content, $content['time_from'],
$content['time_to'], 650, 25,'');
$content['time_to'], 650, 25, $config['homeurl'] . '/');
array_push ($tableslice->data, $dataslice);
}
if ($config ['metaconsole'] == 1) {
if ($config ['metaconsole'] == 1 && defined('METACONSOLE')) {
//Restore db connection
metaconsole_restore_db();
}
@ -2553,7 +2554,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
$data_pie_graph = json_encode ($data_graph);
if ($show_graphs && !empty($slas)) {
$data[0] = pie3d_graph(false, $data_graph,
500, 150, __("other"), "", $config['homedir'] . "/images/logo_vertical_water.png",
500, 150, __("other"), $config['homeurl'] . '/', $config['homedir'] . "/images/logo_vertical_water.png",
$config['fontpath'], $config['font_size']);
@ -2867,7 +2868,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
$data = array ();
$data[0] = graph_custom_sql_graph($content["id_rc"], $sizgraph_w, 200, $content["type"], true);
$data[0] = graph_custom_sql_graph($content["id_rc"], $sizgraph_w, 200, $content["type"], true, $config['homeurl'] . '/');
array_push($table->data, $data);
break;
@ -3258,7 +3259,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
foreach ($generals as $key => $row) {
//Metaconsole connection
$server_name = $row ['server_name'];
if (($config ['metaconsole'] == 1) && $server_name != '') {
if (($config ['metaconsole'] == 1) && $server_name != '' && defined('METACONSOLE')) {
$connection = metaconsole_get_connection($server_name);
if (metaconsole_load_external_db($connection) != NOERR) {
//ui_print_error_message ("Error connecting to ".$server_name);
@ -3294,7 +3295,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
$operations[$key] = $row['operation'];
//Restore dbconnection
if (($config ['metaconsole'] == 1) && $server_name != '') {
if (($config ['metaconsole'] == 1) && $server_name != '' && defined('METACONSOLE')) {
metaconsole_restore_db();
}
}
@ -3303,11 +3304,11 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
switch ($order_uptodown) {
//Descending
case 1:
array_multisort($data_res, SORT_DESC, $agent_name, SORT_ASC, $module_name, SORT_ASC, $id_agent_module, SORT_ASC);
array_multisort($data_res, SORT_DESC, $agent_name, SORT_ASC, $module_name, SORT_ASC, $id_agent_module, SORT_ASC, $operations, SORT_ASC);
break;
//Ascending
case 2:
array_multisort($data_res, SORT_ASC, $agent_name, SORT_ASC, $module_name, SORT_ASC, $id_agent_module, SORT_ASC);
array_multisort($data_res, SORT_ASC, $agent_name, SORT_ASC, $module_name, SORT_ASC, $id_agent_module, SORT_ASC, $operations, SORT_ASC);
break;
}
$i=0;
@ -3345,17 +3346,36 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
}
//Order by agent name
elseif ($order_uptodown == 3) {
array_multisort($agent_name, SORT_ASC, $data_avg, SORT_ASC, $module_name, SORT_ASC, $id_agent_module, SORT_ASC);
array_multisort($agent_name, SORT_ASC, $data_res, SORT_ASC, $module_name, SORT_ASC, $id_agent_module, SORT_ASC, $operations, SORT_ASC);
$i=0;
foreach ($agent_name as $a) {
$data = array();
$data[0] = $agent_name[$i];
$data[1] = $module_name[$i];
switch ($operations[$i]) {
case 'sum':
$op = __('Summatory');
break;
case 'min':
$op = __('Minimal');
break;
case 'max':
$op = __('Maximun');
break;
case 'avg':
default:
$op = __('Average');
break;
}
$data[2] = $op;
if ($data_res[$i] === false) {
$data[2] = '--';
$data[3] = '--';
}
else {
$data[2] = format_for_graph($data_res[$i], 2) . " " . $units[$i];
$data[3] = format_for_graph($data_res[$i], 2) . " " . $units[$i];
}
array_push ($table1->data, $data);
$i++;
@ -3388,7 +3408,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
foreach ($generals as $general) {
//Metaconsole connection
$server_name = $general ['server_name'];
if (($config ['metaconsole'] == 1) && $server_name != '') {
if (($config ['metaconsole'] == 1) && $server_name != '' && defined('METACONSOLE')) {
$connection = metaconsole_get_connection($server_name);
if (metaconsole_load_external_db($connection) != NOERR) {
//ui_print_error_message ("Error connecting to ".$server_name);
@ -3404,11 +3424,11 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
if (!in_array ($mod_name, $modules_list)) {
array_push ($modules_list, $mod_name);
}
if (!in_array ($general['operation'], $operation_list)) {
//if (!in_array ($general['operation'], $operation_list)) {
array_push ($operation_list, $general['operation']);
}
//}
//Restore dbconnection
if (($config ['metaconsole'] == 1) && $server_name != '') {
if (($config ['metaconsole'] == 1) && $server_name != '' && defined('METACONSOLE')) {
metaconsole_restore_db();
}
}
@ -3435,7 +3455,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
foreach ($generals as $g) {
//Metaconsole connection
$server_name = $g ['server_name'];
if (($config ['metaconsole'] == 1) && $server_name != '') {
if (($config ['metaconsole'] == 1) && $server_name != '' && defined('METACONSOLE')) {
$connection = metaconsole_get_connection($server_name);
if (metaconsole_load_external_db($connection) != NOERR) {
//ui_print_error_message ("Error connecting to ".$server_name);
@ -3474,10 +3494,20 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
else {
$data[$i] = '--';
}
if ($found == true) break;
if ($found == true) {
//Restore dbconnection
if (($config ['metaconsole'] == 1) && $server_name != '') {
if (($config ['metaconsole'] == 1) && $server_name != '' && defined('METACONSOLE')) {
metaconsole_restore_db();
}
break;
}
//Restore dbconnection
if (($config ['metaconsole'] == 1) && $server_name != '' && defined('METACONSOLE')) {
metaconsole_restore_db();
}
}
@ -3500,7 +3530,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
do {
//Metaconsole connection
$server_name = $generals[$i]['server_name'];
if (($config ['metaconsole'] == 1) && $server_name != '') {
if (($config ['metaconsole'] == 1) && $server_name != '' && defined('METACONSOLE')) {
$connection = metaconsole_get_connection($server_name);
if (metaconsole_load_external_db($connection) != NOERR) {
//ui_print_error_message ("Error connecting to ".$server_name);
@ -3525,7 +3555,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
$i++;
//Restore dbconnection
if (($config ['metaconsole'] == 1) && $server_name != '') {
if (($config ['metaconsole'] == 1) && $server_name != '' && defined('METACONSOLE')) {
metaconsole_restore_db();
}
} while ($min === false && $i < count($generals));
@ -3540,7 +3570,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
foreach ($generals as $g) {
//Metaconsole connection
$server_name = $g['server_name'];
if (($config ['metaconsole'] == 1) && $server_name != '') {
if (($config ['metaconsole'] == 1) && $server_name != '' && defined('METACONSOLE')) {
$connection = metaconsole_get_connection($server_name);
if (metaconsole_load_external_db($connection) != NOERR) {
//ui_print_error_message ("Error connecting to ".$server_name);
@ -3575,7 +3605,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
}
//Restore dbconnection
if (($config ['metaconsole'] == 1) && $server_name != '') {
if (($config ['metaconsole'] == 1) && $server_name != '' && defined('METACONSOLE')) {
metaconsole_restore_db();
}
}
@ -3677,7 +3707,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
//Metaconsole connection
$server_name = $row['server_name'];
if (($config ['metaconsole'] == 1) && $server_name != '') {
if (($config ['metaconsole'] == 1) && $server_name != '' && defined('METACONSOLE')) {
$connection = metaconsole_get_connection($server_name);
if (metaconsole_load_external_db($connection) != NOERR) {
//ui_print_error_message ("Error connecting to ".$server_name);
@ -3716,7 +3746,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
}
//Restore dbconnection
if (($config ['metaconsole'] == 1) && $server_name != '') {
if (($config ['metaconsole'] == 1) && $server_name != '' && defined('METACONSOLE')) {
metaconsole_restore_db();
}
}
@ -3826,7 +3856,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
$data = array();
if ($show_graph == 1 || $show_graph == 2) {
$data[0] = pie3d_graph(false, $data_pie_graph,
$sizgraph_w, $sizgraph_h, __("other"),"", $config['homedir'] . "/images/logo_vertical_water.png",
$sizgraph_w, $sizgraph_h, __("other"),$config['homeurl'] . "/", $config['homedir'] . "/images/logo_vertical_water.png",
$config['fontpath'], $config['font_size']);
array_push ($table->data, $data);
@ -3835,7 +3865,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
$table->style[0] .= 'text-align:center';
$height = count($data_pie_graph)*20+35;
$data = array();
$data[0] = hbar_graph(false, $data_hbar, $sizgraph_w, $height, array(), array(), "", "", true, "", $config['homedir'] . "/images/logo_vertical_water.png", $config['fontpath'], $config['font_size'], true, 1, true);
$data[0] = hbar_graph(false, $data_hbar, $sizgraph_w, $height, array(), array(), "", "", true, $config['homeurl'] . "/", $config['homedir'] . "/images/logo_vertical_water.png", $config['fontpath'], $config['font_size'], true, 1, true);
array_push ($table->data, $data);
}
@ -3944,7 +3974,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
do {
//Metaconsole connection
$server_name = $exceptions[$i]['server_name'];
if (($config ['metaconsole'] == 1) && $server_name != '') {
if (($config ['metaconsole'] == 1) && $server_name != '' && defined('METACONSOLE')) {
$connection = metaconsole_get_connection($server_name);
if (metaconsole_load_external_db($connection) != NOERR) {
//ui_print_error_message ("Error connecting to ".$server_name);
@ -3956,7 +3986,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
$i++;
//Restore dbconnection
if (($config ['metaconsole'] == 1) && $server_name != '') {
if (($config ['metaconsole'] == 1) && $server_name != '' && defined('METACONSOLE')) {
metaconsole_restore_db();
}
} while ($min === false && $i < count($exceptions));
@ -3967,7 +3997,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
foreach ($exceptions as $exc) {
//Metaconsole connection
$server_name = $exc['server_name'];
if (($config ['metaconsole'] == 1) && $server_name != '') {
if (($config ['metaconsole'] == 1) && $server_name != '' && defined('METACONSOLE')) {
$connection = metaconsole_get_connection($server_name);
if (metaconsole_load_external_db($connection) != NOERR) {
//ui_print_error_message ("Error connecting to ".$server_name);
@ -4025,7 +4055,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
$units[] = $unit;
}
//Restore dbconnection
if (($config ['metaconsole'] == 1) && $server_name != '') {
if (($config ['metaconsole'] == 1) && $server_name != '' && defined('METACONSOLE')) {
metaconsole_restore_db();
}
}
@ -4122,7 +4152,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
$data = array();
if ($show_graph == 1 || $show_graph == 2) {
$data[0] = pie3d_graph(false, $data_pie_graph,
600, 150, __("other"), "", $config['homedir'] . "/images/logo_vertical_water.png",
600, 150, __("other"), $config['homeurl'] . "/", $config['homedir'] . "/images/logo_vertical_water.png",
$config['fontpath'], $config['font_size']);
array_push ($table->data, $data);
//Display bars graph
@ -4424,8 +4454,8 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
break;
}
//Restore dbconnection
if (($config ['metaconsole'] == 1) && $server_name != '') {
metaconsole_restore_db();
if (($config ['metaconsole'] == 1) && $server_name != '' && defined('METACONSOLE')) {
metaconsole_restore_db_force();
}
}

View File

@ -247,7 +247,7 @@ function area_graph($flash_chart, $chart_data, $width, $height, $color, $legend,
}
if (empty($chart_data)) {
return html_print_image($no_data_image, true, array("border" => '0'));
return '<img src="'.$no_data_image.'">';
}
if ($flash_chart) {
@ -279,7 +279,7 @@ function stacked_area_graph($flash_chart, $chart_data, $width, $height, $color,
setup_watermark($water_mark, $water_mark_file, $water_mark_url);
if (empty($chart_data)) {
return html_print_image($no_data_image, true, array("border" => '0'));
return '<img src="'.$no_data_image.'">';
}
if($flash_chart) {
@ -314,7 +314,7 @@ function stacked_line_graph($flash_chart, $chart_data, $width, $height, $color,
setup_watermark($water_mark, $water_mark_file, $water_mark_url);
if (empty($chart_data)) {
return html_print_image($no_data_image, true, array("border" => '0'));
return '<img src="'.$no_data_image.'">';
}
if($flash_chart) {
@ -349,7 +349,7 @@ function line_graph($flash_chart, $chart_data, $width, $height, $color, $legend,
setup_watermark($water_mark, $water_mark_file, $water_mark_url);
if (empty($chart_data)) {
return html_print_image($no_data_image, true, array("border" => '0'));
return '<img src="'.$no_data_image.'">';
}
if($flash_chart) {
@ -376,7 +376,7 @@ function line_graph($flash_chart, $chart_data, $width, $height, $color, $legend,
function kiviat_graph($graph_type, $flash_chart, $chart_data, $width, $height, $no_data_image, $ttl = 1, $homedir="") {
if (empty($chart_data)) {
return html_print_image($no_data_image, true, array("border" => '0'));
return '<img src="'.$no_data_image.'">';
}
$graph = array();

View File

@ -132,6 +132,7 @@ function isEmptyObject(obj) {
* @param selected Which module(s) have to be selected
*/
function agent_changed_by_multiple_agents (event, id_agent, selected) {
// Hack to add custom condition
if($("#hidden-custom_condition").val() != undefined) {
custom_condition = $("#hidden-custom_condition").val();
@ -164,7 +165,15 @@ function agent_changed_by_multiple_agents (event, id_agent, selected) {
$('#module').attr ('disabled', 1);
$('#module').empty ();
$('#module').append ($('<option></option>').html ("Loading...").attr ("value", 0));
jQuery.post ('ajax.php',
// Check if homedir was received like a JSON
homedir = '';
if (event.data == null)
homedir += '.';
else
homedir = event.data.homedir;
jQuery.post (homedir + '/ajax.php',
{"page": "operation/agentes/ver_agente",
"get_agent_modules_json_for_multiple_agents": 1,
"id_agent[]": idAgents,
@ -206,7 +215,7 @@ function agent_changed_by_multiple_agents (event, id_agent, selected) {
}
jQuery.each (data, function (i, val) {
s = js_html_entity_decode(val);
$('#module').append ($('<option></option>').html (s).attr ("value", val));
$('#module').append ($('<option></option>').html (s).attr ("value", i));
$('#module').fadeIn ('normal');
});
if (selected != undefined)
@ -433,7 +442,7 @@ function agent_changed_by_multiple_agents_id (event, id_agent, selected) {
* @param id_agent_id id of the hidden field to store the agent id
* @param id_agent_module_selector id of the selector for the modules of the agent.
*/
function agent_module_autocomplete (id_agent_name, id_agent_id, id_agent_module_selector, id_server_name, noneValue) {
function agent_module_autocomplete (id_agent_name, id_agent_id, id_agent_module_selector, id_server_name, noneValue, homedir = '.') {
//Check exist the field with id in the var id_agent_name.
if ($(id_agent_name).length == 0)
return;
@ -450,7 +459,7 @@ function agent_module_autocomplete (id_agent_name, id_agent_id, id_agent_module_
data: data_params,
async: false,
type: 'POST',
url: action="ajax.php",
url: action= homedir + "/ajax.php",
timeout: 10000,
dataType: 'json',
success: function (data) {
@ -496,7 +505,7 @@ function agent_module_autocomplete (id_agent_name, id_agent_id, id_agent_module_
jQuery.ajax ({
data: data_params,
type: 'POST',
url: action="ajax.php",
url: action= homedir + "/ajax.php",
timeout: 10000,
dataType: 'json',
success: function (data) {

View File

@ -178,16 +178,22 @@ if (is_ajax ()) {
break;
}
if ($config ['metaconsole'] == 1) {
if ($config ['metaconsole'] == 1 and defined('METACONSOLE')) {
$result = array();
$nameModules = array();
$temp = array();
$first = true;
$temp_element = array();
$counter = 0;
$first_elements = array();
foreach ($idAgents as $idA) {
$row = explode ('|', $idA);
$server_name = $row[0];
$id_agent = $row [1];
// New iteration
$counter++;
//Metaconsole db connection
$connection = metaconsole_get_connection($server_name);
@ -199,26 +205,61 @@ if (is_ajax ()) {
//Get agent's modules
$temp = agents_get_modules ($id_agent);
//Copy only the very first result to $nameModules
// Keep first element to search for common modules in next iterations
if (empty($nameModules) && $first == true) {
$first_elements = $temp;
}
$temp = array_intersect($temp, $first_elements);
// Add elements to array
if (!empty($temp)) {
// Add agent and server
foreach ($temp as $element_key => $element_value) {
//$temp_element[$element_key . '|' . $id_agent . '|' . $server_name] = $element_value;
if (!isset($temp_element[$element_value]) && $first)
$temp_element[$element_value] = $element_key . '|' . $id_agent . '|' . $server_name;
else if (isset($temp_element[$element_value]))
$temp_element[$element_value] .= ';' . $element_key . '|' . $id_agent . '|' . $server_name;
}
}
// If the result array is empty then there aren't common modules
else if (!$first)
unset($temp_element);
// First iteration flag
if (empty($nameModules) && $first == true)
$first = false;
$nameModules = $temp;
// In last iteration we have all elements agents-servers serialized and ready to be used
if ($counter == count($idAgents)) {
if (!empty($temp_element))
foreach ($temp_element as $temp_ele_key => $temp_ele_val) {
$nameModules[$temp_ele_val] = $temp_ele_key;
}
}
//If there's only one agent selected, get out of this loop
if (count($idAgents) <= 1) {
/*if (count($idAgents) <= 1) {
//Restore db connection
metaconsole_restore_db();
break;
}
$nameModules = array_intersect ($nameModules, $temp);
}*/
//$nameModules = array_intersect ($nameModules, $temp);
//Restore db connection
metaconsole_restore_db();
}
foreach ($nameModules as $nameModule) {
$result[] = io_safe_output($nameModule);
foreach ($nameModules as $nameModule_key => $nameModule_value) {
$result[$nameModule_key] = io_safe_output($nameModule_value);
}
}
else {
@ -247,7 +288,7 @@ if (is_ajax ()) {
$result = array();
foreach($nameModules as $nameModule) {
$result[] = io_safe_output($nameModule['nombre']);
$result[$nameModule['nombre'].'$*$'.implode('|', $idAgents)] = io_safe_output($nameModule['nombre']);
}
}
@ -272,7 +313,7 @@ if (is_ajax ()) {
else
$search = false;
if ($config ['metaconsole'] == 1 and !$force_local_modules) {
if ($config ['metaconsole'] == 1 and !$force_local_modules and defined('METACONSOLE')) {
if (enterprise_include_once ('include/functions_metaconsole.php') !== ENTERPRISE_NOT_HOOK) {
$connection = metaconsole_get_connection($server_name);
if (metaconsole_load_external_db($connection) == NOERR) {

View File

@ -38,8 +38,8 @@ if (! check_acl ($config['id_user'], $report['id_group'], "AR")) {
}
// Include with the functions to calculate each kind of report.
require_once ('include/functions_reporting.php');
require_once ('include/functions_groups.php');
require_once ($config['homedir'] . '/include/functions_reporting.php');
require_once ($config['homedir'] . '/include/functions_groups.php');
enterprise_include("include/functions_reporting.php");
@ -65,9 +65,15 @@ $enable_init_date = get_parameter('enable_init_date', 0);
// Standard header
$url = "index.php?sec=reporting&sec2=operation/reporting/reporting_viewer&id=$id_report&date=$date&time=$time";
// Build link for sort actions: metaconsole and normal console
$variable_link = ui_get_full_url(false);
// Metaconsole
if ($config['metaconsole'] == 1 and defined('METACONSOLE'))
$variable_link .= '/enterprise/meta/';
$options['setup'] = "<a href='index.php?sec=reporting&sec2=godmode/reporting/reporting_builder&action=new&tab=item_editor&id_report=$id_report'>"
$url = $variable_link . "index.php?sec=reporting&sec2=" . $config['homedir'] . "/operation/reporting/reporting_viewer&id=$id_report&date=$date&time=$time";
$options['setup'] = "<a href='" . $variable_link . "index.php?sec=reporting&sec2=" . $config['homedir'] . "/godmode/reporting/reporting_builder&action=new&tab=item_editor&id_report=$id_report'>"
. html_print_image ("images/setup.png", true, array ("title" => __('Setup')))
. "</a>";
@ -82,6 +88,17 @@ else {
. "</a>";
}
// Page header for metaconsole
if ($config['metaconsole'] == 1 and defined('METACONSOLE')) {
// Bread crumbs
ui_meta_add_breadcrumb(array('link' => 'index.php?sec=reporting&sec2=' . $config['homedir'] . '/godmode/reporting/reporting_builder', 'text' => __('Reporting')));
ui_meta_print_page_header($nav_bar);
// Print header
ui_meta_print_header(__('Reporting'), "", $options);
}
else
ui_print_page_header (__('Reporting'). " &raquo; ". __('Custom reporting'). " - ".$report["name"],
"images/reporting.png", false, "", false, $options);

View File

@ -984,7 +984,8 @@ CREATE TABLE treport (
footer CLOB default NULL,
custom_font VARCHAR2(200) default NULL,
id_template NUMBER(10, 0) default 0 NOT NULL,
id_group_edit NUMBER(19, 0) default 0 NOT NULL
id_group_edit NUMBER(19, 0) default 0 NOT NULL,
metaconsole NUMBER(5, 0) DEFAULT 0
);
CREATE SEQUENCE treport_s INCREMENT BY 1 START WITH 1;

View File

@ -828,7 +828,8 @@ CREATE TABLE "treport" (
"footer" TEXT default NULL,
"custom_font" varchar(200) default NULL,
"id_template" BIGINT NOT NULL default 0,
"id_group_edit" BIGINT NOT NULL default 0
"id_group_edit" BIGINT NOT NULL default 0,
"metaconsole" SMALLINT DEFAULT 0
);
-- -----------------------------------------------------

View File

@ -956,6 +956,7 @@ CREATE TABLE IF NOT EXISTS `treport` (
`custom_font` varchar(200) default NULL,
`id_template` INTEGER UNSIGNED DEFAULT 0,
`id_group_edit` mediumint(8) unsigned NULL DEFAULT 0,
`metaconsole` tinyint(1) DEFAULT 0,
PRIMARY KEY(`id_report`)
) ENGINE = InnoDB DEFAULT CHARSET=utf8;