New ministry data type
This commit is contained in:
parent
e113ecf59a
commit
3e9089a613
|
@ -22,4 +22,9 @@
|
|||
<adapter for="themis.datatypes.deputy.IDeputy"
|
||||
provides="themis.datatypes.deputy.INameFromPersonNames"
|
||||
factory="themis.datatypes.deputy.NameFromPersonNames" />
|
||||
|
||||
<adapter for="themis.datatypes.ministry.IMinistry"
|
||||
provides="themis.datatypes.deputy.INameFromPersonNames"
|
||||
factory="themis.datatypes.deputy.NameFromPersonNames" />
|
||||
|
||||
</configure>
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
from five import grok
|
||||
from zope import schema
|
||||
from zope.interface import implements
|
||||
|
||||
from plone.directives import form, dexterity
|
||||
from plone.dexterity.content import Item
|
||||
|
||||
from themis.datatypes.interfaces import MessageFactory as _
|
||||
|
||||
class IMinistry(form.Schema):
|
||||
firstname = schema.TextLine(title=_(u'First Name'))
|
||||
lastname = schema.TextLine(title=_(u'Last Name'))
|
||||
function = schema.TextLine(title=_(u'Function'))
|
||||
active = schema.Bool(title=_(u'Active'), default=True)
|
||||
|
||||
class Ministry(Item):
|
||||
implements(IMinistry)
|
||||
|
||||
@property
|
||||
def title(self):
|
||||
return self.firstname + ' ' + self.lastname
|
||||
|
||||
def setTitle(self, value):
|
||||
pass
|
||||
|
|
@ -3,4 +3,5 @@
|
|||
<object name="themis.datatypes.polgroup" meta_type="Dexterity FTI" />
|
||||
<object name="themis.datatypes.deputy" meta_type="Dexterity FTI" />
|
||||
<object name="themis.datatypes.contact" meta_type="Dexterity FTI" />
|
||||
<object name="themis.datatypes.ministry" meta_type="Dexterity FTI" />
|
||||
</object>
|
||||
|
|
|
@ -0,0 +1,50 @@
|
|||
<?xml version="1.0"?>
|
||||
<object name="themis.datatypes.ministry" meta_type="Dexterity FTI"
|
||||
i18n:domain="themis.datatypes" xmlns:i18n="http://xml.zope.org/namespaces/i18n">
|
||||
|
||||
<!-- Basic metadata -->
|
||||
<property name="title" i18n:translate="">Ministry</property>
|
||||
<property name="description" i18n:translate="">A ministry</property>
|
||||
<property name="content_icon">document_icon.gif</property>
|
||||
<property name="allow_discussion">False</property>
|
||||
<property name="global_allow">True</property>
|
||||
<property name="filter_content_types">True</property>
|
||||
<property name="allowed_content_types" />
|
||||
|
||||
<!-- schema interface -->
|
||||
<property name="schema">themis.datatypes.ministry.IMinistry</property>
|
||||
|
||||
<!-- class used for content items -->
|
||||
<property name="klass">themis.datatypes.ministry.Ministry</property>
|
||||
|
||||
<!-- add permission -->
|
||||
<property name="add_permission">cmf.AddPortalContent</property>
|
||||
|
||||
<!-- enabled behaviors -->
|
||||
<property name="behaviors">
|
||||
<element value="plone.app.content.interfaces.INameFromTitle" />
|
||||
</property>
|
||||
|
||||
<!-- View information -->
|
||||
<property name="default_view">view</property>
|
||||
<property name="default_view_fallback">False</property>
|
||||
<property name="view_methods">
|
||||
<element value="view"/>
|
||||
</property>
|
||||
|
||||
<!-- Method aliases -->
|
||||
<alias from="(Default)" to="(dynamic view)"/>
|
||||
<alias from="edit" to="@@edit"/>
|
||||
<alias from="sharing" to="@@sharing"/>
|
||||
<alias from="view" to="(selected layout)"/>
|
||||
|
||||
<!-- Actions -->
|
||||
<action title="View" action_id="view" category="object" condition_expr=""
|
||||
url_expr="string:${object_url}" visible="True">
|
||||
<permission value="View"/>
|
||||
</action>
|
||||
<action title="Edit" action_id="edit" category="object" condition_expr=""
|
||||
url_expr="string:${object_url}/edit" visible="True">
|
||||
<permission value="Modify portal content"/>
|
||||
</action>
|
||||
</object>
|
Reference in New Issue