From 2eba0d27a360ddca184858359dde1bc8d026e3ae Mon Sep 17 00:00:00 2001 From: helmutm Date: Tue, 30 Dec 2008 22:53:11 +0000 Subject: [PATCH] add 'title' attribute to track git-svn-id: svn://svn.cy55.de/Zope3/src/cybertools/trunk@3102 fd906abe-77d9-0310-91a1-e0d9ade77398 --- organize/interfaces.py | 1 + organize/work.py | 21 ++++++++++++++------- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/organize/interfaces.py b/organize/interfaces.py index 58ed910..a4cdc0b 100644 --- a/organize/interfaces.py +++ b/organize/interfaces.py @@ -433,6 +433,7 @@ class IWorkItem(ITrack): party = Attribute('Whoever does the work, usually a person, identified ' 'by its name or ID.') state = Attribute('The current state the work item is in.') + title = Attribute('A short text characterizing the work item.') description = Attribute('A note about what has to be done, and why...') # optional plan fields; duration (and effort) may be derived from start and end # all date/time fields are timeStamp values, all duration and effort diff --git a/organize/work.py b/organize/work.py index b10d2a7..5218b4e 100644 --- a/organize/work.py +++ b/organize/work.py @@ -46,7 +46,7 @@ def workItemStates(): color='yellow'), State('running', 'running', ('finish', 'continue', 'cancel', 'transfer'), color='orange'), - State('finished', 'finished', (), color='green'), + State('finished', 'finished', ('cancel',), color='green'), State('continued', 'continued', ('finish', 'cancel'), color='blue'), State('transferred', 'transferred', ('finish', 'cancel'), color='lightblue'), @@ -72,7 +72,7 @@ class WorkItem(Stateful, Track): index_attributes = metadata_attributes typeName = 'WorkItem' - initAttributes = set(['party', 'description', 'predecessor', + initAttributes = set(['party', 'title', 'description', 'predecessor', 'planStart', 'planEnd', 'planDuration', 'planEffort']) closeAttributes = set(['end', 'duration', 'effort', 'comment']) @@ -86,7 +86,7 @@ class WorkItem(Stateful, Track): def __getattr__(self, attr): if attr not in IWorkItem: raise AttributeError(attr) - return self.data.get(attr, None) + return self.data.get(attr) def getStatesDefinition(self): return component.getUtility(IStatesDefinition, name=self.statesDefinition) @@ -95,6 +95,10 @@ class WorkItem(Stateful, Track): def party(self): return self.userName + @property + def title(self): + return self.data.get('title') or self.description + def setInitData(self, **kw): indexChanged = False updatePlanData = False @@ -163,8 +167,10 @@ class WorkItem(Stateful, Track): new = workItems.add(self.taskId, self.userName, self.runId, **newData) if transition == 'continue': new.assign() - new.data['predecessor'] = getName(self) - self.data['successor'] = getName(new) + #new.data['predecessor'] = getName(self) + new.data['predecessor'] = self.__name__ + #self.data['successor'] = getName(new) + self.data['successor'] = new.__name__ return new # actions @@ -180,8 +186,9 @@ class WorkItem(Stateful, Track): self.startWork(**kw) def action_finish(self, **kw): - if 'description' in kw: - self.data['description'] = kw.pop('description') + for k in ('description', 'title'): + if k in kw: + self.data[k] = kw.pop(k) if self.state == 'new': self.assign(kw.pop('party', None)) if self.state == 'assigned':