<configure
    xmlns="http://namespaces.zope.org/zope"
    xmlns:genericsetup="http://namespaces.zope.org/genericsetup"
    xmlns:i18n="http://namespaces.zope.org/i18n"
    xmlns:browser="http://namespaces.zope.org/browser"
    xmlns:plone="http://namespaces.plone.org/plone"
    i18n_domain="collective.addons">

  <i18n:registerTranslations directory="locales" />

  <!--
    Be careful if you use general includeDependencies, it can have sideffects!
    Better import explicite packages or configurations ;)
  -->
  <includeDependencies package="." />

  <include package=".browser" />

  <include file="permissions.zcml" />

  <include file="upgrades.zcml" />

  <genericsetup:registerProfile
      name="default"
      title="collective.addons"
      directory="profiles/default"
      description="Installs the collective.addons add-on."
      provides="Products.GenericSetup.interfaces.EXTENSION"
      post_handler=".setuphandlers.post_install"
      />

  <genericsetup:registerProfile
      name="uninstall"
      title="collective.addons (uninstall)"
      directory="profiles/uninstall"
      description="Uninstalls the collective.addons add-on."
      provides="Products.GenericSetup.interfaces.EXTENSION"
      post_handler=".setuphandlers.uninstall"
      />

  <utility
      factory=".setuphandlers.HiddenProfiles"
      name="collective.addons-hiddenprofiles"
      />

  <!-- -*- extra stuff goes here -*- -->

  <browser:resourceDirectory
      name="collective.addons"
      directory="resources" />

  <browser:page
      name="view"
      for="collective.addons.addoncenter.IAddonCenter"
      class="collective.addons.addoncenter.AddonCenterView"
      template="view_templates/addoncenter_view.pt"
      permission="zope2.View"
      />

  <browser:page
      name="view"
      for="collective.addons.addonproject.IAddonProject"
      class="collective.addons.addonproject.AddonProjectView"
      template="view_templates/addonproject_view.pt"
      permission="zope2.View"
      />


  <browser:page
      name="view"
      for="collective.addons.addonrelease.IAddonRelease"
      class="collective.addons.addonrelease.AddonReleaseView"
      template="view_templates/addonrelease_view.pt"
      permission="zope2.View"
      />


  <browser:page
      name="view"
      for="collective.addons.addonlinkedrelease.IAddonLinkedRelease"
      class="collective.addons.addonlinkedrelease.AddonLinkedReleaseView"
      template="view_templates/addonlinkedrelease_view.pt"
      permission="zope2.View"
      />

  <adapter
    factory="collective.addons.addonproject.ValidateAddonProjectUniqueness"
    />

  <adapter
    name="addon_release_number"
    factory=".addonrelease.addon_release_number"
    />

  <adapter
    factory=".addonrelease.ValidateAddonReleaseUniqueness"
    />

  <adapter
    name="addon_release_number"
    factory=".addonlinkedrelease.addon_release_number"
    />

  <adapter
    factory=".addonlinkedrelease.ValidateAddonLinkedReleaseUniqueness"
    />


  <adapter for="collective.addons.addonrelease.IAddonRelease"
      factory="collective.addons.releasecustomurl.NameForReleaseURL"
      provides="collective.addons.releasecustomurl.INameForReleaseURL"
      />

  <adapter for="collective.addons.addonlinkedrelease.IAddonLinkedRelease"
      factory="collective.addons.releasecustomurl.NameForReleaseURL"
      provides="collective.addons.releasecustomurl.INameForReleaseURL"
      />

  <adapter name="releases_compat_versions" factory=".adapter.releases_compat_versions"/>

  <adapter factory=".adapter.ReleasesCompatVersions" />

  <adapter factory=".contactauthor.ContactAuthorAdapter"/>

  <browser:page
      for="Products.CMFCore.interfaces.ISiteRoot"
      name="contact-addon-author"
      class=".contactauthor.HoneypotForm"
      permission="zope2.View"
      />

  <adapter factory=".contactprojectowner.ContactProjectOwnerAdapter"/>

  <browser:page
      for="collective.addons.addonproject.IAddonProject"
      name="contact-addon-project-owner"
      class="collective.addons.contactprojectowner.HoneypotForm"
      permission="zope2.View"
      />

  <subscriber
    for="collective.addons.addonproject.IAddonProject
               zope.lifecycleevent.interfaces.IObjectAddedEvent"
    handler="collective.addons.addonproject.notifyAboutNewProject"
    />

  <subscriber
    for="collective.addons.addonrelease.IAddonRelease
         zope.lifecycleevent.interfaces.IObjectAddedEvent"
    handler="collective.addons.addonrelease.update_project_releases_compat_versions_on_creation"
    />

  <subscriber
    for="collective.addons.addonrelease.IAddonRelease
         zope.lifecycleevent.interfaces.IObjectModifiedEvent"
    handler="collective.addons.addonrelease.update_project_releases_compat_versions"
    />


  <subscriber
    for="collective.addons.addonlinkedrelease.IAddonLinkedRelease
         zope.lifecycleevent.interfaces.IObjectAddedEvent"
    handler="collective.addons.addonlinkedrelease.update_project_releases_compat_versions_on_creation"
    />

  <subscriber
    for="collective.addons.addonlinkedrelease.IAddonLinkedRelease
         zope.lifecycleevent.interfaces.IObjectModifiedEvent"
    handler="collective.addons.addonlinkedrelease.update_project_releases_compat_versions"
    />


  <subscriber
    for="collective.addons.addonproject.IAddonProject
               Products.CMFCore.interfaces.IActionSucceededEvent"
    handler="collective.addons.addonproject.notifyProjectManager"
    />

  <subscriber
    for="collective.addons.addonrelease.IAddonRelease
              zope.lifecycleevent.interfaces.IObjectAddedEvent"
    handler="collective.addons.addonproject.notifyProjectManagerReleaseAdd"
    />

  <subscriber
    for="collective.addons.addonlinkedrelease.IAddonLinkedRelease
             zope.lifecycleevent.interfaces.IObjectAddedEvent"
    handler="collective.addons.addonproject.notifyProjectManagerLinkedReleaseAdd"
    />

  <subscriber
    for="collective.addons.addonproject.IAddonProject
               Products.CMFCore.interfaces.IActionSucceededEvent"
    handler="collective.addons.addonproject.notifyAboutNewReviewlistentry"
    />


  <subscriber
    for="collective.addons.addonproject.IAddonProject
         zope.lifecycleevent.interfaces.IObjectModifiedEvent"
    handler="collective.addons.addonproject.textmodified_project"
    />


  <subscriber
    for="collective.addons.addonrelease.IAddonRelease
             Products.CMFCore.interfaces.IActionSucceededEvent"
    handler="collective.addons.addonrelease.notifyAddonHubReleaseAdd"
    />


  <subscriber
    for="collective.addons.addonlinkedrelease.IAddonLinkedRelease
             Products.CMFCore.interfaces.IActionSucceededEvent"
    handler="collective.addons.addonlinkedrelease.notifyAddonHubLinkedReleaseAdd"
    />

  <subscriber
    for="collective.addons.addoncenter.IAddonCenter
               zope.lifecycleevent.interfaces.IObjectModifiedEvent"
    handler="collective.addons.notifications.notifiyAboutNewVersion"
    />

  <browser:viewlet
      name="ownprojects"
      for="collective.addons.addoncenter.IAddonCenter"
      view="plone.app.layout.globals.interfaces.IViewView"
      manager="plone.app.layout.viewlets.interfaces.IAboveContentTitle"
      class="collective.addons.addoncenter.AddonCenterOwnProjectsViewlet"
      template="view_templates/own_projects.pt"
      permission="zope2.View"
      />

  <utility
      name="Categories"
      component=".vocabularies.CategoriesVocabularyFactory" />

  <utility
      name="Licenses"
      component=".vocabularies.LicensesVocabularyFactory" />

  <utility
      name="Versions"
      component=".vocabularies.VersionsVocabularyFactory" />

  <utility
      name="Platforms"
      component=".vocabularies.PlatformVocabularyFactory" />






</configure>
