Display readonly/shared icons for task lists; added toggles to collapse/expand subtasks (although state is not yet saved)

This commit is contained in:
Thomas Bruederli 2012-09-19 18:46:12 +02:00
parent fc09a9f8ac
commit b68a35755b
5 changed files with 81 additions and 6 deletions

View file

@ -107,6 +107,7 @@ class tasklist_kolab_driver extends tasklist_driver
'editable' => !$readonly, 'editable' => !$readonly,
'active' => $folder->is_subscribed(kolab_storage::SERVERSIDE_SUBSCRIPTION), 'active' => $folder->is_subscribed(kolab_storage::SERVERSIDE_SUBSCRIPTION),
'parentfolder' => $path_imap, 'parentfolder' => $path_imap,
'class_name' => $folder->get_namespace(),
); );
$this->lists[$tasklist['id']] = $tasklist; $this->lists[$tasklist['id']] = $tasklist;
$this->folders[$tasklist['id']] = $folder; $this->folders[$tasklist['id']] = $folder;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

View file

@ -199,15 +199,46 @@ body.attachmentwin #topnav .topright {
} }
#tasklists li span.listname { #tasklists li span.listname {
display: block;
cursor: default; cursor: default;
padding-bottom: 2px; padding-bottom: 2px;
padding-right: 30px;
margin-right: 20px;
color: #004458; color: #004458;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
background: url(sprites.png) right 20px no-repeat;
} }
#tasklists li span.handle { #tasklists li span.handle {
display: none; display: none;
} }
#tasklists li.selected span.listname {
font-weight: bold;
}
#tasklists li.readonly span.listname {
background-position: right -142px;
}
#tasklists li.other span.listname {
background-position: right -160px;
}
#tasklists li.other.readonly span.listname {
background-position: right -178px;
}
#tasklists li.shared span.listname {
background-position: right -196px;
}
#tasklists li.shared.readonly span.listname {
background-position: right -214px;
}
#tasklists li input { #tasklists li input {
position: absolute; position: absolute;
top: 5px; top: 5px;
@ -317,8 +348,9 @@ body.attachmentwin #topnav .topright {
} }
.taskitem { .taskitem {
position: relative;
display: block; display: block;
margin-bottom: 5px; margin-bottom: 3px;
} }
.taskitem.dragging { .taskitem.dragging {
@ -326,13 +358,26 @@ body.attachmentwin #topnav .topright {
} }
.taskitem .childtasks { .taskitem .childtasks {
position: relative;
padding: 0; padding: 0;
margin: 0.5em 0 0 2em; margin: 3px 0 0 20px;
list-style: none; list-style: none;
} }
.taskitem .childtoggle {
display: none;
position: absolute;
top: 4px;
left: -5px;
padding: 2px;
font-size: 10px;
color: #727272;
cursor: pointer;
}
.taskhead { .taskhead {
position: relative; position: relative;
margin-left: 14px;
padding: 4px 5px 3px 5px; padding: 4px 5px 3px 5px;
border: 1px solid #fff; border: 1px solid #fff;
border-radius: 5px; border-radius: 5px;

View file

@ -205,8 +205,13 @@ function rcube_tasklist_ui(settings)
// click-handler on task list items (delegate) // click-handler on task list items (delegate)
$(rcmail.gui_objects.resultlist).click(function(e){ $(rcmail.gui_objects.resultlist).click(function(e){
var item = $(e.target); var item = $(e.target);
var className = e.target.className;
if (!item.hasClass('taskhead')) if (item.hasClass('childtoggle')) {
item = item.parent().find('.taskhead');
className = 'childtoggle';
}
else if (!item.hasClass('taskhead'))
item = item.closest('div.taskhead'); item = item.closest('div.taskhead');
// ignore // ignore
@ -217,7 +222,13 @@ function rcube_tasklist_ui(settings)
li = item.parent(), li = item.parent(),
rec = listdata[id]; rec = listdata[id];
switch (e.target.className) { switch (className) {
case 'childtoggle':
rec.collapsed = !rec.collapsed;
li.children('.childtasks:first').toggle();
$(e.target).toggleClass('collapsed').html(rec.collapsed ? '▶' : '▼');
break;
case 'complete': case 'complete':
rec.complete = e.target.checked ? 1 : 0; rec.complete = e.target.checked ? 1 : 0;
li.toggleClass('complete'); li.toggleClass('complete');
@ -450,10 +461,26 @@ function rcube_tasklist_ui(settings)
} }
} }
fix_tree_toggles();
if (!count) if (!count)
msgbox.html(rcmail.gettext('notasksfound','tasklist')).show(); msgbox.html(rcmail.gettext('notasksfound','tasklist')).show();
} }
/**
* Show/hide child toggle buttons on all
*/
function fix_tree_toggles()
{
$('.taskitem', rcmail.gui_objects.resultlist).each(function(i,elem){
var li = $(elem),
rec = listdata[li.attr('rel')],
childs = rec && rec.children && rec.children.length ? $('.childtasks li', li) : [];
$('.childtoggle', li)[(childs.length ? 'show' : 'hide')]();
})
}
/** /**
* *
*/ */
@ -528,6 +555,7 @@ function rcube_tasklist_ui(settings)
$('li[rel="'+id+'"]', rcmail.gui_objects.resultlist).remove(); $('li[rel="'+id+'"]', rcmail.gui_objects.resultlist).remove();
append_tags(rec.tags || []); append_tags(rec.tags || []);
fix_tree_toggles();
} }
/** /**
@ -601,8 +629,9 @@ function rcube_tasklist_ui(settings)
li = $('<li>') li = $('<li>')
.attr('rel', rec.id) .attr('rel', rec.id)
.addClass('taskitem') .addClass('taskitem')
.append((rec.collapsed ? '<span class="childtoggle collapsed">&#9654;' : '<span class="childtoggle expanded">&#9660;') + '</span>')
.append(div) .append(div)
.append('<ul class="childtasks"></ul>'); .append('<ul class="childtasks" style="' + (rec.collapsed ? 'display:none' : '') + '"></ul>');
if (!parent || !parent.length) if (!parent || !parent.length)
li.appendTo(rcmail.gui_objects.resultlist); li.appendTo(rcmail.gui_objects.resultlist);

View file

@ -105,7 +105,7 @@ class tasklist_ui
$html_id = html_identifier($id); $html_id = html_identifier($id);
$class = 'tasks-' . asciiwords($id, true); $class = 'tasks-' . asciiwords($id, true);
if ($prop['readonly']) if (!$prop['editable'])
$class .= ' readonly'; $class .= ' readonly';
if ($prop['class_name']) if ($prop['class_name'])
$class .= ' '.$prop['class_name']; $class .= ' '.$prop['class_name'];