mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Next front page improvement
- load all files in include directory - half-baked attempt to make HTML output more readable - add top hosts by total bits box - horrible hack to generate_device_link() to make it possible to insert the device_bits graph
This commit is contained in:
@@ -113,10 +113,10 @@ function get_percentage_colours($percentage)
|
||||
|
||||
}
|
||||
|
||||
function generate_minigraph_image($device, $start, $end, $type, $legend = 'no', $width = 275, $height = 100)
|
||||
function generate_minigraph_image($device, $start, $end, $type, $legend = 'no', $width = 275, $height = 100, $sep = '&')
|
||||
{
|
||||
return '<img class=minigraph-image src="graph.php?device='.$device['device_id'].
|
||||
"&from=$start&to=$end&width=$width&height=$height&type=$type&legend=$legend".'">';
|
||||
return '<img class=minigraph-image src="graph.php?'.
|
||||
implode(array('device='.$device['device_id'], "from=$start", "to=$end", "width=$width", "height=$height", "type=$type", "legend=$legend"), $sep).'">';
|
||||
}
|
||||
|
||||
function generate_device_url($device, $vars=array())
|
||||
@@ -124,7 +124,7 @@ function generate_device_url($device, $vars=array())
|
||||
return generate_url(array('page' => 'device', 'device' => $device['device_id']), $vars);
|
||||
}
|
||||
|
||||
function generate_device_link($device, $text=NULL, $vars=array(), $start=0, $end=0)
|
||||
function generate_device_link($device, $text=NULL, $vars=array(), $start=0, $end=0, $escape_text=1)
|
||||
{
|
||||
global $config;
|
||||
|
||||
@@ -169,7 +169,7 @@ function generate_device_link($device, $text=NULL, $vars=array(), $start=0, $end
|
||||
$contents .= '</div>';
|
||||
}
|
||||
|
||||
$text = htmlentities($text);
|
||||
if ($escape_text) { $text = htmlentities($text); }
|
||||
$link = overlib_link($url, $text, escape_quotes($contents), $class);
|
||||
|
||||
if (device_permitted($device['device_id']))
|
||||
@@ -644,4 +644,31 @@ function report_this_text($message)
|
||||
return $message.'\nPlease report this to the developers at '.$config['project_issues'].'\n';
|
||||
}
|
||||
|
||||
# Find all the files in the given directory that match the pattern
|
||||
function get_matching_files($dir, $match = "/\.php$/")
|
||||
{
|
||||
global $config;
|
||||
|
||||
if ($handle = opendir($dir))
|
||||
{
|
||||
while (false !== ($file = readdir($handle)))
|
||||
{
|
||||
if ($file != "." && $file != ".." && preg_match($match, $file) === 1)
|
||||
{
|
||||
$list[] = $file;
|
||||
}
|
||||
}
|
||||
closedir($handle);
|
||||
}
|
||||
return $list;
|
||||
}
|
||||
|
||||
# Include all the files in the given directory that match the pattern
|
||||
function include_matching_files($dir, $match = "/\.php$/")
|
||||
{
|
||||
foreach (get_matching_files($dir, $match) as $file) {
|
||||
include_once($file);
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user