Add filters for my tasks and assigned to others; allow combined filter selections (using shift+click)
This commit is contained in:
parent
b1dbc46925
commit
5cdeed5c68
4 changed files with 55 additions and 10 deletions
|
@ -43,6 +43,10 @@ $labels['today'] = 'Today';
|
|||
$labels['tomorrow'] = 'Tomorrow';
|
||||
$labels['next7days'] = 'Next 7 days';
|
||||
$labels['later'] = 'Later';
|
||||
$labels['assigned'] = 'Assigned';
|
||||
$labels['assignedtitle'] = 'Tasks you assigned to others';
|
||||
$labels['mytasks'] = 'My tasks';
|
||||
$labels['mytaskstitle'] = 'Tasks assigned to you';
|
||||
$labels['nodate'] = 'no date';
|
||||
$labels['removetag'] = 'Remove';
|
||||
|
||||
|
|
|
@ -84,9 +84,15 @@
|
|||
<li class="flagged" role="radio" aria-checked="false" aria-labelledby="aria-radio-flagged"><a href="#flagged" id="aria-radio-flagged"><roundcube:label name="tasklist.flagged" /><span class="count"></span></a></li>
|
||||
<li class="today" role="radio" aria-checked="false" aria-labelledby="aria-radio-today"><a href="#today" id="aria-radio-today"><roundcube:label name="tasklist.today" /><span class="count"></span></a></li>
|
||||
<li class="tomorrow" role="radio" aria-checked="false" aria-labelledby="aria-radio-tomorrow"><a href="#tomorrow" id="aria-radio-tomorrow"><roundcube:label name="tasklist.tomorrow" /><span class="count"></span></a></li>
|
||||
<roundcube:if condition="env:tasklist_driver != 'kolab'" />
|
||||
<li class="week" role="radio" aria-checked="false" aria-labelledby="aria-radio-week"><a href="#week" id="aria-radio-week"><roundcube:label name="tasklist.next7days" /></a></li>
|
||||
<roundcube:endif />
|
||||
<li class="later" role="radio" aria-checked="false" aria-labelledby="aria-radio-later"><a href="#later" id="aria-radio-later"><roundcube:label name="tasklist.later" /></a></li>
|
||||
<li class="nodate" role="radio" aria-checked="false" aria-labelledby="aria-radio-nodate"><a href="#nodate" id="aria-radio-nodate"><roundcube:label name="tasklist.nodate" ucfirst="true" /></a></li>
|
||||
<roundcube:if condition="env:tasklist_driver == 'kolab'" />
|
||||
<li class="mytasks" role="radio" aria-checked="false" aria-labelledby="aria-radio-mytasks"><a href="#mytasks" id="aria-radio-mytasks" title="<roundcube:label name='tasklist.mytaskstitle'/>"><roundcube:label name="tasklist.mytasks" /></a></li>
|
||||
<li class="assigned" role="radio" aria-checked="false" aria-labelledby="aria-radio-assigned"><a href="#assigned" id="aria-radio-assigned" title="<roundcube:label name='tasklist.assignedtitle'/>"><roundcube:label name="tasklist.assigned" /></a></li>
|
||||
<roundcube:endif />
|
||||
<li class="complete" role="radio" aria-checked="false" aria-labelledby="aria-radio-complete"><a href="#complete" id="aria-radio-complete"><roundcube:label name="tasklist.complete" /><span class="count"></span></a></li>
|
||||
</ul>
|
||||
|
||||
|
|
|
@ -40,6 +40,8 @@ function rcube_tasklist_ui(settings)
|
|||
var FILTER_MASK_OVERDUE = 32;
|
||||
var FILTER_MASK_FLAGGED = 64;
|
||||
var FILTER_MASK_COMPLETE = 128;
|
||||
var FILTER_MASK_ASSIGNED = 256;
|
||||
var FILTER_MASK_MYTASKS = 512;
|
||||
|
||||
var filter_masks = {
|
||||
all: FILTER_MASK_ALL,
|
||||
|
@ -50,11 +52,12 @@ function rcube_tasklist_ui(settings)
|
|||
nodate: FILTER_MASK_NODATE,
|
||||
overdue: FILTER_MASK_OVERDUE,
|
||||
flagged: FILTER_MASK_FLAGGED,
|
||||
complete: FILTER_MASK_COMPLETE
|
||||
complete: FILTER_MASK_COMPLETE,
|
||||
assigned: FILTER_MASK_ASSIGNED,
|
||||
mytasks: FILTER_MASK_MYTASKS
|
||||
};
|
||||
|
||||
/* private vars */
|
||||
var selector = 'all';
|
||||
var tagsfilter = [];
|
||||
var filtermask = FILTER_MASK_ALL;
|
||||
var loadstate = { filter:-1, lists:'', search:null };
|
||||
|
@ -245,9 +248,21 @@ function rcube_tasklist_ui(settings)
|
|||
list_tasks();
|
||||
|
||||
// register event handlers for UI elements
|
||||
$('#taskselector a').click(function(e){
|
||||
if (!$(this).parent().hasClass('inactive'))
|
||||
list_tasks(this.href.replace(/^.*#/, ''));
|
||||
$('#taskselector a').click(function(e) {
|
||||
if (!$(this).parent().hasClass('inactive')) {
|
||||
var selector = this.href.replace(/^.*#/, ''),
|
||||
mask = filter_masks[selector],
|
||||
shift = e.shiftKey || e.ctrlKey || e.metaKey;
|
||||
|
||||
if (!shift)
|
||||
filtermask = mask; // reset selection on regular clicks
|
||||
else if (filtermask & mask)
|
||||
filtermask -= mask;
|
||||
else
|
||||
filtermask |= mask;
|
||||
|
||||
list_tasks();
|
||||
}
|
||||
return false;
|
||||
});
|
||||
|
||||
|
@ -606,11 +621,10 @@ function rcube_tasklist_ui(settings)
|
|||
|
||||
if (sel && filter_masks[sel] !== undefined) {
|
||||
filtermask = filter_masks[sel];
|
||||
selector = sel;
|
||||
}
|
||||
|
||||
var active = active_lists(),
|
||||
basefilter = filtermask == FILTER_MASK_COMPLETE ? FILTER_MASK_COMPLETE : FILTER_MASK_ALL,
|
||||
basefilter = filtermask & FILTER_MASK_COMPLETE ? FILTER_MASK_COMPLETE : FILTER_MASK_ALL,
|
||||
reload = force || active.join(',') != loadstate.lists || basefilter != loadstate.filter || loadstate.search != search_query;
|
||||
|
||||
if (active.length && reload) {
|
||||
|
@ -623,7 +637,16 @@ function rcube_tasklist_ui(settings)
|
|||
render_tasklist();
|
||||
|
||||
$('#taskselector li.selected').removeClass('selected').attr('aria-checked', 'false');
|
||||
$('#taskselector li.'+selector).addClass('selected').attr('aria-checked', 'true');
|
||||
|
||||
// select all active selectors
|
||||
if (filtermask > 0) {
|
||||
$.each(filter_masks, function(sel, mask) {
|
||||
if (filtermask & mask)
|
||||
$('#taskselector li.'+sel).addClass('selected').attr('aria-checked', 'true');
|
||||
});
|
||||
}
|
||||
else
|
||||
$('#taskselector li.all').addClass('selected').attr('aria-checked', 'true');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1876,10 +1899,14 @@ function rcube_tasklist_ui(settings)
|
|||
}
|
||||
});
|
||||
|
||||
$('#edit-tab-attendees').show();
|
||||
$('#edit-attendees-form')[(allow_invitations?'show':'hide')]();
|
||||
$('#edit-identities-list').val(identity_id);
|
||||
$('#taskedit-organizer')[(organizer ? 'show' : 'hide')]();
|
||||
}
|
||||
else {
|
||||
$('#edit-tab-attendees').hide();
|
||||
}
|
||||
|
||||
// attachments
|
||||
rcmail.enable_command('remove-attachment', list.editable);
|
||||
|
@ -2238,7 +2265,7 @@ function rcube_tasklist_ui(settings)
|
|||
return cache[rec.id];
|
||||
}
|
||||
|
||||
var match = !filtermask || (filtermask & rec.mask) > 0;
|
||||
var match = !filtermask || (filtermask & rec.mask) == filtermask;
|
||||
|
||||
// in focusview mode, only tasks from the selected list are allowed
|
||||
if (focusview && rec.list != focusview)
|
||||
|
|
|
@ -32,6 +32,8 @@ class tasklist extends rcube_plugin
|
|||
const FILTER_MASK_OVERDUE = 32;
|
||||
const FILTER_MASK_FLAGGED = 64;
|
||||
const FILTER_MASK_COMPLETE = 128;
|
||||
const FILTER_MASK_ASSIGNED = 256;
|
||||
const FILTER_MASK_MYTASKS = 512;
|
||||
|
||||
const SESSION_KEY = 'tasklist_temp';
|
||||
|
||||
|
@ -44,6 +46,8 @@ class tasklist extends rcube_plugin
|
|||
'overdue' => self::FILTER_MASK_OVERDUE,
|
||||
'flagged' => self::FILTER_MASK_FLAGGED,
|
||||
'complete' => self::FILTER_MASK_COMPLETE,
|
||||
'assigned' => self::FILTER_MASK_ASSIGNED,
|
||||
'mytasks' => self::FILTER_MASK_MYTASKS,
|
||||
);
|
||||
|
||||
public $task = '?(?!login|logout).*';
|
||||
|
@ -1077,7 +1081,11 @@ class tasklist extends rcube_plugin
|
|||
else if ($start > $weeklimit || ($rec['date'] && $duedate > $weeklimit))
|
||||
$mask |= self::FILTER_MASK_LATER;
|
||||
|
||||
// TODO: add mask for "assigned to me"
|
||||
// add masks for assigned tasks
|
||||
if ($this->is_organizer($rec) && !empty($rec['attendees']) && $this->is_attendee($rec) === false)
|
||||
$mask |= self::FILTER_MASK_ASSIGNED;
|
||||
else if (/*empty($rec['attendees']) ||*/ $this->is_attendee($rec) !== false)
|
||||
$mask |= self::FILTER_MASK_MYTASKS;
|
||||
|
||||
return $mask;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue