provide separate interfaces and type concepts for events and agenda items, e.g. for improving meeting minutes

This commit is contained in:
Helmut Merz 2012-07-17 08:42:36 +02:00
parent 944bb0e308
commit 142e1cb20b
9 changed files with 87 additions and 23 deletions

Binary file not shown.

View file

@ -3,7 +3,7 @@ msgstr ""
"Project-Id-Version: $Id$\n"
"POT-Creation-Date: 2007-05-22 12:00 CET\n"
"PO-Revision-Date: 2012-06-10 12:00 CET\n"
"PO-Revision-Date: 2012-07-17 12:00 CET\n"
"Last-Translator: Helmut Merz <helmutm@cy55.de>\n"
"Language-Team: loops developers <helmutm@cy55.de>\n"
"MIME-Version: 1.0\n"
@ -296,6 +296,9 @@ msgstr "Besprechungsprotokoll für dieses Objekt anzeigen."
msgid "Download Meeting Minutes"
msgstr "Besprechungsprotokoll generieren"
msgid "Participants"
msgstr "Teilnehmer"
msgid "Task/Action"
msgstr "Aufgabe"

View file

@ -316,7 +316,6 @@ class CreateFollowUpEvent(CreateConcept, BaseFollowUpController):
result = super(CreateFollowUpEvent, self).update()
form = self.request.form
toBeAssigned = form.get('cb_select_tasks') or []
print '***', toBeAssigned
for uid in toBeAssigned:
task = util.getObjectForUid(uid)
self.createFollowUpTask(adapted(task))

View file

@ -39,6 +39,26 @@
set_schema="loops.organize.interfaces.ITask" />
</zope:class>
<zope:adapter factory="loops.organize.task.Event"
provides="loops.organize.interfaces.IEvent"
trusted="True" />
<zope:class class="loops.organize.task.Event">
<require permission="zope.View"
interface="loops.organize.interfaces.IEvent" />
<require permission="zope.ManageContent"
set_schema="loops.organize.interfaces.IEvent" />
</zope:class>
<zope:adapter factory="loops.organize.task.AgendaItem"
provides="loops.organize.interfaces.IAgendaItem"
trusted="True" />
<zope:class class="loops.organize.task.AgendaItem">
<require permission="zope.View"
interface="loops.organize.interfaces.IAgendaItem" />
<require permission="zope.ManageContent"
set_schema="loops.organize.interfaces.IAgendaItem" />
</zope:class>
<zope:adapter factory="loops.organize.party.HasRole"
provides="loops.organize.interfaces.IHasRole"
trusted="True" />

View file

@ -1,5 +1,5 @@
#
# Copyright (c) 2011 Helmut Merz helmutm@cy55.de
# Copyright (c) 2012 Helmut Merz helmutm@cy55.de
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -18,8 +18,6 @@
"""
Interfaces for organizational stuff like persons and addresses.
$Id$
"""
from zope.interface import Interface, Attribute
@ -156,13 +154,29 @@ class IMemberRegistrationManager(Interface):
current password.
"""
# task
# task management, meeting minutes: task, event, agenda item
class ITask(IConceptSchema, ITask, ILoopsAdapter):
pass
class IEvent(ITask):
participants = schema.Text(
title=_(u'Participants'),
description=_(u'The names of the persons taking part in the event.'),
default=u'',
missing_value=u'',
required=False)
class IAgendaItem(ILoopsAdapter):
pass
# 'hasrole' predicate
class IHasRole(IRelationAdapter):

View file

@ -1,5 +1,5 @@
#
# Copyright (c) 2009 Helmut Merz helmutm@cy55.de
# Copyright (c) 2012 Helmut Merz helmutm@cy55.de
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -17,23 +17,22 @@
#
"""
Adapters for IConcept providing interfaces from the cybertools.organize package.
$Id$
Adapters for IConcept providing interfaces from the
cybertools.organize package.
"""
from time import mktime
from zope.component import adapts
from zope.interface import implements
from loops.organize.interfaces import ITask
from loops.organize.interfaces import ITask, IEvent, IAgendaItem
from loops.interfaces import IConcept
from loops.interfaces import IIndexAttributes
from loops.common import AdapterBase
from loops.type import TypeInterfaceSourceList
TypeInterfaceSourceList.typeInterfaces += (ITask,)
TypeInterfaceSourceList.typeInterfaces += (ITask, IEvent, IAgendaItem)
class Task(AdapterBase):
@ -42,10 +41,29 @@ class Task(AdapterBase):
implements(ITask)
_adapterAttributes = ('context', '__parent__',)
_adapterAttributes = AdapterBase._adapterAttributes
_contextAttributes = list(ITask)
class Event(Task):
""" A scheduled event or appointment.
"""
implements(IEvent)
_contextAttributes = list(IEvent)
class AgendaItem(AdapterBase):
""" Some topic (a sort of task) that is discussed during an event.
"""
implements(IAgendaItem)
_adapterAttributes = AdapterBase._adapterAttributes
_contextAttributes = list(IAgendaItem)
class IndexAttributes(object):
implements(IIndexAttributes)

View file

@ -24,8 +24,9 @@ from cybertools.util.jeep import Jeep
from loops.common import adapted
from loops.concept import Concept
from loops.organize.interfaces import IPerson, IHasRole
from loops.organize.interfaces import IEvent, IAgendaItem
from loops.organize.party import Person, HasRole
from loops.organize.task import Task
from loops.organize.task import Task, Event, AgendaItem
from loops.setup import addAndConfigureObject
from loops.tests.auth import login
@ -37,6 +38,8 @@ def setupUtilitiesAndAdapters(loopsRoot):
component.provideUtility(principalAnnotations, IPrincipalAnnotationUtility)
component.provideAdapter(Person, provides=IPerson)
component.provideAdapter(Task)
component.provideAdapter(Event, provides=IEvent)
component.provideAdapter(AgendaItem, provides=IAgendaItem)
component.provideAdapter(FoundPrincipalFactory)
component.provideAdapter(HasRole, provides=IHasRole)
return Jeep((

View file

@ -242,14 +242,19 @@ and recording information about the tasks.
Let's start with creating an a event and assigning it a task.
>>> from loops.organize.interfaces import ITask
>>> from loops.organize.interfaces import IEvent, IAgendaItem
>>> tEvent = addAndConfigureObject(concepts, Concept, 'event',
... title=u'Event', conceptType=concepts.getTypeConcept(),
... typeInterface=ITask)
... title=u'Event', conceptType=concepts.getTypeConcept(),
... typeInterface=IEvent)
>>> tAgendaItem = addAndConfigureObject(concepts, Concept, 'agendaitem',
... title=u'AgendaItem', conceptType=concepts.getTypeConcept(),
... typeInterface=IEvent)
>>> ev01 = addAndConfigureObject(concepts, Concept, 'ev01',
... title=u'loops Meeting', conceptType=tEvent)
>>> ev01.assignChild(task01)
... title=u'loops Meeting', conceptType=tEvent)
>>> aitem01 = addAndConfigureObject(concepts, Concept, 'aitem01',
... title=u'Documentation of Features', conceptType=tAgendaItem)
>>> ev01.assignChild(aitem01)
Now we create the meeting minutes report. We assign the event type as a
child in order to provide the information for which types of objects the
@ -259,9 +264,9 @@ report is available.
>>> component.provideAdapter(MeetingMinutes, provides=IReportInstance,
... name='meeting_minutes')
>>> meetingMinutes = addAndConfigureObject(concepts, Concept, 'meeting_minutes',
... title=u'Meeting Minutes', conceptType=tReport,
... reportType='meeting_minutes')
>>> meetingMinutes = addAndConfigureObject(concepts, Concept,
... 'meeting_minutes', title=u'Meeting Minutes', conceptType=tReport,
... reportType='meeting_minutes')
>>> meetingMinutes.assignChild(tEvent, hasReport)
We can now access the report using a corresponding report-based view.
@ -277,7 +282,8 @@ We can now access the report using a corresponding report-based view.
... for col in reportView.displayedColumns:
... print col.getDisplayValue(row),
... print
{'url': 'http://127.0.0.1/loops/views/home/.36', 'title': u'loops Development'}
{'url': 'http://127.0.0.1/loops/views/home/.58',
'title': u'Documentation of Features'}
<cybertools.composer.report.result.ResultSet object ...>

View file

@ -371,6 +371,7 @@ class MeetingMinutes(WorkReportInstance):
tasks, taskTitle, taskDescription, workItems))
defaultOutputFields = fields
states = ('planned', 'accepted', 'done', 'done_x', 'finished')
taskTypeNames = ('agendaitem',)
def selectObjects(self, parts):
return [adapted(t) for t in self.getTasks(parts)[1:]]