stuff (maybe cheesey broke some shit here)

git-svn-id: http://www.observium.org/svn/observer/trunk@2390 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Adam Amstrong
2011-06-14 14:04:56 +00:00
parent 2cd4e4f321
commit b46e001027
3 changed files with 25 additions and 1 deletions

View File

@@ -226,6 +226,28 @@ function generate_graph_tag($args)
return '<img src="graph.php?' . implode('&amp;',$urlargs).'" border="0" />'; return '<img src="graph.php?' . implode('&amp;',$urlargs).'" border="0" />';
} }
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 = <<<STATE
<script type="text/javascript" language="JavaScript">
document.graphFrom = $from;
document.graphTo = $to;
document.graphWidth = $width;
document.graphHeight = $height;
document.graphLegend = '$legend';
</script>
STATE;
return $state;
}
function print_percentage_bar($width, $height, $percent, $left_text, $left_colour, $left_background, $right_text, $right_colour, $right_background) function print_percentage_bar($width, $height, $percent, $left_text, $left_colour, $left_background, $right_text, $right_colour, $right_background)
{ {
$output = ' $output = '

View File

@@ -7,7 +7,7 @@
if($affected) if($affected)
{ {
$message .= $message_break . $rows . " service deleted!"; $message .= $message_break . $rows . " service deleted!";
$message_break .= "<br />" $message_break .= "<br />";
} }
?> ?>

View File

@@ -118,6 +118,8 @@ if (!$auth)
$graph_array['to'] = $to; $graph_array['to'] = $to;
$graph_array['legend'] = "yes"; $graph_array['legend'] = "yes";
echo generate_graph_js_state($graph_array);
echo("<div style='width:1150px; margin: auto;'>"); echo("<div style='width:1150px; margin: auto;'>");
echo(generate_graph_tag($graph_array)); echo(generate_graph_tag($graph_array));
echo("</div>"); echo("</div>");