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

* include/functions_reporting.php
	 include/javascript/pandora.js
	 include/functions_ui.php
	 operation/reporting/reporting_viewer.php
	 godmode/reporting/reporting_builder.php
	 godmode/reporting/reporting_builder.item_editor.php: Urls 
	 compatible with reverse proxy functionality.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6960 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
juanmanuelr 2012-09-11 19:16:11 +00:00
parent eeb662ee2c
commit 5dc689693e
7 changed files with 56 additions and 38 deletions

View File

@ -1,3 +1,13 @@
2012-09-11 Juan Manuel Ramon <juanmanuel.ramon@artica.es>
* include/functions_reporting.php
include/javascript/pandora.js
include/functions_ui.php
operation/reporting/reporting_viewer.php
godmode/reporting/reporting_builder.php
godmode/reporting/reporting_builder.item_editor.php: Urls
compatible with reverse proxy functionality.
2012-09-11 Sergio Martin <sergio.martin@artica.es>
* include/javascript/pandora_modules.js: Fixed the reset of the

View File

@ -986,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', 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'] . '"'; ?>);
agent_module_autocomplete('#text-agent', '#hidden-id_agent', '#id_agent_module', '#hidden-server_name', undefined, <?php echo '"' . ui_get_full_url(false) . '"'; ?>);
agent_module_autocomplete('#text-agent_sla', '#hidden-id_agent_sla', '#id_agent_module_sla', '#hidden-server_name', undefined, <?php echo '"' . ui_get_full_url(false) . '"'; ?>);
agent_module_autocomplete('#text-agent_general', '#hidden-id_agent_general', '#id_agent_module_general', '#hidden-server_name_general', '#id_operation_module_general', <?php echo '"' . ui_get_full_url(false) . '"'; ?>);
chooseType();
chooseSQLquery();
@ -1025,7 +1025,7 @@ function create_custom_graph() {
jQuery.ajax ({
data: params1.join ("&"),
type: 'POST',
url: action= <?php echo '"' . $config['homeurl'] . '"'; ?> + "/ajax.php",
url: action= <?php echo '"' . ui_get_full_url(false) . '"'; ?> + "/ajax.php",
async: false,
timeout: 10000,
success: function (data) {
@ -1041,7 +1041,7 @@ function create_custom_graph() {
jQuery.ajax ({
data: params1.join ("&"),
type: 'POST',
url: action= <?php echo '"' . $config['homeurl'] . '"'; ?> + "/ajax.php",
url: action= <?php echo '"' . ui_get_full_url(false) . '"'; ?> + "/ajax.php",
async: false,
timeout: 10000,
success: function (data) {
@ -1087,7 +1087,7 @@ function edit_custom_graph() {
jQuery.ajax ({
data: params1.join ("&"),
type: 'POST',
url: action= <?php echo '"' . $config['homeurl'] . '"'; ?> + "/ajax.php",
url: action= <?php echo '"' . ui_get_full_url(false) . '"'; ?> + "/ajax.php",
async: false,
timeout: 10000,
success: function (data) {
@ -1103,7 +1103,7 @@ function edit_custom_graph() {
jQuery.ajax ({
data: params1.join ("&"),
type: 'POST',
url: action= <?php echo '"' . $config['homeurl'] . '"'; ?> + "/ajax.php",
url: action= <?php echo '"' . ui_get_full_url(false) . '"'; ?> + "/ajax.php",
async: false,
timeout: 10000,
success: function (data) {
@ -1152,7 +1152,7 @@ function chooseSQLquery() {
jQuery.ajax ({
data: params1.join ("&"),
type: 'POST',
url: action= <?php echo '"' . $config['homeurl'] . '"'; ?> + "/ajax.php",
url: action= <?php echo '"' . ui_get_full_url(false) . '"'; ?> + "/ajax.php",
async: false,
timeout: 10000,
success: function (data) {
@ -1167,7 +1167,7 @@ function chooseSQLquery() {
jQuery.ajax ({
data: params.join ("&"),
type: 'POST',
url: action= <?php echo '"' . $config['homeurl'] . '"'; ?> + "/ajax.php",
url: action= <?php echo '"' . ui_get_full_url(false) . '"'; ?> + "/ajax.php",
timeout: 10000,
dataType: 'json',
success: function (data) {
@ -1188,7 +1188,7 @@ function deleteSLARow(id_row) {
jQuery.ajax ({
data: params.join ("&"),
type: 'POST',
url: action= <?php echo '"' . $config['homeurl'] . '"'; ?> + "/ajax.php",
url: action= <?php echo '"' . ui_get_full_url(false) . '"'; ?> + "/ajax.php",
timeout: 10000,
dataType: 'json',
success: function (data) {
@ -1208,7 +1208,7 @@ function deleteGeneralRow(id_row) {
jQuery.ajax ({
data: params.join ("&"),
type: 'POST',
url: action= <?php echo '"' . $config['homeurl'] . '"'; ?> + "/ajax.php",
url: action= <?php echo '"' . ui_get_full_url(false) . '"'; ?> + "/ajax.php",
timeout: 10000,
dataType: 'json',
success: function (data) {
@ -1239,7 +1239,7 @@ function addSLARow() {
jQuery.ajax ({
data: params.join ("&"),
type: 'POST',
url: action= <?php echo '"' . $config['homeurl'] . '"'; ?> + "/ajax.php",
url: action= <?php echo '"' . ui_get_full_url(false) . '"'; ?> + "/ajax.php",
async: false,
timeout: 10000,
success: function (data) {
@ -1254,7 +1254,7 @@ function addSLARow() {
jQuery.ajax ({
data: params.join ("&"),
type: 'POST',
url: action= <?php echo '"' . $config['homeurl'] . '"'; ?> + "/ajax.php",
url: action= <?php echo '"' . ui_get_full_url(false) . '"'; ?> + "/ajax.php",
async: false,
timeout: 10000,
success: function (data) {
@ -1275,7 +1275,7 @@ function addSLARow() {
jQuery.ajax ({
data: params.join ("&"),
type: 'POST',
url: action= <?php echo '"' . $config['homeurl'] . '"'; ?> + "/ajax.php",
url: action= <?php echo '"' . ui_get_full_url(false) . '"'; ?> + "/ajax.php",
timeout: 10000,
dataType: 'json',
success: function (data) {
@ -1327,7 +1327,7 @@ function addGeneralRow() {
jQuery.ajax ({
data: params.join ("&"),
type: 'POST',
url: action= <?php echo '"' . $config['homeurl'] . '"'; ?> + "/ajax.php",
url: action= <?php echo '"' . ui_get_full_url(false) . '"'; ?> + "/ajax.php",
async: false,
timeout: 10000,
success: function (data) {
@ -1342,7 +1342,7 @@ function addGeneralRow() {
jQuery.ajax ({
data: params.join ("&"),
type: 'POST',
url: action= <?php echo '"' . $config['homeurl'] . '"'; ?> + "/ajax.php",
url: action= <?php echo '"' . ui_get_full_url(false) . '"'; ?> + "/ajax.php",
async: false,
timeout: 10000,
success: function (data) {
@ -1357,7 +1357,7 @@ function addGeneralRow() {
jQuery.ajax ({
data: params.join ("&"),
type: 'POST',
url: action= <?php echo '"' . $config['homeurl'] . '"'; ?> + "/ajax.php",
url: action= <?php echo '"' . ui_get_full_url(false) . '"'; ?> + "/ajax.php",
async: false,
timeout: 10000,
success: function (data) {
@ -1375,7 +1375,7 @@ function addGeneralRow() {
jQuery.ajax ({
data: params.join ("&"),
type: 'POST',
url: action= <?php echo '"' . $config['homeurl'] . '"'; ?> + "/ajax.php",
url: action= <?php echo '"' . ui_get_full_url(false) . '"'; ?> + "/ajax.php",
timeout: 10000,
dataType: 'json',
success: function (data) {

View File

@ -396,7 +396,7 @@ switch ($action) {
$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="'. $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
$data[3] = '<a href="'. ui_get_full_url(false) . '/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

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"), ui_get_full_url(false) . '/', $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"), ui_get_full_url(false) . '/', $config['homedir'] . "/images/logo_vertical_water.png",
$config['fontpath'], $config['font_size']);
if (!$return)
@ -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, ui_get_full_url(false) . '/');
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,
'',
ui_get_full_url(false) . '/',
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, ui_get_full_url(false) . '/');
/*$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,
ui_get_full_url(false) . '/');
array_push ($table->data, $data);
break;
@ -2536,7 +2537,7 @@ 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, ui_get_full_url(false) . '/');
array_push ($tableslice->data, $dataslice);
}
@ -2559,7 +2560,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"), ui_get_full_url(false) . '/', $config['homedir'] . "/images/logo_vertical_water.png",
$config['fontpath'], $config['font_size']);
@ -2877,7 +2878,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, ui_get_full_url(false) . '/');
array_push($table->data, $data);
break;
@ -3865,7 +3866,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"), ui_get_full_url(false) . '/', $config['homedir'] . "/images/logo_vertical_water.png",
$config['fontpath'], $config['font_size']);
array_push ($table->data, $data);
@ -3874,7 +3875,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, ui_get_full_url(false) . '/', $config['homedir'] . "/images/logo_vertical_water.png", $config['fontpath'], $config['font_size'], true, 1, true);
array_push ($table->data, $data);
}
@ -4161,7 +4162,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"), ui_get_full_url(false) . '/', $config['homedir'] . "/images/logo_vertical_water.png",
$config['fontpath'], $config['font_size']);
array_push ($table->data, $data);
//Display bars graph
@ -4169,7 +4170,7 @@ function reporting_render_report_html_item ($content, $table, $report, $mini = f
$height = count($data_pie_graph)*20+35;
$data = array();
$data[0] = hbar_graph(false, $data_hbar, 600, $height, array(), array(), "", "", true, "", $config['homedir'] . "/images/logo_vertical_water.png", '', '', true, 1, true);
$data[0] = hbar_graph(false, $data_hbar, 600, $height, array(), array(), "", "", true, ui_get_full_url(false) . '/', $config['homedir'] . "/images/logo_vertical_water.png", '', '', true, 1, true);
array_push ($table->data, $data);
}

View File

@ -1995,9 +1995,14 @@ function ui_get_full_url ($url = '', $no_proxy = false, $add_name_php_file = fal
}
}
elseif ($url === false) {
if ($proxy) {
$url = '';
}
else {
//Only add the home url
$url = $config['homeurl'] . '/';
}
}
elseif (!strstr($url, ".php")) {
if ($proxy) {
$fullurl .= '/';

View File

@ -447,8 +447,10 @@ function agent_module_autocomplete (id_agent_name, id_agent_id, id_agent_module_
return;
homedir_path = '';
if (homedir != undefined)
if (homedir == undefined)
homedir_path = '.';
else
homedir_path = homedir;
$(id_agent_name).autocomplete({
minLength: 2,
@ -462,7 +464,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_path + "/ajax.php",
timeout: 10000,
dataType: 'json',
success: function (data) {

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