class ICollaborationsFolder(Interface):
    '''A collaborations folder contains collaborative groups.'''
    contains('edrnsite.collaborations.interfaces.ICollaborativeGroup')
    title = schema.TextLine(
        title=_(u'Title'),
        description=_(u'The name of this collaborations folder.'),
        required=True,
    )
    description = schema.Text(
        title=_(u'Description'),
        description=_(u'A short summary of this collaborations folder.'),
        required=False,
    )
class IGroupSpaceIndex(Interface):
    '''A group space index provides the view and discussion for a group.'''
    chair = schema.Object(
        title=_(u'Chair'),
        description=_(u'The person in charge of this group.'),
        required=False,
        schema=IPerson)
    coChair = schema.Object(
        title=_(u'Co-Chair'),
        description=_(u'The assistant to the person in charge of this group.'),
        required=False,
        schema=IPerson)
    members = schema.List(title=_(u'Members'),
                          description=_(u'Members of this group.'),
                          required=False,
                          value_type=schema.Object(
                              title=_(u'Member'),
                              description=_(u'A member of this group.'),
                              schema=IPerson))
class IGroupSpace(Interface):
    '''A group space is a place for members of a group to share stuff.'''
    contains('edrnsite.collaborations.interfaces.IGroupSpaceIndex')
    title = schema.TextLine(
        title=_(u'Title'),
        description=_(u'The name of this group.'),
        required=True,
    )
    description = schema.Text(
        title=_(u'Description'),
        description=_(u'A short summary of this group.'),
        required=False,
    )
    updateNotifications = schema.Bool(
        title=_(u'Update Notifications'),
        description=_(u'Enable notifying members (by email) of updates to this group.'),
        required=False,
    )
from plone.contentrules.engine.assignments import RuleAssignment
from plone.contentrules.engine.interfaces import IRuleAssignmentManager, IRuleStorage
from Products.Archetypes import atapi
from Products.ATContentTypes.content import folder
from Products.ATContentTypes.content import schemata
from Products.CMFCore.utils import getToolByName
from zope.component import getUtility
from zope.interface import implements

GroupSpaceSchema = folder.ATFolderSchema.copy() + atapi.Schema((
    atapi.BooleanField(
        'updateNotifications',
        required=False,
        storage=atapi.AnnotationStorage(),
        widget=atapi.BooleanWidget(
            label=_(u'Update Notifications'),
            description=_(u'Enable notifying members (by email) of updates to this group.'),
        ),
    ),
))
GroupSpaceSchema['title'].storage = atapi.AnnotationStorage()
GroupSpaceSchema['description'].storage = atapi.AnnotationStorage()

schemata.finalizeATCTSchema(GroupSpaceSchema, folderish=True, moveDiscussion=False)

class GroupSpace(folder.ATFolder):
    '''A group space'''
    implements(IGroupSpace)
    schema              = GroupSpaceSchema
    portal_type         = 'Group Space'
    description         = atapi.ATFieldProperty('description')
from edrnsite.collaborations.interfaces import IGroupSpaceIndex
from Products.Archetypes import atapi
from Products.ATContentTypes.content import base, schemata
from zope.interface import implements

