From e83f99adc97ef86327f031c01440c1907ca3e2fc Mon Sep 17 00:00:00 2001 From: cajus Date: Sun, 14 Mar 2010 11:32:34 +0000 Subject: [PATCH] Added css progress bar git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@16501 594d385d-05f5-0310-b6e9-bd551577e9d8 --- gosa-core/html/themes/modern/style.css | 29 ++++++++++++++++ gosa-core/include/class_filter.inc | 2 +- gosa-core/include/functions.inc | 48 ++++++++++++++++++++++++++ 3 files changed, 78 insertions(+), 1 deletion(-) diff --git a/gosa-core/html/themes/modern/style.css b/gosa-core/html/themes/modern/style.css index 793a2d13e..5db9f79a7 100644 --- a/gosa-core/html/themes/modern/style.css +++ b/gosa-core/html/themes/modern/style.css @@ -1343,3 +1343,32 @@ background-image:none; color:#777; text-align:right; } + +/* Progress */ + +div.progress { + text-align:center; + color: rgba(255,255,255,0.9); + padding:1px; + border: 1px solid rgba(0,0,0,0.6); + -moz-border-radius: 2px; + -webkit-border-radius: 2px; + border-radius: 2px; +} + +.progress-low { + background-color:#32CD32; +} + +.progress-mid { + background-color:#FFFF00; +} + +.progress-high { + background-color:#FFA500; +} + +.progress-full { + background-color:#FF0000; +} + diff --git a/gosa-core/include/class_filter.inc b/gosa-core/include/class_filter.inc index f4f1daad7..666443e5d 100644 --- a/gosa-core/include/class_filter.inc +++ b/gosa-core/include/class_filter.inc @@ -117,8 +117,8 @@ class filter { } // Initialize searches and default search mode - $this->reloadFilters(); $this->defaultSearch= $xmlData['definition']['default']; + $this->reloadFilters(); $this->setSearch($this->defaultSearch); return true; diff --git a/gosa-core/include/functions.inc b/gosa-core/include/functions.inc index df32e69ea..cbcc4a46e 100644 --- a/gosa-core/include/functions.inc +++ b/gosa-core/include/functions.inc @@ -3582,6 +3582,54 @@ function image($path, $action= "", $title= "", $align= "middle") } +function progress($progress, $width= 200, $height= 14) +{ + $text= ""; + $class= ""; + $style= "width:${width};height:${height}px;"; + + // Fix progress range + $progress= floor($progress); + if ($progress > 100) { + $progress= 100; + } + if ($progress < 0) { + $progress= 0; + } + + // Only show text if we're above 10px height + if ($height>10){ + $text= $progress."%"; + } + + // Set font size + $style.= "font-size:".($height-3)."px;"; + + // Set color + if ($progress < 70) { + $class= " progress-low"; + } elseif ($progress < 80) { + $class= " progress-mid"; + } elseif ($progress < 90) { + $class= " progress-high"; + } else { + $class= " progress-full"; + } + + // Apply gradients + $hoffset= floor($height / 2) + 4; + $woffset= floor($width * (100-$progress) / 100); + $style.="-moz-box-shadow: + 0 0 2px rgba(255, 255, 255, 0.4) inset, + 0 4px 6px rgba(255, 255, 255, 0.4) inset, + 0 ".$hoffset."px 0 -2px rgba(255, 255, 255, 0.2) inset, + -".$woffset."px 0 0 -2px rgba(255, 255, 255, 0.2) inset, + -".($woffset+1)."px 0 0 -2px rgba(0, 0, 0, 0.6) inset, + 0pt ".($hoffset+1)."px 8px rgba(0, 0, 0, 0.3) inset, + 0pt 1px 0px rgba(0, 0, 0, 0.2);"; + + echo "
$text
"; +} // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: ?> -- 2.30.2