<?xml version="1.0"?>
<configure xmlns="http://namespaces.zope.org/zope"
           xmlns:i18n="http://namespaces.zope.org/i18n"
           i18n_domain="schooltool">

  <interface
      interface=".interfaces.ILevelContainerContainer"
      type="zope.app.content.interfaces.IContentType"
      />

  <class class=".level.LevelContainerContainer">
    <allow interface="zope.container.interfaces.ISimpleReadContainer" />
    <require permission="schooltool.view"
             attributes="keys values items __iter__ __len__" />
    <require permission="schooltool.edit"
             interface="zope.container.interfaces.IWriteContainer" />
  </class>

  <interface
      interface=".interfaces.ILevelContainer"
      type="zope.app.content.interfaces.IContentType"
      />

  <class class=".level.LevelContainer">
    <allow interface="zope.container.interfaces.ISimpleReadContainer" />
    <require permission="schooltool.view"
             attributes="keys values items __iter__ __len__" />
    <require permission="schooltool.edit"
             interface="zope.container.interfaces.IWriteContainer" />
    <require permission="schooltool.edit"
             interface="zope.container.interfaces.IOrdered" />
  </class>

  <interface
      interface=".interfaces.ILevel"
      type="zope.app.content.interfaces.IContentType"
      />

  <class class=".level.Level">
    <allow attributes="__cmp__" />
    <require permission="schooltool.view"
             interface=".interfaces.ILevel" />
    <require permission="schooltool.edit"
             set_schema=".interfaces.ILevel" />
  </class>

  <!-- Data consistency hooks -->

  <adapter
      for="schooltool.app.interfaces.ISchoolToolApplication"
      factory=".level.LevelInit"
      name="schooltool.level.level" />

  <adapter
      for="schooltool.app.interfaces.ISchoolToolApplication"
      factory=".level.LevelStartUp"
      name="schooltool.level.level" />

  <adapter factory=".level.RemoveLevelsWhenSchoolYearIsDeleted"
           name="schooltool.level.level" />

  <!-- Content adapters -->

  <adapter factory=".level.getLevelContainer" />
  <adapter factory=".level.getLevelContainerForApp" />
  <adapter factory=".level.getSchoolYearForLevelContainer" />
  <adapter factory=".level.getSchoolYearForLevel" />

  <adapter
      for=".interfaces.ILevelContainer"
      factory="schooltool.app.app.SimpleNameChooser"
      provides="zope.container.interfaces.INameChooser" />

  <utility
     factory=".level.levelVocabularyFactory"
     provides="zope.schema.interfaces.IVocabularyFactory"
     name="schooltool.level.level.levelvocabulary" />

</configure>
