diff --git a/calendar/inc/class.calendar_bo.inc.php b/calendar/inc/class.calendar_bo.inc.php
index b9edff81bb..eeaffa2029 100644
--- a/calendar/inc/class.calendar_bo.inc.php
+++ b/calendar/inc/class.calendar_bo.inc.php
@@ -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 "
\n";
foreach($events as $id => $event)
{
if ($remove_rejected_by_user && $event['participants'][$remove_rejected_by_user] == 'R')
diff --git a/calendar/inc/class.calendar_hooks.inc.php b/calendar/inc/class.calendar_hooks.inc.php
index eda65f0629..8cf4165d83 100644
--- a/calendar/inc/class.calendar_hooks.inc.php
+++ b/calendar/inc/class.calendar_hooks.inc.php
@@ -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.',''.$freebusy_url.'');
@@ -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 ? 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',
diff --git a/calendar/inc/class.calendar_so.inc.php b/calendar/inc/class.calendar_so.inc.php
index f05bf04e8f..6ef7141770 100644
--- a/calendar/inc/class.calendar_so.inc.php
+++ b/calendar/inc/class.calendar_so.inc.php
@@ -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 '