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

    <adapter
        for="plone.event.interfaces.IEvent"
        factory=".exporter.ICalendarEventComponent"
        />

    <adapter
        for="plone.event.interfaces.IOccurrence"
        factory=".exporter.ICalendarEventComponent"
        />

    <adapter
        for="plone.event.interfaces.IEvent"
        provides="plone.event.interfaces.IICalendar"
        factory=".exporter.calendar_from_event"
        />

    <adapter
        for="plone.event.interfaces.IOccurrence"
        provides="plone.event.interfaces.IICalendar"
        factory=".exporter.calendar_from_event"
        />

    <adapter
        for="Products.CMFCore.interfaces.ISiteRoot"
        provides="plone.event.interfaces.IICalendar"
        factory=".exporter.calendar_from_container"
        />

    <adapter
        for="plone.folder.interfaces.IFolder"
        provides="plone.event.interfaces.IICalendar"
        factory=".exporter.calendar_from_container"
        />

    <adapter
        for="plone.app.collection.interfaces.ICollection"
        provides="plone.event.interfaces.IICalendar"
        factory=".exporter.calendar_from_collection"
        zcml:condition="installed plone.app.collection"
        />

    <adapter
        for="plone.app.contenttypes.interfaces.ICollection"
        provides="plone.event.interfaces.IICalendar"
        factory=".exporter.calendar_from_collection"
        zcml:condition="installed plone.app.contenttypes"
        />

    <!-- ICal Browser Views -->
    <browser:page
        for="plone.event.interfaces.IEvent"
        name="ics_view"
        class=".exporter.EventsICal"
        permission="zope2.View"
        layer="..interfaces.IBrowserLayer"
        />

    <browser:page
        for="plone.event.interfaces.IOccurrence"
        name="ics_view"
        class=".exporter.EventsICal"
        permission="zope2.View"
        layer="..interfaces.IBrowserLayer"
        />

    <browser:page
        for="Products.CMFCore.interfaces.ISiteRoot"
        name="ics_view"
        class=".exporter.EventsICal"
        permission="zope2.View"
        layer="..interfaces.IBrowserLayer"
        />

    <browser:page
        for="plone.folder.interfaces.IFolder"
        name="ics_view"
        class=".exporter.EventsICal"
        permission="zope2.View"
        layer="..interfaces.IBrowserLayer"
        />

    <browser:page
        for="plone.app.collection.interfaces.ICollection"
        name="ics_view"
        class=".exporter.EventsICal"
        permission="zope2.View"
        zcml:condition="installed plone.app.collection"
        layer="..interfaces.IBrowserLayer"
        />

    <browser:page
        for="plone.app.contenttypes.interfaces.ICollection"
        name="ics_view"
        class=".exporter.EventsICal"
        permission="zope2.View"
        zcml:condition="installed plone.app.contenttypes"
        layer="..interfaces.IBrowserLayer"
        />

    <!-- Ical import -->
    <adapter factory=".importer.IcalendarImportSettings"/>

    <browser:page
        for="plone.folder.interfaces.IFolder"
        name="ical_import_settings"
        class=".importer.IcalendarImportSettingsFormView"
        allowed_attributes="enable
                            disable"
        permission="cmf.ManagePortal"
        layer="..interfaces.IBrowserLayer"
        />

    <browser:page
        for="*"
        name="ical_import_tool"
        class=".importer.IcalendarImportTool"
        allowed_attributes="enabled
                            available
                            available_disabled"
        permission="zope2.View"
        layer="..interfaces.IBrowserLayer"
        />

</configure>
