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

  <include file="security.zcml" />

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

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

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

  <class class=".person.PersonPasswordWriter">
    <require
        interface=".interfaces.IPasswordWriter"
        permission="schooltool.edit" />
  </class>

  <adapter trusted="True"
           factory=".person.PersonPasswordWriter" />

  <class class=".person.Person">
    <implements interface="schooltool.app.interfaces.IHaveCalendar" />
    <implements interface=".interfaces.IHavePreferences" />
    <require
        permission="schooltool.view"
        interface=".interfaces.IReadPerson"
        attributes="__cmp__" />
    <require
        permission="schooltool.edit"
        interface=".interfaces.IWritePerson"
        set_schema=".interfaces.IPerson" />
  </class>

  <utility
     factory=".utility.PersonFactoryUtility"
     provides="schooltool.person.interfaces.IPersonFactory"
     />

  <class class=".preference.PersonPreferences">
    <require
        permission="schooltool.view"
        interface=".interfaces.IPersonPreferences" />
    <require
        permission="schooltool.edit"
        set_schema=".interfaces.IPersonPreferences" />
  </class>

  <adapter
      for=".interfaces.IHavePreferences"
      provides=".interfaces.IPersonPreferences"
      factory=".preference.getPersonPreferences"
      trusted="true"
      />

  <subscriber
      for="schooltool.person.interfaces.IPerson zope.app.container.interfaces.IObjectAddedEvent"
      handler=".person.personAppCalendarOverlaySubscriber"
      />

  <!-- Application hook -->
  <adapter
      for="schooltool.app.interfaces.ISchoolToolApplication"
      factory=".person.PersonInit"
      name="schooltool.persons"
      />

  <adapter
      factory=".person.getCalendarOwner"
      provides=".interfaces.IPerson"
      for="schooltool.app.interfaces.ISchoolToolCalendar" />

  <adapter
      factory=".preference.getPreferencesOwner"
      provides=".interfaces.IPerson"
      for="schooltool.person.interfaces.IPersonPreferences" />

  <subscriber
      for="schooltool.app.interfaces.ICatalogSetUpEvent"
      handler=".person.catalogSetUpSubscriber"
      />

  <adapter
      for=".interfaces.IPersonContainer"
      factory=".person.getPersonContainerCatalog"
      provides="zope.app.catalog.interfaces.ICatalog" />

  <configure
      xmlns:zcml="http://namespaces.zope.org/zcml"
      zcml:condition="have devmode">

    <utility
        factory=".sampledata.SampleStudents"
        provides="schooltool.sampledata.interfaces.ISampleDataPlugin"
        name="students"
        />

    <utility
        factory=".sampledata.SampleTeachers"
        provides="schooltool.sampledata.interfaces.ISampleDataPlugin"
        name="teachers"
        />

  </configure>

  <include package=".browser" />

  <!-- Help files -->
  <include package=".help" />

</configure>
