Code

Added css progress bar
authorcajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Sun, 14 Mar 2010 11:32:34 +0000 (11:32 +0000)
committercajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Sun, 14 Mar 2010 11:32:34 +0000 (11:32 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@16501 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-core/html/themes/modern/style.css
gosa-core/include/class_filter.inc
gosa-core/include/functions.inc

index 793a2d13e77b3f0633df18c73baa4a4899a352c4..5db9f79a7e542ac8c34ebc7d1fb69b6951c76ef1 100644 (file)
@@ -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;
+}
+
index f4f1daad718af1893101c38c774baf2aadff0807..666443e5d55ba0f029ef90e4197450d5322e17cb 100644 (file)
@@ -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;  
index df32e69ea857864c9cb278cefa02afef3b14d365..cbcc4a46e321f3bbf949392ad2557c98279cbba8 100644 (file)
@@ -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 "<div class='progress$class' style='$style'>$text</div>";
+}
 
 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
 ?>