Index: /branches/2.2/phpgwapi/templates/classic/listUsers.php
===================================================================
--- /branches/2.2/phpgwapi/templates/classic/listUsers.php	(revision 1565)
+++ /branches/2.2/phpgwapi/templates/classic/listUsers.php	(revision 3404)
@@ -115,5 +115,5 @@
 	$users = Array();
 	$groups = Array();
-	$justthese = array("phpgwaccountvisible","uidNumber","cn");
+	$justthese = array("phpgwaccountvisible","uidNumber","cn","phpgwaccounttype","gidnumber");
 	
 	$typeAccount = 'u';
@@ -126,20 +126,35 @@
     if ($ds) 
     {
-		$sr=ldap_search($ds, $user_context, ("(&(cn=$cn)(phpgwaccounttype=".$typeAccount."))"),$justthese);	
-		$info = ldap_get_entries($ds, $sr);
-		
-		if($typeAccount == 'u'){ 
+		if( $acl_app == 'calendar' ){
+			$sr=ldap_search($ds, $user_context, ("(&(cn=$cn)(|(phpgwaccounttype=u)(phpgwaccounttype=g)))"),$justthese);
+			$info = ldap_get_entries($ds, $sr);
+			
 			for ($i=0; $i<$info["count"]; $i++)
-			{
-				if ($info[$i]["phpgwaccountvisible"][0] == '-1')
-					continue;
-				$users[$uids=$info[$i]["uidnumber"][0]] = Array('name'	=>	$uids=$info[$i]["cn"][0], 'type'	=>	u );
-			}
-		}
-		else {
-			for ($i=0; $i<$info["count"]; $i++)	
-				$users[$uids=$info[$i]["gidnumber"][0]] = Array('name'	=>	$uids=$info[$i]["cn"][0], 'type'	=>	g);		
-		
-		}
+				{
+					if ($info[$i]["phpgwaccountvisible"][0] == '-1')
+						continue;
+					if( $info[$i]["phpgwaccounttype"][0] == 'u')
+						$users[$uids=$info[$i]["uidnumber"][0]] = Array('name'	=>	$uids=$info[$i]["cn"][0], 'type'	=>	u );
+					else
+						$groups[$uids=$info[$i]["gidnumber"][0]] = Array('name'	=>	$uids=$info[$i]["cn"][0], 'type'	=>	g ); 
+				}
+		}
+		else{
+    		$sr=ldap_search($ds, $user_context, ("(&(cn=$cn)(phpgwaccounttype=".$typeAccount."))"),$justthese);
+    		$info = ldap_get_entries($ds, $sr);
+			if($typeAccount == 'u'){ 
+				for ($i=0; $i<$info["count"]; $i++)
+				{
+					if ($info[$i]["phpgwaccountvisible"][0] == '-1')
+						continue;
+					$users[$uids=$info[$i]["uidnumber"][0]] = Array('name'	=>	$uids=$info[$i]["cn"][0], 'type'	=>	u );
+				}
+			}
+			else {
+				for ($i=0; $i<$info["count"]; $i++)	
+					$users[$uids=$info[$i]["gidnumber"][0]] = Array('name'	=>	$uids=$info[$i]["cn"][0], 'type'	=>	g);		
+			
+			}
+		}	
 	}
 	ldap_close($ds);
@@ -147,6 +162,6 @@
 	@asort($users);
 	@reset($users);	
