X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=include%2Fclass_divlist.inc;h=9c52b768c9044d714fc81ea9eef9820b53d6f744;hb=b55c9da0cc1fed54d967f22d17380948e94d40a0;hp=69d43a1fb1b97005c0c3ba17f11d575cf1a41168;hpb=3665e2ce16701da340dcbc6a2b4a167344785aa6;p=gosa.git diff --git a/include/class_divlist.inc b/include/class_divlist.inc index 69d43a1fb..9c52b768c 100644 --- a/include/class_divlist.inc +++ b/include/class_divlist.inc @@ -16,15 +16,17 @@ class divlist { var $i_currentPage; var $i_entriesPerPage; - var $height_forced = false; - + 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 = "450"; - $this->s_width = "600"; + $this->s_width = "600px"; $this->s_summary = ""; $this->a_entries = array(); $this->a_header = array(); @@ -37,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; } @@ -51,11 +63,14 @@ class divlist { function SetHeight($s_height) { $this->s_height= $s_height; - $this->height_forced =true; + $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){ @@ -64,13 +79,19 @@ class divlist { function DrawList(){ $s_return = ""; - $s_return.= ""; + if(!$this->force_height){ + $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); @@ -90,6 +111,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"; + } else { + $s_return.= "\n"; + } + + $s_return.= "\n"; + + } + return($s_return); + } function _generateHeader(){ $s_return = ""; @@ -98,7 +146,11 @@ class divlist { // 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
"; + } else { + $s_return.= "\n
"; + } } $s_return.= "\n"; @@ -138,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
"; - $s_return .= ""; + if(!$this->force_height || $this->fix_list_for_plugins) { + $s_return .= "\n
"; + $s_return .= ""; + } else { + $s_return .= "\n
"; + $s_return .= ""; + } } $i_alternate=0; @@ -181,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;