Horde::logMessage($e, 'ERR');
}
}
-
- /* Update tags */
- Kronolith::getTagger()->replaceTags($event->uid, $event->tags, $event->creator, 'event');
-
- /* Add tags again, but as the share owner (replaceTags removes ALL tags). */
- try {
- $cal = $GLOBALS['kronolith_shares']->getShare($event->calendar);
- } catch (Horde_Share_Exception $e) {
- throw new Kronolith_Exception($e);
- }
- Kronolith::getTagger()->tag($event->uid, $event->tags, $cal->get('owner'), 'event');
+ $this->_updateTags($event);
/* Update Geolocation */
if ($gDriver = Kronolith::getGeoDriver()) {
Horde::logMessage($e, 'ERR');
}
+ $this->_addTags($event);
+
+ /* Update Geolocation */
+ if ($event->geoLocation && $gDriver = Kronolith::getGeoDriver()) {
+ $gDriver->setLocation($event->id, $event->geoLocation);
+ }
+
+ /* Notify users about the new event. */
+ Kronolith::sendNotification($event, 'add');
+
+ return $id;
+ }
+
+ /**
+ * Helper function to update an existing event's tags to tagger storage.
+ *
+ * @param Kronolith_Event $event The event to update
+ */
+ protected function _updateTags($event)
+ {
+ /* Update tags */
+ Kronolith::getTagger()->replaceTags($event->uid, $event->tags, $event->creator, 'event');
+
+ /* Add tags again, but as the share owner (replaceTags removes ALL tags). */
+ try {
+ $cal = $GLOBALS['kronolith_shares']->getShare($event->calendar);
+ } catch (Horde_Share_Exception $e) {
+ throw new Kronolith_Exception($e);
+ }
+ Kronolith::getTagger()->tag($event->uid, $event->tags, $cal->get('owner'), 'event');
+ }
+
+ /**
+ * Helper function to add tags from a newly creted event to the tagger.
+ *
+ * @param Kronolith_Event $event The event to save tags to storage for.
+ */
+ protected function _addTags($event)
+ {
/* Deal with any tags */
$tagger = Kronolith::getTagger();
$tagger->tag($event->uid, $event->tags, $event->creator, 'event');
throw new Kronolith_Exception($e);
}
$tagger->tag($event->uid, $event->tags, $cal->get('owner'), 'event');
-
- /* Update Geolocation */
- if ($event->geoLocation && $gDriver = Kronolith::getGeoDriver()) {
- $gDriver->setLocation($event->id, $event->geoLocation);
- }
-
- /* Notify users about the new event. */
- Kronolith::sendNotification($event, 'add');
-
- return $id;
}
/**
/* Get the resource and protect against infinite recursion in case
* someone is silly enough to add a resource to it's own event.*/
$resource = Kronolith::getDriver('Resource')->getResource($id);
+ Horde::logMessage('Kronolith_Event::save() checking resource ' . $id);
$rcal = $resource->get('calendar');
if ($rcal == $this->calendar) {
continue;
/* Remember accepted resources so we can add the event to their
* calendars. Otherwise, clear the lock. */
+ Horde::logMessage('Kronolith_Event::save() response for resource ' . $id . ': ' . $response);
if ($response == Kronolith::RESPONSE_ACCEPTED) {
$add_events[] = $resource;
} else {
* calendar before it is saved, they will have different GUIDs, and
* hence no longer refer to the same event. */
foreach ($add_events as $resource) {
+ Horde::logMessage('Kronolith_Event::save() Adding event ' . $this->uid . ' to resource ' . $resource->getId() . ' calendar. ');
$resource->addEvent($this);
if ($resource->get('response_type') == Kronolith_Resource::RESPONSETYPE_AUTO) {
$locks->clearLock($lock[$resource->getId()]);