Updated workflow interfaces
authorThierry Florac <thierry.florac@onf.fr>
Thu, 08 Oct 2015 11:34:40 +0200
changeset 13 316232c0fbf4
parent 12 ab8948c2b00b
child 14 84c77a226560
Updated workflow interfaces
src/pyams_workflow/interfaces/__init__.py
--- a/src/pyams_workflow/interfaces/__init__.py	Wed Jun 17 10:02:12 2015 +0200
+++ b/src/pyams_workflow/interfaces/__init__.py	Thu Oct 08 11:34:40 2015 +0200
@@ -16,6 +16,7 @@
 # import standard library
 
 # import interfaces
+from pyams_utils.interfaces import VIEW_PERMISSION
 from zope.annotation.interfaces import IAttributeAnnotatable
 from zope.interface.interfaces import IObjectEvent, ObjectEvent
 from zope.lifecycleevent.interfaces import IObjectCreatedEvent
@@ -24,7 +25,7 @@
 from pyams_security.schema import Principal
 from zope.interface import implementer, invariant, Interface, Attribute, Invalid
 from zope.lifecycleevent import ObjectCreatedEvent
-from zope.schema import Choice, Datetime, Set, TextLine, Text, List, Object, Int
+from zope.schema import Choice, Datetime, Set, TextLine, Text, List, Object, Int, Bool
 
 from pyams_workflow import _
 
@@ -137,7 +138,29 @@
     Defined as a utility.
     """
 
-    published_states = Set(title="Published states")
+    initial_state = Attribute("Initial state")
+
+    update_states = Set(title="Updatable states",
+                        description="States of contents which are updatable by standard contributors")
+
+    readonly_states = Set(title="Read-only states",
+                          description="States of contents which can't be modified by anybody")
+
+    protected_states = Set(title="Protected states",
+                           description="States of contents which can only be modified by site administrators")
+
+    manager_states = Set(title="Manager states",
+                         description="States of contents which can be modified by site administrators and content "
+                                     "managers")
+
+    published_states = Set(title="Published states",
+                           description="States of contents which are published and visible")
+
+    waiting_states = Set(title="Waiting states",
+                         description="States of contents waiting for action")
+
+    retired_states = Set(title="Retired states",
+                         description="States of contents which are retired but not yet archived")
 
     def initialize(self):
         """Do any needed initialization.
@@ -255,6 +278,9 @@
     target_state = TextLine(title="Transition target state",
                             required=True)
 
+    transition_id = TextLine(title="Transition ID",
+                             required=True)
+
     transition = TextLine(title="Transition name",
                           required=True)
 
@@ -281,6 +307,10 @@
     state_principal = Principal(title=_("State principal"),
                                 description=_("ID of the principal which defined current state"))
 
+    state_urgency = Bool(title=_("Urgent request?"),
+                         required=True,
+                         default=False)
+
     history = List(title="Workflow states history",
                    value_type=Object(schema=IWorkflowStateHistoryItem))
 
@@ -312,6 +342,13 @@
         """Remove version with given ID"""
 
 
+class IWorkflowStateLabel(Interface):
+    """Workflow state label adapter interface"""
+
+    def get_label(self, content, request=None, format=True):
+        """Get state label for given content"""
+
+
 class IWorkflowManagedContent(IAttributeAnnotatable):
     """Workflow managed content"""
 
@@ -325,7 +362,7 @@
     view_permission = Choice(title=_("View permission"),
                              description=_("This permission will be required to display content"),
                              vocabulary='PyAMS permissions',
-                             required=False)
+                             default=VIEW_PERMISSION)
 
 
 class IWorkflowPublicationSupport(IAttributeAnnotatable):
@@ -380,6 +417,15 @@
         """Is the content visible?"""
 
 
+class IWorkflowRequestUrgencyInfo(Interface):
+    """Workflow request urgency info"""
+
+    urgent_request = Bool(title=_("Urgent request?"),
+                          description=_("Please use this option only when really needed..."),
+                          required=True,
+                          default=False)
+
+
 class IWorkflowCommentInfo(Interface):
     """Workflow comment info"""