From d0299a7f17d9b2998b5e2a3d1e28fb4c70dc9bf3 Mon Sep 17 00:00:00 2001 From: Thomas Desvenain Date: Fri, 4 Oct 2013 19:11:40 +0200 Subject: [PATCH] Added logo and activity rich field on organization type. --- CHANGES.rst | 3 +++ .../contact/core/browser/organization.py | 2 ++ src/collective/contact/core/browser/person.py | 1 - .../core/browser/templates/organization.pt | 9 ++++++++ .../contact/core/content/organization.py | 23 +++++++++++++++---- 5 files changed, 32 insertions(+), 6 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index 64d1310..7103faf 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -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] diff --git a/src/collective/contact/core/browser/organization.py b/src/collective/contact/core/browser/organization.py index a7e7655..828177b 100644 --- a/src/collective/contact/core/browser/organization.py +++ b/src/collective/contact/core/browser/organization.py @@ -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 diff --git a/src/collective/contact/core/browser/person.py b/src/collective/contact/core/browser/person.py index d8649e0..e51f636 100644 --- a/src/collective/contact/core/browser/person.py +++ b/src/collective/contact/core/browser/person.py @@ -14,7 +14,6 @@ class Person(BaseView): person_title = '' gender = '' held_positions = '' - photo = '' def update(self): super(Person, self).update() diff --git a/src/collective/contact/core/browser/templates/organization.pt b/src/collective/contact/core/browser/templates/organization.pt index 529c7df..4882bf1 100644 --- a/src/collective/contact/core/browser/templates/organization.pt +++ b/src/collective/contact/core/browser/templates/organization.pt @@ -7,12 +7,21 @@

+ +
+
+ + +
+
    diff --git a/src/collective/contact/core/content/organization.py b/src/collective/contact/core/content/organization.py index 446c0e8..01f2a1c 100644 --- a/src/collective/contact/core/content/organization.py +++ b/src/collective/contact/core/content/organization.py @@ -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 :