-//	@asort($groups);
-//	@reset($groups);
+	@asort($groups);
+	@reset($groups);
 
 	
@@ -155,8 +170,20 @@
 	
 	if($current == 'preferences'){
-		foreach($users as $id => $user_array) {
-			if($owner != $id){
-				$newId = 'u_'.$acl_app.'['.$id;			
-				$options .= '<option  value="'.$newId.'">'.utf8_decode($user_array['name']).'</option>'."\n";
+		if( count($users) > 0 ){
+			$options .= '<option value="-1" disabled="disabled">------------------- '.lang('users').' ------------------ </option>';
+			foreach($users as $id => $user_array) {
+				if($owner != $id){
+					$newId = 'u_'.$acl_app.'['.$id;			
+					$options .= '<option  value="'.$newId.'">'.utf8_decode($user_array['name']).'</option>'."\n";
+				}
+			}
+		}
+		if( count($groups) > 0 ){
+			$options .= '<option value="-1" disabled="disabled">------------------- '.lang('groups').' ------------------ </option>';
+			foreach($groups as $id => $groups_array) {
+				if($owner != $id){
+					$newId = 'g_'.$acl_app.'['.$id;			
+					$options .= '<option  value="'.$newId.'">'.utf8_decode($groups_array['name']).'</option>'."\n";
+				}
 			}
 		}
Index: /branches/2.2/phpgwapi/templates/classic/js/listUsers.js
===================================================================
--- /branches/2.2/phpgwapi/templates/classic/js/listUsers.js	(revision 1510)
+++ /branches/2.2/phpgwapi/templates/classic/js/listUsers.js	(revision 3404)
@@ -179,6 +179,8 @@
 
 					option = window.opener.document.createElement('option');
-					option.value =select.options[i].value;
+					option.value =select.options[i].value;					 
 					option.text = select.options[i].text;
+					if( option.value.charAt(0) == 'g' )
+						option.text = "(G) "+option.text;
 					selectOpener.options[selectOpener.options.length] = option;	
 					
Index: /branches/2.2/phpgwapi/templates/default/listUsers.php
===================================================================
--- /branches/2.2/phpgwapi/templates/default/listUsers.php	(revision 1559)
+++ /branches/2.2/phpgwapi/templates/default/listUsers.php	(revision 3404)
@@ -115,5 +115,5 @@
 	$users = Array();
 	$groups = Array();
-	$justthese = array("phpgwaccountvisible","uidNumber","cn");
+	$justthese = array("phpgwaccountvisible","uidNumber","cn","phpgwaccounttype","gidnumber");
 	
 	$typeAccount = 'u';
@@ -126,19 +126,34 @@
     if ($ds) 
     {
-		$sr=ldap_search($ds, $user_context, ("(&(cn=$cn)(phpgwaccounttype=".$typeAccount."))"),$justthese);	
-		$info = ldap_get_entries($ds, $sr);
-		
-		if($typeAccount == 'u'){ 
+    	if( $acl_app == 'calendar' ){
+			$sr=ldap_search($ds, $user_context, ("(&(cn=$cn)(|(phpgwaccounttype=u)(phpgwaccounttype=g)))"),$justthese);
+			$info = ldap_get_entries($ds, $sr);
+			
 			for ($i=0; $i<$info["count"]; $i++)
-			{
-				if ($info[$i]["phpgwaccountvisible"][0] == '-1')
-					continue;
-				$users[$uids=$info[$i]["uidnumber"][0]] = Array('name'	=>	$uids=$info[$i]["cn"][0], 'type'	=>	u );
-			}
-		}
-		else {
-			for ($i=0; $i<$info["count"]; $i++)	
-				$users[$uids=$info[$i]["gidnumber"][0]] = Array('name'	=>	$uids=$info[$i]["cn"][0], 'type'	=>	g);		
-		
+				{
+					if ($info[$i]["phpgwaccountvisible"][0] == '-1')
+						continue;
+					if( $info[$i]["phpgwaccounttype"][0] == 'u')
+						$users[$uids=$info[$i]["uidnumber"][0]] = Array('name'	=>	$uids=$info[$i]["cn"][0], 'type'	=>	u );
+					else
+						$groups[$uids=$info[$i]["gidnumber"][0]] = Array('name'	=>	$uids=$info[$i]["cn"][0], 'type'	=>	g ); 
+				}
+		}
+		else{
+    		$sr=ldap_search($ds, $user_context, ("(&(cn=$cn)(phpgwaccounttype=".$typeAccount."))"),$justthese);
+    		$info = ldap_get_entries($ds, $sr);
+			if($typeAccount == 'u'){ 
+				for ($i=0; $i<$info["count"]; $i++)
+				{
+					if ($info[$i]["phpgwaccountvisible"][0] == '-1')
+						continue;
+					$users[$uids=$info[$i]["uidnumber"][0]] = Array('name'	=>	$uids=$info[$i]["cn"][0], 'type'	=>	u );
+				}
+			}
+			else {
+				for ($i=0; $i<$info["count"]; $i++)	
+					$users[$uids=$info[$i]["gidnumber"][0]] = Array('name'	=>	$uids=$info[$i]["cn"][0], 'type'	=>	g);		
+			
+			}
 		}
 	}
@@ -147,6 +162,6 @@
 	@asort($users);
 	@reset($users);	
-//	@asort($groups);
-//	@reset($groups);
+	@asort($groups);
+	@reset($groups);
 
 	
@@ -155,8 +170,20 @@
 	
 	if($current == 'preferences'){
-		foreach($users as $id => $user_array) {
-			if($owner != $id){
-				$newId = 'u_'.$acl_app.'['.$id;			
-				$options .= '<option  value="'.$newId.'">'.utf8_decode($user_array['name']).'</option>'."\n";
+		if( count($users) > 0 ){
+			$options .= '<option value="-1" disabled="disabled">------------------- '.lang('users').' ------------------ </option>';
+			foreach($users as $id => $user_array) {
+				if($owner != $id){
+					$newId = 'u_'.$acl_app.'['.$id;			
+					$options .= '<option  value="'.$newId.'">'.utf8_decode($user_array['name']).'</option>'."\n";
+				}
+			}
+		}
+		if( count($groups) > 0 ){
+			$options .= '<option value="-1" disabled="disabled">------------------- '.lang('groups').' ------------------ </option>';
+			foreach($groups as $id => $groups_array) {
+				if($owner != $id){
+					$newId = 'g_'.$acl_app.'['.$id;			
+					$options .= '<option  value="'.$newId.'">'.utf8_decode($groups_array['name']).'</option>'."\n";
+				}
 			}
 		}
Index: /branches/2.2/phpgwapi/templates/default/js/listUsers.js
===================================================================
--- /branches/2.2/phpgwapi/templates/default/js/listUsers.js	(revision 1510)
+++ /branches/2.2/phpgwapi/templates/default/js/listUsers.js	(revision 3404)
@@ -181,4 +181,6 @@
 					option.value =select.options[i].value;
 					option.text = select.options[i].text;
+					if( option.value.charAt(0) == 'g' )
+						option.text = "(G) "+option.text;
 					selectOpener.options[selectOpener.options.length] = option;	
 					
Index: /branches/2.2/preferences/inc/class.uiaclprefs.inc.php
===================================================================
--- /branches/2.2/preferences/inc/class.uiaclprefs.inc.php	(revision 1496)
+++ /branches/2.2/preferences/inc/class.uiaclprefs.inc.php	(revision 3404)
@@ -238,10 +238,10 @@
 					$processed[] = $id;
 				}	
-				//else
-				//{
-			//		$group_array['name'] = '(G) ' . $fname;
-			//		$this->display_option('g_',$id,$group_array['name'],$is_group);
-			//		$processed[] = $id;
-			//	}	
+				else if(($acl_app == 'calendar') && ($acct->get_type($id) == 'g') && ($owner != $id && $rights))
+				{
+					$group_array['name'] = '(G) ' . $fname;
+					$this->display_option('g_',$id,$group_array['name'],$is_group);
+					$processed[] = $id;
+				}	
 			}
 			
