diff --git a/bureau/admin/menu.php b/bureau/admin/menu.php index c5b5a9a9..6ff5966f 100644 --- a/bureau/admin/menu.php +++ b/bureau/admin/menu.php @@ -77,11 +77,10 @@ foreach ($obj_menu as $k => $m ) { foreach( $m['links'] as $l ) { if ( $l['txt'] == 'progressbar' ) { $usage_percent = (int) ($l['used'] / $l['total'] * 100); - $usage_color = ( $l['used'] > $l['total'] ? '#800' : '#080'); - $usage_color = ((85 < $usage_percent && $usage_percent <= 100) ? '#ff8800' : $usage_color); // yellow echo "
  • "; echo '
    '; - echo '
     
    '; + echo '
    '; + //echo '
    '.$usage.' %
    '; echo '
    '; echo "
  • "; continue; diff --git a/bureau/admin/quotas_oneuser.php b/bureau/admin/quotas_oneuser.php index 47105898..530479fa 100644 --- a/bureau/admin/quotas_oneuser.php +++ b/bureau/admin/quotas_oneuser.php @@ -7,12 +7,13 @@ if (!defined("QUOTASONE")) return; if (!isset($mode)) { # when included from adm_login, mode is not set $mode = 0; } +// $mode = 4; // Pour Debuguer le mode "graphique" des quotas ?>

    %s account"),$mem->user["login"]); ?>

    -
    +
    @@ -29,7 +30,7 @@ if (!isset($mode)) { # when included from adm_login, mode is not set - +
    @@ -101,6 +102,7 @@ if (!isset($mode)) { # when included from adm_login, mode is not set
    +

     

    "; ?> - +
    @@ -138,7 +140,7 @@ if (!isset($mode)) { # when included from adm_login, mode is not set } elseif (isset($mode) &&$mode==1) { echo sprintf("%.1f", $pc)." %"; } else { - $quota->quota_displaybar(2*$pc); + $quota->quota_displaybar(2*$pc, 0); } echo ""; } diff --git a/bureau/admin/quotas_users.php b/bureau/admin/quotas_users.php index 2fe62c85..32768014 100644 --- a/bureau/admin/quotas_users.php +++ b/bureau/admin/quotas_users.php @@ -122,8 +122,8 @@ echo "

    "; printf(_("If you want to manage them, go to")." 
    -
    -
    +
    +
    @@ -163,8 +163,8 @@ echo "

    "; printf(_("If you want to manage them, go to")." 
    -
    -
     
    +
    +
    diff --git a/bureau/admin/styles/style.css b/bureau/admin/styles/style.css index 6c8b44db..1efbec42 100644 --- a/bureau/admin/styles/style.css +++ b/bureau/admin/styles/style.css @@ -609,6 +609,35 @@ input#dir, input#sub_local { margin-left: 10px; } +div.progress-bar { + position: relative; + width: 100%; + height: 20px; + background-color: #fff; + border: solid 1px #aaa; + overflow: hidden; + -webkit-border-radius: 4px; + -moz-border-radius: 4px; + border-radius: 4px; +} + +div.progress-bar div.barre { + position: absolute; + top: 0; + left: 0; + height: 20px; + background-color: #CCC; + border: none; +} + +div.progress-bar div.txt { + position: absolute; + top: 3px; + left: 0; + width: 100%; + text-align:center; +} + .ombrage { border: 1px solid #888; box-shadow: 1px 1px 15px #555; diff --git a/bureau/class/functions.php b/bureau/class/functions.php index f0125360..7c92bff7 100644 --- a/bureau/class/functions.php +++ b/bureau/class/functions.php @@ -678,4 +678,76 @@ function auto_wrap($message="",$max=10,$wrap_string="") { return $message; } +/* +** Converts HSV to RGB values +** ----------------------------------------------------- +** Reference: http://en.wikipedia.org/wiki/HSL_and_HSV +** Purpose: Useful for generating colours with +** same hue-value for web designs. +** Input: Hue (H) Integer 0-360 +** Saturation (S) Integer 0-100 +** Lightness (V) Integer 0-100 +** Output: String "R,G,B" +** Suitable for CSS function RGB(). +*/ + +function fHSVtoRGB($iH, $iS, $iV) { + + if($iH < 0) $iH = 0; // Hue: + if($iH > 360) $iH = 360; // 0-360 + if($iS < 0) $iS = 0; // Saturation: + if($iS > 100) $iS = 100; // 0-100 + if($iV < 0) $iV = 0; // Lightness: + if($iV > 100) $iV = 100; // 0-100 + + $dS = $iS/100.0; // Saturation: 0.0-1.0 + $dV = $iV/100.0; // Lightness: 0.0-1.0 + $dC = $dV*$dS; // Chroma: 0.0-1.0 + $dH = $iH/60.0; // H-Prime: 0.0-6.0 + $dT = $dH; // Temp variable + + while($dT >= 2.0) $dT -= 2.0; // php modulus does not work with float + $dX = $dC*(1-abs($dT-1)); // as used in the Wikipedia link + + switch($dH) { + case($dH >= 0.0 && $dH < 1.0): + $dR = $dC; $dG = $dX; $dB = 0.0; break; + case($dH >= 1.0 && $dH < 2.0): + $dR = $dX; $dG = $dC; $dB = 0.0; break; + case($dH >= 2.0 && $dH < 3.0): + $dR = 0.0; $dG = $dC; $dB = $dX; break; + case($dH >= 3.0 && $dH < 4.0): + $dR = 0.0; $dG = $dX; $dB = $dC; break; + case($dH >= 4.0 && $dH < 5.0): + $dR = $dX; $dG = 0.0; $dB = $dC; break; + case($dH >= 5.0 && $dH < 6.0): + $dR = $dC; $dG = 0.0; $dB = $dX; break; + default: + $dR = 0.0; $dG = 0.0; $dB = 0.0; break; + } + + $dM = $dV - $dC; + $dR += $dM; $dG += $dM; $dB += $dM; + $dR *= 255; $dG *= 255; $dB *= 255; + + return array('r'=>round($dR), 'g'=>round($dG), 'b'=>round($dB) ); +} + +function hexa($hex) +{ + $num = dechex($hex); + return (strlen("$num") >= 2) ? "$num" : "0$num"; +} + +function PercentToColor($p=0) { + if ($p>100) $p=100; + if ($p<0) $p=0; + // Pour aller de vert a rouge en passant par jaune et orange + $h = 1+((100-$p)*130/100); + + $rvb = fHSVtoRGB( (int)$h, 96, 93); + $color = "#".hexa($rvb['r']).hexa($rvb['g']).hexa($rvb['b']); + + return $color; +} ?> diff --git a/bureau/class/m_quota.php b/bureau/class/m_quota.php index 173a75d9..ff5f2a55 100644 --- a/bureau/class/m_quota.php +++ b/bureau/class/m_quota.php @@ -520,13 +520,24 @@ class m_quota { } } - // Cette fonction doit disparaitre quand on refera les pages d'affichage du quota - // trop sale - function quota_displaybar($usage) { - $usage_color = '#A0CFEC'; - $usage_color = ((85 < $usage && $usage <= 100) ? '#82CAFF' : $usage_color); // yellow + // Affiche des barres de progression + // color_type : + // 0 = Pas de changement de couleur + // 1 = Progression du vert vers le rouge en fonction du porcentage + // 2 = Progression du rouge vers le vert en fonction du porcentage + function quota_displaybar($usage, $color_type=1) { + if ($color_type == 1) { + $csscolor = " background-color:".PercentToColor($usage); + } elseif ($color_type == 2) { + $csscolor = " background-color:".PercentToColor(100-$usage); + } else { + $csscolor = ""; + } + + echo '
    '; - echo '
    '.$usage.'%
    '; + echo '
    '; + echo '
    '.$usage.'%
    '; echo '
    '; }