<?xml version="1.0" encoding="utf-8"?>
<configure
    xmlns="http://namespaces.zope.org/zope"
    xmlns:security="http://schooltool.org/securitypolicy"
    xmlns:i18n="http://namespaces.zope.org/i18n"
    i18n_domain="schooltool.intervention">

  <!-- The objects -->
  <class class=".intervention.InterventionRoot">
    <implements interface=".interfaces.IInterventionRoot" />
    <implements interface=".interfaces.IInterventionMarker" />
    <require
        permission="schooltool.edit"
        set_schema=".interfaces.IInterventionRoot" />
    <require
        permission="schooltool.view"
        interface=".interfaces.IInterventionRoot" />
  </class>
  <class class=".intervention.InterventionSchoolYear">
    <implements interface=".interfaces.IInterventionSchoolYear" />
    <implements interface=".interfaces.IInterventionMarker" />
    <require
        permission="schooltool.edit"
        set_schema=".interfaces.IInterventionSchoolYear" />
    <require
        permission="schooltool.view"
        interface=".interfaces.IInterventionSchoolYear" />
  </class>
  <class class=".intervention.InterventionStudent">
    <implements interface=".interfaces.IInterventionStudent" />
    <implements interface=".interfaces.IInterventionMarker" />
    <require
        permission="schooltool.edit"
        set_schema=".interfaces.IInterventionStudent" />
    <require
        permission="schooltool.view"
        interface=".interfaces.IInterventionStudent" />
  </class>
  <class class=".intervention.InterventionMessages">
    <implements interface=".interfaces.IInterventionMessages" />
    <implements interface=".interfaces.IInterventionMarker" />
    <require
        permission="schooltool.edit"
        set_schema=".interfaces.IInterventionMessages" />
    <require
        permission="schooltool.view"
        interface=".interfaces.IInterventionMessages" />
  </class>
  <class class=".intervention.InterventionMessage">
    <implements interface=".interfaces.IInterventionMessage" />
    <implements interface=".interfaces.IInterventionMarker" />
    <require
        permission="schooltool.edit"
        set_schema=".interfaces.IInterventionMessage" />
    <require
        permission="schooltool.view"
        interface=".interfaces.IInterventionMessage" />
  </class>
  <class class=".intervention.InterventionGoals">
    <implements interface=".interfaces.IInterventionGoals" />
    <implements interface=".interfaces.IInterventionMarker" />
    <require
        permission="schooltool.edit"
        set_schema=".interfaces.IInterventionGoals" />
    <require
        permission="schooltool.view"
        interface=".interfaces.IInterventionGoals" />
  </class>
  <class class=".intervention.InterventionGoal">
    <implements interface=".interfaces.IInterventionGoal" />
    <implements interface=".interfaces.IInterventionMarker" />
    <require
        permission="schooltool.edit"
        set_schema=".interfaces.IInterventionGoal" />
    <require
        permission="schooltool.view"
        interface=".interfaces.IInterventionGoal" />
  </class>

  <!-- Security -->
  <security:crowd
      name="intervention_crowd"
      factory=".intervention.InterventionCrowd" />
  <security:allow
      interface=".interfaces.IInterventionMarker"
      crowds="intervention_crowd"
      permission="schooltool.edit" />

  <!-- The application hook -->
  <adapter
      factory=".intervention.InterventionInit"
      name="schooltool.interventions" />

  <adapter
      factory=".intervention.InterventionStartup"
      name="schooltool.interventions" />

  <!-- Various adapters -->
  <adapter
      factory=".intervention.getSchoolYearInterventionSchoolYear" />
  <adapter
      factory=".intervention.getSchoolToolApplicationInterventionSchoolYear" />
  <adapter
      factory=".intervention.getInterventionSchoolYearSchoolYear" />

  <!-- Pluggable traverser plugins for HTTP paths -->
  <adapterTraverserPlugin
      for="schooltool.schoolyear.interfaces.ISchoolYear"
      layer="zope.publisher.interfaces.http.IHTTPRequest"
      name="intervention"
      adapter="schooltool.intervention.interfaces.IInterventionSchoolYear"
      />
  <adapterTraverserPlugin
      for="schooltool.app.interfaces.ISchoolToolApplication"
      layer="zope.publisher.interfaces.http.IHTTPRequest"
      name="intervention"
      adapter="schooltool.intervention.interfaces.IInterventionSchoolYear"
      />

  <!-- The name choosers -->
  <adapter
      for=".interfaces.IInterventionMessages"
      factory=".intervention.SequenceNumberNameChooser"
      provides="zope.container.interfaces.INameChooser" />
  <adapter
      for=".interfaces.IInterventionGoals"
      factory=".intervention.SequenceNumberNameChooser"
      provides="zope.container.interfaces.INameChooser" />

  <!-- Traversal to a student's intervention -->
  <adapter
      name="intervention"
      for="schooltool.basicperson.interfaces.IBasicPerson
           zope.publisher.interfaces.http.IHTTPRequest"
      provides="schooltool.traverser.interfaces.ITraverserPlugin"
      factory=".intervention.InterventionStudentTraverserPlugin" />

  <!-- Traversal to a student's messages with section in traversal path -->
  <class class=".intervention.SectionMessagesProxy">
    <require permission="schooltool.view"
             attributes="section" />
  </class>
  <adapter
      name="messages"
      for="schooltool.course.interfaces.ISection
           zope.publisher.interfaces.http.IHTTPRequest"
      provides="schooltool.traverser.interfaces.ITraverserPlugin"
      factory=".intervention.SectionMessagesTraverserPlugin" />
  <adapter
      for=".intervention.SectionMessagesProxy
           zope.publisher.interfaces.http.IHTTPRequest"
      provides="zope.publisher.interfaces.IPublishTraverse"
      factory=".intervention.SectionMessagesTraverser" />

  <!-- Vocabularies -->
  <utility
     factory=".vocabularies.advisorVocabularyFactory"
     provides="zope.schema.interfaces.IVocabularyFactory"
     name="schooltool.intervention.advisor_source" />

  <!-- Sending email -->
  <subscriber
      for="schooltool.intervention.interfaces.IInterventionMessage zope.lifecycleevent.interfaces.IObjectAddedEvent"
      handler=".sendmail.sendInterventionMessageEmail"
      />
  <subscriber
      for="schooltool.intervention.interfaces.IInterventionGoal zope.lifecycleevent.interfaces.IObjectAddedEvent"
      handler=".sendmail.sendInterventionGoalAddEmail"
      />

  <!-- generations -->
  <utility
      name="schooltool.intervention"
      provides="zope.app.generations.interfaces.ISchemaManager"
      component=".generations.schemaManager"
      />

  <include package=".browser" />

  <!-- Translations -->

  <i18n:registerTranslations directory="locales" />

</configure>
