- work items: provide move action for assigning a work item to

another task
- show work items (if present) for arbitrary concepts


git-svn-id: svn://svn.cy55.de/Zope3/src/loops/trunk@4196 fd906abe-77d9-0310-91a1-e0d9ade77398
This commit is contained in:
helmutm 2011-03-07 12:30:41 +00:00
parent 7859555281
commit 080b3a79f5
11 changed files with 62 additions and 11 deletions

View file

@ -6,6 +6,9 @@ $Id$
1.1 1.1
--- ---
- work items: provide "move" action for assigning a work item to
another task
- show work items (if present) for arbitrary concepts
- portal page with - now fully editable - portal links - portal page with - now fully editable - portal links
- calendar portlet - calendar portlet

View file

@ -452,6 +452,11 @@ class ConceptView(BaseView):
return False return False
return super(ConceptView, self).checkAction(name, category, target) return super(ConceptView, self).checkAction(name, category, target)
@Lazy
def workItems(self):
return component.getMultiAdapter((self.context, self.request),
name='taskworkitems.html')
class ConceptRelationView(ConceptView, BaseRelationView): class ConceptRelationView(ConceptView, BaseRelationView):

View file

@ -13,6 +13,9 @@
<metal:slot define-slot="resources"> <metal:slot define-slot="resources">
<metal:block use-macro="view/concept_macros/conceptresources" /> <metal:block use-macro="view/concept_macros/conceptresources" />
</metal:slot> </metal:slot>
<metal:slot define-slot="workitems">
<metal:block use-macro="view/work_macros/workitems" />
</metal:slot>
<metal:slot define-slot="querydata" /> <metal:slot define-slot="querydata" />
<metal:block use-macro="view/comment_macros/comments" /> <metal:block use-macro="view/comment_macros/comments" />
</div> </div>

View file

