give dropdown javascript box to change graph type

git-svn-id: http://www.observium.org/svn/observer/trunk@3043 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Adam Amstrong
2012-04-17 14:02:51 +00:00
parent a4feccf9e4
commit da9463f5fa
+33
View File
@@ -38,6 +38,20 @@ if (!$auth)
$title .= " :: ".ucfirst($subtype);
}
# Load our list of available graphtypes for this object
# Fixme not all of these are going to be valid
if ($handle = opendir($config['install_dir'] . "/html/includes/graphs/".$type."/"))
{
while (false !== ($file = readdir($handle)))
{
if ($file != "." && $file != ".." && strstr($file, ".inc.php"))
{
$types[] = str_replace(".inc.php", "", $file);
}
}
closedir($handle);
}
$graph_array = $vars;
$graph_array['height'] = "60";
$graph_array['width'] = $thumb_width;
@@ -46,6 +60,25 @@ if (!$auth)
print_optionbar_start();
echo($title);
echo('<div style="float: right;">');
?>
<form action="">
<select name='type' id='type'
onchange="window.open(this.options[this.selectedIndex].value,'_top')" >
<?php
foreach($types as $avail_type)
{
echo("<option value='".generate_url($vars, array('type' => $type."_".$avail_type, 'page' => "graphs"))."'");
if ($avail_type == $subtype) { echo(" selected"); }
echo(">".$avail_type."</option>");
}
?>
</select>
<?php
echo('</div>');
print_optionbar_end();
// css and js for datetimepicker