work in progress: task management with work items

git-svn-id: svn://svn.cy55.de/Zope3/src/loops/trunk@3088 fd906abe-77d9-0310-91a1-e0d9ade77398
This commit is contained in:
helmutm 2008-12-27 10:42:48 +00:00
parent d4715fc882
commit 047ab7ede7
6 changed files with 208 additions and 0 deletions

View file

@ -0,0 +1,3 @@
"""
$Id$
"""

41
organize/work/base.py Normal file
View file

@ -0,0 +1,41 @@
#
# Copyright (c) 2008 Helmut Merz helmutm@cy55.de
#
# 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
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
"""
Recording changes to loops objects.
$Id$
"""
from zope.cachedescriptors.property import Lazy
from zope.component import adapter
from cybertools.organize.work import WorkItem as BaseWorkItem
from cybertools.organize.work import WorkItems as BaseWorkItems
from loops.organize.tracking.base import BaseRecordManager
class WorkItem(BaseWorkItem):
pass
class WorkItems(BaseRecordManager, BaseWorkItems):
pass

64
organize/work/browser.py Normal file
View file

@ -0,0 +1,64 @@
#
# Copyright (c) 2008 Helmut Merz helmutm@cy55.de
#
# 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
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
"""
View class(es) for change tracks.
$Id$
"""
from zope import component
from zope.app.security.interfaces import IAuthentication, PrincipalLookupError
from zope.cachedescriptors.property import Lazy
from zope.app.pagetemplate import ViewPageTemplateFile
from zope.traversing.browser import absoluteURL
from zope.traversing.api import getName
from cybertools.browser.action import actions
from cybertools.tracking.browser import TrackView
from loops.browser.action import DialogAction
from loops.browser.form import ObjectForm, EditObject
from loops.organize.tracking.browser import BaseTrackView
from loops import util
work_macros = ViewPageTemplateFile('work_macros.pt')
class WorkItemView(BaseTrackView):
pass
class CreateWorkItemForm(ObjectForm):
template = work_macros
@Lazy
def macro(self):
return self.template.macros['create_workitem']
# actions
actions.register('createWorkitem', 'portlet', DialogAction,
title=_(u'Create Work Item...'),
description=_(u'Create a work item for this object.'),
viewName='create_workitem.html',
dialogName='createWorkitem',
)

View file

@ -0,0 +1,34 @@
<!-- $Id$ -->
<configure
xmlns:zope="http://namespaces.zope.org/zope"
xmlns:browser="http://namespaces.zope.org/browser"
i18n_domain="loops">
<zope:class class="loops.organize.work.base.WorkItem">
<require permission="zope.View"
interface="cybertools.organize.work.IWorkItem" />
<require permission="zope.ManageContent"
set_schema="cybertools.organize.work.IWorkItem" />
</zope:class>
<!-- ZMI views -->
<browser:page
for="cybertools.organize.interfaces.IWorkItem"
name="index.html"
class="loops.organize.work.browser.WorkItemView"
permission="zope.View" />
<!-- application views -->
<browser:page
name="create_workitem.html"
for="loops.interfaces.INode"
class="loops.organize.work.browser.CreateWorkItemForm"
permission="zope.ManageContent" />
<zope:adapter factory="loops.organize.work.setup.SetupManager"
name="organize.work" />
</configure>

35
organize/work/setup.py Normal file
View file

@ -0,0 +1,35 @@
#
# Copyright (c) 2008 Helmut Merz helmutm@cy55.de
#
# 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
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
"""
Automatic setup of a loops site for the organize.work package.
$Id$
"""
from cybertools.tracking.btree import TrackingStorage
from loops.organize.work.base import WorkItem
from loops.setup import SetupManager as BaseSetupManager
class SetupManager(BaseSetupManager):
def setup(self):
records = self.context.getRecordManager()
work = self.addObject(records, TrackingStorage, 'work',
trackFactory=WorkItem)

View file

@ -0,0 +1,31 @@
<html i18n:domain="loops">
<!-- $Id$ -->
<metal:block define-macro="create_workitem">
<form method="post"
id="addWorkitem_form" class="dialog"
dojoType="dijit.form.Form">
<input type="hidden" name="form.action" value="create_workitem" />
<div class="heading" i18n:translate="">Add Work Item</div>
<div>
<label i18n:translate=""
for="description">Description</label>
<div>
<textarea name="description" cols="80" rows="6" id="description"
dojoType="dijit.form.SimpleTextarea"
style="width: 60em"></textarea><div>
</div>
<div class="buttons">
<input value="Save" type="submit"
onClick="return closeDialog(true)"
i18n:attributes="value">
<input type="button" value="Cancel"
onClick="return closeDialog(false)"
i18n:attributes="value">
</div>
</form>
</metal:block>
</html>