@ -34,6 +34,13 @@ function showIf(node, value, targetName) {
dojo.byId(targetName).style.display = display; dojo.byId(targetName).style.display = display;
} }
function showIfIn(node, conditions) {
dojo.forEach(conditions, function(cond) {
var display = (node.value == cond[0]) ? 'inline' : 'none';
dojo.byId(cond[1]).style.display = display;
})
}
function destroyWidgets(node) { function destroyWidgets(node) {
dojo.forEach(dojo.query('[widgetId]', node), function(n) { dojo.forEach(dojo.query('[widgetId]', node), function(n) {
w = dijit.byNode(n); w = dijit.byNode(n);

Binary file not shown.

View file

@ -3,7 +3,7 @@ msgstr ""
"Project-Id-Version: $Id$\n" "Project-Id-Version: $Id$\n"
"POT-Creation-Date: 2007-05-22 12:00 CET\n" "POT-Creation-Date: 2007-05-22 12:00 CET\n"
"PO-Revision-Date: 2011-02-18 12:00 CET\n" "PO-Revision-Date: 2011-03-07 12:00 CET\n"
"Last-Translator: Helmut Merz <helmutm@cy55.de>\n" "Last-Translator: Helmut Merz <helmutm@cy55.de>\n"
"Language-Team: loops developers <helmutm@cy55.de>\n" "Language-Team: loops developers <helmutm@cy55.de>\n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
@ -676,6 +676,12 @@ msgstr "Informationen über diese Aktivität."
msgid "Edit work item." msgid "Edit work item."
msgstr "Aktivität bearbeiten." msgstr "Aktivität bearbeiten."
msgid "delegate_to_party"
msgstr "an"
msgid "move_to_task"
msgstr "nach"
msgid "new" msgid "new"
msgstr "neu" msgstr "neu"
@ -703,6 +709,9 @@ msgstr "abgeschlossen"
msgid "cancelled" msgid "cancelled"
msgstr "abgebrochen" msgstr "abgebrochen"
msgid "moved"
msgstr "verschoben"
msgid "replaced" msgid "replaced"
msgstr "ersetzt" msgstr "ersetzt"
@ -727,6 +736,9 @@ msgstr "abbrechen"
msgid "delegate" msgid "delegate"
msgstr "delegieren" msgstr "delegieren"
msgid "move"
msgstr "verschieben"
msgid "close" msgid "close"
msgstr "abschließen" msgstr "abschließen"

View file

@ -3,9 +3,6 @@
<metal:task define-macro="task"> <metal:task define-macro="task">
<metal:data use-macro="view/concept_macros/conceptdata"> <metal:data use-macro="view/concept_macros/conceptdata">
<metal:fill fill-slot="querydata">
<metal:workitems use-macro="view/work_macros/workitems" />
</metal:fill>
</metal:data> </metal:data>
</metal:task> </metal:task>

View file

@ -142,7 +142,7 @@ only available for privileged users.
>>> form.actions >>> form.actions
[{'name': 'plan', 'title': 'plan'}, {'name': 'accept', 'title': 'accept'}, [{'name': 'plan', 'title': 'plan'}, {'name': 'accept', 'title': 'accept'},
{'name': 'start', 'title': 'start working'}, {'name': 'work', 'title': 'work'}, {'name': 'start', 'title': 'start working'}, {'name': 'work', 'title': 'work'},
{'name': 'finish', 'title': 'finish'}, {'name': 'finish', 'title': 'finish'}, {'name': 'move', 'title': 'move'},
{'name': 'cancel', 'title': 'cancel'}, {'name': 'modify', 'title': 'modify'}] {'name': 'cancel', 'title': 'cancel'}, {'name': 'modify', 'title': 'modify'}]

View file

@ -1,5 +1,5 @@
# #
# Copyright (c) 2009 Helmut Merz helmutm@cy55.de # Copyright (c) 2011 Helmut Merz helmutm@cy55.de
# #
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
@ -217,7 +217,7 @@ class BaseWorkItemsView(object):
state = form.get('wi_state') or self.options.wi_state state = form.get('wi_state') or self.options.wi_state
if not state: if not state:
result['state'] = ['planned', 'accepted', 'running', 'done', 'done_x', result['state'] = ['planned', 'accepted', 'running', 'done', 'done_x',
'finished', 'delegated', 'finished', 'delegated', 'moved',
'cancelled'] 'cancelled']
elif state != 'all': elif state != 'all':
result['state'] = state result['state'] = state
@ -348,6 +348,17 @@ class CreateWorkItemForm(ObjectForm, BaseTrackView):
return [dict(name=util.getUidForObject(p), title=p.title) return [dict(name=util.getUidForObject(p), title=p.title)
for p in persons] for p in persons]
@Lazy
def tasks(self):
tasks = []
tnames = ['task', 'event']
ttypes = [self.conceptManager.get(tname) for tname in tnames]
for ttype in ttypes:
if ttype is not None:
tasks.extend(ttype.getChildren([self.typePredicate]))
return [dict(name=util.getUidForObject(t), title=t.title)
for t in tasks]
@Lazy @Lazy
def duration(self): def duration(self):
if self.state == 'running': if self.state == 'running':
@ -411,6 +422,8 @@ class CreateWorkItem(EditObject, BaseTrackView):
setValue(k) setValue(k)
if action == 'delegate': if action == 'delegate':
setValue('party') setValue('party')
if action == 'move':
setValue('task')
startDate = form.get('start_date', '').strip() startDate = form.get('start_date', '').strip()
startTime = form.get('start_time', '').strip().replace('T', '') or '00:00:00' startTime = form.get('start_time', '').strip().replace('T', '') or '00:00:00'
endTime = form.get('end_time', '').strip().replace('T', '') or '00:00:00' endTime = form.get('end_time', '').strip().replace('T', '') or '00:00:00'

View file

@ -90,14 +90,16 @@
<div> <div>
<label i18n:translate="" for="action">Action</label> <label i18n:translate="" for="action">Action</label>
<select name="workitem.action" id="action" <select name="workitem.action" id="action"
onChange="showIf(this, 'delegate', 'party')"> xonChange="showIf(this, 'delegate', 'party')"
onChange="showIfIn(this, [['move', 'target_task'],
['delegate', 'target_party']])">
<option tal:repeat="action view/actions" <option tal:repeat="action view/actions"
tal:attributes="value action/name" tal:attributes="value action/name"
tal:content="action/title" tal:content="action/title"
i18n:translate="" /> i18n:translate="" />
</select> </select>
<span id="party" style="display: none">&nbsp; <span id="target_party" style="display: none">&nbsp;
<label i18n:translate="" for="input_party" <label i18n:translate="delegate_to_party" for="input_party"
style="display: inline">to</label> style="display: inline">to</label>
<select name="party" id="input_party"> <select name="party" id="input_party">
<option tal:repeat="cand view/candidates" <option tal:repeat="cand view/candidates"
@ -105,6 +107,15 @@
tal:content="cand/title" /> tal:content="cand/title" />
</select> </select>
</span> </span>
<span id="target_task" style="display: none">&nbsp;
<label i18n:translate="move_to_task" for="input_task"
style="display: inline">to</label>
<select name="task" id="input_task">
<option tal:repeat="cand view/tasks"
tal:attributes="value cand/name"
tal:content="cand/title" />
</select>
</span>
</div> </div>
<div> <div>
<label i18n:translate="" for="start-end">Start - End</label> <label i18n:translate="" for="start-end">Start - End</label>

View file

@ -1,5 +1,5 @@
# #
# Copyright (c) 2008 Helmut Merz helmutm@cy55.de # Copyright (c) 2011 Helmut Merz helmutm@cy55.de
# #
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by