<?xml version="1.0" encoding="utf-8"?>
<dc-workflow xmlns:i18n="http://xml.zope.org/namespaces/i18n"
             description="Workflow for content contained within a workspace."
             initial_state="draft"
             manager_bypass="False"
             state_variable="review_state"
             title="Ploneintranet Workspace Content Workflow"
             workflow_id="ploneintranet_workflow"
             i18n:attributes="title; description"
             i18n:domain="ploneintranet"
>

  <permission>Access contents information</permission>
  <permission>Delete objects</permission>
  <permission>List folder contents</permission>
  <permission>Modify portal content</permission>
  <permission>View</permission>

  <state state_id="draft"
         title="Draft"
         i18n:attributes="title"
  >
    <description i18n:translate="">Only visible to me.</description>
    <exit-transition transition_id="submit" />
    <exit-transition transition_id="publish" />
    <permission-map acquired="False"
                    name="Access contents information"
    >
      <permission-role>Manager</permission-role>
      <permission-role>Owner</permission-role>
      <permission-role>Site Administrator</permission-role>
      <permission-role>TeamManager</permission-role>
      <permission-role>Reader</permission-role>
    </permission-map>
    <permission-map acquired="False"
                    name="List folder contents"
    >
      <permission-role>Manager</permission-role>
      <permission-role>Owner</permission-role>
      <permission-role>Site Administrator</permission-role>
      <permission-role>TeamManager</permission-role>
      <permission-role>Editor</permission-role>
    </permission-map>
    <permission-map acquired="False"
                    name="Modify portal content"
    >
      <permission-role>Manager</permission-role>
      <permission-role>Site Administrator</permission-role>
      <permission-role>Owner</permission-role>
      <permission-role>TeamManager</permission-role>
      <permission-role>Editor</permission-role>
    </permission-map>
    <permission-map acquired="False"
                    name="Delete objects"
    >
      <permission-role>Editor</permission-role>
      <permission-role>Manager</permission-role>
      <permission-role>Owner</permission-role>
      <permission-role>Site Administrator</permission-role>
      <permission-role>TeamManager</permission-role>
    </permission-map>
    <permission-map acquired="False"
                    name="View"
    >
      <permission-role>Manager</permission-role>
      <permission-role>Owner</permission-role>
      <permission-role>Site Administrator</permission-role>
      <permission-role>TeamManager</permission-role>
      <permission-role>Reader</permission-role>
    </permission-map>
  </state>

  <state state_id="pending"
         title="Pending"
         i18n:attributes="title"
  >
    <description i18n:translate="">Visible to reviewers.</description>
    <exit-transition transition_id="publish" />
    <exit-transition transition_id="send_back" />
    <exit-transition transition_id="retract" />
    <permission-map acquired="False"
                    name="Access contents information"
    >
      <permission-role>Manager</permission-role>
      <permission-role>Owner</permission-role>
      <permission-role>Site Administrator</permission-role>
      <permission-role>TeamManager</permission-role>
      <permission-role>Reviewer</permission-role>
    </permission-map>
    <permission-map acquired="False"
                    name="List folder contents"
    >
      <permission-role>Manager</permission-role>
      <permission-role>Owner</permission-role>
      <permission-role>Site Administrator</permission-role>
      <permission-role>TeamManager</permission-role>
      <permission-role>Reviewer</permission-role>
    </permission-map>
    <permission-map acquired="False"
                    name="Modify portal content"
    >
      <permission-role>Manager</permission-role>
      <permission-role>Site Administrator</permission-role>
      <permission-role>TeamManager</permission-role>
      <permission-role>Editor</permission-role>
    </permission-map>
    <permission-map acquired="False"
                    name="Delete objects"
    >
      <permission-role>Manager</permission-role>
      <!-- NOT owner! -->
      <permission-role>Site Administrator</permission-role>
      <permission-role>TeamManager</permission-role>
    </permission-map>
    <permission-map acquired="False"
                    name="View"
    >
      <permission-role>Manager</permission-role>
      <permission-role>Owner</permission-role>
      <permission-role>Site Administrator</permission-role>
      <permission-role>TeamManager</permission-role>
      <permission-role>Reviewer</permission-role>
    </permission-map>
  </state>

  <state state_id="published"
         title="Published"
         i18n:attributes="title"
  >
    <description i18n:translate="">Shared with my team.</description>
    <!-- keep permission settings in sync with published state
    of event_workflow -->
    <exit-transition transition_id="retract" />
    <permission-map acquired="False"
                    name="Access contents information"
    >
      <permission-role>Manager</permission-role>
      <permission-role>Owner</permission-role>
      <permission-role>Site Administrator</permission-role>
      <permission-role>TeamManager</permission-role>
      <permission-role>TeamMember</permission-role>
      <permission-role>Reader</permission-role>
      <permission-role>Guest</permission-role>
    </permission-map>
    <permission-map acquired="False"
                    name="List folder contents"
    >
      <permission-role>Manager</permission-role>
      <permission-role>Owner</permission-role>
      <permission-role>Site Administrator</permission-role>
      <permission-role>TeamManager</permission-role>
      <permission-role>TeamMember</permission-role>
      <permission-role>Reader</permission-role>
    </permission-map>
    <permission-map acquired="False"
                    name="Modify portal content"
    >
      <permission-role>Manager</permission-role>
      <permission-role>Site Administrator</permission-role>
      <permission-role>TeamManager</permission-role>
      <permission-role>Editor</permission-role>
    </permission-map>
    <permission-map acquired="False"
                    name="Delete objects"
    >
      <permission-role>Manager</permission-role>
      <!-- NOT owner! -->
      <permission-role>Site Administrator</permission-role>
      <permission-role>TeamManager</permission-role>
      <permission-role>Editor</permission-role>
    </permission-map>
    <permission-map acquired="False"
                    name="View"
    >
      <permission-role>Manager</permission-role>
      <permission-role>Owner</permission-role>
      <permission-role>Site Administrator</permission-role>
      <permission-role>TeamManager</permission-role>
      <permission-role>TeamMember</permission-role>
      <permission-role>Reader</permission-role>
      <permission-role>Guest</permission-role>
    </permission-map>
  </state>

  <transition after_script=""
              before_script=""
              new_state="pending"
              title="Admin submits content"
              transition_id="submit"
              trigger="USER"
              i18n:attributes="title"
  >
    <description i18n:translate="">Submitting the item sends it for review.</description>
    <action category="workflow"
            icon=""
            url="%(content_url)s/content_status_modify?workflow_action=submit"
            i18n:translate=""
    >Submit</action>
    <guard>
      <guard-permission>Request review</guard-permission>
    </guard>
  </transition>

  <transition after_script=""
              before_script=""
              new_state="published"
              title="Publishes content"
              transition_id="publish"
              trigger="USER"
              i18n:attributes="title"
  >
    <description i18n:translate="">Publishes the item for members.</description>
    <action category="workflow"
            icon=""
            url="%(content_url)s/content_status_modify?workflow_action=publish"
            i18n:translate=""
    >Publish</action>
    <guard>
      <guard-permission>Review portal content</guard-permission>
    </guard>
  </transition>

  <transition after_script=""
              before_script=""
              new_state="published"
              title="Restricts content"
              transition_id="restrict"
              trigger="USER"
              i18n:attributes="title"
  >
    <description i18n:translate="">Restricts content to workspace members.</description>
    <action category="workflow"
            icon=""
            url="%(content_url)s/content_status_modify?workflow_action=restrict"
            i18n:translate=""
    >Restrict</action>
    <guard>
      <guard-permission>Review portal content</guard-permission>
    </guard>
  </transition>

  <transition after_script=""
              before_script=""
              new_state="draft"
              title="Sends content back to draft"
              transition_id="send_back"
              trigger="USER"
              i18n:attributes="title"
  >
    <description i18n:translate="">Sends content back to draft.</description>
    <action category="workflow"
            icon=""
            url="%(content_url)s/content_status_modify?workflow_action=send_back"
            i18n:translate=""
    >Send back</action>
    <guard>
      <guard-permission>Modify portal content</guard-permission>
    </guard>
  </transition>

  <transition after_script=""
              before_script=""
              new_state="draft"
              title="Retracts content to draft"
              transition_id="retract"
              trigger="USER"
              i18n:attributes="title"
  >
    <description i18n:translate="">Retracts content back draft.</description>
    <action category="workflow"
            icon=""
            url="%(content_url)s/content_status_modify?workflow_action=retract"
            i18n:translate=""
    >Retract</action>
    <guard>
      <guard-permission>Request review</guard-permission>
    </guard>
  </transition>

</dc-workflow>
