new work item query for related tasks

This commit is contained in:
Helmut Merz 2012-11-28 16:22:25 +01:00
parent 2b80ebefdd
commit 4aeea61ed0
2 changed files with 27 additions and 0 deletions

View file

@ -288,6 +288,25 @@ class TaskWorkItems(BaseWorkItemsView, ConceptView):
return sorted(self.query(**criteria), key=lambda x: x.track.timeStamp)
class RelatedTaskWorkItems(TaskWorkItems):
""" Show work items for all instances of a concept type assigned to
the query as query target.
"""
@Lazy
def isQueryTarget(self):
return self.conceptManager['querytarget']
def listWorkItems(self):
criteria = self.baseCriteria
tasks = []
for parent in self.context.getChildren([self.isQueryTarget]):
for task in parent.getChildren([self.typePredicate]):
tasks.append(util.getUidForObject(task))
criteria['task'] = tasks
return sorted(self.query(**criteria), key=lambda x: x.track.timeStamp)
class PersonWorkItems(BaseWorkItemsView, ConceptView):
""" A query view showing work items for a person, the query's parent.
"""

View file

@ -30,6 +30,14 @@
factory="loops.organize.work.browser.AllWorkItems"
permission="zope.View" />
<zope:adapter
name="relatedtaskworkitems.html"
for="loops.interfaces.IConcept
zope.publisher.interfaces.browser.IBrowserRequest"
provides="zope.interface.Interface"
factory="loops.organize.work.browser.RelatedTaskWorkItems"
permission="zope.View" />
<zope:adapter
name="taskworkitems.html"
for="loops.interfaces.IConcept