<configure
    xmlns="http://namespaces.zope.org/zope"
    xmlns:browser="http://namespaces.zope.org/browser"
    xmlns:plone="http://namespaces.plone.org/plone"
    xmlns:zcml="http://namespaces.zope.org/zcml"
    i18n_domain="ftw.events">

    <include package="plone.behavior" file="meta.zcml" />

    <plone:behavior
        title="Event location"
        description="Location fields for event pages."
        provides="ftw.events.behaviors.location.ILocationFields"
        for="ftw.events.interfaces.IEventPage"
        />

    <plone:behavior
        title="Mopage trigger configuration"
        description="Provides fields for configuring a mopage trigger (ftw.publisher)."
        provides="ftw.events.behaviors.mopage.IPublisherMopageTrigger"
        for="ftw.events.interfaces.IEventFolder"
        marker="ftw.events.behaviors.mopage.IPublisherMopageTriggerSupport"
        factory="ftw.events.behaviors.mopage.PublisherMopageTrigger"
        />

    <configure zcml:condition="have ftw.events:mopage_publisher_receiver">

        <subscriber
            for="*
                 ftw.publisher.receiver.interfaces.IAfterCreatedEvent"
            handler=".mopage.trigger_mopage_refresh" />

        <subscriber
            for="*
                 ftw.publisher.receiver.interfaces.IAfterUpdatedEvent"
            handler=".mopage.trigger_mopage_refresh" />

        <browser:page
            name="taskqueue_events_trigger_mopage_refresh"
            for="Products.CMFPlone.interfaces.siteroot.IPloneSiteRoot"
            layer="collective.taskqueue.interfaces.ITaskQueueLayer"
            class=".mopage.TriggerMopageRefreshTaskQueueWorker"
            permission="zope2.View"
            />

        <adapter
            for="ftw.events.interfaces.IEventPage"
            provides="ftw.events.behaviors.mopage.IMopageModificationDate"
            factory="ftw.events.behaviors.mopage.MopageModificationDate"
            />

    </configure>

</configure>
