<?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"
           xmlns:flourish="http://schooltool.org/flourish"
           xmlns:report="http://namespaces.schooltool.org/report"
           i18n_domain="schooltool">

  <!-- Container views -->

  <flourish:breadcrumb
      for="schooltool.person.interfaces.IPersonContainer"
      title="People"
      />

  <flourish:content
      class="schooltool.app.browser.app.ContentTitle"
      permission="schooltool.view"
      for="schooltool.person.interfaces.IPersonContainer"
      layer="schooltool.skin.flourish.IFlourishLayer"
      title="People"
      name="title" />

  <flourish:viewlet
      name="demographics"
      title="Demographics"
      class="schooltool.skin.flourish.page.LinkViewlet"
      manager="schooltool.app.browser.app.CustomizeSchoolLinks"
      permission="schooltool.view"
      />

  <flourish:page
      name="index.html"
      for="schooltool.person.interfaces.IPersonContainer"
      class=".person.FlourishBasicPersonContainerView"
      permission="schooltool.view"
      />

  <flourish:viewlet
      name="person_container"
      manager="schooltool.skin.flourish.page.IPageRefineManager"
      class="schooltool.basicperson.browser.person.PersonContainerLinks"
      view=".person.FlourishBasicPersonContainerView"
      for="schooltool.person.interfaces.IPersonContainer"
      title="Add"
      permission="schooltool.view"
      />

  <flourish:viewlet
      name="person-links"
      manager="schooltool.skin.flourish.page.IPageRefineManager"
      class="schooltool.basicperson.browser.person.PersonLinks"
      for="schooltool.person.interfaces.IPerson"
      permission="schooltool.view"
      view=".person.FlourishPersonView"
      />

  <flourish:viewlet
      name="person-actions-links"
      before="person-settings-links"
      manager="schooltool.skin.flourish.page.IPageRefineManager"
      class="schooltool.basicperson.browser.person.PersonActionsLinks"
      title="Actions"
      for="schooltool.person.interfaces.IPerson"
      permission="schooltool.edit"
      view=".person.FlourishPersonView"
      />

  <flourish:viewlet
      name="person-settings-links"
      manager="schooltool.skin.flourish.page.IPageRefineManager"
      class="schooltool.basicperson.browser.person.PersonSettingsLinks"
      title="Settings"
      for="schooltool.person.interfaces.IPerson"
      permission="schooltool.view"
      view=".person.FlourishPersonView"
      />

  <flourish:viewletFactory
      name="manage_school_links"
      manager="schooltool.skin.flourish.page.IPageRefineManager"
      for="schooltool.person.interfaces.IPersonContainer"
      factory="schooltool.app.browser.app.getAppViewlet"
      />

  <flourish:activeViewlet
      name="manage_school"
      manager="schooltool.skin.flourish.page.IHeaderNavigationManager"
      for="schooltool.person.interfaces.IPersonContainer"
      />

  <!-- Add views -->

  <flourish:page
      name="add_multiple.html"
      subtitle="Add new persons"
      for="schooltool.person.interfaces.IPersonContainer"
      class="schooltool.basicperson.browser.person.FlourishMultiplePersonAddView"
      permission="schooltool.edit"
      content_template="templates/f_person_add_multiple.pt"
      />

