add 'title' attribute to track

git-svn-id: svn://svn.cy55.de/Zope3/src/cybertools/trunk@3102 fd906abe-77d9-0310-91a1-e0d9ade77398
This commit is contained in:
helmutm 2008-12-30 22:53:11 +00:00
parent 7d2b8768b1
commit 2eba0d27a3
2 changed files with 15 additions and 7 deletions

View file

@ -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

View file

@ -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':