fixed not working alternating nextmatch colors of groups in account selection popup

This commit is contained in:
Ralf Becker 2010-11-02 13:28:41 +00:00
parent 42508c4f63
commit 5b361f3f6c
2 changed files with 24 additions and 16 deletions

View File

@ -610,21 +610,26 @@
{ {
$currentcolor = @$GLOBALS['tr_color']; $currentcolor = @$GLOBALS['tr_color'];
} }
// this is for old apps relying on the old themes if ($do_class)
$row_on_color = '" class="row_on'; {
$row_off_color = '" class="row_off'; $row_on_color = 'row_on';
$row_off_color = 'row_off';
}
else // this is for old apps relying on the old themes
{
$row_on_color = '" class="row_on';
$row_off_color = '" class="row_off';
}
if ($currentcolor == $row_on_color) if ($currentcolor == $row_on_color)
{ {
$GLOBALS['tr_color'] = $row_off_color; $GLOBALS['tr_color'] = $row_off_color;
$class='row_off';
} }
else else
{ {
$GLOBALS['tr_color'] = $row_on_color; $GLOBALS['tr_color'] = $row_on_color;
$class='row_on';
} }
return $do_class ? $class : $GLOBALS['tr_color']; return $GLOBALS['tr_color'];
} }
// If you are using the common bgcolor="{tr_color}" // If you are using the common bgcolor="{tr_color}"

View File