<!--    <flourish:viewlet
        name="add_multiple.html"
        title="Add Persons"
        class="schooltool.skin.flourish.page.LinkViewlet"
        manager="schooltool.basicperson.browser.person.PersonContainerLinks"
        permission="schooltool.edit"
        /> -->


  <flourish:page
     name="add.html"
     subtitle="Add new person"
     for="schooltool.person.interfaces.IPersonContainer"
     class="schooltool.basicperson.browser.person.FlourishPersonAddView"
     permission="schooltool.edit"
     content_template="templates/f_person_form.pt"
     />

  <flourish:page
     name="addTeacher.html"
     subtitle="Add new teacher"
     for="schooltool.person.interfaces.IPersonContainer"
     class="schooltool.basicperson.browser.person.FlourishPersonAddView"
     group_id="teachers"
     permission="schooltool.edit"
     content_template="templates/f_person_form.pt"
     />

  <flourish:page
     name="addStudent.html"
     subtitle="Add new student"
     for="schooltool.person.interfaces.IPersonContainer"
     class="schooltool.basicperson.browser.person.FlourishPersonAddView"
     group_id="students"
     permission="schooltool.edit"
     content_template="templates/f_person_form.pt"
     />

  <flourish:page
     name="addAdministrator.html"
     subtitle="Add new administrator"
     for="schooltool.person.interfaces.IPersonContainer"
     class="schooltool.basicperson.browser.person.FlourishPersonAddView"
     group_id="administrators"
     permission="schooltool.edit"
     content_template="templates/f_person_form.pt"
     />


  <configure package="schooltool.skin.flourish">
    <flourish:viewlet
        name="add.html"
        title="Person"
        class="schooltool.skin.flourish.page.LinkViewlet"
        manager="schooltool.basicperson.browser.person.PersonContainerLinks"
        permission="schooltool.edit"
        />

    <flourish:viewlet
        name="add_person"
        link="add.html"
        title="Add Person"
        view="schooltool.basicperson.browser.person.FlourishBasicPersonContainerView"
        for="schooltool.person.interfaces.IPersonContainer"
        manager="schooltool.skin.flourish.page.IContentActionsManager"
        class="schooltool.skin.flourish.page.LinkViewlet"
        permission="schooltool.edit"
        html_class="create"
        />

    <flourish:viewlet
        name="addTeacher.html"
        title="Teacher"
        class="schooltool.skin.flourish.page.LinkViewlet"
        manager="schooltool.basicperson.browser.person.PersonContainerLinks"
        permission="schooltool.edit"
        />

    <flourish:viewlet
        name="addStudent.html"
        title="Student"
        class="schooltool.skin.flourish.page.LinkViewlet"
        manager="schooltool.basicperson.browser.person.PersonContainerLinks"
        permission="schooltool.edit"
        />

    <flourish:viewlet
        name="addAdministrator.html"
        title="Administrator"
        class="schooltool.skin.flourish.page.LinkViewlet"
        manager="schooltool.basicperson.browser.person.PersonContainerLinks"
        permission="schooltool.edit"
        />

    <flourish:activeViewlet
        factory="schooltool.skin.flourish.page.getViewletViewName"
        manager="schooltool.basicperson.browser.person.PersonContainerLinks"
        />

  </configure>

  <!-- Person index page -->

  <flourish:breadcrumb
      for="schooltool.basicperson.interfaces.IBasicPerson"
      />

  <flourish:page
      name="index.html"
      for="schooltool.basicperson.interfaces.IBasicPerson"
      class="schooltool.basicperson.browser.person.FlourishPersonView"
      permission="schooltool.view"
      />

  <flourish:viewlet
      name="details"
      view=".person.FlourishPersonView"
      permission="schooltool.view"
      manager="schooltool.skin.flourish.page.IPageContentManager"
      class=".person.FlourishPersonInfo"
      />

  <!-- Edit person page -->

  <flourish:page
      name="edit.html"
      for="schooltool.basicperson.interfaces.IBasicPerson"
      class="schooltool.basicperson.browser.person.FlourishPersonEditView"
      content_template="templates/f_person_form.pt"
      permission="schooltool.edit"
      subtitle="Edit"
      />

  <flourish:viewlet
      name="edit_person"
      link="edit.html"
      title="Edit"
      for="schooltool.basicperson.interfaces.IBasicPerson"
      view="schooltool.basicperson.browser.person.FlourishPersonView"
      manager="schooltool.skin.flourish.page.IContentActionsManager"
      class="schooltool.skin.flourish.page.LinkViewlet"
      permission="schooltool.edit"
      html_class="modify"
      />

  <!-- DemographicsFields pages -->

  <zope:adapter
      factory=".demographics.getAddEditViewTitle" />

  <zope:adapter
      factory=".demographics.getLimitKeysLabel" />

  <zope:adapter
      factory=".demographics.getLimitKeysHint" />

  <flourish:breadcrumb
      for="schooltool.basicperson.interfaces.IDemographicsFields"
      title=""
      />

  <flourish:page
     name="index.html"
     for="schooltool.basicperson.interfaces.IDemographicsFields"
     class=".demographics.FlourishDemographicsView"
     content_template="templates/f_demographics_view.pt"
     permission="schooltool.edit"
     title="Demographics and Personal Information"
     />

  <flourish:page
     name="reorder.html"
     for="schooltool.basicperson.interfaces.IDemographicsFields"
     class=".demographics.FlourishReorderDemographicsView"
     content_template="templates/f_demographics_reorder.pt"
     permission="schooltool.edit"
     title="Demographics and Personal Information"
     />

  <flourish:viewlet
      name="demographics_fields"
      before="demographics_actions"
      manager="schooltool.skin.flourish.page.IPageRefineManager"
      view=".demographics.FlourishDemographicsView"
      class=".demographics.FlourishDemographicsFieldsLinks"
      for="schooltool.basicperson.interfaces.IDemographicsFields"
      title="Add"
      permission="schooltool.view"
      />

  <flourish:viewlet
      name="demographics_actions"
      manager="schooltool.skin.flourish.page.IPageRefineManager"
      view=".demographics.FlourishDemographicsView"
      class=".demographics.FlourishDemographicsFieldsActions"
      for="schooltool.basicperson.interfaces.IDemographicsFields"
      title="Actions"
      permission="schooltool.view"
      />

  <configure package="schooltool.skin.flourish">
    <flourish:viewlet
        name="addText.html"
        before="addDate.html"
        title="Text Field"
        class="schooltool.skin.flourish.page.LinkViewlet"
        manager="schooltool.basicperson.browser.demographics.FlourishDemographicsFieldsLinks"
        permission="schooltool.edit"
        />

    <flourish:viewlet
        name="addDescription.html"
        after="addText.html"
        title="Description Field"
        class="schooltool.skin.flourish.page.LinkViewlet"
        manager="schooltool.basicperson.browser.demographics.FlourishDemographicsFieldsLinks"
        permission="schooltool.edit"
        />

    <flourish:viewlet
        name="addDate.html"
        before="addBool.html"
        title="Date Field"
        class="schooltool.skin.flourish.page.LinkViewlet"
        manager="schooltool.basicperson.browser.demographics.FlourishDemographicsFieldsLinks"
        permission="schooltool.edit"
        />

    <flourish:viewlet
        name="addBool.html"
        before="addEnum.html"
        title="Yes/No Field"
        class="schooltool.skin.flourish.page.LinkViewlet"
        manager="schooltool.basicperson.browser.demographics.FlourishDemographicsFieldsLinks"
        permission="schooltool.edit"
        />

    <flourish:viewlet
        name="addEnum.html"
        title="Selection List Field"
        class="schooltool.skin.flourish.page.LinkViewlet"
        manager="schooltool.basicperson.browser.demographics.FlourishDemographicsFieldsLinks"
        permission="schooltool.edit"
        />

    <flourish:viewlet
        name="reorder.html"
        title="Reorder or Delete Fields"
        class="schooltool.skin.flourish.page.LinkViewlet"
        manager="schooltool.basicperson.browser.demographics.FlourishDemographicsFieldsActions"
        permission="schooltool.edit"
        />

    <flourish:page
       name="addText.html"
       for="schooltool.basicperson.interfaces.IDemographicsFields"
       class="schooltool.basicperson.browser.demographics.FlourishTextFieldDescriptionAddView"
       content_template="templates/z3c_form_edit.pt"
       permission="schooltool.edit"
       subtitle="New Text Field"
       />

    <flourish:page
       name="addDescription.html"
       for="schooltool.basicperson.interfaces.IDemographicsFields"
       class="schooltool.basicperson.browser.demographics.FlourishDescriptionFieldDescriptionAddView"
       content_template="templates/z3c_form_edit.pt"
       permission="schooltool.edit"
       subtitle="New Description Field"
       />

    <flourish:page
       name="addDate.html"
       for="schooltool.basicperson.interfaces.IDemographicsFields"
       class="schooltool.basicperson.browser.demographics.FlourishDateFieldDescriptionAddView"
       content_template="templates/z3c_form_edit.pt"
       permission="schooltool.edit"
       subtitle="New Date Field"
       />

    <flourish:page
       name="addBool.html"
       for="schooltool.basicperson.interfaces.IDemographicsFields"
       class="schooltool.basicperson.browser.demographics.FlourishBoolFieldDescriptionAddView"
       content_template="templates/z3c_form_edit.pt"
       permission="schooltool.edit"
       subtitle="New Yes/No Field"
       />

    <flourish:page
       name="addEnum.html"
       for="schooltool.basicperson.interfaces.IDemographicsFields"
       class="schooltool.basicperson.browser.demographics.FlourishEnumFieldDescriptionAddView"
       content_template="templates/z3c_form_edit.pt"
       permission="schooltool.edit"
       subtitle="New Selection List Field"
       />

    <flourish:breadcrumb
        for="schooltool.basicperson.interfaces.IDemographicsFields"
        view="schooltool.basicperson.browser.demographics.FlourishFieldDescriptionEditView"
        title="Demographics"
        />

    <flourish:breadcrumb
        for="schooltool.basicperson.interfaces.IFieldDescription"
        view="schooltool.basicperson.browser.demographics.FlourishFieldDescriptionEditView"
        title=""
        />

    <flourish:breadcrumb
        for="schooltool.basicperson.interfaces.IDemographicsFields"
        view="schooltool.basicperson.browser.demographics.FlourishFieldDescriptionAddView"
        title="Demographics"
        />

    <flourish:page
       name="edit.html"
       for="schooltool.basicperson.demographics.TextFieldDescription"
       class="schooltool.basicperson.browser.demographics.FlourishFieldDescriptionEditView"
       content_template="templates/z3c_form_edit.pt"
       permission="schooltool.edit"
       />

    <flourish:page
       name="edit.html"
       for="schooltool.basicperson.demographics.DescriptionFieldDescription"
       class="schooltool.basicperson.browser.demographics.FlourishFieldDescriptionEditView"
       content_template="templates/z3c_form_edit.pt"
       permission="schooltool.edit"
       />

    <flourish:page
       name="edit.html"
       for="schooltool.basicperson.demographics.DateFieldDescription"
       class="schooltool.basicperson.browser.demographics.FlourishFieldDescriptionEditView"
       content_template="templates/z3c_form_edit.pt"
       permission="schooltool.edit"
       />

    <flourish:page
       name="edit.html"
       for="schooltool.basicperson.demographics.BoolFieldDescription"
       class="schooltool.basicperson.browser.demographics.FlourishFieldDescriptionEditView"
       content_template="templates/z3c_form_edit.pt"
       permission="schooltool.edit"
       />

    <flourish:page
       name="edit.html"
       for="schooltool.basicperson.demographics.EnumFieldDescription"
       class="schooltool.basicperson.browser.demographics.FlourishEnumFieldDescriptionEditView"
       content_template="templates/z3c_form_edit.pt"
       permission="schooltool.edit"
       />

    <flourish:page
       name="index.html"
       for="schooltool.basicperson.demographics.TextFieldDescription"
       class="schooltool.basicperson.browser.demographics.FlourishTextFieldDescriptionView"
       content_template="templates/z3c_form_display.pt"
       permission="schooltool.view"
       title="View"
       />

    <flourish:page
       name="index.html"
       for="schooltool.basicperson.demographics.DescriptionFieldDescription"
       class="schooltool.basicperson.browser.demographics.FlourishDescriptionFieldDescriptionView"
       content_template="templates/z3c_form_display.pt"
       permission="schooltool.view"
       title="View"
       />

    <flourish:page
       name="index.html"
       for="schooltool.basicperson.demographics.DateFieldDescription"
       class="schooltool.basicperson.browser.demographics.FlourishDateFieldDescriptionView"
       content_template="templates/z3c_form_display.pt"
       permission="schooltool.view"
       title="View"
       />

    <flourish:page
       name="index.html"
       for="schooltool.basicperson.demographics.BoolFieldDescription"
       class="schooltool.basicperson.browser.demographics.FlourishBoolFieldDescriptionView"
       content_template="templates/z3c_form_display.pt"
       permission="schooltool.view"
       title="View"
       />

    <flourish:page
       name="index.html"
       for="schooltool.basicperson.demographics.EnumFieldDescription"
       class="schooltool.basicperson.browser.demographics.FlourishEnumFieldDescriptionView"
       content_template="templates/z3c_form_display.pt"
       permission="schooltool.view"
       title="View"
       />
  </configure>

  <!-- Viewlet Mangers -->

  <flourish:viewletManager
      name="schooltool.person.FlourishInfo"
      for="schooltool.basicperson.interfaces.IBasicPerson"
      view="schooltool.basicperson.browser.person.FlourishPersonInfo"
      provides="schooltool.basicperson.browser.person.IFlourishPersonInfoManager"
      class="schooltool.basicperson.browser.person.FlourishPersonInfoManager"
      permission="zope.Public"
      />

  <!-- viewlets -->

  <flourish:viewlet
      name="advisory"
      after="contacts-accordion"
      for="schooltool.basicperson.interfaces.IBasicPerson"
      manager="schooltool.basicperson.browser.person.IFlourishPersonInfoManager"
      class="schooltool.basicperson.browser.person.FlourishAdvisoryViewlet"
      render="template"
      permission="schooltool.view"
      />
  <flourish:viewlet
      name="general"
      before="contacts-accordion"
      for="schooltool.basicperson.interfaces.IBasicPerson"
      manager="schooltool.basicperson.browser.person.IFlourishPersonInfoManager"
      class="schooltool.basicperson.browser.person.FlourishGeneralViewlet"
      render="template"
      permission="schooltool.view"
      />

  <!-- Other -->

  <flourish:content
      class="schooltool.basicperson.browser.person.PersonTitle"
      for="schooltool.basicperson.interfaces.IBasicPerson"
      permission="schooltool.view"
      name="title" />

  <zope:adapter
      for="schooltool.person.interfaces.IPersonContainer
           schooltool.skin.flourish.IFlourishLayer"
      factory=".person.BasicPersonTableFormatter" />

  <!-- Reports -->

  <report:reportLink
       name="person_export_xml"
       for="schooltool.person.interfaces.IPerson"
       permission="schooltool.edit"
       group="Student"
       description="Contains an XML representation of the person."
       title="Export as XML"
       file_type="xml"
       link="request_person_export_xml.html"
       />

  <flourish:page
      name="person_export.xml"
      for="schooltool.person.interfaces.IPerson"
      class=".xml.FlourishPersonXMLExportView"
      permission="schooltool.edit"
      />

  <flourish:page
      name="request_person_export_xml.html"
      for="schooltool.person.interfaces.IPerson"
      class=".person.FlourishRequestPersonXMLExportView"
      permission="schooltool.edit"
      />

  <flourish:page
      name="advisors.html"
      for="schooltool.basicperson.interfaces.IBasicPerson"
      class=".person.FlourishPersonAdvisorView"
      permission="schooltool.edit"
      subtitle="Advisors"
      />

  <flourish:page
      name="advisees.html"
      for="schooltool.basicperson.interfaces.IBasicPerson"
      class=".person.FlourishPersonAdviseeView"
      permission="schooltool.edit"
      subtitle="Advisees"
      />

  <flourish:viewlet
      name="manage-people-overview"
      view="schooltool.app.browser.app.ManageSchool"
      permission="schooltool.edit"
      manager="schooltool.skin.flourish.page.IPageContentManager"
      class=".person.FlourishManagePeopleOverview"
      />

  <!-- Import -->

  <flourish:viewlet
      after="person_container"
      name="person-import-links"
      for="schooltool.person.interfaces.IPersonContainer"
      manager="schooltool.skin.flourish.page.IPageRefineManager"
      class="schooltool.basicperson.browser.person.PersonImportLinks"
      view=".person.FlourishBasicPersonContainerView"
      title="Import"
      permission="schooltool.edit"
      />

  <flourish:viewlet
      name="csvimport.html"
      title="Import CSV"
      manager="schooltool.basicperson.browser.person.PersonImportLinks"
      class="schooltool.skin.flourish.page.LinkViewlet"
      permission="schooltool.edit"
      />

  <flourish:page
     name="csvimport.html"
     subtitle="Import"
     for="schooltool.person.interfaces.IPersonContainer"
     class=".csvimport.FlourishBasicPersonCSVImportView"
     permission="schooltool.edit"
     />

  <flourish:content
      name="import-description"
      view=".csvimport.FlourishBasicPersonCSVImportView"
      template="templates/f_csvimport_description.pt"
      permission="zope.Public"
      />

  <flourish:viewletFactory
      name="home"
      manager="schooltool.skin.flourish.page.IHeaderNavigationManager"
      for="*"
      factory="schooltool.basicperson.browser.person.getUserViewlet"
      />

  <flourish:viewlet
      name="home"
      before="*"
      for="schooltool.basicperson.interfaces.IBasicPerson"
      manager="schooltool.skin.flourish.page.IHeaderNavigationManager"
      class="schooltool.skin.flourish.page.LinkViewlet"
      title="Home"
      link="index.html"
      permission="schooltool.view"
      />

  <flourish:activeViewlet
      factory=".person.getPersonActiveViewlet"
      manager="schooltool.skin.flourish.page.IHeaderNavigationManager"
      for="schooltool.basicperson.interfaces.IBasicPerson"
      />

  <zope:adapter factory=".person.PasswordValidator" />

</configure>
