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

  <!-- Resource Traverser -->
  <zope:view
      for="..interfaces.IBaseResource"
      type="zope.publisher.interfaces.browser.IBrowserRequest"
      provides="zope.publisher.interfaces.browser.IBrowserPublisher"
      factory="schooltool.traverser.browser.PluggableBrowserTraverser"
      permission="zope.Public"
      />

  <zope:view
      for="..interfaces.IResourceContainer"
      type="zope.publisher.interfaces.browser.IBrowserRequest"
      provides="zope.publisher.interfaces.browser.IBrowserPublisher"
      factory="schooltool.traverser.browser.PluggableBrowserTraverser"
      permission="zope.Public"
      />

  <zope:adapter
      for="schooltool.resource.types.ResourceFactoryUtility
           zope.publisher.interfaces.browser.IBrowserRequest"
      factory=".resource.ResourceTypeFilter"
      />

  <zope:adapter
      for="schooltool.resource.types.LocationFactoryUtility
           zope.publisher.interfaces.browser.IBrowserRequest"
      factory=".resource.LocationTypeFilter"
      />

  <zope:adapter
      for="schooltool.resource.types.EquipmentFactoryUtility
           zope.publisher.interfaces.browser.IBrowserRequest"
      factory=".resource.EquipmentTypeFilter"
      />

  <viewlet
      name="resource-booking-info"
      for="*"
      manager="schooltool.app.browser.skin.ICalendarEventViewletManager"
      template="event_booking_viewlet.pt"
      permission="zope.Public"
      order="20"
      />

  <viewlet
      name="resource-booking-edit"
      for="schooltool.resource.booking.IBookingCalendar"
      class="schooltool.app.browser.skin.CalendarEventBookingViewlet"
      manager="schooltool.app.browser.skin.ICalendarEventViewletManager"
      template="event_edit_booking_viewlet.pt"
      permission="zope.Public"
      order="30"
      />

  <configure package="schooltool.skin">

    <page
        name="index.html"
        for="schooltool.resource.interfaces.IResourceContainer"
        class="schooltool.resource.browser.resource.ResourceContainerView"
        permission="schooltool.view"
        menu="zmi_views"
        title="View"
        />

    <addform
        label="Add a Resource"
        name="addSchoolToolResource.html"
        schema="schooltool.resource.interfaces.IResource"
        fields="title description notes"
        set_before_add="title description notes"
        content_factory="schooltool.resource.resource.Resource"
        template="templates/simple_add.pt"
        class="schooltool.app.browser.app.BaseAddView"
        permission="schooltool.edit">
      <widget field="description" height="5" />
    </addform>

    <editform
        for="schooltool.resource.interfaces.IResource"
        name="edit.html"
        label="Edit Resource Information"
        schema="schooltool.resource.interfaces.IResource"
        fields="title description notes"
        permission="schooltool.edit"
        template="templates/simple_edit.pt"
        class="schooltool.resource.browser.resource.ResourceEditView"
        menu="schooltool_actions"
        title="Edit Info">
      <widget field="description" height="5" />
    </editform>

    <!-- Location forms -->
    <addform
        label="Add a Location"
        name="addSchoolToolLocation.html"
        schema="schooltool.resource.interfaces.ILocation"
        fields="title type description capacity notes"
        set_before_add="title type description capacity notes"
        content_factory="schooltool.resource.resource.Location"
        template="templates/simple_add.pt"
        class="schooltool.app.browser.app.BaseAddView"
        permission="schooltool.edit">
      <widget field="description" height="5" />
      <widget field="type"
          class="schooltool.resource.browser.resource.ResourceSubTypeWidget"
          utility="location"/>
    </addform>

    <editform
        for="schooltool.resource.interfaces.ILocation"
        name="edit.html"
        label="Edit Location Information"
        schema="schooltool.resource.interfaces.ILocation"
        fields="title type description capacity notes"
        permission="schooltool.edit"
        template="templates/simple_edit.pt"
        class="schooltool.resource.browser.resource.ResourceEditView"
        menu="schooltool_actions"
        title="Edit Info">
      <widget field="description" height="5" />
      <widget field="type"
          class="schooltool.resource.browser.resource.ResourceSubTypeWidget"
          utility="location"/>
    </editform>

    <!-- Equipment forms -->
    <addform
        label="Add an Equipment"
        name="addSchoolToolEquipment.html"
        schema="schooltool.resource.interfaces.IEquipment"
        fields="title description type manufacturer model serialNumber
                purchaseDate notes"
        set_before_add="title description notes type manufacturer model
                        serialNumber purchaseDate"
        content_factory="schooltool.resource.resource.Equipment"
        template="templates/simple_add.pt"
        class="schooltool.app.browser.app.BaseAddView"
        permission="schooltool.edit">
      <widget field="description" height="5" />
      <widget field="type"
          class="schooltool.resource.browser.resource.ResourceSubTypeWidget"
          utility="equipment"/>
    </addform>

    <editform
        for="schooltool.resource.interfaces.IEquipment"
        name="edit.html"
        label="Edit Equipment Information"
        schema="schooltool.resource.interfaces.IEquipment"
        fields="title description type manufacturer model serialNumber
                purchaseDate notes"
        permission="schooltool.edit"
        template="templates/simple_edit.pt"
        class="schooltool.resource.browser.resource.ResourceEditView"
        menu="schooltool_actions"
        title="Edit Info">
      <widget field="description" height="5" />
      <widget field="type"
          class="schooltool.resource.browser.resource.ResourceSubTypeWidget"
          utility="equipment"/>
    </editform>

    <navigationViewlet
      name="resources"
      for="*"
      manager="schooltool.app.browser.interfaces.IManageMenuViewletManager"
      template="templates/navigationViewlet.pt"
      class="schooltool.skin.TopLevelContainerNavigationViewlet"
      permission="schooltool.view"
      link="resources"
      title="Resources"
      order="60"
      />

  </configure>


  <containerViews
      for="..interfaces.IResourceContainer"
      contents="schooltool.view"
      add="schooltool.edit"
      />

  <menuItem
      menu="schooltool_actions"
      title="New Resource"
      for="..interfaces.IResourceContainer"
      action="+/addSchoolToolResource.html"
      />

  <menuItem
      menu="schooltool_actions"
      title="New Location"
      for="..interfaces.IResourceContainer"
      action="+/addSchoolToolLocation.html"
      />

  <menuItem
      menu="schooltool_actions"
      title="New Equipment"
      for="..interfaces.IResourceContainer"
      action="+/addSchoolToolEquipment.html"
      />

  <addMenuItem
      title="SchoolBell Resource"
      description="A Resource"
      class="..resource.Resource"
      permission="schooltool.edit"
      view="addSchoolToolResource.html"
      />

  <page
      name="index.html"
      for="..interfaces.IResource"
      class=".resource.ResourceView"
      permission="schooltool.view"
      />

  <page
      name="index.html"
      for="..interfaces.ILocation"
      class=".resource.LocationView"
      permission="schooltool.view"
      />

  <page
      name="index.html"
      for="..interfaces.IEquipment"
      class=".resource.EquipmentView"
      permission="schooltool.view"
      />

  <page
      name="resource-csvimport.html"
      for="..interfaces.IResourceContainer"
      class=".csvimport.ResourceCSVImportView"
      template="resource-csvimport.pt"
      permission="schooltool.edit"
      menu="schooltool_actions"
      title="Import Resources"
      />

  <zope:adapter
      for="schooltool.resource.interfaces.IResourceContainer
           zope.publisher.interfaces.browser.IBrowserRequest"
      factory=".resource.ResourceContainerFilterWidget" />

  <zope:adapter
      for="schooltool.resource.interfaces.IResourceContainer
           zope.publisher.interfaces.browser.IBrowserRequest"
      factory="schooltool.table.table.SchoolToolTableFormatter " />

  <zope:configure package="schooltool.app.browser">
    <page
       name="daily.html"
       for="schooltool.resource.interfaces.IBookingCalendar"
       class="schooltool.resource.browser.booking.DailyBookingCalendarView"
       template="templates/cal_daily.pt"
       permission="schooltool.view"
       />

    <page
       name="weekly.html"
       for="schooltool.resource.interfaces.IBookingCalendar"
       class="schooltool.resource.browser.booking.WeeklyBookingCalendarView"
       template="templates/cal_weekly.pt"
       permission="schooltool.view"
       />

    <page
       name="monthly.html"
       for="schooltool.resource.interfaces.IBookingCalendar"
       class="schooltool.resource.browser.booking.MonthlyBookingCalendarView"
       template="templates/cal_monthly.pt"
       permission="schooltool.view"
       />

    <page
       name="yearly.html"
       for="schooltool.resource.interfaces.IBookingCalendar"
       class="schooltool.resource.browser.booking.YearlyBookingCalendarView"
       template="templates/cal_yearly.pt"
       permission="schooltool.view"
       />

  </zope:configure>

  <page
      for="schooltool.resource.interfaces.IBookingCalendar"
      name="book_one_resource.html"
      layer="schooltool.skin.ISchoolToolLayer"
      class=".booking.CalendarEventBookOneResourceView"
      permission="zope.View"
      />

  <viewlet
      name="portlet-tomorrow-events"
      for="schooltool.resource.interfaces.IBookingCalendar"
      manager="schooltool.app.browser.cal.ICalendarPortletViewletManager"
      template="portlet_tomorrow_events.pt"
      permission="zope.Public"
      layer="schooltool.skin.ISchoolToolLayer"
      order="5"
      />

</configure>
