X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=include%2Fclass_divlist.inc;h=b17dfa74e3a73cdbe9b12c81ee05bf8ed56dd6bc;hb=01d4e77bb5563cbf98c3074b4d83b393571315c2;hp=461d3f92d8e53b07f6e80edf517766d825d20b36;hpb=12620943a49337bdfb6a5c7296c81c9cd2029067;p=gosa.git diff --git a/include/class_divlist.inc b/include/class_divlist.inc index 461d3f92d..b17dfa74e 100644 --- a/include/class_divlist.inc +++ b/include/class_divlist.inc @@ -5,21 +5,28 @@ 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; + var $force_height = false; + var $list_footer = ""; + var $fix_list_for_plugins = FALSE; + // Added php 4 constructor function divlist($pageid){ $this->i_currentPage = 0; $this->i_entriesPerPage = 10; - $this->s_height = "500"; - $this->s_width = "600"; + $this->s_height = "450"; + $this->s_width = "600px"; $this->s_summary = ""; $this->a_entries = array(); $this->a_header = array(); @@ -32,6 +39,16 @@ class divlist { } + function SetPluginMode($val = TRUE) + { + $this->fix_list_for_plugins = $val; + } + + function SetFooter($str) + { + $this->list_footer = $str; + } + function AddEntry($a_entriedata) { $this->a_entries[] = $a_entriedata; } @@ -46,10 +63,14 @@ class divlist { function SetHeight($s_height) { $this->s_height= $s_height; + $this->force_height = true; } 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){ @@ -58,11 +79,19 @@ class divlist { function DrawList(){ $s_return = ""; - $s_return.= ""; + if(!$this->force_height || $this->fix_list_for_plugins){ + $s_return.= "
"; + } else { + $s_return.= "
"; + } $s_return.= $this->_generateHeader(); - $s_return.=$this->_generatePage(); - + $s_return.= $this->_generatePage(); + $s_return.= $this->_generateFooter(); $s_return.= "
"; return ($s_return); @@ -71,30 +100,60 @@ 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 _generateFooter() + { + $s_return = ""; + if(!empty($this->list_footer)){ + + // Using scrolltable? + if($this->i_entriesPerPage == 0) { + if(!$this->force_height) { + $s_return.= "\n"; + } else { + $s_return.= "\n"; + } + + $s_return.= "\n"; + + } + return($s_return); + } function _generateHeader(){ - $s_return = ""; $s_value = ""; $s_key = ""; // Using scrolltable? if($this->i_entriesPerPage == 0) { - $s_return .= "\n
"; + } + } + $s_return .= ""; + // 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"; + $s_return.= "\n
".$this->list_footer." 
"; + if(!$this->force_height) { + $s_return.= "\n"; } - $s_return .= "\n"; + $s_return.= "\n"; return $s_return; } @@ -131,8 +190,13 @@ 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
"; + } else { + $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'])){ @@ -111,11 +170,11 @@ class divlist { // 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"; - $s_return .= "\n
 
 
"; - $s_return .= ""; + if(!$this->force_height) { + $s_return .= "\n
"; + $s_return .= ""; + } else { + $s_return .= "\n"; @@ -158,6 +222,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; @@ -173,10 +238,10 @@ 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"; + $s_return .= "\n"; $cnt = 0; @@ -241,7 +306,7 @@ class divlist { $i_alternate=1; } - $s_return .= "\n"; + $s_return .= "\n"; $cnt = 0; @@ -262,7 +327,7 @@ class divlist { $style = " ".$s_value2['attach']." " ; } - $s_return .= "\n"; } @@ -271,13 +336,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.= ""; + $fill.= ""; } else { - $fill.= ""; + $fill.= ""; } } $s_return.="\n$fill"; @@ -290,5 +356,6 @@ class divlist { } } } + // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: ?>
"; + $s_return .= ""; + } } $i_alternate=0; @@ -150,7 +214,7 @@ class divlist { /* If divlist is empty, append a single white entry */ if(count($this->a_entries)==0){ $str = $s_return.""; - $str.=""; + $str.=""; $str.=""; if($this->i_entriesPerPage == 0) { $str.="
  
"; + $s_return .= "\n"; $s_return .= $s_value2['string']; $s_return .= "