From c3cadea4f460fa731174dc6932e09f372197b7ab Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Tue, 31 Jan 2012 01:02:21 +0000 Subject: [PATCH] storing unsupported (valarm-)components like unsupported (X-)properties --- etemplate/inc/class.historylog_widget.inc.php | 13 +++++---- infolog/inc/class.infolog_ical.inc.php | 27 ++++++++++++++++++- 2 files changed, 34 insertions(+), 6 deletions(-) diff --git a/etemplate/inc/class.historylog_widget.inc.php b/etemplate/inc/class.historylog_widget.inc.php index 68b85f4c5a..bc913b7e24 100644 --- a/etemplate/inc/class.historylog_widget.inc.php +++ b/etemplate/inc/class.historylog_widget.inc.php @@ -77,13 +77,16 @@ class historylog_widget $options = implode(',',array($rows,$type1,$type2,$type3,$type4,$type5,$type6)); } $cell = etemplate::empty_cell($type,$cell['name'],array('readonly' => true,'size' => $options)); - // display unsupported iCal properties, which have multiple values or attributes - if ($type === 'label' && $value[1] === ':' && ($v = unserialize($value))) + // display unsupported iCal properties, which have multiple values or attributes, or multiple components + if ($type === 'label' && $value[1] === ':' && ($values = unserialize($value))) { - $values = $v['values']; - foreach((array)$v['params'] as $name => $val) + if (isset($values['values'])) { - $values[] = $name.': '.$val; + foreach((array)$values['params'] as $name => $val) + { + $values['values'][] = $name.': '.$val; + } + $values = $values['values']; } $value = implode("\n", $values); } diff --git a/infolog/inc/class.infolog_ical.inc.php b/infolog/inc/class.infolog_ical.inc.php index 7f7c01fdd1..b8ab13c3b0 100644 --- a/infolog/inc/class.infolog_ical.inc.php +++ b/infolog/inc/class.infolog_ical.inc.php @@ -334,7 +334,17 @@ class infolog_ical extends infolog_bo { if (substr($name, 0, 2) == '##') { - if ($value[1] == ':' && ($attr = unserialize($value)) !== false) + if ($name[2] == ':') + { + if ($value[1] == ':' && ($v = unserialize($value)) !== false) $value = $v; + foreach((array)$value as $compvData) + { + $comp = Horde_iCalendar::newComponent(substr($name,3), $vevent); + $comp->parsevCalendar($compvData,substr($name,3),'utf-8'); + $vevent->addComponent($comp); + } + } + elseif ($value[1] == ':' && ($attr = unserialize($value)) !== false) { $vevent->setAttribute(substr($name, 2), $attr['value'], $attr['params'], true, $attr['values']); } @@ -726,6 +736,21 @@ class infolog_ical extends infolog_bo } break; } + // store included, but unsupported components like valarm as x-properties + foreach($component->getComponents() as $comp) + { + $name = '##:'.strtoupper($comp->getType()); + $compvData = $comp->exportvCalendar($comp,'utf-8'); + if (isset($taskData[$name])) + { + $taskData[$name] = array($taskData[$name]); + $taskData[$name][] = $compvData; + } + else + { + $taskData[$name] = $compvData; + } + } if ($this->log) { error_log(__FILE__.'['.__LINE__.'] '.__METHOD__."($_taskID)\n" .