* CalDAV/GroupDAV/InfoLog: making synced InfoLog types configurable and moved getctag method to infolog_bo in preparation of InfoLog eSync support

This commit is contained in:
Ralf Becker 2011-09-28 12:35:53 +00:00
parent 4dc0f22c81
commit bb4b9819b0
4 changed files with 53 additions and 43 deletions

View File

@ -93,16 +93,19 @@ class infolog_groupdav extends groupdav_handler
} }
/** /**
* Handle propfind in the infolog folder * Get filter-array for infolog_bo::search used by getctag and propfind
* *
* @param string $path * @param string $path
* @param array $options
* @param array &$files
* @param int $user account_id * @param int $user account_id
* @return mixed boolean true on success, false on failure or string with http status (eg. '404 Not Found') * @return array
*/ */
function propfind($path,$options,&$files,$user,$id='') private function get_infolog_filter($path, $user)
{ {
if (!($infolog_types = $GLOBALS['egw_info']['user']['preferences']['activesync']['infolog-types']))
{
$infolog_types = 'task';
}
$myself = ($user == $GLOBALS['egw_info']['user']['account_id']); $myself = ($user == $GLOBALS['egw_info']['user']['account_id']);
if ($path == '/infolog/') if ($path == '/infolog/')
@ -121,11 +124,25 @@ class infolog_groupdav extends groupdav_handler
} }
} }
// todo add a filter to limit how far back entries from the past get synced return array(
$filter = array(
'info_type' => 'task',
'filter' => $task_filter, 'filter' => $task_filter,
'info_type' => explode(',', $infolog_types),
); );
}
/**
* Handle propfind in the infolog folder
*
* @param string $path
* @param array $options
* @param array &$files
* @param int $user account_id
* @return mixed boolean true on success, false on failure or string with http status (eg. '404 Not Found')
*/
function propfind($path,$options,&$files,$user,$id='')
{
// todo add a filter to limit how far back entries from the past get synced
$filter = $this->get_infolog_filter($path, $user);
// process REPORT filters or multiget href's // process REPORT filters or multiget href's
if (($id || $options['root']['name'] != 'propfind') && !$this->_report_filters($options,$filter,$id)) if (($id || $options['root']['name'] != 'propfind') && !$this->_report_filters($options,$filter,$id))
@ -466,41 +483,7 @@ class infolog_groupdav extends groupdav_handler
*/ */
public function getctag($path,$user) public function getctag($path,$user)
{ {
$myself = ($user == $GLOBALS['egw_info']['user']['account_id']); return $this->bo->getctag($this->get_infolog_filter($path, $user));
if ($path == '/infolog/')
{
$task_filter= 'own';
}
else
{
if ($myself)
{
$task_filter = 'open';
}
else
{
$task_filter = 'open-user' . $user;
}
}
$query = array(
'order' => 'info_datemodified',
'sort' => 'DESC',
'filter' => $task_filter,
'date_format' => 'server',
'col_filter' => array('info_type' => 'task'),
'start' => 0,
'num_rows' => 1,
);
$result =& $this->bo->search($query);
if (empty($result)) return 'EGw-0-wGE';
$entry = array_shift($result);
return $this->get_etag($entry);
} }
/** /**

View File

@ -93,6 +93,27 @@ class groupdav_hooks
'default' => 'P', 'default' => 'P',
); );
translation::add_app('infolog');
$infolog = new infolog_bo();
if (!($types = $infolog->enums['type']))
{
$types = array(
'task' => 'Tasks',
);
}
$settings['infolog-types'] = array(
'type' => 'multiselect',
'label' => 'InfoLog types to sync',
'name' => 'infolog-types',
'help' => 'Which InfoLog types should be synced with the device, default only tasks.',
'values' => $types,
'default' => 'task',
'xmlrpc' => True,
'admin' => False,
);
$settings['debug_level'] = array( $settings['debug_level'] = array(
'type' => 'select', 'type' => 'select',
'label' => 'Debug level for Apache/PHP error-log', 'label' => 'Debug level for Apache/PHP error-log',

View File

@ -193,6 +193,7 @@ date common de Datum
date due common de fällig am date due common de fällig am
date selection: jscalendar de Datum auswählen: date selection: jscalendar de Datum auswählen:
datetime port.<br>if using port 13, please set firewall rules appropriately before submitting this page.<br>(port: 13 / host: 129.6.15.28) admin de Datum-Zeit Port.<br>Wenn Sie Port 13 benutzen, passen Sie bitte die Regeln der Firewall an bevor Sie die Seite speichern.<br>(Port: 13 / Host: 129.6.15.28) datetime port.<br>if using port 13, please set firewall rules appropriately before submitting this page.<br>(port: 13 / host: 129.6.15.28) admin de Datum-Zeit Port.<br>Wenn Sie Port 13 benutzen, passen Sie bitte die Regeln der Firewall an bevor Sie die Seite speichern.<br>(Port: 13 / Host: 129.6.15.28)
debug level for apache/php error-log common de Debug Stufe für Apache/PHP Fehlerprotokol
december common de Dezember december common de Dezember
default category common de Standard-Kategorie default category common de Standard-Kategorie
default height for the windows common de Vorgabewert für Höhe des Fensters default height for the windows common de Vorgabewert für Höhe des Fensters
@ -346,6 +347,7 @@ image directory relative to document root (use / !), example: common de Bildverz
image url common de Bild URL image url common de Bild URL
india common de INDIEN india common de INDIEN
indonesia common de INDONESIEN indonesia common de INDONESIEN
infolog types to sync common de InfoLog Typen zum synchronisieren
insert all %1 addresses of the %2 contacts in %3 common de Alle %1 Adressen der %2 Kontakte in %3 einfügen insert all %1 addresses of the %2 contacts in %3 common de Alle %1 Adressen der %2 Kontakte in %3 einfügen
insert column after common de Spalte danach einfügen insert column after common de Spalte danach einfügen
insert column before common de Spalte davor einfügen insert column before common de Spalte davor einfügen
@ -776,6 +778,7 @@ what style would you like the image to have? common de Welchen Stil soll das Bil
when you say yes the home and logout buttons are presented as applications in the main top applcation bar. common de Wenn Sie dies aktivieren, werden die Start und Abmelde Symbole als Anwendungen im oberen Anwendungsbalken angezeigt. when you say yes the home and logout buttons are presented as applications in the main top applcation bar. common de Wenn Sie dies aktivieren, werden die Start und Abmelde Symbole als Anwendungen im oberen Anwendungsbalken angezeigt.
where and how will the egroupware links like preferences, about and logout be displayed. common de Wo und wie werden die EGroupware Verknüpfungen wie Einstellungen, Über ..., und Abmelden angezeigt. where and how will the egroupware links like preferences, about and logout be displayed. common de Wo und wie werden die EGroupware Verknüpfungen wie Einstellungen, Über ..., und Abmelden angezeigt.
which groups common de Welche Gruppen which groups common de Welche Gruppen
which infolog types should be synced with the device, default only tasks. common de Welche InfoLog Typen sollen synchronisiert werden, Vorabe nur Aufgaben.
whole query common de Gesamte Abfrage whole query common de Gesamte Abfrage
width common de Breite width common de Breite
wk jscalendar de KW wk jscalendar de KW

View File

@ -191,6 +191,7 @@ date common en Date
date due common en Due date date due common en Due date
date selection: jscalendar en Date selection: date selection: jscalendar en Date selection:
datetime port.<br>if using port 13, please set firewall rules appropriately before submitting this page.<br>(port: 13 / host: 129.6.15.28) admin en Date time port.<br>If using port 13, set firewall rules appropriately before submitting this page.<br>(Port: 13 / Host: 129.6.15.28). datetime port.<br>if using port 13, please set firewall rules appropriately before submitting this page.<br>(port: 13 / host: 129.6.15.28) admin en Date time port.<br>If using port 13, set firewall rules appropriately before submitting this page.<br>(Port: 13 / Host: 129.6.15.28).
debug level for apache/php error-log common en Debug level for Apache/PHP error-log
december common en December december common en December
default category common en Default category default category common en Default category
default height for the windows common en Default height for the windows default height for the windows common en Default height for the windows
@ -343,6 +344,7 @@ image directory relative to document root (use / !), example: common en Image di
image url common en Image URL image url common en Image URL
india common en INDIA india common en INDIA
indonesia common en INDONESIA indonesia common en INDONESIA
infolog types to sync common en InfoLog types to sync
insert all %1 addresses of the %2 contacts in %3 common en Insert all %1 addresses of the %2 contacts in %3 insert all %1 addresses of the %2 contacts in %3 common en Insert all %1 addresses of the %2 contacts in %3
insert column after common en Insert column after insert column after common en Insert column after
insert column before common en Insert column before insert column before common en Insert column before
@ -769,6 +771,7 @@ what style would you like the image to have? common en Image style
when you say yes the home and logout buttons are presented as applications in the main top applcation bar. common en If you say yes, the Home and Log out buttons are presented as applications in the main top application bar. when you say yes the home and logout buttons are presented as applications in the main top applcation bar. common en If you say yes, the Home and Log out buttons are presented as applications in the main top application bar.
where and how will the egroupware links like preferences, about and logout be displayed. common en Where and how will the EGroupware links like Preferences, About and Log out be displayed. where and how will the egroupware links like preferences, about and logout be displayed. common en Where and how will the EGroupware links like Preferences, About and Log out be displayed.
which groups common en Which groups which groups common en Which groups
which infolog types should be synced with the device, default only tasks. common en Which InfoLog types should be synced with the device, default only tasks.
whole query common en Whole query whole query common en Whole query
width common en Width width common en Width
wk jscalendar en wk wk jscalendar en wk