Exemplo n.º 1
0
class IRelatedContacts(model.Schema):

    form.order_before(location='IRichText.text')
    location = ContactChoice(
        title=_(u'Location'),
        source=ContactSourceBinder(portal_type=('organization', ), ),
        required=False,
    )

    form.order_after(organizer='IRelatedContacts.location')
    organizer = ContactChoice(
        title=_(u'Organizer'),
        source=ContactSourceBinder(portal_type=('person', 'organization'), ),
        required=False,
    )

    form.order_after(contact='IRelatedContacts.organizer')
    contact = ContactChoice(
        title=_(u'Contact'),
        source=ContactSourceBinder(portal_type=('person', 'organization'), ),
        required=False,
    )

    form.order_after(partners='IRelatedContacts.contact')
    partners = ContactList(
        title=_(u'Partners'),
        value_type=ContactChoice(title=_(u'Partner'),
                                 source=ContactSourceBinder(
                                     portal_type=('person',
                                                  'organization'), )),
        required=False,
    )
Exemplo n.º 2
0
class IAddContact(model.Schema):
    """Schema to add held position, person or organization

    Fields are not required."""

    organization = ContactChoice(
        title=_(u"Organization"),
        required=False,
        description=_(
            u"Select the organization where the person holds the position"),
        source=ContactSourceBinder(portal_type="organization"))

    person = ContactChoice(
        title=_(u"Person"),
        description=_(u"Select the person who holds the position"),
        required=False,
        source=ContactSourceBinder(portal_type="person"))

    position = ContactChoice(
        title=_(u"Position"),
        required=False,
        description=
        _(u"Select the position held by this person in the selected organization"
          ),
        source=ContactSourceBinder(portal_type="position"))
    def __init__(self, contact_lists_query, contact_lists_operator='or', **kwargs):
        ContactSourceBinder.__init__(self, **kwargs)

        contact_lists_query = deepcopy(contact_lists_query)
        if 'portal_type' not in contact_lists_query:
            contact_lists_query['portal_type'] = 'contact_list'

        self.contact_lists_query = contact_lists_query
        self.contact_lists_operator = contact_lists_operator
Exemplo n.º 4
0
class IAddContact(model.Schema):
    organization = ContactChoice(
        title=_(u"Organization"),
        required=False,
        source=ContactSourceBinder(portal_type="organization"))

    person = ContactChoice(title=_(u"Person"),
                           required=False,
                           source=ContactSourceBinder(portal_type="person"))

    position = ContactChoice(
        title=_(u"Position"),
        required=False,
        source=ContactSourceBinder(portal_type="position"))
Exemplo n.º 5
0
class IHeldPosition(model.Schema, IContactContent):
    """Interface for HeldPosition content type"""

    position = ContactChoice(
        title=_("Organization/Position"),
        source=ContactSourceBinder(portal_type=("organization", "position")),
        required=True,
    )
    label = schema.TextLine(title=_("Additional label"),
                            description=_("Additional label with information that does not appear on position label"),
                            required=False)
    start_date = schema.Date(
      title=_("Start date"),
      required=False,
    )
    end_date = schema.Date(
      title=_("End date"),
      required=False,
    )
    photo = NamedImage(
        title=_("Photo"),
        required=False,
        readonly=True,
        )

    def get_person():
        """Returns the person who holds the position
        """

    def get_position():
        """Returns the position (if position field is a position)
        """

    def get_organization():
        """Returns the first organization related to HeldPosition
Exemplo n.º 6
0
class IRelatedOrganizations(model.Schema):
    """A content on which we can attach organizations
    """

    fieldset(
        'related_organizations',
        label=_(u'Related organizations'),
        fields=('related_organizations',),
        )

    related_organizations = ContactList(
            value_type=ContactChoice(
                    description=_("Search and attach organizations related to this one"),
                    source=ContactSourceBinder(portal_type=("organization",)),),
            required=False,
            addlink=False,
    )
Exemplo n.º 7
0
class ContactBatchActionForm(ContactBaseBatchActionForm):

    available_permission = 'Manage portal'
    attribute = 'related_organizations'
    field_value_type = ContactChoice(source=ContactSourceBinder(
        portal_type="organization"))
Exemplo n.º 8
0
class IPMHeldPosition(IHeldPosition):
    """ """
    form.order_before(position_type='start_date')
    position_type = zope.schema.Choice(
        title=_("Position type"),
        description=
        _("Select a position type, correct label will be taken from this list "
          "depending on person gender and context. If you need to add new position types, "
          "it is defined on the directory at the root of contacts configuration "
          "(element <a href='../../contacts/edit' target='_blank'>\"edit contacts\"</a>)."
          ),
        vocabulary="PMPositionTypes",
        required=True,
    )

    form.order_after(secondary_position_type='position_type')
    secondary_position_type = zope.schema.Choice(
        title=_("Secondary position type"),
        description=_(
            "Select a secondary position type if necessary. "
            "Will work the same way as field \"Position type\" here above."),
        vocabulary="PMPositionTypes",
        required=False,
    )

    form.widget('usages', PMCheckBoxFieldWidget, multiple='multiple')
    usages = zope.schema.List(
        title=_("Usages"),
        value_type=zope.schema.Choice(
            vocabulary=
            "Products.PloneMeeting.vocabularies.pmheldposition_usagesvocabulary"
        ),
        required=False,
        default=[],
    )

    form.widget('defaults', PMCheckBoxFieldWidget, multiple='multiple')
    defaults = zope.schema.List(
        title=_("Defaults"),
        value_type=zope.schema.Choice(
            vocabulary=
            "Products.PloneMeeting.vocabularies.pmheldposition_defaultsvocabulary"
        ),
        required=False,
        default=[],
    )

    voting_group = ContactChoice(
        title=_("Voting group"),
        description=_("Voting group descr"),
        source=ContactSourceBinder(portal_type=("organization", "position")),
        required=False,
    )

    signature_number = zope.schema.Choice(
        title=_("Signature number"),
        description=_(
            "If this contact is a default signer, select signature number."),
        vocabulary="Products.PloneMeeting.vocabularies.numbersvocabulary",
        required=False,
    )

    form.widget('represented_organizations', PMCheckBoxFieldWidget)
    represented_organizations = RelationList(
        title=_("Represented organizations"),
        default=[],
        description=
        _("Select organizations the current held position is representative for."
          ),
        value_type=RelationChoice(
            vocabulary=
            "Products.PloneMeeting.vocabularies.sortedselectedorganizationsvocabulary"
        ),
        required=False,
    )

    model.fieldset('held_position_app_parameters',
                   label=_(u"Application parameters"),
                   fields=[
                       'position', 'label', 'position_type',
                       'secondary_position_type', 'start_date', 'end_date',
                       'usages', 'defaults', 'voting_group',
                       'signature_number', 'represented_organizations'
                   ])