diff --git a/html/includes/functions.inc.php b/html/includes/functions.inc.php index 105d5f4362..8e1b227f8e 100644 --- a/html/includes/functions.inc.php +++ b/html/includes/functions.inc.php @@ -226,6 +226,28 @@ function generate_graph_tag($args) return ''; } +function generate_graph_js_state($args) { + // we are going to assume we know roughly what the graph url looks like here. + // TODO: Add sensible defaults + $from = (is_numeric($args['from']) ? $args['from'] : 0); + $to = (is_numeric($args['to']) ? $args['to'] : 0); + $width = (is_numeric($args['width']) ? $args['width'] : 0); + $height = (is_numeric($args['height']) ? $args['height'] : 0); + $legend = str_replace("'", "", $args['legend']); + + $state = << +document.graphFrom = $from; +document.graphTo = $to; +document.graphWidth = $width; +document.graphHeight = $height; +document.graphLegend = '$legend'; + +STATE; + + return $state; +} + function print_percentage_bar($width, $height, $percent, $left_text, $left_colour, $left_background, $right_text, $right_colour, $right_background) { $output = ' diff --git a/html/includes/service-delete.inc.php b/html/includes/service-delete.inc.php index c102fd817f..9e55c990d3 100644 --- a/html/includes/service-delete.inc.php +++ b/html/includes/service-delete.inc.php @@ -7,7 +7,7 @@ if($affected) { $message .= $message_break . $rows . " service deleted!"; - $message_break .= "
" + $message_break .= "
"; } ?> diff --git a/html/pages/graphs.inc.php b/html/pages/graphs.inc.php index 8616c9921a..5b322451c0 100644 --- a/html/pages/graphs.inc.php +++ b/html/pages/graphs.inc.php @@ -118,6 +118,8 @@ if (!$auth) $graph_array['to'] = $to; $graph_array['legend'] = "yes"; + echo generate_graph_js_state($graph_array); + echo("
"); echo(generate_graph_tag($graph_array)); echo("
");