Skip to content

collective/collective.contact.widget

Repository files navigation

collective.contact.widget

This add-on is part of the collective.contact.* suite. For an overview and a demo of these suite, see collective.contact.demo.

This module provides a widget for contacts.

You can add contact fields to your schema, like this

class IMyProject(Interface):

    company = ContactChoice(
    title=_(u"Company"),
    source=ContactSourceBinder(portal_type=("organization",),
    )

        manager = ContactList(
        title=_(u"Project Manager"),
        value_type=ContactChoice(source=ContactSourceBinder(portal_type=("held_position",),
                                                            relations={'position': '/contacts/ecreall'})),
        )

Example code means that 'manager' is a multi-valued contact field which vocabulary gets held_position objects of site. The vocabulary is restricted to objects that have a 'position' relation to '/contacts/ecreall' object (i.e. which are held_positions in ecreall company).

You can add another filtering option like this
company = ContactChoice( title=_(u"Company"), source=ContactSourceBinder(portal_type=("organization",), prefilter_vocabulary='vocabulary or source', prefilter_default_value='context aware method', )

The prefilter vocabulary is displayed in the widget. The user can select a specific directory by example. Each term value contains a criteria, like u'{"path": "/Plone/directory1"}' (beware to use " in dict !).

If you run this javascript expression :

contactswidget.setup_relation_dependency('form.widgets.company', 'form.widgets.manager', 'position') the vocabulary of 'manager' field will be restricted to the held_positions of selected company.

Translations

This product has been translated into

  • Spanish.
  • French.

You can contribute for any message missing or other new languages, join us at Plone Collective Team into Transifex.net service with all world Plone translators community.

Contribute

Have an idea? Found a bug? Let us know by opening a ticket.

Tests

This add-on is tested using Travis CI. The current status of the add-on is :

License

The project is licensed under the GPLv2.