|
From: | Pascal Vilarem |
Subject: | Re: [Phpgroupware-developers] displaying items - backgroud color |
Date: | Tue, 19 Aug 2003 09:55:24 +0200 |
User-agent: | Mozilla/5.0 (X11; U; Linux i686; fr-FR; rv:1.4) Gecko/20030624 |
Chris Weiss wrote:I'd prefer to use the templates and theme...Pascal Vilarem (address@hidden) wrote:Hi, all This is my first writing to this list... I currenty need to display a list of items with a background color that shows the status of the item ("ok"... "not ok"... "late"... "corrected"... and things like that). Is there a "classic" way to do that in phpGW ? the alternate_row_color of the "netxtmatchs" class seems only to allow to swich between two colors... and i need something a little bit more "flexible"...not really, just set the color in td tags or use css and set the style according to your status. what about the following idea ? in nextmatchs class : change alternate_row_color and template_alternate_row_color : --------------------------------------------------------------------------------------------------------------- /*********************************************************************************************/ function alternate_row_color($tr_color = '', $rowstatus='') { global $tr_color; /* useless now but important to avoid changing existing calls to the method */ global $row_light; global $row_status; if ( !$rowlight ) { $rowlight = $row_light; } if ( $rowstatus ) { $rowstatus.='_'; } elseif ( $row_status != '') { $rowstatus=$row_status.'_'; } if ( $rowlight == 'row_on' ) { $rowlight = 'row_off'; } else { $rowlight = 'row_on'; } $row_light=$rowlight; $tr_color = $GLOBALS['phpgw_info']['theme'][$rowstatus.$rowlight]; return $tr_color; } function template_alternate_row_color(&$tpl, $rowstatus='') { if ( $rowstatus ) { global $row_status; $row_status = $rowstatus; } $tpl->set_var('tr_color',$this->alternate_row_color()); } /*********************************************************************************************/ in theme files add lines like this : -------------------------------------------- $phpgw_info['theme']['status1_row_on'] = '#color1light'; $phpgw_info['theme']['status1_row_off'] = '#color1dark'; and in ui class : -------------------- write $tr_color = $this->nextmatchs->alternate_row_color($tr_color, $status ); instead of $tr_color = $this->nextmatchs->alternate_row_color($tr_color); and $this->nextmatchs->template_alternate_row_color(&$this->t, $status); instead of $this->nextmatchs->template_alternate_row_color(&$this->t); the result : -------------- nothing is gonna change is status isn't given... and if it is given, the background color is set up accordingly... the highlighting of the background is now independant of the color itself Nota : i should check that the right line exists in theme file... good idea ? or stupid one ? plz feel right to give comments. |
[Prev in Thread] | Current Thread | [Next in Thread] |