GroupSpaceIndexSchema = schemata.ATContentTypeSchema.copy() + atapi.Schema((
    atapi.ReferenceField(
        'chair',
        storage=atapi.AnnotationStorage(),
        enforceVocabulary=True,
        multiValued=False,
        vocabulary_factory=u'eke.site.People',
        relationship='chairOfThisGroup',
        vocabulary_display_path_bound=-1,
        widget=atapi.ReferenceWidget(
            label=_(u'Chair'),
            description=_(u'The person in charge of this group.'),
        )),
    atapi.ReferenceField(
        'coChair',
        storage=atapi.AnnotationStorage(),
        enforceVocabulary=True,
        multiValued=False,
        vocabulary_factory=u'eke.site.People',
        relationship='coChairOfThisGroup',
        vocabulary_display_path_bound=-1,
        widget=atapi.ReferenceWidget(
            label=_(u'Co-Chair'),
            description=_(
                u'The assistant to the person in charge of this group.'),
        )),
from edrnsite.collaborations.interfaces import IGroupSpaceIndex
from Products.Archetypes import atapi
from Products.ATContentTypes.content import base, schemata
from zope.interface import implements

GroupSpaceIndexSchema = schemata.ATContentTypeSchema.copy() + atapi.Schema((
    atapi.ReferenceField(
        'chair',
        storage=atapi.AnnotationStorage(),
        enforceVocabulary=True,
        multiValued=False,
        vocabulary_factory=u'eke.site.People',
        relationship='chairOfThisGroup',
        vocabulary_display_path_bound=-1,
        widget=atapi.ReferenceWidget(
            label=_(u'Chair'),
            description=_(u'The person in charge of this group.'),
        )
    ),
    atapi.ReferenceField(
        'coChair',
        storage=atapi.AnnotationStorage(),
        enforceVocabulary=True,
        multiValued=False,
        vocabulary_factory=u'eke.site.People',
        relationship='coChairOfThisGroup',
        vocabulary_display_path_bound=-1,
        widget=atapi.ReferenceWidget(
            label=_(u'Co-Chair'),
            description=_(u'The assistant to the person in charge of this group.'),
        )
class ICollaborativeGroupIndex(IGroupSpaceIndex):
    '''A collaborative group index provides the view and discussion for a collaborative group.'''
    protocols = schema.List(
        title=_(u'Protocols & Studies'),
        description=
        _(u'Protocols and studies that are executed (and studied) by this collaborative group.'
          ),
        required=False,
        value_type=schema.Object(
            title=_(u'Study'),
            description=
            _(u'A study or protocol executed (and studies) by this collaborative group.'
              ),
            schema=IProtocol))
    biomarkers = schema.List(
        title=_(u'Biomarkers'),
        description=_(
            u'Biomarkers of which this collaborative group is fond.'),
        required=False,
        value_type=schema.Object(
            title=_(u'Biomarker'),
            description=_(
                u'A biomarker of which this collaborative group is fond.'),
            schema=IBiomarker))
    datasets = schema.List(
        title=_(u'Datasets'),
        description=_(u'Datasets of interest to this collaborative group.'),
        required=False,
        value_type=schema.Object(
            title=_(u'Dataset'),
            description=_(
                u'A dataset of interest to this collaborative group.'),
            schema=IDataset))
    projects = schema.List(
        title=_(u'Projects'),
        description=
        _(u'Team projects (which are just special protocols) of which this collaborative group is part.'
          ),
        required=False,
        value_type=schema.Object(
            title=_(u'Project'),
            description=
            _(u'Team project (which is just a special protocol) of which this collaborative group is part.'
              ),
            schema=IProtocol))
from Products.Archetypes import atapi
from Products.ATContentTypes.content import schemata
from Products.CMFCore.utils import getToolByName
from zope.interface import implements

CollaborativeGroupIndexSchema = GroupSpaceIndexSchema.copy() + atapi.Schema((
    atapi.ReferenceField(
        'biomarkers',
        storage=atapi.AnnotationStorage(),
        enforceVocabulary=True,
        multiValued=True,
        vocabulary_factory=u'eke.biomarker.BiomarkersVocabulary',
        relationship='biomarkersThisGroupLikes',
        vocabulary_display_path_bound=-1,
        widget=atapi.ReferenceWidget(
            label=_(u'Biomarkers'),
            description=_(u'Biomarkers of which this collaborative group is fond.'),
        ),
    ),
    atapi.ReferenceField(
        'protocols',
        storage=atapi.AnnotationStorage(),
        enforceVocabulary=True,
        multiValued=True,
        vocabulary_factory=u'eke.study.ProtocolsVocabulary',
        relationship='protocolsExecutedByThisGroup',
        vocabulary_display_path_bound=-1,
        widget=atapi.ReferenceWidget(
            label=_(u'Protocols & Studies'),
            description=_(u'Protocols and studies that are executed (and studied) by this collaborative group.'),
        ),