provide new 'contact' states definition to be used for persons or other kinds of parties
This commit is contained in:
parent
c4ce28e239
commit
c824c0bdb5
4 changed files with 79 additions and 2 deletions
|
@ -187,6 +187,12 @@ Task States
|
|||
>>> from loops.organize.stateful.task import taskStates, publishableTask
|
||||
|
||||
|
||||
Contact States
|
||||
===========
|
||||
|
||||
>>> from loops.organize.stateful.contact import contactStates
|
||||
|
||||
|
||||
Fin de partie
|
||||
=============
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#
|
||||
# Copyright (c) 2014 Helmut Merz helmutm@cy55.de
|
||||
# Copyright (c) 2015 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
|
||||
|
@ -45,7 +45,8 @@ template = ViewPageTemplateFile('view_macros.pt')
|
|||
statefulActions = ('classification_quality',
|
||||
'simple_publishing',
|
||||
'task_states',
|
||||
'publishable_task',)
|
||||
'publishable_task',
|
||||
'contact_states',)
|
||||
|
||||
|
||||
def registerStatesPortlet(controller, view, statesDefs,
|
||||
|
|
|
@ -77,6 +77,20 @@
|
|||
set_schema="cybertools.stateful.interfaces.IStateful" />
|
||||
</zope:class>
|
||||
|
||||
<zope:utility
|
||||
factory="loops.organize.stateful.contact.contactStates"
|
||||
name="contact_states" />
|
||||
|
||||
<zope:adapter
|
||||
factory="loops.organize.stateful.contact.StatefulContact"
|
||||
name="contact_states" />
|
||||
<zope:class class="loops.organize.stateful.contact.StatefulContact">
|
||||
<require permission="zope.View"
|
||||
interface="cybertools.stateful.interfaces.IStateful" />
|
||||
<require permission="zope.ManageContent"
|
||||
set_schema="cybertools.stateful.interfaces.IStateful" />
|
||||
</zope:class>
|
||||
|
||||
<!-- views and form controllers -->
|
||||
|
||||
<browser:page
|
||||
|
|
56
organize/stateful/contact.py
Normal file
56
organize/stateful/contact.py
Normal file
|
@ -0,0 +1,56 @@
|
|||
#
|
||||
# Copyright (c) 2015 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
|
||||
#
|
||||
|
||||
"""
|
||||
States definition for contacts (persons, customers, ...).
|
||||
"""
|
||||
|
||||
from zope import component
|
||||
from zope.component import adapter
|
||||
from zope.interface import implementer
|
||||
from zope.traversing.api import getName
|
||||
|
||||
from cybertools.stateful.definition import StatesDefinition
|
||||
from cybertools.stateful.definition import State, Transition
|
||||
from cybertools.stateful.interfaces import IStatesDefinition, IStateful
|
||||
from loops.common import adapted
|
||||
from loops.organize.stateful.base import commentsField
|
||||
from loops.organize.stateful.base import StatefulLoopsObject
|
||||
from loops.security.interfaces import ISecuritySetter
|
||||
from loops.util import _
|
||||
|
||||
|
||||
@implementer(IStatesDefinition)
|
||||
def contactStates():
|
||||
return StatesDefinition('contact_states',
|
||||
State('prospective', 'prospective', ('activate', 'inactivate',),
|
||||
color='blue'),
|
||||
State('active', 'active', ('retract', 'inactivate',),
|
||||
color='green'),
|
||||
State('inactive', 'inactive', ('activate',),
|
||||
color='x'),
|
||||
Transition('activate', 'activate', 'active'),
|
||||
Transition('retract', 'retract', 'prospective'),
|
||||
Transition('inactivate', 'inactivate', 'inactive'),
|
||||
initialState='active')
|
||||
|
||||
|
||||
class StatefulContact(StatefulLoopsObject):
|
||||
|
||||
statesDefinition = 'contact_states'
|
||||
|
Loading…
Add table
Reference in a new issue