Activesync, eSync, z-push in current trunk of egroupware: Calendar issues with older Clients for EAS

classic Classic list List threaded Threaded
1 message Options
umehner umehner
Reply | Threaded
Open this post in threaded view
|

Activesync, eSync, z-push in current trunk of egroupware: Calendar issues with older Clients for EAS

For syncing calendar and addressbook with eGroupware to mobile devices I always prefer Exchange ActiveSync (EAS), as it comes preinstalled/built in with every mobile OS I know of.
While having mostly Android  4.x (and above) mobile clients synced to my eGW , there are some older devices with AS 12.1 and even an old SonyEricsson with AS 2.5 syncing calendar and addressbook as well.

These older devices do not support multiple calendars in one account. This is bad when syncing calendars from other users as it can be set in esync settings (given the appropriate rights to read and edit).
So when syncing the EAS account, all items owned by other users are ignored, except when the account user is an attendee/participant for this item.
It would be nice to have an option to sync all calendars in to one calendar (for older clients), like it can be set in esync settings for addressbook.

But instead of asking for that feature, I tried by myself and it turned out to be not that much of coded lines. One section for only syncing one folder for older clients and another section for extending the search for messages to retrieve the messages (calendar items) from all the calendars/users set in esync settings.
Just in file egroupware/calendar/inc/class.calendar_zpush.inc.php (diff to current revision 54458)
diff  class.calendar_zpush.inc.php.changed   class.calendar_zpush.inc.php.original
94,98c94,104
< 				$folderlist[] = $f = array(
< 					'id'	=>	$this->backend->createID('calendar',$account_id),
< 					'mod'	=>	$GLOBALS['egw']->accounts->id2name($account_id,'account_fullname'),
< 					'parent'=>	'0',
< 				);
---
> 				// Support for 12.1 and older Clients
> 				// For these clients show one folder only - the own
> 				if (intval(Request::GetProtocolVersion()) >= 14 ||
> 					intval(Request::GetProtocolVersion()) < 14 && $account_id == $GLOBALS['egw_info']['user']['account_id'] )
> 				{
> 					$folderlist[] = $f = array(
> 						'id'	=>	$this->backend->createID('calendar',$account_id),
> 						'mod'	=>	$GLOBALS['egw']->accounts->id2name($account_id,'account_fullname'),
> 						'parent'=>	'0',
> 					);
> 				}
201a208,216
> 		// Support for 12.1 and older Clients.
> 		// Get messages from all calendars the user has chosen to sync in esync setting (and thus has access rights) ...
> 		if (intval(Request::GetProtocolVersion()) < 14 && $user == $GLOBALS['egw_info']['user']['account_id'] )
> 		{
> 			$cals = $GLOBALS['egw_info']['user']['preferences']['activesync']['calendar-cals'];
> 			$filter['users'] = $cals ? explode(',',$cals) : array('P');     // implicit default of 'P'
> 			$filter['users'][] = $user;
> 		}
> 
773c788,791
< 		if (!$event['id'] || !$participants || !isset($participants[$account]))
---
> 		// Fuer eine Aenderung in einem bestehenden Termin muss man nicht zwangslaeufig als Teilnehmer hinzugefuegt werden!
> 		// umehner, 20160110
> 		//if (!$event['id'] || !$participants || !isset($participants[$account]))
> 		if (!$event['id'] || !$participants)
998a1017

The third "section" (sorry for the german comments) fixes an issue  I see for quite a long time (and hits newer clients as well): When editing a calendar item which is owned by another user on the phone, the phone user ist added as a participant/attendee when synced into eGW. I don't see a reason for this and it behaves different to editing a calendar item from a different user in eGW webfrontend.

That way one can see and edit all items from shared calendars - even on older devices. Okay, there might raise problems when determing the "own" item, when there are equal items in own and shared calendars ...
I would really love to see this kind of code/feature in eGW, maybe even extended as a user option in esync settings.

Cheers,
Ulle
eGroupware SVN Trunk