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

  <zope:adapterTraverserPlugin
      for="schooltool.timetable.interfaces.IHaveSchedule"
      layer="zope.publisher.interfaces.browser.IBrowserRequest"
      name="schedule"
      adapter="schooltool.timetable.interfaces.IScheduleContainer"
      permission="schooltool.view"
      />

  <zope:adapter
      factory=".app.ScheduleContainerAbsoluteURLAdapter"
      provides="zope.traversing.browser.interfaces.IAbsoluteURL" />

  <zope:adapter
      factory=".app.ScheduleContainerAbsoluteURLAdapter"
      provides="zope.interface.Interface"
      name="absolute_url"/>

  <zope:adapterTraverserPlugin
      for="schooltool.timetable.interfaces.IHaveTimetables"
      layer="zope.publisher.interfaces.browser.IBrowserRequest"
      name="timetables"
      adapter="schooltool.timetable.interfaces.ITimetableContainer"
      permission="schooltool.view"
      />

  <zope:adapter
      factory=".app.TimetableContainerAbsoluteURLAdapter"
      provides="zope.traversing.browser.interfaces.IAbsoluteURL" />

  <zope:adapter
      factory=".app.TimetableContainerAbsoluteURLAdapter"
      provides="zope.interface.Interface"
      name="absolute_url"/>


  <!-- XXX: this should be declared where ISchoolYear gets IHaveTimetables -->
  <navigationViewlet
      name="school_timetables"
      for="*"
      manager="schooltool.schoolyear.browser.interfaces.ISchoolYearViewMenuViewletManager"
      template="templates/link_to_school_timetables.pt"
      permission="schooltool.view"
      order="60"
      />

  <page
      name="index.html"
      for="schooltool.timetable.interfaces.ITimetableContainer"
      class=".app.TimetableContainerView"
      template="templates/timetable_container.pt"
      permission="schooltool.view"
      />

  <page
      name="add.html"
      for="schooltool.timetable.interfaces.ITimetableContainer"
      class=".ttwizard.TimetableWizard"
      permission="schooltool.edit"
      menu="schooltool_actions"
      title="New Timetable"
      />


  <page
      name="index.html"
      for="schooltool.timetable.interfaces.ITimetable"
      class=".timetable.TimetableView"
      layer="schooltool.skin.ISchoolToolLayer"
      permission="schooltool.view"
      />

  <zope:utility
     factory=".app.timetableVocabularyFactory"
     provides="zope.schema.interfaces.IVocabularyFactory"
     name="schooltool.timetable.browser.timetable_vocabulary" />

  <configure package="schooltool.skin">
    <navigationViewlet
      name="schedule"
      for="schooltool.timetable.interfaces.IHaveSchedule"
      manager="schooltool.skin.IActionMenuManager"
      template="templates/actionsViewlet.pt"
      permission="schooltool.edit"
      link="schedule"
      title="Schedule"
      order="10"
      />
  </configure>

  <page
      name="index.html"
      for="schooltool.timetable.interfaces.IScheduleContainer"
      class="schooltool.timetable.browser.schedule.ScheduleContainerView"
      permission="schooltool.edit" />

  <page
      name="confirm-delete.html"
      for="schooltool.timetable.interfaces.IScheduleContainer"
      class="schooltool.timetable.browser.schedule.ScheduleDeleteView"
      permission="schooltool.edit" />

  <page
      name="special.html"
      for="schooltool.timetable.interfaces.IScheduleWithExceptions"
      class=".schedule.SpecialDayView"
      permission="schooltool.edit"
      />

  <configure package="schooltool.skin">
    <navigationViewlet
      name="special-day"
      for="schooltool.timetable.interfaces.IScheduleWithExceptions"
      manager="schooltool.skin.IActionMenuManager"
      template="templates/actionsViewlet.pt"
      permission="schooltool.edit"
      link="special.html"
      title="Change Schedule for One Day"
      order="70"
      />

    <navigationViewlet
      name="special-day"
      for="schooltool.timetable.interfaces.ITimetable"
      manager="schooltool.skin.IActionMenuManager"
      template="templates/actionsViewlet.pt"
      permission="schooltool.edit"
      link="special.html"
      title="Change Timetable for One Day"
      order="70"
      />

    <navigationViewlet
      name="add-timetable"
      for="schooltool.timetable.interfaces.IScheduleContainer"
      manager="schooltool.skin.IActionMenuManager"
      template="templates/actionsViewlet.pt"
      permission="schooltool.edit"
      link="addTimetable.html"
      title="Add Timetable"
      order="10"
      />
  </configure>


  <zope:adapter
       factory=".timetable.TimetableAdd_default_first"
       name="default"
       />

  <zope:adapter
       factory=".timetable.TimetableAdd_default_last"
       name="default"
       />


  <page
      name="addTimetable.html"
      for="schooltool.timetable.interfaces.IScheduleContainer"
      class=".timetable.SelectedPeriodsAddView"
      permission="schooltool.edit"
      />

  <page
      name="edit.html"
      for="schooltool.timetable.interfaces.ISelectedPeriodsSchedule"
      class=".timetable.SelectedPeriodsScheduleEditView"
      permission="schooltool.edit"
      />

   <page
      for="schooltool.timetable.interfaces.IScheduleCalendarEvent"
      name="edit.html"
      layer="schooltool.skin.ISchoolToolLayer"
      class=".calendar.ScheduleEventEditView"
      permission="schooltool.edit"
      />

  <addform
      label="Add Meeting"
      name="add.html"
      for="schooltool.timetable.interfaces.IScheduleCalendar"
      schema=".calendar.IScheduleEventAddForm"
      arguments=""
      keyword_arguments="title description
                         start_date start_time
                         duration duration_type allday
                         location
                         "
      content_factory="schooltool.timetable.calendar.ScheduleCalendarEvent"
      permission="schooltool.edit"
      template="templates/schedule_event_add.pt"
      class=".calendar.ScheduleEventAddView">

    <widget field="description" height="5" />
  </addform>

  <viewlet
      name="calendar-term-legend"
      for="*"
      class="schooltool.timetable.browser.calendar.TermLegendViewlet"
      view="schooltool.timetable.browser.calendar.ScheduleYearlyCalendarView"
      manager="schooltool.app.browser.cal.ICalendarPortletViewletManager"
      template="templates/calendar_yearly_legend.pt"
      permission="schooltool.view"
      layer="schooltool.skin.ISchoolToolLayer"
      order="6"
      />

   <page
       name="yearly.html"
       for="schooltool.timetable.interfaces.IScheduleCalendar"
       class=".calendar.ScheduleYearlyCalendarView"
       template="templates/calendar_yearly.pt"
       permission="schooltool.view"
       layer="schooltool.skin.ISchoolToolLayer"
       />

  <page
      for="schooltool.app.interfaces.ISchoolToolCalendar"
      name="daily_calendar_rows"
      layer="schooltool.skin.ISchoolToolLayer"
      class=".calendar.ScheduleDailyCalendarRowsView"
      permission="zope.View"
      />

  <zope:adapter
      factory=".calendar.getScheduleCalendarEventDeleteLink"
      name="delete_link" />

   <zope:subscriber
       for="schooltool.app.interfaces.ISchoolToolCalendar
            zope.publisher.interfaces.http.IHTTPRequest"
       provides="schooltool.app.browser.interfaces.ICalendarProvider"
       factory=".calendar.TimetableCalendarListSubscriber"
       />


</configure>
