- Fix clicking to create an event on another user's calendar did not always set that user as owner, even with add permission

- Fix doubled users in planner view when users and groups were selected
This commit is contained in:
Nathan Gray 2015-11-13 17:07:48 +00:00
parent cf26523530
commit ddb63f4f46
4 changed files with 19 additions and 9 deletions

View File

@ -111,7 +111,7 @@ class calendar_uiforms extends calendar_ui
}
$owner = $this->user;
}
//echo "<p>this->owner=$this->owner, _GET[owner]=$_GET[owner], user=$this->user => owner=$owner, extra_participants=".implode(',',$extra_participants)."</p>\n";
//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;

View File

@ -775,11 +775,16 @@ var et2_calendar_daycol = et2_valueWidget.extend([et2_IDetachedDOM],
else if ($j(_ev.target).hasClass('calendar_calAddEvent'))
{
// Default handler to open a new event at the selected time
this.egw().open(null, 'calendar', 'add', {
var options = {
date: _ev.target.dataset.date || this.options.date,
hour: _ev.target.dataset.hour || this._parent.options.day_start,
minute: _ev.target.dataset.minute || 0
} , '_blank');
};
if (this.options.owner != app.calendar.state.owner)
{
options.owner = this.options.owner;
}
this.egw().open(null, 'calendar', 'add', options, '_blank');
return false;
}
else if (this.header.has(_ev.target).length || this.header.is(_ev.target))

View File

@ -382,9 +382,9 @@ var et2_calendar_planner = et2_valueWidget.extend([et2_IDetachedDOM, et2_IResize
egw.accountData(user,'account_fullname',true,function(result) {
for(var id in result)
{
if(already_added.indexOf(id) < 0)
if(already_added.indexOf(''+id) < 0)
{
this.push({id: id, label: result[id], data: {participants:id,owner:''}});
this.push({id: id, label: result[id], data: {participants:id,owner:id}});
already_added.push(id);
}
}
@ -393,11 +393,11 @@ var et2_calendar_planner = et2_valueWidget.extend([et2_IDetachedDOM, et2_IResize
else // users
{
user = parseInt(user)
for(var j = 0; j < accounts.length && already_added.indexOf(user) < 0; j++)
for(var j = 0; j < accounts.length && already_added.indexOf(''+user) < 0; j++)
{
if(accounts[j].value === user)
{
labels.push({id: user, label: accounts[j].label, data: {participants:user,owner:''}});
labels.push({id: user, label: accounts[j].label, data: {participants:user,owner:user}});
already_added.push(user);
break;
}

View File

@ -1427,11 +1427,16 @@ var et2_calendar_timegrid = et2_valueWidget.extend([et2_IDetachedDOM, et2_IResiz
else if (_ev.target.dataset.date)
{
// Default handler to open a new event at the selected time
this.egw().open(null, 'calendar', 'add', {
var options = {
date: _ev.target.dataset.date || this.day_list[0],
hour: _ev.target.dataset.hour || this.options.day_start,
minute: _ev.target.dataset.minute || 0
} , '_blank');
};
if (this.options.owner != app.calendar.state.owner)
{
options.owner = this.options.owner;
}
this.egw().open(null, 'calendar', 'add', options , '_blank');
return false;
}
},