2012-12-18 Juan Manuel Ramon <juanmanuel.ramon@artica.es>

* include/functions_reporting.php
	include/functions_reports.php
	extensions/resource_registration.php
	extensions/resource_exportation.php
	operation/reporting/reporting_xml.php
	godmode/reporting/reporting_builder.list_items.php
	godmode/reporting/reporting_builder.php
	godmode/reporting/reporting_builder.item_editor.php: Fixed report
	templates.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7303 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
juanmanuelr 2012-12-18 15:47:11 +00:00
parent 57c85500b3
commit 6e8b5a435a
9 changed files with 357 additions and 306 deletions

View File

@ -1,3 +1,15 @@
2012-12-18 Juan Manuel Ramon <juanmanuel.ramon@artica.es>
* include/functions_reporting.php
include/functions_reports.php
extensions/resource_registration.php
extensions/resource_exportation.php
operation/reporting/reporting_xml.php
godmode/reporting/reporting_builder.list_items.php
godmode/reporting/reporting_builder.php
godmode/reporting/reporting_builder.item_editor.php: Fixed report
templates.
2012-12-18 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_config.php: fixed check if it set the id_user

View File

@ -123,6 +123,7 @@ function output_xml_report($id) {
break;
case 2:
case 'custom_graph':
case 'automatic_custom_graph':
$graph = db_get_value('name', 'tgraph', 'id_graph', $item['id_gs']);
echo "<graph><![CDATA[" . io_safe_output($graph) . "]]></graph>\n";
break;

View File

@ -174,6 +174,7 @@ function process_upload_xml_report($xml, $group_filter = 0) {
break;
case 2:
case 'custom_graph':
case 'automatic_custom_graph':
$group = db_get_value('id_grupo', 'tgrupo', 'nombre', io_safe_input($item['graph']));
$values['id_gs'] = $group;
break;

View File

@ -85,6 +85,7 @@ $resolution = 0;
switch ($action) {
case 'new':
$actionParameter = 'save';
$type = get_parameter('type', 'SLA');
$description = null;
$sql = null;
@ -92,8 +93,36 @@ switch ($action) {
$show_in_landscape = 0;
$server_name = '';
break;
case 'save':
default:
$actionParameter = 'update';
// If we are creating a new report item then clean interface and display creation view
$type = get_parameter('type', 'SLA');
switch ($type) {
case 'SLA':
case 'top_n':
case 'exception':
case 'general':
$get_data_editor = true;
break;
default:
$actionParameter = 'save';
$action = 'new';
$type = 'SLA';
$description = null;
$sql = null;
$show_in_two_columns = 0;
$show_in_landscape = 0;
$server_name = '';
$get_data_editor = false;
break;
}
// Get data to fill editor if type is not SLA, top_n, exception, general
if ($get_data_editor) {
$item = db_get_row_filter('treport_content', array('id_rc' => $idItem));
$server_name = $item ['server_name'];
@ -145,6 +174,7 @@ switch ($action) {
$period_pg = $item['period'];
break;
case 'custom_graph':
case 'automatic_custom_graph':
$description = $item['description'];
$period = $item['period'];
$idCustomGraph = $item['id_gs'];
@ -366,6 +396,7 @@ switch ($action) {
&& defined('METACONSOLE')) {
metaconsole_restore_db();
}
}
break;
}
@ -382,7 +413,7 @@ html_print_input_hidden('id_item', $idItem);
<td style="">
<?php
if ($action == 'new') {
html_print_select(reports_get_report_types(), 'type', $type, 'chooseType();', '', '');
html_print_select(reports_get_report_types(false, true), 'type', $type, 'chooseType();', '', '');
}
else {
$report_type = reports_get_report_types($type);
@ -1500,20 +1531,10 @@ function addGeneralRow() {
$("input[name=id_agent_general]").val('');
$("input[name=server_name_general]").val('');
$("input[name=agent_general]").val('');
$("#id_operation_module_general").val('avg');
$("#id_agent_module_general").empty();
$("#id_agent_module_general").attr('disabled', 'true');
$("#id_agent_module_general").append(
$("<option></option>")
.attr ("value", 0)
.html ($("#module_general_text").html()));
$("#id_operation_module_general").empty();
$("#id_operation_module_general").attr('disabled', 'true');
$("#id_operation_module_general").append(
$("<option></option>")
.attr ("value", 0)
//.html ($("#id_operation_general_text").html()));
.html ($("#operation_general_text").html()));
}
}
});
@ -1602,6 +1623,7 @@ function chooseType() {
$("#row_show_in_two_columns").show();
break;
case 'custom_graph':
case 'automatic_custom_graph':
$("#row_description").show();
$("#row_period").show();
$("#row_custom_graph").show();

View File

@ -122,6 +122,9 @@ else {
$types = array();
foreach ($rows as $row) {
if ($row['type'] == 'automatic_custom_graph')
$types['custom_graph'] = get_report_name($row['type']);
else
$types[$row['type']] = get_report_name($row['type']);
}
}
@ -163,6 +166,9 @@ echo '</div>';
$where = '1=1';
if ($typeFilter != '0') {
if ($typeFilter == 'custom_graph')
$where .= ' AND (type = "' . $typeFilter . '" or type = "automatic_custom_graph") ';
else
$where .= ' AND type = "' . $typeFilter . '"';
}
if ($agentFilter != 0) {

View File

@ -463,10 +463,6 @@ switch ($action) {
}
html_print_table ($table);
}
else {
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&pure='.$pure.'">';
@ -706,14 +702,14 @@ switch ($action) {
if ($values['server_name'] == '')
$values['server_name'] = get_parameter ('combo_server');
if (($values['type'] == 'custom_graph') && ($values['id_gs'] == 0 || $values['id_gs'] == '')) {
if ((($values['type'] == 'custom_graph') or ($values['type'] == 'automatic_custom_graph')) && ($values['id_gs'] == 0 || $values['id_gs'] == '')) {
$resultOperationDB = false;
break;
}
// If metaconsole is activated
if ($config['metaconsole'] == 1) {
if ($values['type'] == 'custom_graph') {
if ($config['metaconsole'] == 1 && defined('METACONSOLE')) {
if (($values['type'] == 'custom_graph') or ($values['type'] == 'automatic_custom_graph')) {
$id_gs = substr ($values['id_gs'], 0, strpos ($values['id_gs'], '|'));
if ($id_gs !== false) {
$server_name = strstr($values ['id_gs'], '|');
@ -899,13 +895,13 @@ switch ($action) {
if ($values['server_name'] == '')
$values['server_name'] = get_parameter ('combo_server');
if (($values['type'] == 'custom_graph') && ($values['id_gs'] == 0 || $values['id_gs'] == '')) {
if ((($values['type'] == 'custom_graph') or ($values['type'] == 'automatic_custom_graph')) && ($values['id_gs'] == 0 || $values['id_gs'] == '')) {
$resultOperationDB = false;
break;
}
if ($config['metaconsole'] == 1 && defined('METACONSOLE')) {
if ($values['type'] == 'custom_graph') {
if (($values['type'] == 'custom_graph') or ($values['type'] == 'automatic_custom_graph')) {
$id_gs = substr ($values['id_gs'], 0, strpos ($values['id_gs'], '|'));
if ($id_gs !== false && $id_gs !== '') {
$server_name = strstr($values ['id_gs'], '|');

View File

@ -2394,6 +2394,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
case 2:
case 'custom_graph':
case 'automatic_custom_graph':
$graph = db_get_row ("tgraph", "id_graph", $content['id_gs']);
reporting_header_content($mini, $content, $report, $table, __('Custom graph'),

View File

@ -420,6 +420,9 @@ function get_report_name ($type, $template = false) {
if (! isset ($types[$type]))
return __('Unknown');
if ($type == 'automatic_custom_graph')
return __('Custom graph');
return $types[$type]['name'];
}
@ -452,6 +455,7 @@ function get_report_type_data_source ($type) {
break;
case 2:
case 'custom_graph':
case 'automatic_custom_graph':
return 'custom-graph';
break;
case 3:
@ -477,10 +481,11 @@ function get_report_type_data_source ($type) {
* Get report types in an array.
*
* @param boolean $template Set true for to get types for templates. By default false.
* @param boolean $not_editor When this function is not used in item editors.
*
* @return array An array with all the possible reports in Pandora where the array index is the report id.
*/
function reports_get_report_types ($template = false) {
function reports_get_report_types ($template = false, $not_editor = false) {
global $config;
$types = array ();
@ -489,6 +494,9 @@ function reports_get_report_types ($template = false) {
'name' => __('Simple graph'));
$types['simple_baseline_graph'] = array('optgroup' => __('Graphs'),
'name' => __('Simple baseline graph'));
if ($not_editor == false)
$types['automatic_custom_graph'] = array('optgroup' => __('Graphs'),
'name' => __('Custom graph'));
$types['custom_graph'] = array('optgroup' => __('Graphs'),
'name' => __('Custom graph'));
# Only pandora managers have access to the whole database
@ -597,6 +605,8 @@ function reports_get_report_types ($template = false) {
$types['group_configuration'] = array('optgroup' => __('Configuration'),
'name' => __('Group configuration'));
if (!$template) {
$types['netflow_area'] = array('optgroup' => __('Netflow'),
'name' => __('Netflow area chart'));
$types['netflow_pie'] = array('optgroup' => __('Netflow'),
@ -607,6 +617,7 @@ function reports_get_report_types ($template = false) {
'name' => __('Netflow statistics table'));
$types['netflow_summary'] = array('optgroup' => __('Netflow'),
'name' => __('Netflow summary table'));
}
return $types;
}

View File

@ -380,6 +380,7 @@ foreach ($contents as $content) {
break;
case 2:
case 'custom_graph':
case 'automatic_custom_graph':
$data["module"] = io_safe_output_xml (db_get_value ('nombre', 'tagente_modulo', 'id_agente_modulo', $content['id_agent_module']));
$data["agent"] = io_safe_output_xml (modules_get_agentmodule_agent_name ($content['id_agent_module']));