X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=include%2Fclass_divlist.inc;h=52eaecce87fb642fae430ec7c3afbf368377b0d6;hb=3e9d09385b5848172ec406723b7c059108de1464;hp=203d2298424f83770e13c85fdd2c0ed05e532c14;hpb=2c0d4431501d331a8d0c11fc74d4c335451cf150;p=gosa.git diff --git a/include/class_divlist.inc b/include/class_divlist.inc index 203d22984..52eaecce8 100644 --- a/include/class_divlist.inc +++ b/include/class_divlist.inc @@ -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.= ""; + $s_return.= "
"; $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"; } - $s_return .= "\n"; + $s_return.= "\n"; return $s_return; } @@ -128,17 +133,13 @@ class divlist { $s_key = ""; $s_return = ""; - // We need to construct a "body"-table that is width-of-scrollbar thinner than the "head"-table. - $s_return .= "\n"; + } 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; @@ -184,7 +187,6 @@ class divlist { foreach($s_value as $s_key2 => $s_value2 ){ - $this->cols = count($s_value) ; $cnt++; if(!isset($s_value2['class'])){ @@ -218,9 +220,9 @@ class divlist { $cnt=0; for($a = 0 ; $a < (count($this->a_header[0])) ; $a ++ ) { if($a ==(count($this->a_header[0])-1)){ - $s_return.="\n"; + $s_return.="\n"; } else { - $s_return.="\n"; + $s_return.="\n"; } } $s_return.="\n"; @@ -244,7 +246,7 @@ class divlist { $i_alternate=1; } - $s_return .= "\n"; + $s_return .= "\n"; $cnt = 0; @@ -273,22 +275,27 @@ class divlist { } } - // if fewer than 19 Entries (list not full), print row to fill empty space - if($this->_numEntries()<19){ + // 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.= ""; + $fill.= ""; } else { - $fill.= ""; + $fill.= ""; } } - $s_return.="\n$fill"; + $s_return.="\n$fill"; } - $s_return .= "\n
"; + $s_return.= "\n"; + $s_return.= "\n"; + $s_return.= "\n
"; } - $s_return .= "\n"; + $s_return.= "\n"; foreach($this->a_header[0] as $s_key => $s_value ){ if(!isset($s_value['attach'])){ @@ -103,18 +106,20 @@ class divlist { } $s_return.= "\n"; + + // Increment column counter + $this->cols++; + } - // 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) { - if($this->_numEntries()>=20) { - $s_return .= "\n"; - } - $s_return .= "\n
".$s_value['string']." 
 
"; - - // Only reduce width if we need a scrollbar (>19 Entries) - if($this->_numEntries()>19) { - $s_return .= ""; - } else { - $s_return .= "
"; - } - $i_alternate=0; - + 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"; + $str.=""; + $str.=""; + if($this->i_entriesPerPage == 0) { + $str.="
"; + $s_return .= ""; + } + + $i_alternate=0; if(isset($_GET['start'])){ $_SESSION['start'.$this->pageid]=$_GET['start']; $start = $_GET['start']; @@ -153,13 +154,15 @@ class divlist { /* If divlist is empty, append a single white entry */ if(count($this->a_entries)==0){ $str = $s_return.""; - //for($i = 0 ; $i < count($this->a_header[0]); $i++){ - $str.=""; - //} - $str.="
 
 
    
    
"; + if($this->i_entriesPerPage == 0) { + $s_return .= "\n"; + } + $s_return .= ""; return $s_return; } } } + // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: ?>