Patch from Klaus Leithoff <kl-at-stylite.de> to better deal with a big number of groups in edit accounts

This commit is contained in:
Ralf Becker 2006-12-15 10:41:33 +00:00
parent 22508fffc1
commit 176554400a

View File

@ -1275,6 +1275,27 @@
$t->set_var($var); $t->set_var($var);
$t->parse('password_fields','form_passwordinfo',True); $t->parse('password_fields','form_passwordinfo',True);
// prepare the allGroups array for use with the checkbox-multiselect use
$allGroupsBuff=array();
while (list($key,$value) = each($allGroups))
{
$allGroupsBuff[$value['account_lid']]=$value['account_id'];
}
// sort alphabetical
ksort($allGroupsBuff);
$allGroupsSorted=array();
while (list($key,$value) = each($allGroupsBuff))
{
$allGroupsSorted[$value]=$key;
}
//prepare the userGroups Array for use with the checkbox-multiselect use -> selarray
$selarray=array();
while (list($key,$value) = each($userGroups))
{
array_push($selarray,$value['account_id']);
}
$t->set_var('groups_select','<div id="groupselector">' .$GLOBALS['egw']->html->checkbox_multiselect('account_groups[]',$selarray,$allGroupsSorted,true,'',min(3+count($allGroupsSorted),10),' style="width: 300px; text-align:left" ').'</div>');
/* KL 20061211 removed
$groups_select = ''; $groups_select = '';
$primary_group_select = ''; $primary_group_select = '';
reset($allGroups); reset($allGroups);
@ -1284,9 +1305,9 @@
$groups_select .= '<input type="checkbox" name="account_groups[]" value="' . $value['account_id'] . '"'; $groups_select .= '<input type="checkbox" name="account_groups[]" value="' . $value['account_id'] . '"';
for ($i=0; $i<count($userGroups); $i++) for ($i=0; $i<count($userGroups); $i++)
{ {
/* print // print
"Los1:".$userData["account_id"].$userGroups[$i]['account_id']." : //"Los1:".$userData["account_id"].$userGroups[$i]['account_id']." :
".$value['account_id']."<br>"; */ //".$value['account_id']."<br>";
if (@$userGroups[$i]['account_id'] == $value['account_id']) if (@$userGroups[$i]['account_id'] == $value['account_id'])
{ {
$groups_select .= ' checked'; $groups_select .= ' checked';
@ -1294,7 +1315,7 @@
} }
$groups_select .= '>' . $value['account_lid'] . "<br/>\n"; $groups_select .= '>' . $value['account_lid'] . "<br/>\n";
} }
*/
if (!$userData['account_primary_group']) if (!$userData['account_primary_group'])
{ {
@ -1348,9 +1369,10 @@
} }
$var = Array( $var = Array(
'groups_select' // KL 20061211 groups_select is already set
=> '<div id="groupselector">' . //'groups_select'
"\n".$groups_select. '</div>' . "\n", //=> '<div id="groupselector">' .
//"\n".$groups_select. '</div>' . "\n",
'primary_group_select' 'primary_group_select'
=> '<select => '<select
name="account_primary_group">'."\n".$primary_group_select.'</ name="account_primary_group">'."\n".$primary_group_select.'</