Code

Fixed change_password().
[gosa.git] / include / class_divlist.inc
index 1a4161432e7bfdf91ab23e6debac827c05053aec..17176b217b9ce96ffbe8d5f2b743a2a0ecc61291 100644 (file)
@@ -17,14 +17,15 @@ class divlist {
        var $i_entriesPerPage;
 
   var $force_height = false;
+  var $list_footer = "";
   
        // Added php 4 constructor
        function divlist($pageid){
 
                $this->i_currentPage    = 0;
                $this->i_entriesPerPage = 10;
-    $this->s_height         = "650";
-    $this->s_width          = "600";
+    $this->s_height         = "450";
+    $this->s_width          = "600px";
                $this->s_summary        = "";
                $this->a_entries        = array();
                $this->a_header         = array();
@@ -37,6 +38,11 @@ class divlist {
        
        }
 
+  function SetFooter($str)
+  {
+    $this->list_footer = $str;
+  }
+
        function AddEntry($a_entriedata) {
                $this->a_entries[] = $a_entriedata;
        }
@@ -56,6 +62,9 @@ class divlist {
   
   function SetWidth($s_width) {
                $this->s_width= $s_width;
+    if(preg_match("/^[0-9]*$/",$this->s_width)){
+      $this->s_width .="px";
+    }
        }
 
        function SetEntriesPerPage($i_num){
@@ -66,17 +75,17 @@ class divlist {
                $s_return = "";
     if(!$this->force_height){
                  $s_return.= "<table summary='".$this->s_summary."' style='width:".
-                  $this->s_width."px;height:".$this->s_height.
+                  $this->s_width.";height:".$this->s_height.
                   "px;' cellspacing='0' id='t_scrolltable'>";
     } else {
                  $s_return.= "<table summary='".$this->s_summary."' style='width:".
-                  $this->s_width."px;height:".$this->s_height.
+                  $this->s_width.";height:".$this->s_height.
                   "px;' cellspacing='0' id='t_scrolltable_onlywidth'>";
     }
 
     $s_return.= $this->_generateHeader();
-    $s_return.=$this->_generatePage();
-               
+    $s_return.= $this->_generatePage();
+         $s_return.= $this->_generateFooter(); 
                $s_return.= "</table>";
                
                return ($s_return);
@@ -96,6 +105,33 @@ class divlist {
        function _numentries(){
                return count($this->a_entries);
        }
+
+  function _generateFooter()
+  {
+    $s_return = "";
+    if(!empty($this->list_footer)){
+
+      // Using scrolltable?
+      if($this->i_entriesPerPage == 0) {
+        if(!$this->force_height) {
+          $s_return.= "\n<tr><td class='scrollhead'><table summary='' style='width:100%' cellspacing='0' id='t_scrollfoot'>";
+        } else {
+          $s_return.= "\n<tr><td class='scrollhead'><table summary='' style='width:100%' cellspacing='0'                      id='t_scrollfoot_onlywidth'>";
+        }
+      }
+      $s_return .= "<tr><td class='listfooter' style='border-bottom:0px;'>".$this->list_footer."</td>";
+          // Attach a 13px-wide column (used as scrollbar space in body-table),
+    // but do this only if we are really using scrolltables.
+    if($this->i_entriesPerPage == 0) {
+      $s_return.= "\n<td class='listfooter' style='width:13px;border-right:0px;'>&nbsp;</td>";
+      $s_return.= "\n</table></td>";
+    }
+
+    $s_return.= "\n</tr>";
+
+    }
+    return($s_return);
+  }
        
        function _generateHeader(){
                $s_return = "";
@@ -105,9 +141,9 @@ class divlist {
     // Using scrolltable?
     if($this->i_entriesPerPage == 0) {
       if(!$this->force_height) {
-        $s_return.= "\n<tr><td class='scrollhead'><table summary='' style='width:".$this->s_width."px;' cellspacing='0' id='t_scrollhead'>";
+        $s_return.= "\n<tr><td class='scrollhead'><table summary='' style='width:".$this->s_width.";' cellspacing='0' id='t_scrollhead'>";
       } else {
-        $s_return.= "\n<tr><td class='scrollhead'><table summary='' style='width:".$this->s_width."px;' cellspacing='0' id='t_scrollhead_onlywidth'>";
+        $s_return.= "\n<tr><td class='scrollhead'><table summary='' style='width:".$this->s_width.";' cellspacing='0' id='t_scrollhead_onlywidth'>";
       }
     }
 
@@ -149,10 +185,10 @@ class divlist {
     if($this->i_entriesPerPage == 0) {
       // We need to construct a "body"-table that is width-of-scrollbar thinner than the "head"-table.
       if(!$this->force_height) {
-        $s_return .= "\n<tr><td colspan='".$this->cols."' class='scrollbody'><div style='width:".$this->s_width."px;height:".($this->s_height-20)."px;' id='d_scrollbody' class='scrollbody'>";
+        $s_return .= "\n<tr><td colspan='".$this->cols."' class='scrollbody'><div style='width:".$this->s_width.";height:".($this->s_height-20)."px;' id='d_scrollbody' class='scrollbody'>";
         $s_return .= "<table summary='' style='height:100%;width:581px;' cellspacing='0' id='t_scrollbody'>";
       } else {
-        $s_return .= "\n<tr><td colspan='".$this->cols."' class='scrollbody'><div style='width:".$this->s_width."px;height:".($this->s_height-20)."px;' id='d_scrollbody_onlywidth' class='scrollbody'>";
+        $s_return .= "\n<tr><td colspan='".$this->cols."' class='scrollbody'><div style='width:".$this->s_width.";height:".($this->s_height-20)."px;' id='d_scrollbody_onlywidth' class='scrollbody'>";
         $s_return .= "<table summary='' style='height:100%;width:581px;' cellspacing='0' id='t_scrollbody_onlywidth'>";
       }
        }
@@ -196,7 +232,7 @@ class divlist {
                                                        
                                $s_value = $this->a_entries[$i];
                                
-                               
+                   // Alternation of background color          
                                if($i_alternate) $i_alternate=0; else $i_alternate=1;
                                
                                $s_return .= "\n<tr>";