Add a preference for participants for new events - just me, or selected

Applies when there is no obvious participant (clicking on a single user's calendar)
This commit is contained in:
Nathan Gray 2015-12-29 00:11:29 +00:00
parent 94b80f7790
commit d89e847acc
2 changed files with 17 additions and 6 deletions

View File

@ -184,6 +184,10 @@ class calendar_hooks
45 => '45',
60 => '60'
);
$default_participants = array(
0 => lang('Just me'),
'selected' => lang('Selected users/groups')
);
$defaultresource_sel = array(
'resources_conflict' => lang('resources with conflict detection'),
'resources_without_conflict' => lang('resources except conflicting ones'),
@ -383,6 +387,16 @@ class calendar_hooks
'admin' => False,
'default'=> 60,
),
'default_participant' => array(
'type' => 'select',
'label' => 'New event participants',
'name' => 'default_participant',
'values'=> $default_participants,
'help' => 'Participants automatically added to new events',
'default' => 0,
'xmlrpc' => False,
'admin' => False
),
'default-alarm' => array(
'type' => 'date-duration',//'select',
'label' => lang('Default alarm for regular events').' ('.lang('empty = no alarm').')',

View File

@ -87,7 +87,7 @@ class calendar_uiforms extends calendar_ui
}
else
{
$owner = $this->owner;
$owner = !$this->cal_prefs['default_participant'] ? $this->user : $this->owner;
}
if (!$owner || !is_numeric($owner) || $GLOBALS['egw']->accounts->get_type($owner) != 'u' ||
@ -116,9 +116,6 @@ class calendar_uiforms extends calendar_ui
}
//error_log("this->owner=$this->owner, _GET[owner]=$_GET[owner], user=$this->user => owner=$owner, extra_participants=".implode(',',$extra_participants).")");
// by default include the owner as participant (the user can remove him)
$extra_participants[] = $owner;
if(isset($_GET['start']))
{
$start = egw_time::to($_GET['start'], 'ts');
@ -168,8 +165,8 @@ class calendar_uiforms extends calendar_ui
}
if (!$participants) // if all participants got removed, include current user
{
$participants[$this->user] = $participant_types['u'][$this->user] = calendar_so::combine_status('A',1,'CHAIR');
}
$participants[$this->user] = $participant_types['u'][$this->user] = calendar_so::combine_status('A',1,'CHAIR');
}
if(isset($_GET['cat_id']))
{
$cat_id = explode(',',$_GET['cat_id']);