mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-07 16:44:20 +01:00
New filter for calendar based on participant status:
- Not rejected - Accepted - Invitations - Tentative - Rejected - Owner too: display also events you own, not only ones you participate - All incl. rejected - Hide private infos: as usual --> filter is stored in the user prefs (survives logouts) --> old "show events you rejected" preference got removed Also added a hook allowing applications supplying resources to modify calendar search with SQL.
This commit is contained in:
parent
9b29f45a0f
commit
c38acb88d5
@ -264,7 +264,7 @@ class calendar_bo
|
||||
* users mixed integer user-id or array of user-id's to use, defaults to the current user
|
||||
* cat_id mixed category-id or array of cat-id's, defaults to all if unset, 0 or False
|
||||
* Please note: only a single cat-id, will include all sub-cats (if the common-pref 'cats_no_subs' is False)
|
||||
* filter string filter-name, atm. 'all' or 'hideprivate'
|
||||
* filter string all (not rejected), accepted, unknown, tentative, rejected or hideprivate
|
||||
* query string pattern so search for, if unset or empty all matching entries are returned (no search)
|
||||
* Please Note: a search never returns repeating events more then once AND does not honor start+end date !!!
|
||||
* dayswise boolean on True it returns an array with YYYYMMDD strings as keys and an array with events
|
||||
@ -276,7 +276,6 @@ class calendar_bo
|
||||
* otherwise the original recuring event (with the first start- + enddate) is returned
|
||||
* num_rows int number of entries to return, default or if 0, max_entries from the prefs
|
||||
* order column-names plus optional DESC|ASC separted by comma
|
||||
* show_rejected if set rejected invitation are shown only when true, otherwise it depends on the cal-pref or a running query
|
||||
* ignore_acl if set and true no check_perms for a general EGW_ACL_READ grants is performed
|
||||
* enum_groups boolean if set and true, group-members will be added as participants with status 'G'
|
||||
* cols string|array columns to select, if set the recordset/iterator will be returned
|
||||
@ -288,6 +287,17 @@ class calendar_bo
|
||||
{
|
||||
$params_in = $params;
|
||||
|
||||
unset($params['sql_filter']); // dont allow to set it via UI or xmlrpc
|
||||
|
||||
// check if any resource wants to hook into
|
||||
foreach($this->resources as $app => $data)
|
||||
{
|
||||
if (isset($data['search_filter']))
|
||||
{
|
||||
$params = ExecMethod($data['search_filter'],$params);
|
||||
}
|
||||
}
|
||||
|
||||
if (!isset($params['users']) || !$params['users'] ||
|
||||
count($params['users']) == 1 && isset($params['users'][0]) && !$params['users'][0]) // null or '' casted to an array
|
||||
{
|
||||
@ -366,15 +376,14 @@ class calendar_bo
|
||||
$cat_id = isset($params['cat_id']) ? $params['cat_id'] : 0;
|
||||
$filter = isset($params['filter']) ? $params['filter'] : 'all';
|
||||
$offset = isset($params['offset']) && $params['offset'] !== false ? (int) $params['offset'] : false;
|
||||
$show_rejected = isset($params['show_rejected']) ? $params['show_rejected'] : $this->cal_prefs['show_rejected'] || $params['query'];
|
||||
if ($this->debug && ($this->debug > 1 || $this->debug == 'search'))
|
||||
{
|
||||
$this->debug_message('bocal::search(%1) start=%2, end=%3, daywise=%4, cat_id=%5, filter=%6, query=%7, offset=%8, num_rows=%9, order=%10, show_rejected=%11)',
|
||||
True,$params,$start,$end,$daywise,$cat_id,$filter,$params['query'],$offset,(int)$params['num_rows'],$params['order'],$show_rejected);
|
||||
$this->debug_message('bocal::search(%1) start=%2, end=%3, daywise=%4, cat_id=%5, filter=%6, query=%7, offset=%8, num_rows=%9, order=%10, sql_filter=%11)',
|
||||
True,$params,$start,$end,$daywise,$cat_id,$filter,$params['query'],$offset,(int)$params['num_rows'],$params['order'],$params['sql_filter']);
|
||||
}
|
||||
// date2ts(,true) converts to server time, db2data converts again to user-time
|
||||
$events =& $this->so->search(isset($start) ? $this->date2ts($start,true) : null,isset($end) ? $this->date2ts($end,true) : null,
|
||||
$users,$cat_id,$filter,$params['query'],$offset,(int)$params['num_rows'],$params['order'],$show_rejected,$params['cols'],$params['append']);
|
||||
$users,$cat_id,$filter,$params['query'],$offset,(int)$params['num_rows'],$params['order'],$params['sql_filter'],$params['cols'],$params['append']);
|
||||
|
||||
if (isset($params['cols']))
|
||||
{
|
||||
@ -385,8 +394,8 @@ class calendar_bo
|
||||
|
||||
// socal::search() returns rejected group-invitations, as only the user not also the group is rejected
|
||||
// as we cant remove them efficiantly in SQL, we kick them out here, but only if just one user is displayed
|
||||
$remove_rejected_by_user = !$show_rejected && count($params['users']) == 1 ? $params['users'][0] : false;
|
||||
//echo "<p align=right>remove_rejected_by_user=$remove_rejected_by_user, show_rejected=$show_rejected, params[users]=".print_r($param['users'])."</p>\n";
|
||||
$remove_rejected_by_user = !in_array($filter,array('all','rejected')) && count($params['users']) == 1 ? $params['users'][0] : false;
|
||||
//echo "<p align=right>remove_rejected_by_user=$remove_rejected_by_user, filter=$filter, params[users]=".print_r($param['users'])."</p>\n";
|
||||
foreach($events as $id => $event)
|
||||
{
|
||||
if ($remove_rejected_by_user && $event['participants'][$remove_rejected_by_user] == 'R')
|
||||
|
@ -247,15 +247,6 @@ class calendar_hooks
|
||||
$options[$group['account_id']] = $GLOBALS['egw']->common->grab_owner_name($group['account_id']);
|
||||
}
|
||||
}
|
||||
$defaultfilter = array(
|
||||
'all' => lang('all'),
|
||||
'private' => lang('private only'),
|
||||
// 'public' => lang('global public only'),
|
||||
// 'group' => lang('group public only'),
|
||||
// 'private+public' => lang('private and global public'),
|
||||
// 'private+group' => lang('private and group public'),
|
||||
// 'public+group' => lang('global public and group public')
|
||||
);
|
||||
$freebusy_url = calendar_bo::freebusy_url($GLOBALS['egw_info']['user']['account_lid'],$GLOBALS['egw_info']['user']['preferences']['calendar']['freebusy_pw']);
|
||||
$freebusy_help = lang('Should not loged in persons be able to see your freebusy information? You can set an extra password, different from your normal password, to protect this informations. The freebusy information is in iCal format and only include the times when you are busy. It does not include the event-name, description or locations. The URL to your freebusy information is %1.','<a href="'.$freebusy_url.'" target="_blank">'.$freebusy_url.'</a>');
|
||||
|
||||
@ -296,12 +287,6 @@ class calendar_hooks
|
||||
'xmlrpc' => True,
|
||||
'admin' => False
|
||||
),
|
||||
'show_rejected' => array(
|
||||
'type' => 'check',
|
||||
'label' => 'Show invitations you rejected',
|
||||
'name' => 'show_rejected',
|
||||
'help' => 'Should invitations you rejected still be shown in your calendar ?<br>You can only accept them later (eg. when your scheduling conflict is removed), if they are still shown in your calendar!'
|
||||
),
|
||||
'weekdaystarts' => array(
|
||||
'type' => 'select',
|
||||
'label' => 'weekday starts on',
|
||||
|
@ -269,13 +269,13 @@ class calendar_so
|
||||
* @param int|array $users user-id or array of user-id's, !$users means all entries regardless of users
|
||||
* @param int $cat_id=0 mixed category-id or array of cat-id's, default 0 = all
|
||||
* Please note: only a single cat-id, will include all sub-cats (if the common-pref 'cats_no_subs' is False)
|
||||
* @param string $filter='' string filter-name, atm. all or hideprivate
|
||||
* @param string $filter='all' string filter-name: all (not rejected), accepted, unknown, tentative, rejected or hideprivate (handled elsewhere!)
|
||||
* @param string $query='' pattern so search for, if unset or empty all matching entries are returned (no search)
|
||||
* Please Note: a search never returns repeating events more then once AND does not honor start+end date !!!
|
||||
* @param int|boolean $offset=False offset for a limited query or False (default)
|
||||
* @param int $num_rows=0 number of rows to return if offset set, default 0 = use default in user prefs
|
||||
* @param string $order='cal_start' column-names plus optional DESC|ASC separted by comma
|
||||
* @param boolean $show_rejected=true should the search return rejected invitations
|
||||
* @param string $sql_filter='' sql to be and'ed into query (fully quoted)
|
||||
* @param string|array $_cols=null what to select, default "$this->repeats_table.*,$this->cal_table.*,cal_start,cal_end,cal_recur_date"
|
||||
* if specified an iterator for the rows is returned
|
||||
* @param string $append='' SQL to append to the query before $order, eg. for a GROUP BY clause
|
||||
@ -283,13 +283,17 @@ class calendar_so
|
||||
*
|
||||
* ToDo: search custom-fields too
|
||||
*/
|
||||
function &search($start,$end,$users,$cat_id=0,$filter='',$query='',$offset=False,$num_rows=0,$order='cal_start',$show_rejected=true,$_cols=null,$append='')
|
||||
function &search($start,$end,$users,$cat_id=0,$filter='all',$query='',$offset=False,$num_rows=0,$order='cal_start',$sql_filter='',$_cols=null,$append='')
|
||||
{
|
||||
//echo '<p>'.__METHOD__.'('.($start ? date('Y-m-d H:i',$start) : '').','.($end ? date('Y-m-d H:i',$end) : '').','.array2string($users).','.array2string($cat_id).",'$filter',".array2string($query).",$offset,$num_rows,$order,$show_rejected,".array2string($_cols).",$append)</p>\n";
|
||||
|
||||
$cols = !is_null($_cols) ? $_cols : "$this->repeats_table.*,$this->cal_table.*,cal_start,cal_end,cal_recur_date";
|
||||
|
||||
$where = array();
|
||||
if (!empty($sql_filter) && is_string($sql_filter))
|
||||
{
|
||||
$where[] = $sql_filter;
|
||||
}
|
||||
if (is_array($query))
|
||||
{
|
||||
$where = $query;
|
||||
@ -324,10 +328,31 @@ class calendar_so
|
||||
'cal_user_type' => $type,
|
||||
'cal_user_id' => $ids,
|
||||
));
|
||||
if ($type == 'u' && $filter == 'owner')
|
||||
{
|
||||
$cal_table_def = $this->db->get_table_definitions('calendar',$this->cal_table);
|
||||
$to_or[] = $this->db->expression($cal_table_def,array('cal_owner' => $ids));
|
||||
}
|
||||
}
|
||||
$where[] = '('.implode(' OR ',$to_or).')';
|
||||
|
||||
if (!$show_rejected) $where[] = "cal_status != 'R'";
|
||||
switch($filter)
|
||||
{
|
||||
case 'unknown':
|
||||
$where[] = "cal_status='U'"; break;
|
||||
case 'accepted':
|
||||
$where[] = "cal_status='A'"; break;
|
||||
case 'tentative':
|
||||
$where[] = "cal_status='T'"; break;
|
||||
case 'rejected':
|
||||
$where[] = "cal_status='R'"; break;
|
||||
case 'all':
|
||||
break;
|
||||
default:
|
||||
//if (!$show_rejected) // not longer used
|
||||
$where[] = "cal_status != 'R'";
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ($cat_id)
|
||||
{
|
||||
|
@ -123,7 +123,7 @@ class calendar_ui
|
||||
/**
|
||||
* @var array $states_to_save all states that will be saved to the user prefs
|
||||
*/
|
||||
var $states_to_save = array('owner');
|
||||
var $states_to_save = array('owner','filter');
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
@ -687,10 +687,21 @@ class calendar_ui
|
||||
$this->cats->formatted_list('select','all',$this->cat_id,'True'),$baseurl ? $baseurl.'&cat_id=' : '');
|
||||
|
||||
// Filter all or hideprivate
|
||||
$file[] = $this->_select_box('Filter','filter',
|
||||
'<option value="all"'.($this->filter=='all'?' selected="selected"':'').'>'.lang('No filter').'</option>'."\n".
|
||||
'<option value="hideprivate"'.($this->filter=='hideprivate'?' selected="selected"':'').'>'.lang('Hide private infos').'</option>'."\n",
|
||||
$baseurl ? $baseurl.'&filter=' : '');
|
||||
$options = '';
|
||||
foreach(array(
|
||||
'default' => lang('Not rejected'),
|
||||
'accepted' => lang('Accepted'),
|
||||
'unknown' => lang('Invitations'),
|
||||
'tentative' => lang('Tentative'),
|
||||
'rejected' => lang('Rejected'),
|
||||
'owner' => lang('Owner too'),
|
||||
'all' => lang('All incl. rejected'),
|
||||
'hideprivate' => lang('Hide private infos'),
|
||||
) as $value => $label)
|
||||
{
|
||||
$options .= '<option value="'.$value.'"'.($this->filter == $value ? ' selected="selected"' : '').'>'.$label.'</options>'."\n";
|
||||
}
|
||||
$file[] = $this->_select_box('Filter','filter',$options,$baseurl ? $baseurl.'&filter=' : '');
|
||||
|
||||
// Calendarselection: User or Group
|
||||
if(count($this->bo->grants) > 0 && $this->accountsel->account_selection != 'none')
|
||||
|
@ -25,6 +25,7 @@ all categories calendar de Alle Kategorien
|
||||
all day calendar de ganztägig
|
||||
all events calendar de Alle Termine
|
||||
all future calendar de Alle zukünftigen
|
||||
all incl. rejected calendar de Alle einschl. abgesagte
|
||||
all participants calendar de Alle Teilnehmer
|
||||
allows to edit the event again calendar de Erlaubt den Termin erneut zu bearbeiten
|
||||
apply the changes calendar de Übernimmt die Änderungen
|
||||
@ -177,6 +178,7 @@ import csv-file common de CSV-Datei importieren
|
||||
imports events into your calendar from a csv file. csv means 'comma seperated values'. however in the options tab you can also choose other seperators. calendar de Importieren von Terminen von einer CSV Datei. CSV bedeutet: Komma separierte Werte. Sie können in den Optionen des Import ebenso einen anderen Separator (Tab) wählen.
|
||||
interval calendar de Intervall
|
||||
invalid email-address "%1" for user %2 calendar de Ungültige E-Mail-Adresse "%1" für Benutzer %2
|
||||
invitations calendar de Einladungen
|
||||
last calendar de letzte
|
||||
lastname of person to notify calendar de Nachname der zu benachrichtigenden Person
|
||||
length of the time interval calendar de Länge des Zeitintervals
|
||||
@ -204,6 +206,7 @@ no matches found calendar de Keine Treffer gefunden
|
||||
no response calendar de Keine Antwort
|
||||
non blocking calendar de nicht blockierend
|
||||
not calendar de nicht
|
||||
not rejected calendar de Nicht abgesagt
|
||||
notification messages for added events calendar de Benachrichtigungstext für neue Termine
|
||||
notification messages for canceled events calendar de Benachrichtigungstext für stornierte Termine
|
||||
notification messages for disinvited participants calendar de Benachrichtigung für ausgeladene Teilnehmer
|
||||
@ -226,6 +229,7 @@ one year calendar de ein Jahr
|
||||
only the initial date of that recuring event is checked! calendar de Nur das Startdatum diese wiederholenden Termins wird geprüft!
|
||||
open todo's: calendar de unerledigte Aufgaben:
|
||||
overlap holiday calendar de überlappender Feiertag
|
||||
owner too calendar de Auch Besitzer
|
||||
participants calendar de Teilnehmer
|
||||
participants disinvited from an event calendar de Ausgeladene Teilnehmer eines Termins
|
||||
participants, resources, ... calendar de Teilnehmer, Ressourcen
|
||||
@ -271,7 +275,6 @@ selected range calendar de Ausgewählter Zeitraum
|
||||
set a year only for one-time / non-regular holidays. calendar de Nur für einmalige/unregelmäßige Feiertage das Jahr angeben.
|
||||
set new events to private calendar de Neue Termine als private Termine eintragen
|
||||
setting lock time calender admin de Zeitintervall für Datensatzlock (default 1 sec.)
|
||||
should invitations you rejected still be shown in your calendar ?<br>you can only accept them later (eg. when your scheduling conflict is removed), if they are still shown in your calendar! calendar de Sollen Einladungen welche von Ihnen abgelehnt wurden in Ihrem Kalender angezeigt werden?<br> Sie können diese Einladungen dann später akzeptieren (z. B. wenn Sie eine Terminkolission gelöst haben), wenn Sie in Ihrem Kalender noch vorhanden sind!
|
||||
should new events created as private by default ? calendar de Sollen neue Termine generell als Privat angelegt werden?
|
||||
should not loged in persons be able to see your freebusy information? you can set an extra password, different from your normal password, to protect this informations. the freebusy information is in ical format and only include the times when you are busy. it does not include the event-name, description or locations. the url to your freebusy information is %1. calendar de Sollen nicht angemeldete Personen ihre Belegtzeiten einsehen können? Sie können ein Passwort setzen um diese Informationen zu schützen. Das Passwort sollte sich von Ihrem normalen Passwort unterscheiden. Die Belegtzeiten sind im iCal Format und enthalten ausschließlich die Zeiten an denen sie nicht verfügbar sind. Sie enthalten NICHT den Namen, die Beschreibung oder den Ort des Termins. Die Adresse (URL) Ihrer Belegtzeiten ist %1.
|
||||
should not loged in persons be able to see your freebusy information? you can set an extra password, different from your normal password, to protect this informations. the freebusy information is in ical format and only include the times when you are busy. it does not include the event-name, description or locations. the url to your freebusy information is <a href="http://localhost/egroupware/calendar/freebusy.php?user=stivi" target="_blank">http://localhost/egroupware/calendar/freebusy.php?user=stivi</a>. calendar de Sollten Ihre Free/Bussy Zeiten nicht so geschützt sein das diese Daten nur bestimmten Personen zugänglich gemacht werden können? Sie können dafür ein Passwort, abweichend fom eGroupware Passwort vergeben. Die freebusy Information sind im iCal Format und nur dann inkludiert, wenn Sie keine Zeit haben. Die Eventnamen oder die Veranstaltungsorte werden nicht mit übertragen. Die URL zu den freebusy Information ist <a href="http://localhost/egroupware/calendar/freebusy.php?user=stivi" target="_blank">http://localhost/egroupware/calendar/freebusy.php?user=stivi</a>.
|
||||
@ -280,7 +283,6 @@ should the status of the event-participants (accept, reject, ...) be shown in br
|
||||
show birthdays from addressbook admin de Zeige Geburtstage vom Adressbuch
|
||||
show default view on main screen calendar de Standardansicht auf der Startseite anzeigen
|
||||
show empty rows in planner calendar de Zeige leere Zeilen im Planer
|
||||
show invitations you rejected calendar de Zeige Einladungen welche abgelehnt wurden an
|
||||
show list of upcoming events calendar de Zeige eine Liste der kommenden Termine
|
||||
show only the date, not the year admin de Zeige nur das Datum nicht das Jahr
|
||||
show this month calendar de Diesen Monat anzeigen
|
||||
|
@ -25,6 +25,7 @@ all categories calendar en All categories
|
||||
all day calendar en all day
|
||||
all events calendar en All events
|
||||
all future calendar en All future
|
||||
all incl. rejected calendar en All incl. rejected
|
||||
all participants calendar en All participants
|
||||
allows to edit the event again calendar en Allows to edit the event again
|
||||
apply the changes calendar en apply the changes
|
||||
@ -177,6 +178,7 @@ import csv-file common en Import CSV-File
|
||||
imports events into your calendar from a csv file. csv means 'comma seperated values'. however in the options tab you can also choose other seperators. calendar en Imports events into your Calendar from a CSV File. CSV means 'Comma Seperated Values'. However in the options Tab you can also choose other seperators.
|
||||
interval calendar en Interval
|
||||
invalid email-address "%1" for user %2 calendar en Invalid email-address "%1" for user %2
|
||||
invitations calendar en Invitations
|
||||
last calendar en Last
|
||||
lastname of person to notify calendar en Lastname of person to notify
|
||||
length of the time interval calendar en Length of the time interval
|
||||
@ -204,6 +206,7 @@ no matches found calendar en no matches found
|
||||
no response calendar en No response
|
||||
non blocking calendar en non blocking
|
||||
not calendar en not
|
||||
not rejected calendar en Not rejected
|
||||
notification messages for added events calendar en Notification messages for added events
|
||||
notification messages for canceled events calendar en Notification messages for canceled events
|
||||
notification messages for disinvited participants calendar en Notification messages for disinvited participants
|
||||
@ -226,6 +229,7 @@ one year calendar en one year
|
||||
only the initial date of that recuring event is checked! calendar en Only the initial date of that recuring event is checked!
|
||||
open todo's: calendar en open ToDo's:
|
||||
overlap holiday calendar en overlap holiday
|
||||
owner too calendar en Owner too
|
||||
participants calendar en Participants
|
||||
participants disinvited from an event calendar en Participants disinvited from an event
|
||||
participants, resources, ... calendar en Participants, Resources, ...
|
||||
@ -271,7 +275,6 @@ selected range calendar en Selected range
|
||||
set a year only for one-time / non-regular holidays. calendar en Set a Year only for one-time / non-regular holidays.
|
||||
set new events to private calendar en Set new events to private
|
||||
setting lock time calender admin en Setting Datalock Time for Calendar (default 1 sec.)
|
||||
should invitations you rejected still be shown in your calendar ?<br>you can only accept them later (eg. when your scheduling conflict is removed), if they are still shown in your calendar! calendar en Should invitations you rejected still be shown in your calendar ?<br>You can only accept them later (eg. when your scheduling conflict is removed), if they are still shown in your calendar!
|
||||
should new events created as private by default ? calendar en Should new events created as private by default ?
|
||||
should not loged in persons be able to see your freebusy information? you can set an extra password, different from your normal password, to protect this informations. the freebusy information is in ical format and only include the times when you are busy. it does not include the event-name, description or locations. the url to your freebusy information is %1. calendar en Should not loged in persons be able to see your freebusy information? You can set an extra password, different from your normal password, to protect this informations. The freebusy information is in iCal format and only include the times when you are busy. It does not include the event-name, description or locations. The URL to your freebusy information is %1.
|
||||
should not loged in persons be able to see your freebusy information? you can set an extra password, different from your normal password, to protect this informations. the freebusy information is in ical format and only include the times when you are busy. it does not include the event-name, description or locations. the url to your freebusy information is <a href="http://localhost/egroupware/calendar/freebusy.php?user=stivi" target="_blank">http://localhost/egroupware/calendar/freebusy.php?user=stivi</a>. calendar en Should not loged in persons be able to see your freebusy information? You can set an extra password, different from your normal password, to protect this informations. The freebusy information is in iCal format and only include the times when you are busy. It does not include the event-name, description or locations. The URL to your freebusy information is <a href="http://localhost/egroupware/calendar/freebusy.php?user=stivi" target="_blank">http://localhost/egroupware/calendar/freebusy.php?user=stivi</a>.
|
||||
@ -280,7 +283,6 @@ should the status of the event-participants (accept, reject, ...) be shown in br
|
||||
show birthdays from addressbook admin en Show birthdays from addressbook
|
||||
show default view on main screen calendar en show default view on main screen
|
||||
show empty rows in planner calendar en Show empty rows in Planner
|
||||
show invitations you rejected calendar en Show invitations you rejected
|
||||
show list of upcoming events calendar en show list of upcoming events
|
||||
show only the date, not the year admin en Show only the date, not the year
|
||||
show this month calendar en show this month
|
||||
|
Loading…
Reference in New Issue
Block a user