@ -339,7 +339,7 @@ function addOption(id,label,value,do_onchange)
//echo "<p>uiaccountsel::popup(): app='$app', use='$use', multiple='$multiple', group_id='$group_id', element_id='$element_id', start='$start', order='$order', sort='$sort'</p>\n"; //echo "<p>uiaccountsel::popup(): app='$app', use='$use', multiple='$multiple', group_id='$group_id', element_id='$element_id', start='$start', order='$order', sort='$sort'</p>\n";
$this->nextmatchs =& CreateObject('phpgwapi.nextmatchs'); $nextmatchs = new nextmatchs();
$GLOBALS['egw']->template->set_root(common::get_tpl_dir('phpgwapi')); $GLOBALS['egw']->template->set_root(common::get_tpl_dir('phpgwapi'));
@ -405,9 +405,9 @@ function addOption(id,label,value,do_onchange)
); );
// -------------- list header variable template-declaration ------------------------ // -------------- list header variable template-declaration ------------------------
$GLOBALS['egw']->template->set_var('sort_lid',$this->nextmatchs->show_sort_order($sort,'account_lid',$order,'/index.php',lang('LoginID'),$link_data)); $GLOBALS['egw']->template->set_var('sort_lid',$nextmatchs->show_sort_order($sort,'account_lid',$order,'/index.php',lang('LoginID'),$link_data));
$GLOBALS['egw']->template->set_var('sort_firstname',$this->nextmatchs->show_sort_order($sort,'account_firstname',$order,'/index.php',lang('Firstname'),$link_data)); $GLOBALS['egw']->template->set_var('sort_firstname',$nextmatchs->show_sort_order($sort,'account_firstname',$order,'/index.php',lang('Firstname'),$link_data));
$GLOBALS['egw']->template->set_var('sort_lastname',$this->nextmatchs->show_sort_order($sort,'account_lastname',$order,'/index.php',lang('Lastname'),$link_data)); $GLOBALS['egw']->template->set_var('sort_lastname',$nextmatchs->show_sort_order($sort,'account_lastname',$order,'/index.php',lang('Lastname'),$link_data));
// ------------------------- end header declaration -------------------------------- // ------------------------- end header declaration --------------------------------
@ -427,6 +427,7 @@ function addOption(id,label,value,do_onchange)
'order' => 'account_lid', 'order' => 'account_lid',
'sort' => 'ASC', 'sort' => 'ASC',
)); ));
$tr_color_app_groups = $tr_color_all_groups = 'row_off';
foreach($all_groups as $group) foreach($all_groups as $group)
{ {
$link_data['group_id'] = $group['account_id']; $link_data['group_id'] = $group['account_id'];
@ -437,7 +438,7 @@ function addOption(id,label,value,do_onchange)
if (!$app || in_array($group['account_id'],$app_groups)) if (!$app || in_array($group['account_id'],$app_groups))
{ {
$GLOBALS['egw']->template->set_var('tr_color',$this->nextmatchs->alternate_row_color($tr_color,True)); $GLOBALS['egw']->template->set_var('tr_color',$tr_color_app_groups=$nextmatchs->alternate_row_color($tr_color_app_groups,True));
$GLOBALS['egw']->template->set_var('link_user_group',egw::link('/index.php',$link_data)); $GLOBALS['egw']->template->set_var('link_user_group',egw::link('/index.php',$link_data));
$GLOBALS['egw']->template->set_var('name_user_group',common::grab_owner_name($group['account_id'])); $GLOBALS['egw']->template->set_var('name_user_group',common::grab_owner_name($group['account_id']));
@ -452,6 +453,7 @@ function addOption(id,label,value,do_onchange)
} }
else else
{ {
$GLOBALS['egw']->template->set_var('tr_color',$tr_color_all_groups=$nextmatchs->alternate_row_color($tr_color_all_groups,True));
$GLOBALS['egw']->template->set_var('link_all_group',egw::link('/index.php',$link_data)); $GLOBALS['egw']->template->set_var('link_all_group',egw::link('/index.php',$link_data));
$GLOBALS['egw']->template->set_var('name_all_group',common::grab_owner_name($group['account_id'])); $GLOBALS['egw']->template->set_var('name_all_group',common::grab_owner_name($group['account_id']));
$GLOBALS['egw']->template->set_var('accountid',$group['account_id']); $GLOBALS['egw']->template->set_var('accountid',$group['account_id']);
@ -472,24 +474,25 @@ function addOption(id,label,value,do_onchange)
)); ));
$GLOBALS['egw']->template->set_var(array( $GLOBALS['egw']->template->set_var(array(
'left' => $this->nextmatchs->left('/index.php',$start,$this->accounts->total,$link_data+array('query'=>$query)), 'left' => $nextmatchs->left('/index.php',$start,$this->accounts->total,$link_data+array('query'=>$query)),
'right' => $this->nextmatchs->right('/index.php',$start,$this->accounts->total,$link_data+array('query'=>$query)), 'right' => $nextmatchs->right('/index.php',$start,$this->accounts->total,$link_data+array('query'=>$query)),
'lang_showing' => ($group_id ? common::grab_owner_name($group_id).': ' : ''). 'lang_showing' => ($group_id ? common::grab_owner_name($group_id).': ' : '').
($query ? lang("Search %1 '%2'",lang($this->accounts->query_types[$query_type]),$query).': ' : '') ($query ? lang("Search %1 '%2'",lang($this->accounts->query_types[$query_type]),$query).': ' : '')
.$this->nextmatchs->show_hits($this->accounts->total,$start), .$nextmatchs->show_hits($this->accounts->total,$start),
)); ));
// -------------------------- end nextmatch ------------------------------------ // -------------------------- end nextmatch ------------------------------------
$GLOBALS['egw']->template->set_var('search_action',egw::link('/index.php',$link_data)); $GLOBALS['egw']->template->set_var('search_action',egw::link('/index.php',$link_data));
$GLOBALS['egw']->template->set_var('prev_query', $query); $GLOBALS['egw']->template->set_var('prev_query', $query);
$GLOBALS['egw']->template->set_var('search_list',$this->nextmatchs->search(array('query' => $query, 'search_obj' => 1))); $GLOBALS['egw']->template->set_var('search_list',$nextmatchs->search(array('query' => $query, 'search_obj' => 1)));
$GLOBALS['egw']->template->set_var('lang_firstname', lang("firstname")); $GLOBALS['egw']->template->set_var('lang_firstname', lang("firstname"));
$GLOBALS['egw']->template->set_var('lang_lastname', lang("lastname")); $GLOBALS['egw']->template->set_var('lang_lastname', lang("lastname"));
$tr_color = 'row_off';
foreach($users as $user) foreach($users as $user)
{ {
$GLOBALS['egw']->template->set_var('tr_color',$this->nextmatchs->alternate_row_color($tr_color,True)); $GLOBALS['egw']->template->set_var('tr_color',$tr_color=$nextmatchs->alternate_row_color($tr_color,True));
// ---------------- template declaration for list records -------------------------- // ---------------- template declaration for list records --------------------------