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

  <class class=".project.Project">
    <allow interface="zope.interface.common.mapping.IReadMapping" />
    <require
        permission="schooltool.view"
        attributes="keys __iter__ values items __len__ deployed title"
        />
    <require
        permission="schooltool.edit"
        interface="zope.interface.common.mapping.IWriteMapping"
        set_schema=".interfaces.IProject"
        />
    <require
        permission="schooltool.edit"
        attributes="add"
        />
  </class>

  <class class=".project.Projects">
    <require
        permission="schooltool.edit"
        set_schema=".interfaces.IProjects" />
    <require
        permission="schooltool.view"
        interface=".interfaces.IProjects" />
  </class>

  <class class=".project.CourseProject">
    <allow interface="zope.interface.common.mapping.IReadMapping" />
    <require
        permission="schooltool.view"
        attributes="keys __iter__ values items __len__ deployed title"
        />
    <require
        permission="schooltool.edit"
        interface="zope.interface.common.mapping.IWriteMapping"
        set_schema=".interfaces.ICourseProject"
        />
  </class>

  <class class=".project.CourseProjects">
    <require
        permission="schooltool.view"
        attributes="keys __iter__ values items __len__ title"
        />
    <require
        permission="schooltool.edit"
        interface="zope.interface.common.mapping.IWriteMapping"
        set_schema=".interfaces.ICourseProject"
        />
    <require
        permission="schooltool.view"
        attributes="isDeployed"
        />
    <require
        permission="schooltool.edit"
        attributes="deploy"
        />
  </class>

  <adapter factory=".project.getCourseProjects" />
  <adapter factory=".project.getCourseFromProjects" />
  <adapter factory=".project.getSectionProjects"
           trusted="true" />
  <adapter factory=".project.getSectionFromProjects" />

  <adapterTraverserPlugin
      for="schooltool.course.interfaces.ISection"
      layer="zope.publisher.interfaces.http.IHTTPRequest"
      name="projects"
      adapter="schooltool.cando.interfaces.IProjects"
      />

  <!-- External Activities -->
  <adapter
      for=".interfaces.IProject"
      provides="schooltool.gradebook.interfaces.IExternalActivity"
      factory=".project.CanDoExternalActivityProjectTotal"
      name="projecttotal"
      trusted="true"
      />
  <class class=".project.CanDoExternalActivityProjectTotal">
    <require
        permission="schooltool.view"
        attributes="source external_activity_id title description getGrade
                    __eq__"
        />
    <require
        permission="schooltool.edit"
        set_schema="schooltool.gradebook.interfaces.IExternalActivity"
        />
  </class>
  <adapter
      for=".interfaces.IProject"
      provides="schooltool.gradebook.interfaces.IExternalActivity"
      factory=".project.CanDoExternalActivityProjectPercentPassed"
      name="projectpercentpassed"
      trusted="true"
      />
  <class class=".project.CanDoExternalActivityProjectPercentPassed">
    <require
        permission="schooltool.view"
        attributes="source external_activity_id title description getGrade
                    __eq__"
        />
    <require
        permission="schooltool.edit"
        set_schema="schooltool.gradebook.interfaces.IExternalActivity"
        />
  </class>
  <adapter
      for="schooltool.course.interfaces.ISection"
      provides="schooltool.gradebook.interfaces.IExternalActivity"
      factory=".project.CanDoExternalActivitySectionTotal"
      name="sectiontotal"
      trusted="true"
      />
  <class class=".project.CanDoExternalActivitySectionTotal">
    <require
        permission="schooltool.view"
        attributes="source external_activity_id title description getGrade
                    __eq__"
        />
    <require
        permission="schooltool.edit"
        set_schema="schooltool.gradebook.interfaces.IExternalActivity"
        />
  </class>
  <adapter
      for="schooltool.course.interfaces.ISection"
      provides="schooltool.gradebook.interfaces.IExternalActivity"
      factory=".project.CanDoExternalActivitySectionPercentPassed"
      name="sectionpercentpassed"
      trusted="true"
      />
  <class class=".project.CanDoExternalActivitySectionPercentPassed">
    <require
        permission="schooltool.view"
        attributes="source external_activity_id title description getGrade
                    __eq__"
        />
    <require
        permission="schooltool.edit"
        set_schema="schooltool.gradebook.interfaces.IExternalActivity"
        />
  </class>

  <!-- External Activities Adapter -->
  <adapter
      for="schooltool.course.interfaces.ISection"
      provides="schooltool.gradebook.interfaces.IExternalActivities"
      factory=".project.CanDoExternalActivities"
      name="cando.external_activities"
      trusted="true"
      />
  <class class=".project.CanDoExternalActivities">
    <require
        permission="schooltool.view"
        attributes="title source getExternalActivities getExternalActivity"
        />
  </class>

</configure>
