mirror of
https://github.com/nidebr/as-stats-gui.git
synced 2025-02-20 11:23:18 +08:00
Patch display of the legend for mobile devices, and patch display legend in history graph.
This commit is contained in:
parent
32cf279b92
commit
04ef3a7d5b
1
func.inc
1
func.inc
@ -1,6 +1,7 @@
|
||||
<?php
|
||||
require_once("config_defaults.inc");
|
||||
require_once('config.inc');
|
||||
require_once('plugins/mobile-detect/Mobile_Detect.php');
|
||||
|
||||
/* make sure we have enough memory, as some pages can be quite memory intensive */
|
||||
ini_set("memory_limit", "256M");
|
||||
|
@ -124,6 +124,7 @@ if ($compat_rrdtool12) {
|
||||
|
||||
/* generate graph area/stack for inbound */
|
||||
$i = 0;
|
||||
|
||||
foreach ($knownlinks as $link) {
|
||||
if ($outispositive && $brighten_negative)
|
||||
$col = $link['color'] . "BB";
|
||||
@ -134,6 +135,7 @@ foreach ($knownlinks as $link) {
|
||||
if ($i > 0)
|
||||
$cmd .= ":STACK";
|
||||
$cmd .= " ";
|
||||
|
||||
$i++;
|
||||
}
|
||||
|
||||
@ -151,11 +153,13 @@ foreach ($knownlinks as $link) {
|
||||
$i++;
|
||||
}
|
||||
|
||||
$cmd .= "COMMENT:' \\n' ";
|
||||
|
||||
if ($show95th && !$compat_rrdtool12) {
|
||||
$cmd .= "LINE1:tot_in_bits_95th#FF0000 ";
|
||||
$cmd .= "LINE1:tot_out_bits_95th#FF0000 ";
|
||||
$cmd .= "GPRINT:tot_in_bits_95th_pos:'95th in %6.2lf%s' ";
|
||||
$cmd .= "GPRINT:tot_out_bits_95th_pos:'95th out %6.2lf%s' ";
|
||||
$cmd .= "GPRINT:tot_out_bits_95th_pos:'/ 95th out %6.2lf%s\\n' ";
|
||||
}
|
||||
|
||||
# zero line
|
||||
|
77
index.php
77
index.php
@ -21,6 +21,9 @@ $end = time();
|
||||
|
||||
if ($showv6) { $first_col = "1"; $second_col = "11"; $offset_second_col = "0"; } else { $first_col = "2"; $second_col = "9"; $offset_second_col = "1"; }
|
||||
|
||||
// Mobile Detect for show legend
|
||||
$detect = new Mobile_Detect;
|
||||
|
||||
$i = 0;
|
||||
$aff_astable = '<ul class="nav nav-stacked">';
|
||||
|
||||
@ -88,28 +91,49 @@ foreach ($topas as $as => $nbytes) {
|
||||
$aff_astable .= '</ul>';
|
||||
|
||||
// LEGEND
|
||||
|
||||
$aff_legend = "<table class='small'>";
|
||||
|
||||
$knownlinks = getknownlinks();
|
||||
foreach ($knownlinks as $link) {
|
||||
$aff_legend .= "<tr><td style=\"border: 4px solid #fff;\">";
|
||||
|
||||
$aff_legend .= "<table style=\"border-collapse: collapse; margin: 0; padding: 0\"><tr>";
|
||||
if ($brighten_negative) {
|
||||
$aff_legend .= "<td width=\"9\" height=\"18\" style=\"background-color: #{$link['color']}\"> </td>";
|
||||
$aff_legend .= "<td width=\"9\" height=\"18\" style=\"opacity: 0.73; background-color: #{$link['color']}\"> </td>";
|
||||
} else {
|
||||
$aff_legend .= "<td width=\"18\" height=\"18\" style=\"background-color: #{$link['color']}\"> </td>";
|
||||
}
|
||||
$aff_legend .= "</tr></table>";
|
||||
if ( !$detect->isMobile() && !$detect->isTablet() ) {
|
||||
$aff_legend = "<table class='small'>";
|
||||
|
||||
$aff_legend .= "</td><td> " . $link['descr'] . "</td></tr>\n";
|
||||
foreach ($knownlinks as $link) {
|
||||
$aff_legend .= "<tr><td style=\"border: 4px solid #fff;\">";
|
||||
|
||||
$aff_legend .= "<table style=\"border-collapse: collapse; margin: 0; padding: 0\"><tr>";
|
||||
if ($brighten_negative) {
|
||||
$aff_legend .= "<td width=\"9\" height=\"18\" style=\"background-color: #{$link['color']}\"> </td>";
|
||||
$aff_legend .= "<td width=\"9\" height=\"18\" style=\"opacity: 0.73; background-color: #{$link['color']}\"> </td>";
|
||||
} else {
|
||||
$aff_legend .= "<td width=\"18\" height=\"18\" style=\"background-color: #{$link['color']}\"> </td>";
|
||||
}
|
||||
$aff_legend .= "</tr></table>";
|
||||
|
||||
$aff_legend .= "</td><td> " . $link['descr'] . "</td></tr>\n";
|
||||
}
|
||||
|
||||
$aff_legend .= "</table>";
|
||||
} else {
|
||||
$aff_legend = "<table class='small'>";
|
||||
$aff_legend .= "<tr>";
|
||||
$aff_legend .= "<td style=\"border: 4px solid #fff;\">";
|
||||
|
||||
$aff_legend .= "<table style=\"border-collapse: collapse; margin: 0; padding: 0\"><tr>";
|
||||
foreach ($knownlinks as $link) {
|
||||
if ($brighten_negative) {
|
||||
$aff_legend .= "<td width=\"9\" height=\"18\" style=\"background-color: #{$link['color']}\"> </td>";
|
||||
$aff_legend .= "<td width=\"9\" height=\"18\" style=\"opacity: 0.73; background-color: #{$link['color']}\"> </td>";
|
||||
} else {
|
||||
$aff_legend .= "<td width=\"18\" height=\"18\" style=\"background-color: #{$link['color']}\"> </td>";
|
||||
}
|
||||
$aff_legend .= "<td> " . $link['descr'] . " </td>\n";
|
||||
}
|
||||
$aff_legend .= "</tr></table>";
|
||||
|
||||
$aff_legend .= "</td>";
|
||||
$aff_legend .= "</tr>";
|
||||
$aff_legend .= "</table>";
|
||||
}
|
||||
|
||||
$aff_legend .= "</table>";
|
||||
|
||||
|
||||
?>
|
||||
|
||||
<html>
|
||||
@ -148,7 +172,9 @@ $aff_legend .= "</table>";
|
||||
<div class="row">
|
||||
|
||||
<div class="col-lg-12">
|
||||
<div class="row affix col-md-12 col-lg-<?php echo $first_col; ?>">
|
||||
<?php
|
||||
if ( $detect->isMobile() || $detect->isTablet() ) {
|
||||
?>
|
||||
|
||||
<div class="box box-primary">
|
||||
<div class="box-header with-border">
|
||||
@ -159,7 +185,22 @@ $aff_legend .= "</table>";
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
} else {
|
||||
?>
|
||||
|
||||
<div class="row affix col-md-12 col-lg-<?php echo $first_col; ?>">
|
||||
<div class="box box-primary">
|
||||
<div class="box-header with-border">
|
||||
<h3 class="box-title">Legend</h3>
|
||||
</div>
|
||||
<div class="box-body">
|
||||
<?php echo $aff_legend; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php } ?>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
Loading…
x
Reference in New Issue
Block a user