From: Jan Schneider Date: Sat, 12 Jun 2010 18:41:01 +0000 (+0200) Subject: Fix updating tasks if editing from a calendar view. X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=15debc4cd977a5165baaefad1a6bc87fab060a2b;p=horde.git Fix updating tasks if editing from a calendar view. --- diff --git a/kronolith/js/kronolith.js b/kronolith/js/kronolith.js index ccfcfa109..c248a8c88 100644 --- a/kronolith/js/kronolith.js +++ b/kronolith/js/kronolith.js @@ -2582,6 +2582,7 @@ KronolithCore = { return el.retrieve('tasklist') == list && el.retrieve('taskid') == task; }).invoke('remove'); + this.removeEvent('_tasks' + task, 'tasklists|tasks/' + list); }, /** @@ -2595,19 +2596,30 @@ KronolithCore = { } var tasklist = $F('kronolithTaskOldList'), - taskid = $F('kronolithTaskId'); + target = $F('kronolithTaskList'), + taskid = $F('kronolithTaskId'), + viewDates = this.viewDates(this.date, this.view), + start = viewDates[0].dateString(), + end = viewDates[1].dateString(); $('kronolithTaskSave').disable(); + this.startLoading('tasklists|tasks/' + target, start + end); this.loading++; $('kronolithLoading').show(); this.doAction('saveTask', $H($('kronolithTaskForm').serialize({ hash: true })) - .merge({ sig: this.tasktype }), + .merge({ + sig: this.tasktype, + view: this.view, + view_start: start, + view_end: end + }), function(r) { if (r.response.tasks && taskid) { this.removeTask(taskid, tasklist); } this.loadTasksCallback(r, false); + this.loadEventsCallback(r, false); if (r.response.tasks) { this.closeRedBox(); window.history.back(); diff --git a/kronolith/lib/Ajax/Application.php b/kronolith/lib/Ajax/Application.php index 6e015e817..910eadfa6 100644 --- a/kronolith/lib/Ajax/Application.php +++ b/kronolith/lib/Ajax/Application.php @@ -463,7 +463,7 @@ class Kronolith_Ajax_Application extends Horde_Ajax_Application_Base } unset($task['alarm_methods']); - $result = new stdClass; + $result = $this->_signedResponse('tasklists|tasks/' . $task['tasklist']); try { $ids = ($id && $list) ? $GLOBALS['registry']->tasks->updateTask($list, $id, $task) @@ -477,6 +477,26 @@ class Kronolith_Ajax_Application extends Horde_Ajax_Application_Base $result->list = $task->tasklist; } catch (Exception $e) { $GLOBALS['notification']->push($e, 'horde.error'); + return $result; + } + + if ($kronolith_driver = $this->_getDriver('tasklists|tasks/' . $task->tasklist)) { + try { + $event = $kronolith_driver->getEvent('_tasks' . $id); + $end = new Horde_Date($this->_vars->view_end); + $end->hour = 23; + $end->min = $end->sec = 59; + Kronolith::addEvents($events, $event, + new Horde_Date($this->_vars->view_start), + $end, true, true); + if (count($events)) { + $result->events = $events; + } + } catch (Horde_Exception_NotFound $e) { + $GLOBALS['notification']->push(_("The requested event was not found."), 'horde.error'); + } catch (Exception $e) { + $GLOBALS['notification']->push($e, 'horde.error'); + } } return $result;