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:
parent
7d2b8768b1
commit
2eba0d27a3
2 changed files with 15 additions and 7 deletions
|
@ -433,6 +433,7 @@ class IWorkItem(ITrack):
|
||||||
party = Attribute('Whoever does the work, usually a person, identified '
|
party = Attribute('Whoever does the work, usually a person, identified '
|
||||||
'by its name or ID.')
|
'by its name or ID.')
|
||||||
state = Attribute('The current state the work item is in.')
|
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...')
|
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
|
# optional plan fields; duration (and effort) may be derived from start and end
|
||||||
# all date/time fields are timeStamp values, all duration and effort
|
# all date/time fields are timeStamp values, all duration and effort
|
||||||
|
|
|
@ -46,7 +46,7 @@ def workItemStates():
|
||||||
color='yellow'),
|
color='yellow'),
|
||||||
State('running', 'running', ('finish', 'continue', 'cancel', 'transfer'),
|
State('running', 'running', ('finish', 'continue', 'cancel', 'transfer'),
|
||||||
color='orange'),
|
color='orange'),
|
||||||
State('finished', 'finished', (), color='green'),
|
State('finished', 'finished', ('cancel',), color='green'),
|
||||||
State('continued', 'continued', ('finish', 'cancel'), color='blue'),
|
State('continued', 'continued', ('finish', 'cancel'), color='blue'),
|
||||||
State('transferred', 'transferred', ('finish', 'cancel'),
|
State('transferred', 'transferred', ('finish', 'cancel'),
|
||||||
color='lightblue'),
|
color='lightblue'),
|
||||||
|
@ -72,7 +72,7 @@ class WorkItem(Stateful, Track):
|
||||||
index_attributes = metadata_attributes
|
index_attributes = metadata_attributes
|
||||||
typeName = 'WorkItem'
|
typeName = 'WorkItem'
|
||||||
|
|
||||||
initAttributes = set(['party', 'description', 'predecessor',
|
initAttributes = set(['party', 'title', 'description', 'predecessor',
|
||||||
'planStart', 'planEnd', 'planDuration', 'planEffort'])
|
'planStart', 'planEnd', 'planDuration', 'planEffort'])
|
||||||
|
|
||||||
closeAttributes = set(['end', 'duration', 'effort', 'comment'])
|
closeAttributes = set(['end', 'duration', 'effort', 'comment'])
|
||||||
|
@ -86,7 +86,7 @@ class WorkItem(Stateful, Track):
|
||||||
def __getattr__(self, attr):
|
def __getattr__(self, attr):
|
||||||
if attr not in IWorkItem:
|
if attr not in IWorkItem:
|
||||||
raise AttributeError(attr)
|
raise AttributeError(attr)
|
||||||
return self.data.get(attr, None)
|
return self.data.get(attr)
|
||||||
|
|
||||||
def getStatesDefinition(self):
|
def getStatesDefinition(self):
|
||||||
return component.getUtility(IStatesDefinition, name=self.statesDefinition)
|
return component.getUtility(IStatesDefinition, name=self.statesDefinition)
|
||||||
|
@ -95,6 +95,10 @@ class WorkItem(Stateful, Track):
|
||||||
def party(self):
|
def party(self):
|
||||||
return self.userName
|
return self.userName
|
||||||
|
|
||||||
|
@property
|
||||||
|
def title(self):
|
||||||
|
return self.data.get('title') or self.description
|
||||||
|
|
||||||
def setInitData(self, **kw):
|
def setInitData(self, **kw):
|
||||||
indexChanged = False
|
indexChanged = False
|
||||||
updatePlanData = False
|
updatePlanData = False
|
||||||
|
@ -163,8 +167,10 @@ class WorkItem(Stateful, Track):
|
||||||
new = workItems.add(self.taskId, self.userName, self.runId, **newData)
|
new = workItems.add(self.taskId, self.userName, self.runId, **newData)
|
||||||
if transition == 'continue':
|
if transition == 'continue':
|
||||||
new.assign()
|
new.assign()
|
||||||
new.data['predecessor'] = getName(self)
|
#new.data['predecessor'] = getName(self)
|
||||||
self.data['successor'] = getName(new)
|
new.data['predecessor'] = self.__name__
|
||||||
|
#self.data['successor'] = getName(new)
|
||||||
|
self.data['successor'] = new.__name__
|
||||||
return new
|
return new
|
||||||
|
|
||||||
# actions
|
# actions
|
||||||
|
@ -180,8 +186,9 @@ class WorkItem(Stateful, Track):
|
||||||
self.startWork(**kw)
|
self.startWork(**kw)
|
||||||
|
|
||||||
def action_finish(self, **kw):
|
def action_finish(self, **kw):
|
||||||
if 'description' in kw:
|
for k in ('description', 'title'):
|
||||||
self.data['description'] = kw.pop('description')
|
if k in kw:
|
||||||
|
self.data[k] = kw.pop(k)
|
||||||
if self.state == 'new':
|
if self.state == 'new':
|
||||||
self.assign(kw.pop('party', None))
|
self.assign(kw.pop('party', None))
|
||||||
if self.state == 'assigned':
|
if self.state == 'assigned':
|
||||||
|
|
Loading…
Add table
Reference in a new issue