<configure
    xmlns="http://namespaces.zope.org/zope"
    xmlns:browser="http://namespaces.zope.org/browser"
    >

  <include package="collective.workspace" />
  <include
      package="ploneintranet.layout"
      file="permissions.zcml"
      />
  <include package=".mails" />
  <include package=".tiles" />
  <include file="cart.zcml" />

  <browser:page
      name="pas-graph"
      for="ploneintranet.workspace.interfaces.IBaseWorkspaceFolder"
      class=".pas_graph.WorkspaceGraphView"
      permission="zope2.View"
      />

  <browser:page
      name="pas-graph"
      for="Products.PluggableAuthService.plugins.DynamicGroupsPlugin.IDynamicGroupsPlugin"
      class=".pas_graph.DynamicGroupsGraphView"
      permission="zope2.View"
      />

  <!-- redirect is active in both Quaive and Barceloneta -->
  <browser:page
      name="workspaces.html"
      for="plone.app.layout.navigation.interfaces.INavigationRoot"
      class=".workspacecontainer.WorkspacesOnNavigationRoot"
      template="templates/workspaces.pt"
      permission="ploneintranet.viewsite"
      layer="..interfaces.IPloneintranetWorkspaceLayer"
      />

  <!-- the regular Quaive variant -->
  <browser:page
      name="workspaces.html"
      for="ploneintranet.workspace.workspacecontainer.IWorkspaceContainer"
      class=".workspacecontainer.Workspaces"
      template="templates/workspaces.pt"
      permission="ploneintranet.viewsite"
      layer="..interfaces.IThemedWorkspaceLayer"
      />

  <!-- warning in Barceloneta -->
  <browser:page
      name="workspaces.html"
      for="ploneintranet.workspace.workspacecontainer.IWorkspaceContainer"
      class="ploneintranet.layout.browser.barceloneta.BarcelonetaWarning"
      permission="ploneintranet.viewsite"
      layer="..interfaces.IPloneintranetWorkspaceLayer"
      />

  <browser:page
      name="add_workspace"
      for="ploneintranet.workspace.workspacecontainer.IWorkspaceContainer"
      class=".add_workspace.AddWorkspace"
      template="templates/add_workspace.pt"
      permission="cmf.AddPortalContent"
      layer="..interfaces.IThemedWorkspaceLayer"
      />

  <browser:page
      name="copy_to_templates"
      for="ploneintranet.workspace.interfaces.IBaseWorkspaceFolder"
      class=".copy_to_templates.CopyToTemplates"
      permission="cmf.ManagePortal"
      layer="..interfaces.IThemedWorkspaceLayer"
      />

  <!-- this is public to allow interested users to request workspace access -->
  <browser:page
      name="panel-request-access"
      for="ploneintranet.workspace.workspacefolder.IWorkspaceFolder"
      class=".request_access.RequestAccessPanel"
      template="templates/panel-request-access.pt"
      permission="zope.Public"
      layer="ploneintranet.layout.interfaces.INoBarcelonetaLayer"
      />

  <!-- those are helper public view, they will not render anything through the web -->
  <browser:page
      name="request-access-receipt-email"
      for="ploneintranet.workspace.workspacefolder.IWorkspaceFolder"
      class=".request_access.RequestAccessReceiptEmail"
      template="templates/request-access-receipt-email.pt"
      permission="zope.Public"
      layer="ploneintranet.layout.interfaces.INoBarcelonetaLayer"
      />

  <browser:page
      name="request-access-request-email"
      for="ploneintranet.workspace.workspacefolder.IWorkspaceFolder"
      class=".request_access.RequestAccessRequestEmail"
      template="templates/request-access-request-email.pt"
      permission="zope.Public"
      layer="ploneintranet.layout.interfaces.INoBarcelonetaLayer"
      />

  <browser:page
      name="request-access-approval-email"
      for="ploneintranet.workspace.workspacefolder.IWorkspaceFolder"
      class=".request_access.RequestAccessApprovalEmail"
      template="templates/request-access-approval-email.pt"
      permission="zope.Public"
      layer="ploneintranet.layout.interfaces.INoBarcelonetaLayer"
      />

  <browser:page
      name="request-access-denial-email"
      for="ploneintranet.workspace.workspacefolder.IWorkspaceFolder"
      class=".request_access.RequestAccessDenialEmail"
      template="templates/request-access-denial-email.pt"
      permission="zope.Public"
      layer="ploneintranet.layout.interfaces.INoBarcelonetaLayer"
      />

  <!-- this one overrides the one below in default Quaive rendering -->
  <browser:page
      name="view"
      for="ploneintranet.workspace.workspacefolder.IWorkspaceFolder"
      class=".workspace.WorkspaceView"
      template="templates/workspace.pt"
      permission="zope2.AccessContentsInformation"
      layer="..interfaces.IThemedWorkspaceLayer"
      />

  <!-- this one shadows the one above, only in barceloneta -->
  <browser:page
      name="view"
      for="ploneintranet.workspace.workspacefolder.IWorkspaceFolder"
      class=".workspace.WorkspaceView"
      template="templates/workspace-barceloneta.pt"
      permission="zope2.AccessContentsInformation"
      layer="..interfaces.IPloneintranetWorkspaceLayer"
      />

  <browser:page
      name="view"
      for="ploneintranet.workspace.superspace.ISuperspaceFolder"
      class=".workspace.SuperspaceView"
      template="templates/superspace.pt"
      permission="zope2.AccessContentsInformation"
      layer="..interfaces.IThemedWorkspaceLayer"
      />

  <browser:page
      name="workspace-leader"
      for="ploneintranet.workspace.workspacefolder.IWorkspaceFolder"
      class=".workspace.WorkspaceView"
      template="templates/workspace-leader.pt"
      permission="zope2.View"
      layer="ploneintranet.layout.interfaces.INoBarcelonetaLayer"
      />

  <browser:page
      name="panel-request-access-manage"
      for="ploneintranet.workspace.workspacefolder.IWorkspaceFolder"
      class=".request_access.RequestAccessManage"
      template="templates/panel-request-access-manage.pt"
      permission="ploneintranet.workspace.ManageWorkspace"
      layer="ploneintranet.layout.interfaces.INoBarcelonetaLayer"
      />

  <browser:page
      name="members.json"
      for="ploneintranet.workspace.workspacefolder.IWorkspaceFolder"
      class=".workspace.WorkspaceMembersJSONView"
      permission="zope2.View"
      layer="..interfaces.IThemedWorkspaceLayer"
      />

  <browser:page
      name="content_macros"
      for="*"
      template="templates/content_macros.pt"
      permission="zope2.View"
      layer="..interfaces.IThemedWorkspaceLayer"
      />

  <browser:page
      name="workspace-calendar"
      for="*"
      class=".workspace.WorkspaceCalendarView"
      template="templates/workspace-calendar.pt"
      permission="zope2.View"
      layer="..interfaces.IThemedWorkspaceLayer"
      />

  <browser:page
      name="workspace-video-conference"
      for="ploneintranet.workspace.workspacefolder.IWorkspaceFolder"
      class=".workspace.WorkspaceVideoConferenceView"
      template="templates/workspace-video-conference.pt"
      permission="zope2.View"
      layer="..interfaces.IThemedWorkspaceLayer"
      />

  <browser:page
      name="invite"
      for="ploneintranet.workspace.workspacefolder.IWorkspaceFolder"
      class=".forms.InviteForm"
      permission="cmf.ModifyPortalContent"
      layer="..interfaces.IThemedWorkspaceLayer"
      />

  <browser:page
      name="sharing"
      for="ploneintranet.workspace.workspacefolder.IWorkspaceFolder"
      class=".views.SharingView"
      permission="ploneintranet.workspace.ManageWorkspace"
      layer="..interfaces.IThemedWorkspaceLayer"
      />

  <browser:page
      name="updateSharingInfo"
      for="ploneintranet.workspace.workspacefolder.IWorkspaceFolder"
      class=".views.SharingView"
      attribute="updateSharingInfo"
      permission="ploneintranet.workspace.ManageWorkspace"
      layer="..interfaces.IThemedWorkspaceLayer"
      />

  <browser:page
      name="add_content"
      for="Products.CMFCore.interfaces.IFolderish"
      class=".add_content.AddContent"
      template="templates/add_content.pt"
      permission="cmf.AddPortalContent"
      layer="..interfaces.IThemedWorkspaceLayer"
      />

  <browser:page
      name="add_folder"
      for="Products.CMFCore.interfaces.IFolderish"
      class=".add_content.AddFolder"
      template="templates/add_folder.pt"
      permission="cmf.AddPortalContent"
      layer="..interfaces.IThemedWorkspaceLayer"
      />

  <browser:page
      name="add_link"
      for="Products.CMFCore.interfaces.IFolderish"
      class=".add_content.AddLink"
      permission="cmf.AddPortalContent"
      layer="..interfaces.IThemedWorkspaceLayer"
      />

  <browser:page
      name="edit_folder"
      for="Products.CMFCore.interfaces.IFolderish"
      class=".edit_content.EditFolder"
      template="templates/edit_folder.pt"
      permission="cmf.ModifyPortalContent"
      layer="..interfaces.IThemedWorkspaceLayer"
      />

  <!-- BBB this has to go -->
  <browser:page
      name="view"
      for="ploneintranet.workspace.case.ICase"
      class=".case.CaseView"
      template="templates/workspace.pt"
      permission="zope2.View"
      />

  <browser:page
      name="workspace-timeline"
      for="ploneintranet.workspace.case.ICase"
      class=".case.CaseView"
      template="templates/case_timeline.pt"
      permission="zope2.View"
      />

  <browser:page
      name="freeze-view"
      for="ploneintranet.workspace.workspacefolder.IWorkspaceFolder"
      class=".case.FreezeView"
      permission="zope2.View"
      />

  <browser:page
      name="unfreeze-view"
      for="ploneintranet.workspace.workspacefolder.IWorkspaceFolder"
      class=".case.UnfreezeView"
      permission="zope2.View"
      />

  <browser:page
      name="case-manager"
      for="ploneintranet.layout.app.IApp"
      class=".case_manager.CaseManagerView"
      template="templates/case_manager.pt"
      permission="zope2.View"
      />

  <browser:page
      name="add_event"
      for="Products.CMFCore.interfaces.IFolderish"
      class=".add_content.AddEvent"
      permission="cmf.AddPortalContent"
      layer="..interfaces.IThemedWorkspaceLayer"
      />

  <browser:page
      name="panel-rename"
      for="*"
      class=".edit_content.PanelRename"
      template="templates/panel-rename.pt"
      permission="cmf.ModifyPortalContent"
      layer="..interfaces.IThemedWorkspaceLayer"
      />

  <!-- Also used in read-only mode for central calendars,
       therefore registered with zope2.View -->
  <browser:page
      name="panel-edit-event"
      for="plone.event.interfaces.IEvent"
      class=".add_content.EditEvent"
      permission="zope2.View"
      layer="..interfaces.IThemedWorkspaceLayer"
      />

  <browser:page
      name="panel-edit-calendar"
      for="ploneintranet.calendar.content.ICentralCalendar"
      class=".add_content.EditCalendar"
      permission="cmf.ModifyPortalContent"
      layer="..interfaces.IThemedWorkspaceLayer"
      />

  <!-- add events called on the calendar app -->
  <browser:page
      name="add_event"
      for="ploneintranet.layout.app.IApp"
      class=".add_content.AddEvent"
      permission="zope2.View"
      layer="..interfaces.IThemedWorkspaceLayer"
      />

  <browser:page
      name="add_calendar"
      for="ploneintranet.layout.app.IApp"
      class=".add_content.AddEvent"
      permission="zope2.View"
      layer="..interfaces.IThemedWorkspaceLayer"
      />


  <browser:page
      name="email_invitees"
      for="plone.event.interfaces.IEvent"
      class=".event.EmailInvitees"
      permission="zope2.View"
      layer="..interfaces.IThemedWorkspaceLayer"
      />

  <browser:page
      name="promo"
      for="plone.event.interfaces.IEvent"
      class=".event.PromoView"
      template="templates/event_promo.pt"
      permission="zope2.View"
      layer="ploneintranet.layout.interfaces.INoBarcelonetaLayer"
      />

  <browser:page
      name="promo-voting-bar"
      for="plone.event.interfaces.IEvent"
      class=".event.PromoView"
      template="templates/event_promo_voting_bar.pt"
      permission="zope2.View"
      layer="ploneintranet.layout.interfaces.INoBarcelonetaLayer"
      />

  <browser:page
      name="rsvp.csv"
      for="plone.event.interfaces.IEvent"
      class=".event.PromoRSVPCSV"
      permission="cmf.ModifyPortalContent"
      />

  <browser:viewlet
      name="ploneintranet.workspace.sharinginfo"
      for="ploneintranet.workspace.workspacefolder.IWorkspaceFolder"
      manager="plone.app.layout.viewlets.interfaces.IAboveContentBody"
      class=".viewlets.SharingViewlet"
      template="templates/sharingviewlet.pt"
      permission="ploneintranet.workspace.ManageWorkspace"
      layer="..interfaces.IThemedWorkspaceLayer"
      />

  <browser:page
      name="joinme"
      for="ploneintranet.workspace.workspacefolder.IWorkspaceFolder"
      class=".views.JoinView"
      permission="zope2.AccessContentsInformation"
      layer="..interfaces.IThemedWorkspaceLayer"
      />

  <browser:viewlet
      name="ploneintranet.workspace.join"
      view="plone.app.layout.globals.interfaces.IViewView"
      manager="plone.app.layout.viewlets.interfaces.IAboveContentTitle"
      class=".viewlets.JoinViewlet"
      template="templates/joinviewlet.pt"
      permission="zope2.AccessContentsInformation"
      layer="..interfaces.IThemedWorkspaceLayer"
      />

  <browser:page
      name="workspaceFileUpload"
      for="Products.CMFCore.interfaces._content.IFolderish"
      class=".views.FileUploadView"
      permission="cmf.AddPortalContent"
      layer="..interfaces.IThemedWorkspaceLayer"
      />

  <!-- The permissions for viewing the panels used for editing the members
         roster are deliberately relaxed in these View definitions.
         Reason: in a team managed WS, any team member may add users/groups.
         For the case of removing users or changing role assignments, we want to
         be able to give feedback about missing permissions to the user (in case
         they somehow manage to trigger this functionality which the UI hides
         from them).
         The actual permission handling is done in the View code -->
  <browser:page
      name="panel-add-user"
      for="ploneintranet.workspace.workspacefolder.IWorkspaceFolder"
      class=".roster.WorkspaceMemberPicker"
      template="templates/panel-add-user.pt"
      permission="collective.workspace.ViewRoster"
      layer="..interfaces.IThemedWorkspaceLayer"
      />

  <browser:page
      name="panel-add-group"
      for="ploneintranet.workspace.workspacefolder.IWorkspaceFolder"
      class=".roster.WorkspaceMemberPicker"
      template="templates/panel-add-group.pt"
      permission="collective.workspace.ViewRoster"
      layer="..interfaces.IThemedWorkspaceLayer"
      />

  <browser:page
      name="panel-remove-user"
      for="ploneintranet.workspace.workspacefolder.IWorkspaceFolder"
      class=".roster.WorkspaceMemberPicker"
      template="templates/panel-remove-user.pt"
      permission="collective.workspace.ViewRoster"
      layer="..interfaces.IThemedWorkspaceLayer"
      />

  <browser:page
      name="panel-change-role"
      for="ploneintranet.workspace.workspacefolder.IWorkspaceFolder"
      class=".roster.WorkspaceChangeRole"
      template="templates/panel-change-role.pt"
      permission="collective.workspace.ViewRoster"
      layer="..interfaces.IThemedWorkspaceLayer"
      />

  <browser:page
      name="panel-member-role-actions"
      for="ploneintranet.workspace.workspacefolder.IWorkspaceFolder"
      class=".roster.WorkspaceChangeRole"
      template="templates/panel-member-role-actions.pt"
      permission="collective.workspace.ViewRoster"
      layer="..interfaces.IThemedWorkspaceLayer"
      />

  <browser:page
      name="panel-related-workspaces"
      for="ploneintranet.workspace.workspacefolder.IWorkspaceFolder"
      class=".workspace.BaseWorkspaceView"
      template="templates/panel-related-workspaces.pt"
      permission="ploneintranet.workspace.ManageWorkspace"
      layer="..interfaces.IThemedWorkspaceLayer"
      />

  <browser:page
      name="panel-reorder-tags"
      for="ploneintranet.workspace.workspacefolder.IWorkspaceFolder"
      class=".workspace.ReorderTags"
      template="templates/panel-reorder-tags.pt"
      permission="ploneintranet.workspace.ManageWorkspace"
      layer="..interfaces.IThemedWorkspaceLayer"
      />


  <browser:page
      name="workspace-hotspot-targets"
      for="ploneintranet.workspace.workspacefolder.IWorkspaceFolder"
      class=".workspace.WorkspaceHotspotTargets"
      permission="ploneintranet.workspace.ManageWorkspace"
      layer="..interfaces.IThemedWorkspaceLayer"
      />

  <browser:page
      name="panel-set-hotspots"
      for="ploneintranet.workspace.workspacefolder.IWorkspaceFolder"
      class=".workspace.SetHotspots"
      template="templates/panel-set-hotspots.pt"
      permission="ploneintranet.workspace.ManageWorkspace"
      layer="..interfaces.IThemedWorkspaceLayer"
      />

  <browser:page
      name="confirmation-remove-special-role"
      for="ploneintranet.workspace.workspacefolder.IWorkspaceFolder"
      class=".roster.WorkspaceChangeRole"
      template="templates/confirmation-remove-special-role.pt"
      permission="collective.workspace.ManageRoster"
      layer="..interfaces.IThemedWorkspaceLayer"
      />

  <browser:page
      name="panel-unfreeze-case"
      for="ploneintranet.workspace.workspacefolder.IWorkspaceFolder"
      template="templates/panel-unfreeze-case.pt"
      permission="ploneintranet.workspace.ManageWorkspace"
      layer="..interfaces.IThemedWorkspaceLayer"
      />

  <browser:page
      name="allusers.json"
      for="*"
      class=".workspace.AllUsersJSONView"
      permission="zope2.View"
      />

  <browser:page
      name="allgroups.json"
      for="ploneintranet.workspace.workspacefolder.IWorkspaceFolder"
      class=".workspace.AllGroupsJSONView"
      permission="collective.workspace.ViewRoster"
      />

  <browser:page
      name="allgroups.json"
      for="plone.app.layout.navigation.interfaces.INavigationRoot"
      class=".workspace.AllGroupsGlobalJSONView"
      permission="zope2.View"
      />

  <browser:page
      name="allusers-and-groups.json"
      for="plone.app.layout.navigation.interfaces.INavigationRoot"
      class=".workspace.AllUsersAndGroupsJSONView"
      permission="zope2.View"
      />

  <browser:page
      name="workspaces.json"
      for="*"
      class=".workspace.WorkspacesJSONView"
      permission="zope2.View"
      layer="..interfaces.IThemedWorkspaceLayer"
      />

  <browser:page
      name="workspaces-related.json"
      for="*"
      class=".workspace.RelatedWorkspacesJSONView"
      permission="zope2.View"
      layer="..interfaces.IThemedWorkspaceLayer"
      />

  <browser:page
      name="case_workflow_guard"
      for="ploneintranet.workspace.case.ICase"
      class=".case.CaseWorkflowGuardView"
      permission="zope2.View"
      layer="..interfaces.IThemedWorkspaceLayer"
      />

  <browser:page
      name="pi_modification_mail_notification"
      for="*"
      class=".mail_notification.MailNotificationView"
      template="templates/pi_modification_mail_notification.pt"
      permission="zope2.View"
      layer="..interfaces.IWorkspaceAppContentLayer"
      />

  <browser:page
      name="context-menu"
      for="*"
      class="ploneintranet.workspace.basecontent.baseviews.ContentView"
      template="templates/context-menu.pt"
      permission="zope2.View"
      layer="..interfaces.IWorkspaceAppContentLayer"
      />

  <browser:page
      name="share-panel"
      for="*"
      class="ploneintranet.workspace.basecontent.baseviews.ContentView"
      template="templates/share-panel.pt"
      permission="zope2.View"
      layer="..interfaces.IWorkspaceAppContentLayer"
      />

  <browser:page
      name="archive"
      for="*"
      class=".archive.ArchiveView"
      template="templates/archive.pt"
      permission="zope2.View"
      layer="..interfaces.IWorkspaceAppContentLayer"
      />

  <browser:page
      name="unarchive"
      for="*"
      class=".archive.UnarchiveView"
      template="templates/archive.pt"
      permission="zope2.View"
      layer="..interfaces.IWorkspaceAppContentLayer"
      />

  <browser:page
      name="archive-link-iconified"
      for="*"
      class=".archive.ArchiveLinkIconified"
      template="templates/archive_link.pt"
      permission="zope2.View"
      layer="..interfaces.IWorkspaceAppContentLayer"
      />

  <!-- Render the workflow history as a view -->
  <browser:page
      name="contenthistory"
      for="*"
      class=".views.ContentHistoryView"
      template="templates/content_history.pt"
      permission="zope2.View"
      layer="..interfaces.IWorkspaceAppContentLayer"
      />

  <browser:view
      name="download_file_version"
      for="*"
      class=".download_file_version.DownloadFileVersion"
      permission="zope2.View"
      layer="..interfaces.IWorkspaceAppContentLayer"
      />

  <!-- Trash related views -->
  <browser:page
      name="untrash"
      for="ploneintranet.workspace.interfaces.ITrashed"
      class=".trash_view.UntrashView"
      permission="zope2.DeleteObjects"
      layer="ploneintranet.workspace.interfaces.IWorkspaceAppContentLayer"
      />

  <browser:page
      name="empty-trash"
      for="ploneintranet.workspace.workspacefolder.IWorkspaceFolder"
      class=".trash_view.EmptyTrashPanel"
      template="templates/empty-trash.pt"
      permission="ploneintranet.workspace.ManageWorkspace"
      layer="ploneintranet.workspace.interfaces.IWorkspaceAppContentLayer"
      />

  <browser:page
      name="delete_confirmation"
      for="ploneintranet.workspace.superspace.ISuperspaceFolder"
      class=".delete_confirmation.SuperspaceDeleteConfirmationForm"
      permission="zope2.DeleteObjects"
      layer="ploneintranet.workspace.interfaces.IWorkspaceAppContentLayer"
      />

  <browser:page
      name="delete_confirmation"
      for="ploneintranet.workspace.interfaces.ITrashable"
      class=".delete_confirmation.TrashConfirmationForm"
      permission="zope2.DeleteObjects"
      layer="ploneintranet.workspace.interfaces.IWorkspaceAppContentLayer"
      />

  <browser:page
      name="delete_confirmation"
      for="ploneintranet.workspace.interfaces.ITrashed"
      class="ploneintranet.layout.browser.actions.PIDeleteConfirmationForm"
      permission="zope2.DeleteObjects"
      layer="ploneintranet.workspace.interfaces.IWorkspaceAppContentLayer"
      />

  <browser:page
      name="teammembership-purge-owner"
      for="collective.workspace.membership.ITeamMembership"
      class=".teammembership.View"
      permission="zope2.View"
      />

  <browser:page
      name="workspace-membership-report.xls"
      for="Products.CMFPlone.interfaces.IPloneSiteRoot"
      class=".workspace_membership_report.WorkspaceMembershipReport"
      permission="cmf.ModifyPortalContent"
      />

  <configure package="ploneintranet.microblog.browser">
    <browser:page
        name="panel-users"
        for="ploneintranet.workspace.interfaces.IWorkspaceFolder"
        class="ploneintranet.workspace.browser.panel_users.WorkspaceUsers"
        template="templates/panel_users.pt"
        permission="ploneintranet.microblog.AddStatusUpdate"
        layer="ploneintranet.workspace.interfaces.IThemedWorkspaceLayer"
        />
  </configure>

  <browser:page
      name="empty-video-field"
      for="Products.CMFPlone.interfaces.IPloneSiteRoot"
      template="templates/empty-video-field.pt"
      permission="zope2.View"
      />


</configure>
