Code

Added external resolution hook to environment
[gosa.git] / include / class_divlist.inc
index ab1efecae1dafe496775fc9a27529bfd445fca6d..52eaecce87fb642fae430ec7c3afbf368377b0d6 100644 (file)
@@ -5,10 +5,13 @@ class divlist {
        var $a_entries;
        var $a_header;
        var $b_displayPageNums;         
-       var $summary;
+       var $s_summary;
        var $cols;
        var $pageid;
-
+  //FIXME: Ignoring the fact, that they were missing - height and width are numeric...
+  var $s_height;
+  var $s_width;
+  
        // Members for page managment
        var $i_currentPage;
        var $i_entriesPerPage;
@@ -18,15 +21,14 @@ class divlist {
 
                $this->i_currentPage    = 0;
                $this->i_entriesPerPage = 10;
-    $this->s_height         = "500";
+    $this->s_height         = "450";
     $this->s_width          = "600";
-               $this->s_summary                = "";
-               $this->a_entries                = array();
-               $this->a_header                 = array();
+               $this->s_summary        = "";
+               $this->a_entries        = array();
+               $this->a_header         = array();
                $this->b_displayPageNums= true;
-               $this->cols                     = 0;
-               $this->pageid                   = $pageid ;
-
+               $this->cols             = 0;
+               $this->pageid           = $pageid;
        }
 
        function __destruct(){
@@ -59,7 +61,9 @@ class divlist {
        
        function DrawList(){
                $s_return = "";
-               $s_return.= "<table summary='".$this->s_summary."' style='width:".$this->s_width."px;height:".$this->s_height."px;' cellspacing='0'>";
+               $s_return.= "<table summary='".$this->s_summary."' style='width:".
+                $this->s_width."px;height:".$this->s_height.
+                "px;' cellspacing='0' id='t_scrolltable'>";
 
     $s_return.= $this->_generateHeader();
     $s_return.=$this->_generatePage();
@@ -72,30 +76,29 @@ class divlist {
        function _numpages(){
                $cnt = count($this->a_entries);
                
-               $tmp    = $cnt % $this->i_entriesPerPage;
                $pages  = (int) ($cnt / $this->i_entriesPerPage);
-               if($tmp) $pages ++;
+               if($cnt % $this->i_entriesPerPage){
+      $pages++;
+    }
                
                return $pages;
        }
        
        function _numentries(){
-               $cnt = count($this->a_entries);
-               return $cnt;
+               return count($this->a_entries);
        }
        
        function _generateHeader(){
-               
                $s_return = "";
                $s_value        = "";
                $s_key          = "";
                
     // Using scrolltable?
     if($this->i_entriesPerPage == 0) {
-      $s_return .= "\n<tr><td class='scrollhead'><table summary='' style='width:".$this->s_width."px;' cellspacing='0'>";
+      $s_return.= "\n<tr><td class='scrollhead'><table summary='' style='width:".$this->s_width."px;' cellspacing='0' id='t_scrollhead'>";
     }
 
-               $s_return .= "\n<tr>";
+               $s_return.= "\n<tr>";
 
                foreach($this->a_header[0] as $s_key => $s_value ){
                        if(!isset($s_value['attach'])){
@@ -109,14 +112,14 @@ class divlist {
 
                }
                
-    // Attach a 18px-wide column (used as scrollbar space in body-table),
+    // 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='listheader' style='width:13px;border-right:0px;'>&nbsp;</td>";
-      $s_return .= "\n</table></td>";
+      $s_return.= "\n<td class='listheader' style='width:13px;border-right:0px;'>&nbsp;</td>";
+      $s_return.= "\n</table></td>";
     }
 
-       $s_return .= "\n</tr>";
+       $s_return.= "\n</tr>";
                return $s_return;
        }
        
@@ -132,9 +135,8 @@ class divlist {
    
     if($this->i_entriesPerPage == 0) {
       // We need to construct a "body"-table that is width-of-scrollbar thinner than the "head"-table.
-      $s_return .= "\n<tr><td colspan='".$this->cols."' class='scrollbody'><div style='width:".$this->s_width."px;height:".($this->s_height-20)."px;' class='scrollbody'>";
-
-      $s_return .= "<table summary='' style='height:100%;width:581px;' cellspacing='0'>";
+      $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 .= "<table summary='' style='height:100%;width:581px;' cellspacing='0' id='t_scrollbody'>";
        }
  
     $i_alternate=0;
@@ -152,7 +154,7 @@ class divlist {
     /* If divlist is empty, append a single white entry */
     if(count($this->a_entries)==0){
       $str = $s_return."<tr>";
-      $str.="<td class='list1' colspan='".$this->cols."' style='height:100%;border-right:0px;width:100%;'>&nbsp;</td>";
+      $str.="<td class='list1nohighlight' colspan='".$this->cols."' style='height:100%;border-right:0px;width:100%;'>&nbsp;</td>";
       $str.="</tr>";
       if($this->i_entriesPerPage == 0) {
         $str.="</table></div></td></tr>";
@@ -160,6 +162,7 @@ class divlist {
       return($str);
     } else {
     
+      //FIXME: Ahrg. I'd like to read this code without wasting my time.
       if ($this->i_entriesPerPage > 0) {
                while($start > $this->_numentries()){
                        $start = $start - $this->i_entriesPerPage;
@@ -243,7 +246,7 @@ class divlist {
             $i_alternate=1;
           }
                  
-          $s_return .= "\n<tr>";
+          $s_return .= "\n<tr class='rowxp".$i_alternate."'>";
                                  
                    $cnt = 0;                                   
                                          
@@ -273,13 +276,14 @@ class divlist {
       }
   
       // if fewer than 22 Entries (list not full), print row to fill empty space
+      //FIXME: Why 22? Isn't the size dynamic
       if($this->_numEntries()<=22){
         $fill= "";
         for ($i= 1; $i <= $this->cols; $i++){
           if ($i == $this->cols){
-           $fill.= "<td class='list1' style='height:100%;border-right:0px;'>&nbsp;</td>";
+           $fill.= "<td class='list1nohighlight' style='height:100%;border-right:0px;'>&nbsp;</td>";
           } else {
-           $fill.= "<td class='list1' style='height:100%;'>&nbsp;</td>";
+           $fill.= "<td class='list1nohighlight' style='height:100%;'>&nbsp;</td>";
           }
         }
         $s_return.="\n<tr>$fill";
@@ -292,5 +296,6 @@ class divlist {
     }
   }
 }
+
 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
 ?>