njv infolog/groupdav work, mostly debug, and special handling for GroupDav as PeroductManufacturer

This commit is contained in:
Klaus Leithoff 2009-04-02 12:57:48 +00:00
parent d5e4faffb1
commit 70bfaee90e
3 changed files with 25 additions and 7 deletions

View File

@ -22,7 +22,7 @@ class infolog_groupdav extends groupdav_handler
* @var infolog_bo
*/
var $bo;
static $debugInfo = 0; // sometimes debuging is quite handy, to see things. check with the error log to see results
/**
* Constructor
*
@ -32,8 +32,10 @@ class infolog_groupdav extends groupdav_handler
*/
function __construct($app,$debug=null,$base_uri=null)
{
if (self::$debugInfo) $debug = self::$debugInfo;
if (self::$debugInfo) error_log(__METHOD__." called ");
parent::__construct($app,$debug,$base_uri);
if (self::$debugInfo) error_log(__METHOD__." parent constructed with $app,$debug,$base_uri; initializing infolog_bo ");
$this->bo =& new infolog_bo();
}
@ -47,6 +49,7 @@ class infolog_groupdav extends groupdav_handler
*/
static function get_path($info)
{
if (self::$debugInfo) error_log(__METHOD__." called with".print_r($info,true));
if (is_numeric($info) && self::PATH_ATTRIBUTE == 'info_id')
{
$name = $info;
@ -54,6 +57,7 @@ class infolog_groupdav extends groupdav_handler
else
{
if (!is_array($info)) $info = $this->bo->read($info);
if (self::$debugInfo) error_log(__METHOD__." returning info on ".print_r( $info,true));
$name = $info[self::PATH_ATTRIBUTE];
}
return '/infolog/'.$name.'.ics';
@ -70,6 +74,7 @@ class infolog_groupdav extends groupdav_handler
*/
function propfind($path,$options,&$files,$user,$id='')
{
if (self::$debugInfo) error_log(__METHOD__." called ");
// todo add a filter to limit how far back entries from the past get synced
$filter = array(
'info_type' => 'task',
@ -112,6 +117,7 @@ class infolog_groupdav extends groupdav_handler
*/
function get(&$options,$id)
{
if (self::$debugInfo) error_log(__METHOD__." called ");
if (!is_array($task = $this->_common_get_put_delete('GET',$options,$id)))
{
return $task;
@ -134,6 +140,7 @@ class infolog_groupdav extends groupdav_handler
*/
function put(&$options,$id,$user=null)
{
if (self::$debugInfo) error_log(__METHOD__." called ");
$ok = $this->_common_get_put_delete('PUT',$options,$id);
if (!is_null($ok) && !is_array($ok))
{
@ -142,7 +149,7 @@ class infolog_groupdav extends groupdav_handler
$handler = $this->_get_handler();
if (!($info_id = $handler->importVTODO($options['content'],is_numeric($id) ? $id : -1)))
{
if ($this->debug) error_log(__METHOD__."(,$id) import_vtodo($options[content]) returned false");
if ($this->debug ) error_log(__METHOD__."(,$id) import_vtodo($options[content]) returned false");
return '403 Forbidden';
}
header('ETag: '.$this->get_etag($info_id));
@ -163,6 +170,7 @@ class infolog_groupdav extends groupdav_handler
*/
function delete(&$options,$id)
{
if (self::$debugInfo) error_log(__METHOD__." called ");
if (!is_array($task = $this->_common_get_put_delete('DELETE',$options,$id)))
{
return $task;
@ -178,6 +186,7 @@ class infolog_groupdav extends groupdav_handler
*/
function read($id)
{
if (self::$debugInfo) error_log(__METHOD__." called ");
return $this->bo->read($id,false);
}
@ -190,6 +199,7 @@ class infolog_groupdav extends groupdav_handler
*/
function check_access($acl,$task)
{
if (self::$debugInfo) error_log(__METHOD__." called ");
return $this->bo->check_access($task,$acl);
}
@ -201,6 +211,7 @@ class infolog_groupdav extends groupdav_handler
*/
function get_etag($info)
{
if (self::$debugInfo) error_log(__METHOD__." called ");
if (!is_array($info))
{
$info = $this->bo->read($info);
@ -219,9 +230,11 @@ class infolog_groupdav extends groupdav_handler
*/
private function _get_handler()
{
if (self::$debugInfo) error_log(__METHOD__." called ");
$handler =& new infolog_ical();
$handler->setSupportedFields('GroupDAV',$this->agent);
return $handler;
}
}
}

View File

@ -11,6 +11,8 @@
*/
require_once EGW_API_INC.'/horde/Horde/iCalendar.php';
require_once EGW_API_INC.'/horde/Horde/iCalendar/vnote.php';
require_once EGW_API_INC.'/horde/Horde/iCalendar/vtodo.php';
/**
* InfoLog: Create and parse iCal's
@ -70,7 +72,7 @@ class infolog_ical extends infolog_bo
{
$vevent->setAttribute($field,$value);
$options = array();
if(preg_match('/([\000-\012\015\016\020-\037\075])/',$value))
if($this->productManufacturer != 'GroupDAV' && preg_match('/([\000-\012\015\016\020-\037\075])/',$value))
{
$options['ENCODING'] = 'QUOTED-PRINTABLE';
}
@ -102,8 +104,10 @@ class infolog_ical extends infolog_bo
$cats = $this->get_categories(array($taskData['info_cat']));
$vevent->setAttribute('CATEGORIES', $cats[0]);
}
//error_log("\n\nexportvcal\n". print_r($vcal,true));
//error_log("\n\nexportvcal\n". print_r($vevent,true));
$vcal->addComponent($vevent);
error_log("\n\nexportvcal from infolog\n");
return $vcal->exportvCalendar();
}
@ -356,7 +360,7 @@ class infolog_ical extends infolog_bo
else
{
// should better be imported as subject, but causes duplicates
// TODO: should be examined
// TODO: should be qexamined
$note['info_des'] = $txt;
}

View File

@ -439,6 +439,7 @@ class infolog_sif extends infolog_bo
function exportVTODO($_taskID, $_version)
{
error_log(__METHOD__."called : $_version ,$_taskID");
$taskData = $this->read($_taskID);
$taskData = $GLOBALS['egw']->translation->convert($taskData,$GLOBALS['egw']->translation->charset(),'UTF-8');