Show changes of parent-child relations in diff view (#3271) + show complete path of parent task titles in task details

This commit is contained in:
Thomas Bruederli 2015-03-25 16:26:13 +01:00
parent 7fec791449
commit c33c964bcd
4 changed files with 23 additions and 3 deletions

View file

@ -796,6 +796,7 @@ class tasklist_kolab_driver extends tasklist_driver
'attendee' => 'attendees', 'attendee' => 'attendees',
'attach' => 'attachments', 'attach' => 'attachments',
'rrule' => 'recurrence', 'rrule' => 'recurrence',
'related-to' => 'parent_id',
'percent-complete' => 'complete', 'percent-complete' => 'complete',
'lastmodified-date' => 'changed', 'lastmodified-date' => 'changed',
); );

View file

@ -882,7 +882,7 @@ ul.toolbarmenu .sortcol.by-auto a {
background: url(images/badge_cancelled.png) top right no-repeat; background: url(images/badge_cancelled.png) top right no-repeat;
} }
#task-parent-title { .task-parent-title {
position: relative; position: relative;
top: -0.6em; top: -0.6em;
} }

View file

@ -163,7 +163,7 @@
<div id="taskshow" class="taskshow"> <div id="taskshow" class="taskshow">
<div class="form-section" id="task-parent-title"></div> <div id="task-parent-title" class="form-section task-parent-title"></div>
<div class="form-section"> <div class="form-section">
<h2 id="task-title"></h2> <h2 id="task-title"></h2>
</div> </div>
@ -249,6 +249,10 @@
</div> </div>
<div id="taskdiff" class="uidialog taskshow" aria-hidden="true"> <div id="taskdiff" class="uidialog taskshow" aria-hidden="true">
<div class="form-section task-parent-title">
<span class="task-text-old"></span> &#8674;
<span class="task-text-new"></span> &raquo;
</div>
<h2 class="task-title">Task Title</h2> <h2 class="task-title">Task Title</h2>
<h2 class="task-title-new task-text-new"></h2> <h2 class="task-title-new task-text-new"></h2>
<div class="form-section task-description"> <div class="form-section task-description">

View file

@ -450,6 +450,16 @@ class tasklist extends rcube_plugin
$change['new']['classname'] = rcube_utils::file2class($change['new']['mimetype'], $change['new']['name']); $change['new']['classname'] = rcube_utils::file2class($change['new']['mimetype'], $change['new']['name']);
} }
} }
// resolve parent_id to the refered task title for display
if ($change['property'] == 'parent_id') {
$change['property'] = 'parent-title';
if (!empty($change['old']) && ($old_parent = $this->driver->get_task(array('id' => $change['old'], 'list' => $rec['list'])))) {
$change['old_'] = $old_parent['title'];
}
if (!empty($change['new']) && ($new_parent = $this->driver->get_task(array('id' => $change['new'], 'list' => $rec['list'])))) {
$change['new_'] = $new_parent['title'];
}
}
// compute a nice diff of description texts // compute a nice diff of description texts
if ($change['property'] == 'description') { if ($change['property'] == 'description') {
$change['diff_'] = libkolab::html_diff($change['old'], $change['new']); $change['diff_'] = libkolab::html_diff($change['old'], $change['new']);
@ -1272,12 +1282,17 @@ class tasklist extends rcube_plugin
private function task_walk_tree(&$rec) private function task_walk_tree(&$rec)
{ {
$rec['_depth'] = 0; $rec['_depth'] = 0;
$parent_titles = array();
$parent_id = $this->task_tree[$rec['id']]; $parent_id = $this->task_tree[$rec['id']];
while ($parent_id) { while ($parent_id) {
$rec['_depth']++; $rec['_depth']++;
$rec['parent_title'] = $this->task_titles[$parent_id]; array_unshift($parent_titles, $this->task_titles[$parent_id]);
$parent_id = $this->task_tree[$parent_id]; $parent_id = $this->task_tree[$parent_id];
} }
if (count($parent_titles)) {
$rec['parent_title'] = join(' » ', array_filter($parent_titles));
}
} }
/** /**