additional fields workItemType and deadline for work items: control editing and display, e.g. for meeting minutes
This commit is contained in:
parent
0700bb971b
commit
ac1968233d
5 changed files with 96 additions and 34 deletions
|
@ -60,7 +60,6 @@ class AgendaItem(AdapterBase):
|
|||
|
||||
implements(IAgendaItem)
|
||||
|
||||
_adapterAttributes = AdapterBase._adapterAttributes
|
||||
_contextAttributes = list(IAgendaItem)
|
||||
|
||||
|
||||
|
|
|
@ -174,8 +174,8 @@ So we use the PersonWorkItems view, assigning john to the query.
|
|||
>>> work = PersonWorkItems(query, TestRequest(form=input))
|
||||
>>> work.listWorkItems()
|
||||
[<WorkItem ['36', 2, '33', '2009-01-19 09:00', 'planned']:
|
||||
{'start': 1232352000, 'created': ..., 'title': u'Install Zope',
|
||||
'creator': '33'}>]
|
||||
{'title': u'Install Zope', 'created': ..., 'end': 1232352000,
|
||||
'start': 1232352000, 'creator': '33'}>]
|
||||
|
||||
|
||||
Work Reports
|
||||
|
|
|
@ -33,13 +33,16 @@ from zope.traversing.api import getName, getParent
|
|||
|
||||
from cybertools.ajax import innerHtml
|
||||
from cybertools.browser.action import actions
|
||||
from cybertools.meta.interfaces import IOptions
|
||||
from cybertools.organize.interfaces import IWorkItems
|
||||
from cybertools.organize.work import workItemTypes
|
||||
from cybertools.tracking.btree import getTimeStamp
|
||||
from cybertools.util import format
|
||||
from loops.browser.action import DialogAction
|
||||
from loops.browser.concept import ConceptView
|
||||
from loops.browser.form import ObjectForm, EditObject
|
||||
from loops.browser.node import NodeView
|
||||
from loops.common import adapted
|
||||
from loops.organize.party import getPersonForUser
|
||||
from loops.organize.stateful.browser import StateAction
|
||||
from loops.organize.tracking.browser import BaseTrackView
|
||||
|
@ -340,6 +343,30 @@ class CreateWorkItemForm(ObjectForm, BaseTrackView):
|
|||
def description(self):
|
||||
return self.track.description or u''
|
||||
|
||||
@Lazy
|
||||
def workItemType(self):
|
||||
name = self.track.workItemType
|
||||
return (name and workItemTypes[name] or self.workItemTypes[0])
|
||||
|
||||
@Lazy
|
||||
def workItemTypes(self):
|
||||
options = IOptions(adapted(self.task.conceptType))
|
||||
typeNames = options.workitem_types
|
||||
if typeNames:
|
||||
return [workItemTypes[name] for name in typeNames]
|
||||
return workItemTypes
|
||||
|
||||
@Lazy
|
||||
def showTypes(self):
|
||||
return len(self.workItemTypes) != 1
|
||||
|
||||
@Lazy
|
||||
def deadline(self):
|
||||
ts = self.track.deadline# or getTimeStamp()
|
||||
if ts:
|
||||
return time.strftime('%Y-%m-%d', time.localtime(ts))
|
||||
return ''
|
||||
|
||||
@Lazy
|
||||
def date(self):
|
||||
ts = self.track.start or getTimeStamp()
|
||||
|
@ -367,9 +394,10 @@ class CreateWorkItemForm(ObjectForm, BaseTrackView):
|
|||
@Lazy
|
||||
def actions(self):
|
||||
result = [dict(name=t.name, title=t.title)
|
||||
for t in self.track.getAvailableTransitions()]
|
||||
#if t.name != 'delegate' or
|
||||
# checkPermission('loops.ManageSite', self.context)]
|
||||
for t in self.track.getAvailableTransitions()
|
||||
if t.name in self.workItemType.actions]
|
||||
#and (t.name != 'delegate' or
|
||||
# checkPermission('loops.ManageSite', self.context))]
|
||||
return result
|
||||
|
||||
def getTypesParamsForFilteringSelect(self, types=['person']):
|
||||
|
@ -452,17 +480,16 @@ class CreateWorkItem(EditObject, BaseTrackView):
|
|||
v = form.get(k)
|
||||
if v:
|
||||
result[k] = v
|
||||
for k in ('title', 'description', 'comment'):
|
||||
for k in ('workItemType', 'title', 'description', 'comment'):
|
||||
setValue(k)
|
||||
if action == 'delegate':
|
||||
setValue('party')
|
||||
if action == 'move':
|
||||
setValue('task')
|
||||
result['deadline'] = parseDate(form.get('deadline'))
|
||||
startDate = form.get('start_date', '').strip()
|
||||
startTime = form.get('start_time', '').strip().replace('T', '') or '00:00:00'
|
||||
endTime = form.get('end_time', '').strip().replace('T', '') or '00:00:00'
|
||||
#print '***', startDate, startTime, endTime
|
||||
#if startDate and startTime:
|
||||
if startDate:
|
||||
result['start'] = parseDateTime('T'.join((startDate, startTime)))
|
||||
result['end'] = parseDateTime('T'.join((startDate, endTime)))
|
||||
|
|
|
@ -66,7 +66,7 @@ class TrackDateField(Field):
|
|||
|
||||
def getValue(self, row):
|
||||
value = self.getRawValue(row)
|
||||
if value is None:
|
||||
if not value:
|
||||
return None
|
||||
return timeStamp2Date(value)
|
||||
|
||||
|
@ -119,6 +119,10 @@ tasks = Field('tasks', u'Tasks',
|
|||
|
||||
# work report fields
|
||||
|
||||
deadline = TrackDateField('deadline', u'Deadline',
|
||||
description=u'The day the work has to be finished.',
|
||||
cssClass='center',
|
||||
executionSteps=['sort', 'output'])
|
||||
dayFrom = TrackDateField('dayFrom', u'Start Day',
|
||||
description=u'The first day from which to select work.',
|
||||
fieldType='date',
|
||||
|
@ -285,7 +289,7 @@ class MeetingMinutesWork(WorkReportInstance, SubReport):
|
|||
|
||||
rowFactory = MeetingMinutesWorkRow
|
||||
|
||||
fields = Jeep((workTitle, party, day)) #, state)) #description,
|
||||
fields = Jeep((workTitle, party, deadline)) #, state)) #description,
|
||||
defaultOutputFields = fields
|
||||
defaultSortCriteria = (day,)
|
||||
states = ('planned', 'accepted', 'running', 'done',
|
||||
|
|
|
@ -67,12 +67,29 @@
|
|||
|
||||
<metal:block define-macro="create_workitem">
|
||||
<form method="post" id="addWorkitem_form" class="dialog"
|
||||
xx_dojoType="dijit.form.Form">
|
||||
xx_dojoType="dijit.form.Form"
|
||||
tal:define="workItemTypes view/workItemTypes;
|
||||
workItemType view/workItemType">
|
||||
<input type="hidden" name="form.action" value="create_workitem" />
|
||||
<input type="hidden" name="id"
|
||||
tal:attributes="value request/form/id|nothing" />
|
||||
<div class="heading" i18n:translate="">Add Work Item</div>
|
||||
<div>
|
||||
<tal:type condition="view/showTypes">
|
||||
<label i18n:translate="" for="types">Work Item Type</label>
|
||||
<select name="workItemType" id="types">
|
||||
<option tal:repeat="type workItemTypes"
|
||||
tal:attributes="value type/name;
|
||||
selected python:
|
||||
type.name == workItemType.name"
|
||||
tal:content="type/title"
|
||||
i18n:translate="" />
|
||||
</select>
|
||||
</tal:type>
|
||||
<tal:type condition="not:view/showTypes">
|
||||
<input type="hidden" name="workItemType"
|
||||
tal:attributes="value python:workItemTypes[0]" />
|
||||
</tal:type>
|
||||
<label i18n:translate="" for="title">Title</label>
|
||||
<div>
|
||||
<input name="title" id="title" style="width: 60em"
|
||||
|
@ -123,28 +140,43 @@
|
|||
</span>
|
||||
</div>
|
||||
<div>
|
||||
<label i18n:translate="" for="start-end">Start - End</label>
|
||||
<div id="start-end">
|
||||
<input type="text" name="start_date" style="width: 8em"
|
||||
dojoType="dijit.form.DateTextBox"
|
||||
tal:attributes="value view/date" />
|
||||
<input type="text" name="start_time" style="width: 6em"
|
||||
dojoType="dijit.form.TimeTextBox"
|
||||
tal:attributes="value view/startTime" /> -
|
||||
<input type="text" name="end_time" style="width: 6em"
|
||||
dojoType="dijit.form.TimeTextBox"
|
||||
tal:attributes="value view/endTime" /></div>
|
||||
<label i18n:translate=""
|
||||
for="duration-effort">Duration / Effort (hh:mm)</label>
|
||||
<div id="duration-effort">
|
||||
<input type="text" name="duration" style="width: 5em"
|
||||
dojoType="dijit.form.ValidationTextBox"
|
||||
regexp="-{0,1}[0-9]{1,2}(:[0-5][0-9]){0,1}"
|
||||
tal:attributes="value view/duration" /> /
|
||||
<input type="text" name="effort" style="width: 5em"
|
||||
dojoType="dijit.form.ValidationTextBox"
|
||||
regexp="-{0,1}[0-9]{1,2}(:[0-5][0-9]){0,1}"
|
||||
tal:attributes="value view/effort" /></div>
|
||||
<div id="deadline"
|
||||
tal:condition="python:'deadline' in workItemType.fields">
|
||||
<label i18n:translate="" for="deadline-input">Deadline</label>
|
||||
<div id="deadline-input">
|
||||
<input type="text" name="deadline" style="width: 8em"
|
||||
dojoType="dijit.form.DateTextBox"
|
||||
tal:attributes="value view/deadline" /></div>
|
||||
</div>
|
||||
<div id="start-end"
|
||||
tal:condition="python:'start-end' in workItemType.fields">
|
||||
<label i18n:translate="" for="start-end-input">Start - End</label>
|
||||
<div id="start-end-input">
|
||||
<input type="text" name="start_date" style="width: 8em"
|
||||
dojoType="dijit.form.DateTextBox"
|
||||
tal:attributes="value view/date" />
|
||||
<input type="text" name="start_time" style="width: 6em"
|
||||
dojoType="dijit.form.TimeTextBox"
|
||||
tal:attributes="value view/startTime" /> -
|
||||
<input type="text" name="end_time" style="width: 6em"
|
||||
dojoType="dijit.form.TimeTextBox"
|
||||
tal:attributes="value view/endTime" /></div>
|
||||
</div>
|
||||
<div id="duration-effort"
|
||||
tal:condition="python:
|
||||
'duration-effort' in workItemType.fields">
|
||||
<label i18n:translate=""
|
||||
for="duration-effort-input">Duration / Effort (hh:mm)</label>
|
||||
<div id="duration-effort-input">
|
||||
<input type="text" name="duration" style="width: 5em"
|
||||
dojoType="dijit.form.ValidationTextBox"
|
||||
regexp="-{0,1}[0-9]{1,2}(:[0-5][0-9]){0,1}"
|
||||
tal:attributes="value view/duration" /> /
|
||||
<input type="text" name="effort" style="width: 5em"
|
||||
dojoType="dijit.form.ValidationTextBox"
|
||||
regexp="-{0,1}[0-9]{1,2}(:[0-5][0-9]){0,1}"
|
||||
tal:attributes="value view/effort" /></div>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<label i18n:translate="" for="comment">Comment</label>
|
||||
|
|
Loading…
Add table
Reference in a new issue