diff --git a/calendar/js/et2_widget_event.js b/calendar/js/et2_widget_event.js index 89666f48f9..d9559dfc15 100644 --- a/calendar/js/et2_widget_event.js +++ b/calendar/js/et2_widget_event.js @@ -523,11 +523,43 @@ var et2_calendar_event = (function(){ "use strict"; return et2_valueWidget.exten (this.options.value.location ? '

'+this.egw().lang('Location') + ':' + this.options.value.location+'

' : '')+ (cat_label ? '

'+this.egw().lang('Category') + ':' + cat_label +'

' : '')+ '

'+this.egw().lang('Participants')+':
'+ - participants + '

'+ + participants + '

'+ this._participant_summary(this.options.value.participants) + ''+ ''; }, + /** + * Generate participant summary line + * + * @returns {String} + */ + _participant_summary: function(participants) + { + if( Object.keys(this.options.value.participants).length < 2) + { + return ''; + } + + var participant_status = {A: 0, R: 0, T: 0, U: 0, D: 0}; + var status_label = {A: 'accepted', R: 'rejected', T: 'tentative', U: 'unknown'}; + var participant_summary = Object.keys(this.options.value.participants).length + ' ' + this.egw().lang('Participants')+': '; + var status_totals = []; + + for(var id in this.options.value.participants) + { + var status = this.options.value.participants[id].substr(0,1); + participant_status[status]++; + } + for(var status in participant_status) + { + if(participant_status[status] > 0) + { + status_totals.push(participant_status[status] + ' ' + this.egw().lang(status_label[status])); + } + } + return participant_summary + status_totals.join(', '); + }, + /** * Get actual icons from list * @returns {undefined}