Added logo and activity rich field on organization type.

This commit is contained in:
Thomas Desvenain 2013-10-04 19:11:40 +02:00
parent b055df0c2b
commit d0299a7f17
5 changed files with 32 additions and 6 deletions

View File

@ -4,6 +4,9 @@ Changelog
1.1 (unreleased)
----------------
- Added logo and activity rich field on organization type.
[thomasdesvenain]
- Fixed generate id from title on held positions and persons.
[thomasdesvenain]

View File

@ -35,6 +35,7 @@ class Organization(BaseView):
parent_organizations = []
sub_organizations = []
positions = []
activity = ''
def update(self):
super(Organization, self).update()
@ -45,6 +46,7 @@ class Organization(BaseView):
factory = getUtility(IVocabularyFactory, "OrganizationTypesOrLevels")
vocabulary = factory(self.context)
self.type = vocabulary.getTerm(organization.organization_type).title
self.activity = self.context.activity
contactable = IContactable(organization)
organizations = contactable.organizations

View File

@ -14,7 +14,6 @@ class Person(BaseView):
person_title = ''
gender = ''
held_positions = ''
photo = ''
def update(self):
super(Person, self).update()

View File

@ -7,12 +7,21 @@
<div metal:fill-slot="main">
<h1 tal:content="view/name"></h1>
<div id="logo" class="field" tal:condition="context/logo">
<img tal:replace="structure python: view.widgets['logo'].render()" />
</div>
<div id="type" class="field">
<label><tal:block i18n:translate="">Organization type</tal:block>:</label>
<span tal:content="view/type"
i18n:translate="" />
</div>
<div id="activity" class="field" tal:condition="view/activity">
<label><tal:block i18n:translate="">Activity</tal:block>:</label>
<span tal:content="structure view/activity/output" />
</div>
<div id="organizations" class="field" tal:condition="view/parent_organizations">
<label><tal:block i18n:translate="">Parent organizations</tal:block>:</label>
<ul>

View File

@ -2,24 +2,26 @@ from Acquisition import aq_inner, aq_chain
from zope.interface import implements
from zope.interface import Attribute
from zope import schema
from zope.component import getUtility
from zope.intid.interfaces import IIntIds
from z3c.form.interfaces import NO_VALUE
from zc.relation.interfaces import ICatalog
from five import grok
from Products.CMFPlone.utils import base_hasattr
from Products.CMFCore.utils import getToolByName
from plone.dexterity.content import Container
from plone.supermodel import model
from plone.dexterity.schema import DexteritySchemaPolicy
from plone.namedfile.field import NamedImage
from collective.contact.core import _
from collective.contact.core.browser.contactable import Contactable
from collective.contact.widget.interfaces import IContactContent
from zope.component._api import getUtility
from zope.intid.interfaces import IIntIds
from zc.relation.interfaces import ICatalog
from collective.contact.core.content.held_position import IHeldPosition
from Products.CMFCore.utils import getToolByName
from plone.app.textfield import RichText
class IOrganization(model.Schema, IContactContent):
@ -27,11 +29,22 @@ class IOrganization(model.Schema, IContactContent):
is_created = Attribute(u"Marker to know if the object is already created")
activity = RichText(
title=_("Activity"),
required=False,
)
organization_type = schema.Choice(
title=_("Type or level"),
vocabulary="OrganizationTypesOrLevels",
)
logo = NamedImage(
title=_("Logo"),
required=False,
)
def get_organizations_chain(self):
"""Returns the list of organizations and sub-organizations in this organization
e.g. for HR service in Division Bar in Organization Foo :