Allow contact lists as event participants

This commit is contained in:
nathangray 2016-07-06 13:18:36 -06:00
parent 004a56c4f8
commit c8ea65828d
8 changed files with 44 additions and 25 deletions

View File

@ -251,6 +251,11 @@ class calendar_bo
'info' => __CLASS__.'::email_info',
'app' => 'email',
);
$this->resources['l'] = array(
'type' => 'l',// one char type-identifier for this resources
'info' => __CLASS__ .'::mailing_lists',// info method, returns array with id, type & name for a given id
'app' => 'Mailing list'
);
$this->resources[''] = array(
'type' => '',
'app' => 'api-accounts',

View File

@ -825,6 +825,7 @@ class calendar_boupdate extends calendar_bo
$event = $msg_type == MSG_ADDED || $msg_type == MSG_MODIFIED ? $new_event : $old_event;
// add all group-members to the notification, unless they are already participants
$contact_obj = false;
foreach($to_notify as $userid => $statusid)
{
if (is_numeric($userid) && $GLOBALS['egw']->accounts->get_type($userid) == 'g' &&
@ -838,6 +839,28 @@ class calendar_boupdate extends calendar_bo
}
}
}
// Mailing lists
else if (!is_numeric($userid) && $userid[0] == 'l')
{
if(!$contact_obj)
{
$contact_obj = new Api\Contacts();
}
$options = array('list' => substr($user,1));
$contacts = $contact_obj->search('',true,'','','',false,'AND',false,$options);
if(!$contacts)
{
continue;
}
foreach($contacts as &$contact)
{
$contact = 'c'.$contact['id'];
if ($contact && !isset($to_notify[$contact])) // already added?
{
$to_notify[$contact] = 'G';
}
}
}
}
$user_prefs = $GLOBALS['egw_info']['user']['preferences'];
$startdate = new Api\DateTime($event['start']);

View File

@ -253,4 +253,4 @@ class calendar_owner_etemplate_widget extends Etemplate\Widget\Taglist
}
return $label;
}
}
}

View File

@ -2753,6 +2753,7 @@ app.classes.calendar = (function(){ "use strict"; return AppJS.extend(
jQuery.extend({}, state, {owner: value[i].owner}),
this.sidebox_et2 ? null : this.et2.getInstanceManager()
);
need_data = false;
}
}

View File

@ -108,7 +108,7 @@ var et2_calendar_timegrid = (function(){ "use strict"; return et2_calendar_view.
.appendTo(this.scrolling);
// Used for owners
this.owner = et2_createWidget('select-account_ro',{},this);
this.owner = et2_createWidget('description',{},this);
this._labelContainer = jQuery(document.createElement("label"))
.addClass("et2_label et2_link")
@ -1586,17 +1586,7 @@ var et2_calendar_timegrid = (function(){ "use strict"; return et2_calendar_view.
if(typeof _owner == 'string' && isNaN(_owner))
{
this.set_label('');
switch(_owner[0])
{
case 'c':
this.owner.options.application = 'addressbook';
this.owner.set_value(_owner.substr(1));
break;
case 'r':
this.owner.options.application = 'resources';
this.owner.set_value(_owner.substr(1));
break;
}
this.owner.set_value(this._get_owner_name(_owner));
// Label is empty, but give extra space for the owner name
this.div.removeClass('calendar_TimeGridNoLabel');
@ -1615,7 +1605,7 @@ var et2_calendar_timegrid = (function(){ "use strict"; return et2_calendar_view.
else
{
this.owner.options.application = 'api-accounts';
this.owner.set_value(typeof _owner == "string" || typeof _owner == "number" ? _owner : jQuery.extend([],_owner));
this.owner.set_value(this._get_owner_name(_owner));
this.set_label('');
jQuery(this.getDOMNode(this.owner)).prepend(this.owner.getDOMNode());
}

View File

@ -345,7 +345,7 @@ var et2_calendar_view = (function(){ "use strict"; return et2_valueWidget.extend
var options = false
if(app.calendar && app.calendar.sidebox_et2 && app.calendar.sidebox_et2.getWidgetById('owner'))
{
options = app.calendar.sidebox_et2.getWidgetById('owner').options.select_options;
options = app.calendar.sidebox_et2.getWidgetById('owner').taglist.getSelection();
}
else
{

View File

@ -39,10 +39,10 @@
}
/* Let hidden user names be visible */
#calendar-view_view.hideDayColHeader tr:not(:first-of-type) .calendar_calGridHeader > ul {
#calendar-view_view.hideDayColHeader tr:not(:first-of-type) .calendar_calGridHeader > span.et2_label {
position: static;
}
#calendar-view_view.hideDayColHeader tr:not(:first-of-type) .calendar_calGridHeader > ul > li {
#calendar-view_view.hideDayColHeader tr:not(:first-of-type) .calendar_calGridHeader > span.et2_label {
overflow: visible !important;
}
}
@ -313,12 +313,12 @@ Hide subsequent headers in week view with non-consolidated owners
#calendar-view_view.hideDayColHeader tr:not(:first-of-type) .calendar_calGridHeader .calendar_calDayColHeader > div[data-date] {
display:none;
}
#calendar-view_view.hideDayColHeader tr .calendar_calGridHeader > ul > li {
#calendar-view_view.hideDayColHeader tr .calendar_calGridHeader > span.et2_label {
white-space:nowrap;
text-overflow: ellipsis;
overflow: hidden;
}
#calendar-view_view.hideDayColHeader tr .calendar_calGridHeader > ul:hover {
#calendar-view_view.hideDayColHeader tr .calendar_calGridHeader > span.et2_label:hover {
overflow: visible;
width: auto;
background-color: inherit;
@ -535,7 +535,7 @@ Hide subsequent headers in week view with non-consolidated owners
text-align: center;
}
.calendar_calGridHeader > ul {
.calendar_calGridHeader > span.et2_label {
position: absolute;
width: 55px;
}

View File

@ -51,10 +51,10 @@
overflow-y: hidden !important;
}
/* Let hidden user names be visible */
#calendar-view_view.hideDayColHeader tr:not(:first-of-type) .calendar_calGridHeader > ul {
#calendar-view_view.hideDayColHeader tr:not(:first-of-type) .calendar_calGridHeader > span.et2_label {
position: static;
}
#calendar-view_view.hideDayColHeader tr:not(:first-of-type) .calendar_calGridHeader > ul > li {
#calendar-view_view.hideDayColHeader tr:not(:first-of-type) .calendar_calGridHeader > span.et2_label {
overflow: visible !important;
}
}
@ -316,12 +316,12 @@ Hide subsequent headers in week view with non-consolidated owners
#calendar-view_view.hideDayColHeader tr:not(:first-of-type) .calendar_calGridHeader .calendar_calDayColHeader > div[data-date] {
display: none;
}
#calendar-view_view.hideDayColHeader tr .calendar_calGridHeader > ul > li {
#calendar-view_view.hideDayColHeader tr .calendar_calGridHeader > span.et2_label {
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
}
#calendar-view_view.hideDayColHeader tr .calendar_calGridHeader > ul:hover {
#calendar-view_view.hideDayColHeader tr .calendar_calGridHeader > span.et2_label:hover {
overflow: visible;
width: auto;
background-color: inherit;
@ -532,7 +532,7 @@ Hide subsequent headers in week view with non-consolidated owners
width: 58px;
text-align: center;
}
.calendar_calGridHeader > ul {
.calendar_calGridHeader > span.et2_label {
position: absolute;
width: 55px;
}