Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/19.1 participant names (19.1) #83

Open
wants to merge 3 commits into
base: 19.1
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions calendar/inc/class.calendar_hooks.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,13 @@ static function settings($hook_data)
'xmlrpc' => True,
'admin' => False,
),
'participant_names' => array(
'type' => 'check',
'label' => 'Show participant names on event',
'name' => 'participant_names',
'help' => 'Controls whether names of participants are shown alongside the title of an appointment.',
'default' => false
),
'2.5.section' => array(
'type' => 'section',
'title' => lang('Configuration settings'),
Expand Down
10 changes: 10 additions & 0 deletions calendar/inc/class.calendar_ui.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -782,6 +782,9 @@ public function to_client(&$event)
$participants = $this->bo->participants($event,false);
$event['parts'] = implode("\n",$participants);
$event['participant_types'] = array();
// semicolon-separated string of participants that may (optionally) be shown alongside title
$participantNames = "";

foreach($participants as $uid => $text)
{
$user_type = $user_id = null;
Expand All @@ -797,7 +800,14 @@ public function to_client(&$event)
'account_id'
));
}
$participantNames .= ($this->bo->participant_name($user_id) . "; ");
}
// add the names of all participants as semicolon-separated string
if($GLOBALS['egw_info']['user']['preferences']['calendar']['participant_names'])
{
$event['participant_names'] = substr($participantNames, 0, -2);
}

$event['date'] = $this->bo->date2string($event['start']);

// Change dates
Expand Down
58 changes: 53 additions & 5 deletions calendar/js/et2_widget_event.js
Original file line number Diff line number Diff line change
Expand Up @@ -326,8 +326,8 @@ var et2_calendar_event = (function(){ "use strict"; return et2_valueWidget.exten
var title = !event.is_private ? egw.htmlspecialchars(event['title']) : egw.lang('private');

this.title
.html('<span class="calendar_calTimespan">'+this._get_timespan(event) + '<br /></span>')
.append('<span class="calendar_calEventTitle">'+title+'</span>')
.html('<span class="calendar_calTimespan">' + this._get_timespan(event) + '<br /></span>')
.append('<span class="calendar_calEventTitle">' + this._getTitle(event) + '</span>')

// Colors - don't make them transparent if there is no color
if(jQuery.Color("rgba(0,0,0,0)").toRgbaString() != jQuery.Color(this.div,'background-color').toRgbaString())
Expand All @@ -342,7 +342,7 @@ var et2_calendar_event = (function(){ "use strict"; return et2_valueWidget.exten
// Body
if(event.whole_day_on_top)
{
this.body.html(title);
this.body.html(this._getTitle(event));
}
else
{
Expand All @@ -358,8 +358,8 @@ var et2_calendar_event = (function(){ "use strict"; return et2_valueWidget.exten
).trim();

this.body
.html('<span class="calendar_calEventTitle">'+title+'</span>')
.append('<span class="calendar_calTimespan">'+start_time + '</span>');
.html('<span class="calendar_calEventTitle">' + this._getTitle(event) + '</span>')
.append('<span class="calendar_calTimespan">' + start_time + '</span>');
if(this.options.value.description.trim())
{
this.body
Expand Down Expand Up @@ -713,6 +713,54 @@ var et2_calendar_event = (function(){ "use strict"; return et2_valueWidget.exten
return timespan;
},

/**
* Creates the title-string for an event
* @param {Object} event the current event.
* @return {string} the resulting title.
*/
_getTitle: function(event) {
let title = "";
if(!event.is_private)
{
title = egw.htmlspecialchars(event['title']);
title += this._getParticipants(event);
}
else
{
title = egw.lang('private');
}
return title;
},

/**
* Retrieves participant names from an event
* @param {Object} event the current event
* @return {string} the participants as span-objects
*/
_getParticipants: function(event) {
let participants = "";
if(this._hasParticipantNames(event))
{
return '<span style="font-weight: normal"> // ' + event["participant_names"] + "</span>"
}
return participants;
},

/**
* Tries to detect provided names of participants for an event.
* Names will only be shown when provided with the event.
*
* @param {Object} event the current event
* @return boolean whether the event contains participant-names or not
*/
_hasParticipantNames: function(event)
{
return event["participant_names"] !== undefined
&& event["participant_names"] !== null;
},



/**
* Make sure event data has all proper values, and format them as expected
* @param {Object} event
Expand Down
2 changes: 2 additions & 0 deletions calendar/lang/egw_de.lang
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ close the window calendar de Schließt das Fenster
compose a mail to all participants after the event is saved calendar de Schreibe eine E-Mail an alle Teilnehmer, nachdem der Termin gespeichert wurde.
configuration settings calendar de Einstellungen der Konfiguration
conflict calendar de Konflikt
controls whether names of participants are shown alongside the title of an appointment. calendar de Steuert, ob die Namen von Teilnehmern auf einem Termin (neben dem Titel) angezeigt werden.
copy of: calendar de Kopie von:
copy this event calendar de Kopiert diesen Termin
copy your changes to the clipboard, %1reload the entry%2 and merge them. calendar de Kopieren Sie ihre Änderungen in die Zwischenablage, %1laden den Eintrag neu%2 und fügen diese wieder ein.
Expand Down Expand Up @@ -531,6 +532,7 @@ show only invitations, not yet accepted or rejected calendar de Zeige nur Einlad
show only rejected events calendar de Zeige nur abgesagte Termine
show only tentative accepted events calendar de Zeige nur vorläufig zugesagte Termine
show only the date, not the year admin de Zeige nur das Datum nicht das Jahr
show participant names on event calendar de Zeige Teilnehmer auf einem Termin an
show this month calendar de Diesen Monat anzeigen
show this week calendar de Diese Woche anzeigen
show year and age calendar de Zeige Jahr und Alter
Expand Down
2 changes: 2 additions & 0 deletions calendar/lang/egw_en.lang
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ close the window calendar en Close the window
compose a mail to all participants after the event is saved calendar en Compose a mail to all participants after the event is saved.
configuration settings calendar en Configuration settings
conflict calendar en Conflict
controls whether names of participants are shown alongside the title of an appointment. calendar en Controls whether names of participants are shown alongside the title of an appointment.
copy of: calendar en Copy of:
copy this event calendar en Copy this event
copy your changes to the clipboard, %1reload the entry%2 and merge them. calendar en Copy your changes to the clipboard, %1reload the entry%2 and merge them.
Expand Down Expand Up @@ -531,6 +532,7 @@ show only invitations, not yet accepted or rejected calendar en Show only invita
show only rejected events calendar en Show only rejected events
show only tentative accepted events calendar en Show only tentative accepted events
show only the date, not the year admin en Show only the date, not the year
show participant names on event calendar en Show participant names on event
show this month calendar en Show this month
show this week calendar en Show this week
show year and age calendar en Show year and age
Expand Down