mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-23 00:13:35 +01:00
Fix missing calendar owner labels when they weren't in the default options
This commit is contained in:
parent
c6501b6a88
commit
d02a1d31a6
@ -324,42 +324,11 @@ var et2_calendar_planner = (function(){ "use strict"; return et2_calendar_view.e
|
||||
// Labels for the rows
|
||||
row_labels: function() {
|
||||
var labels = [];
|
||||
var accounts = egw.accounts();
|
||||
var already_added = [];
|
||||
for(var i = 0; i < this.options.owner.length; i++)
|
||||
{
|
||||
var user = this.options.owner[i];
|
||||
if(parseInt(user) === 0)
|
||||
{
|
||||
// 0 means current user
|
||||
user = egw.user('account_id');
|
||||
}
|
||||
if (isNaN(user)) // resources
|
||||
{
|
||||
var planner = this;
|
||||
var label = egw.link_title('resources',user.match(/\d+/)[0],function(name) {
|
||||
for(var j = 0; j < labels.length; j++)
|
||||
{
|
||||
if(labels[j].id == this)
|
||||
{
|
||||
labels[j].label = name;
|
||||
break;
|
||||
}
|
||||
}
|
||||
var row = planner.getWidgetById('planner_row_'+this);
|
||||
if(row && row.set_label)
|
||||
{
|
||||
row.set_label(name);
|
||||
}
|
||||
},user);
|
||||
if(!label) label = user;
|
||||
if(already_added.indexOf(user) < 0)
|
||||
{
|
||||
labels.push({id: user, label: label, data: {participants:user,owner:''}});
|
||||
already_added.push(''+user);
|
||||
}
|
||||
}
|
||||
else if (user < 0) // groups
|
||||
if (user < 0) // groups
|
||||
{
|
||||
egw.accountData(user,'account_fullname',true,function(result) {
|
||||
for(var id in result)
|
||||
@ -374,15 +343,11 @@ var et2_calendar_planner = (function(){ "use strict"; return et2_calendar_view.e
|
||||
}
|
||||
else // users
|
||||
{
|
||||
user = parseInt(user);
|
||||
for(var j = 0; j < accounts.length && already_added.indexOf(''+user) < 0; j++)
|
||||
var label = this._get_owner_name(user);
|
||||
if(already_added.indexOf(user) < 0)
|
||||
{
|
||||
if(accounts[j].value === user)
|
||||
{
|
||||
labels.push({id: user, label: accounts[j].label, data: {participants:user,owner:user}});
|
||||
already_added.push(''+user);
|
||||
break;
|
||||
}
|
||||
labels.push({id: user, label: label, data: {participants:user,owner:''}});
|
||||
already_added.push(''+user);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -308,28 +308,13 @@ var et2_calendar_view = (function(){ "use strict"; return et2_valueWidget.extend
|
||||
* @memberOf et2_calendar_view
|
||||
*/
|
||||
_get_owner_name: function _get_owner_name(user) {
|
||||
var label = undefined;
|
||||
if(parseInt(user) === 0)
|
||||
{
|
||||
// 0 means current user
|
||||
user = egw.user('account_id');
|
||||
}
|
||||
if (isNaN(user)) // resources or contact
|
||||
{
|
||||
var application = 'home-accounts';
|
||||
switch(user[0])
|
||||
{
|
||||
case 'c':
|
||||
application = 'addressbook';
|
||||
break;
|
||||
case 'r':
|
||||
application = 'resources';
|
||||
break;
|
||||
}
|
||||
// This might not have a value right away
|
||||
// send an empty function or it won't ask the server
|
||||
user = egw.link_title(application,user.match(/\d+/)[0], function() {}, this);
|
||||
}
|
||||
else // users
|
||||
if (!isNaN(user))
|
||||
{
|
||||
user = parseInt(user);
|
||||
var accounts = egw.accounts('both');
|
||||
@ -337,12 +322,21 @@ var et2_calendar_view = (function(){ "use strict"; return et2_valueWidget.extend
|
||||
{
|
||||
if(accounts[j].value === user)
|
||||
{
|
||||
user = accounts[j].label;
|
||||
label = accounts[j].label;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return user;
|
||||
if(typeof label === 'undefined')
|
||||
{
|
||||
// Not found? Ask the sidebox owner widget, it gets updated
|
||||
if(app.calendar && app.calendar.sidebox_et2 && app.calendar.sidebox_et2.getWidgetById('owner'))
|
||||
{
|
||||
user = app.calendar.sidebox_et2.getWidgetById('owner').options.select_options.find(function(element) {return element.id == user;}) || {};
|
||||
label = user.label;
|
||||
}
|
||||
}
|
||||
return label;
|
||||
},
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user