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

  <!-- CSS -->
  <viewlet
      name="gradebook_css"
      for="*"
      manager="schooltool.skin.ICSSManager"
      class=".gradebook.GradebookCSSViewlet"
      permission="zope.View"
      />
  <resource
      name="gradebook.css"
      file="gradebook.css"
      layer="schooltool.skin.ISchoolToolLayer" />

  <!-- Javascript -->
  <page
     name="gradebook_overview.js"
     for="..gradebook.Gradebook"
     template="gradebook_overview.js.pt"
     permission="schooltool.edit"
     class=".gradebook.GradebookOverview"
     layer="schooltool.skin.ISchoolToolLayer"
     />

  <!-- Categories -->
  <form
      label="Activity Categories"
      name="categories.html"
      schema=".category.ICategoriesForm"
      for="schooltool.app.interfaces.ISchoolToolApplication"
      template="categories.pt"
      class=".category.CategoryOverview"
      permission="schooltool.edit"
      />

  <!-- Navigation Tabs -->
  <navigationViewlet
      name="Gradebook"
      for="*"
      manager="schooltool.skin.skin.INavigationManager"
      template="gradebook_tab.pt"
      permission="schooltool.view"
      link="gradebook.html"
      order="310"
      />

  <!-- Activities overview -->
  <page
      name="index.html"
      for="..interfaces.IActivities"
      class=".activity.ActivitiesView"
      template="activities_overview.pt"
      permission="schooltool.view"
      />

  <!-- Worksheets -->
  <configure package="schooltool.skin">
    <addform
        label="Add a Worksheet"
        name="addWorksheet.html"
        schema="schooltool.gradebook.interfaces.IWorksheet"
        fields="title"
        arguments="title"
        content_factory="schooltool.gradebook.activity.Worksheet"
        permission="schooltool.edit"
        template="templates/simple_add.pt"
        class="schooltool.gradebook.browser.worksheet.WorksheetAddView">
      <widget field="description" height="5" />
    </addform>
    <editform
        label="Edit Worksheet"
        name="edit.html"
        for="schooltool.gradebook.interfaces.IWorksheet"
        schema="schooltool.gradebook.interfaces.IWorksheet"
        fields="title"
        permission="schooltool.edit"
        template="templates/simple_edit.pt"
        class="schooltool.gradebook.browser.worksheet.WorksheetEditView"
        menu="schooltool_actions"
        title="Edit"
        />
  </configure>
  <page
      name="index.html"
      for="..interfaces.IWorksheet"
      class=".worksheet.WorksheetGradebookView"
      permission="schooltool.view"
      />
  <page
      name="manage.html"
      for="..interfaces.IWorksheet"
      class=".worksheet.WorksheetManageView"
      template="worksheet_overview.pt"
      permission="schooltool.view"
      />
  <page
      name="delete.html"
      for="..interfaces.IWorksheet"
      class=".worksheet.WorksheetDeleteView"
      template="worksheet_delete.pt"
      permission="schooltool.edit"
      />
  <page
      name="weights.html"
      for="..interfaces.IWorksheet"
      class=".activity.WeightCategoriesView"
      template="weight_categories.pt"
      permission="schooltool.edit"
      />

  <!-- Activities -->
  <page
     name="addActivity.html"
     for="schooltool.gradebook.interfaces.IWorksheet"
     class=".activity.ActivityAddView"
     permission="schooltool.edit"
     menu="schooltool_actions"
     title="Add Activity"/>
  <page
      name="edit.html"
      for="schooltool.gradebook.interfaces.IActivity"
      class=".activity.ActivityEditView"
      permission="schooltool.edit"
      menu="schooltool_actions"
      title="Edit"
      />
  <configure package="schooltool.skin">
    <navigationViewlet
        name="categories"
        for="*"
        manager="schooltool.app.browser.interfaces.IManageMenuViewletManager"
        template="templates/navigationViewlet.pt"
        class="schooltool.skin.skin.NavigationViewlet"
        permission="schooltool.edit"
        link="categories.html"
        title="Activity Categories"
        order="200"
        />
  </configure>

  <defaultView
      for="..interfaces.IActivity"
      name="edit.html"
      />
  <page
      for="zope.app.container.interfaces.IAdding"
      name="addLinkedActivity.html"
      class="schooltool.gradebook.browser.activity.LinkedActivityAddView"
      permission="schooltool.edit"
      />
  <page
      for="schooltool.gradebook.interfaces.ILinkedActivity"
      name="edit.html"
      class="schooltool.gradebook.browser.activity.LinkedActivityEditView"
      permission="schooltool.edit"
      />
  <zope:adapter
      for="schooltool.gradebook.interfaces.ILinkedActivity"
      provides="schooltool.gradebook.browser.activity.ILinkedActivityFields"
      factory=".activity.LinkedActivityFields"
      />
  <defaultView
      for="..interfaces.ILinkedActivity"
      name="edit.html"
      />

  <!-- Menu items for ISection -->
  <menuItem
      menu="schooltool_actions"
      title="Gradebook"
      for="schooltool.course.interfaces.ISection"
      action="gradebook"
      permission="schooltool.view"
      />

  <!-- Menu items for IActivities -->
  <menuItem
      menu="schooltool_actions"
      title="New Worksheet"
      for="..interfaces.IActivities"
      action="+/addWorksheet.html"
      permission="schooltool.view"
      />
  <menuItem
      menu="schooltool_actions"
      title="Return to Gradebook"
      for="..interfaces.IActivities"
      action="../gradebook"
      permission="schooltool.view"
      />

  <!-- Menu items for IWorksheet-->
  <menuItem
      menu="schooltool_actions"
      title="New Activity"
      for="..interfaces.IWorksheet"
      action="addActivity.html"
      permission="schooltool.view"
      />
  <menuItem
      menu="schooltool_actions"
      title="New External Activity"
      for="..interfaces.IWorksheet"
      action="+/addLinkedActivity.html"
      permission="schooltool.view"
      />
  <menuItem
      menu="schooltool_actions"
      title="Return to Gradebook"
      for="..interfaces.IWorksheet"
      action="gradebook"
      permission="schooltool.view"
      />

  <!-- Menu items for IGradebook-->
  <menuItem
      menu="schooltool_actions"
      title="Worksheets"
      for="..interfaces.IGradebook"
      action="../../index.html"
      permission="schooltool.view"
      />
  <menuItem
      menu="schooltool_actions"
      title="View Final Grades"
      for="..interfaces.IGradebook"
      action="final.html"
      permission="schooltool.view"
      />
  <menuItem
      menu="schooltool_actions"
      title="New Activity"
      for="..interfaces.IGradebook"
      action="../addActivity.html"
      permission="schooltool.view"
      />
  <menuItem
      menu="schooltool_actions"
      title="New External Activity"
      for="..interfaces.IGradebook"
      action="../+/addLinkedActivity.html"
      permission="schooltool.view"
      />
  <menuItem
      menu="schooltool_actions"
      title="Manage Activities"
      for="..interfaces.IGradebook"
      action="../manage.html"
      permission="schooltool.view"
      />

  <!-- Menu items for ILinkedActivity -->
  <!-- <menuItem
      menu="schooltool_actions"
      title="Update Grades"
      for="schooltool.gradebook.interfaces.ILinkedActivity"
      action="updateGrades.html"
      permission="schooltool.edit"
      /> -->

  <navigationViewlet
      name="update_grades"
      for="schooltool.gradebook.interfaces.ILinkedActivity"
      manager="schooltool.skin.IActionMenuManager"
      template="templates/actionsViewlet.pt"
      class=".activity.UpdateGradesActionMenuViewlet"
      permission="schooltool.edit"
      link="updateGrades.html"
      title="Update Grades"
      order="0"
      />

  <!-- Gradebook -->
  <page
      name="gradebook.html"
      for="schooltool.app.interfaces.ISchoolToolApplication"
      class=".gradebook.GradebookStartup"
      template="gradebook_startup.pt"
      permission="schooltool.view"
      />
  <page
      name="gradebook"
      for="schooltool.course.interfaces.ISection"
      class=".gradebook.SectionGradebookRedirectView"
      permission="schooltool.view"
      />
  <page
      name="mygrades"
      for="schooltool.course.interfaces.ISection"
      class=".gradebook.SectionGradebookRedirectView"
      permission="schooltool.view"
      />
  <page
      name="index.html"
      for="..interfaces.IGradebook"
      class=".gradebook.GradebookOverview"
      template="gradebook_overview.pt"
      permission="schooltool.view"
      />
  <page
      name="final.html"
      for="..interfaces.IGradebook"
      class=".gradebook.FinalGradesView"
      template="final_grades.pt"
      permission="schooltool.view"
      />
  <page
      name="index.html"
      for="..interfaces.IMyGrades"
      class=".gradebook.MyGradesView"
      template="mygrades.pt"
      permission="schooltool.view"
      />
  <page
      name="gradeStudent.html"
      for="..interfaces.IGradebook"
      class=".gradebook.GradeStudent"
      template="gradebook_grade_student.pt"
      permission="schooltool.edit"
      />
  <page
      name="gradeActivity.html"
      for="..interfaces.IGradebook"
      class=".gradebook.GradeActivity"
      template="gradebook_grade_activity.pt"
      permission="schooltool.edit"
      />
  <page
      name="grade.html"
      for="..interfaces.IGradebook"
      class=".gradebook.Grade"
      template="gradebook_grade.pt"
      permission="schooltool.edit"
      />
  <page
      name="updateGrades.html"
      for="..interfaces.ILinkedActivity"
      class=".gradebook.UpdateLinkedActivityGrades"
      permission="schooltool.edit"
      />

  <!-- Terms -->

  <zope:adapter
      for="schooltool.gradebook.interfaces.IExternalActivitiesSource
           zope.publisher.interfaces.browser.IBrowserRequest"
      factory="schooltool.gradebook.browser.activity.ExternalActivitiesTerms"
      />

</configure>
