[Zope3-checkins] SVN: Zope3/branches/jack-e_interfacebased_workflow/src/interface_based_content_workflows/ Interface based content workflow examples. Testing purposes using interfaces and subsribers

Julien Anguenot ja at nuxeo.com
Tue Oct 12 06:33:57 EDT 2004


Log message for revision 27996:
  Interface based content workflow examples. Testing purposes using interfaces and subsribers


Changed:
  A   Zope3/branches/jack-e_interfacebased_workflow/src/interface_based_content_workflows/
  A   Zope3/branches/jack-e_interfacebased_workflow/src/interface_based_content_workflows/Makefile
  A   Zope3/branches/jack-e_interfacebased_workflow/src/interface_based_content_workflows/README.txt
  A   Zope3/branches/jack-e_interfacebased_workflow/src/interface_based_content_workflows/__init__.py
  A   Zope3/branches/jack-e_interfacebased_workflow/src/interface_based_content_workflows/configure.zcml
  A   Zope3/branches/jack-e_interfacebased_workflow/src/interface_based_content_workflows/contentworkflow_defs/
  A   Zope3/branches/jack-e_interfacebased_workflow/src/interface_based_content_workflows/contentworkflow_defs/README.txt
  A   Zope3/branches/jack-e_interfacebased_workflow/src/interface_based_content_workflows/contentworkflow_defs/__init__.py
  A   Zope3/branches/jack-e_interfacebased_workflow/src/interface_based_content_workflows/contentworkflow_defs/browser/
  A   Zope3/branches/jack-e_interfacebased_workflow/src/interface_based_content_workflows/contentworkflow_defs/browser/__init__.py
  A   Zope3/branches/jack-e_interfacebased_workflow/src/interface_based_content_workflows/contentworkflow_defs/browser/configure.zcml
  A   Zope3/branches/jack-e_interfacebased_workflow/src/interface_based_content_workflows/contentworkflow_defs/browser/content_wf_publish.pt
  A   Zope3/branches/jack-e_interfacebased_workflow/src/interface_based_content_workflows/contentworkflow_defs/browser/content_wf_reject.pt
  A   Zope3/branches/jack-e_interfacebased_workflow/src/interface_based_content_workflows/contentworkflow_defs/browser/content_wf_retract.pt
  A   Zope3/branches/jack-e_interfacebased_workflow/src/interface_based_content_workflows/contentworkflow_defs/browser/content_wf_status.pt
  A   Zope3/branches/jack-e_interfacebased_workflow/src/interface_based_content_workflows/contentworkflow_defs/browser/content_wf_submit.pt
  A   Zope3/branches/jack-e_interfacebased_workflow/src/interface_based_content_workflows/contentworkflow_defs/browser/content_wf_unpublish.pt
  A   Zope3/branches/jack-e_interfacebased_workflow/src/interface_based_content_workflows/contentworkflow_defs/configure.zcml
  A   Zope3/branches/jack-e_interfacebased_workflow/src/interface_based_content_workflows/contentworkflow_defs/interfaces.py
  A   Zope3/branches/jack-e_interfacebased_workflow/src/interface_based_content_workflows/contentworkflow_defs/setup/
  A   Zope3/branches/jack-e_interfacebased_workflow/src/interface_based_content_workflows/contentworkflow_defs/setup/__init__.py
  A   Zope3/branches/jack-e_interfacebased_workflow/src/interface_based_content_workflows/contentworkflow_defs/setup/configure.zcml
  A   Zope3/branches/jack-e_interfacebased_workflow/src/interface_based_content_workflows/contentworkflow_defs/setup/setup.py
  A   Zope3/branches/jack-e_interfacebased_workflow/src/interface_based_content_workflows/contentworkflow_defs/xmldef/
  A   Zope3/branches/jack-e_interfacebased_workflow/src/interface_based_content_workflows/contentworkflow_defs/xmldef/__init__.py


-=-
Added: Zope3/branches/jack-e_interfacebased_workflow/src/interface_based_content_workflows/Makefile
===================================================================
--- Zope3/branches/jack-e_interfacebased_workflow/src/interface_based_content_workflows/Makefile	2004-10-12 10:31:21 UTC (rev 27995)
+++ Zope3/branches/jack-e_interfacebased_workflow/src/interface_based_content_workflows/Makefile	2004-10-12 10:33:56 UTC (rev 27996)
@@ -0,0 +1,8 @@
+.PHONY: clean check
+
+check:
+	pychecker2 *.py
+
+clean:
+	find . "(" -name "*~" -or -name "*.pyc" ")" -print0 | xargs -0 rm -f
+

Added: Zope3/branches/jack-e_interfacebased_workflow/src/interface_based_content_workflows/README.txt
===================================================================
--- Zope3/branches/jack-e_interfacebased_workflow/src/interface_based_content_workflows/README.txt	2004-10-12 10:31:21 UTC (rev 27995)
+++ Zope3/branches/jack-e_interfacebased_workflow/src/interface_based_content_workflows/README.txt	2004-10-12 10:33:56 UTC (rev 27996)
@@ -0,0 +1,32 @@
+$Id: $
+
+Status : Draft
+Author : Julien Anguenot <ja at nuxeo.com>
+
+What's in here ?
+-----------------
+
+Here stands a basic implementation using interfaced based workflow of a
+simple private / pending / published content workflow that you may apply on
+
+Create your workflow out of it :
+----------------------------------
+
+ - Go to management Folder of Z3
+ - Click the 'Tools' tab
+ - Then scroll below and chosse the 'Workflows' section
+ - Click the 'Add' action
+ - Add a 'Stateful Process Definition'
+ - XXX
+
+Permissions and roles that are in use with workflow
+----------------------------------------------------
+
+Roles :
+
+ - Reviewer
+
+Permissions  :
+
+ - CanReviewContent
+ - CanRetract

Added: Zope3/branches/jack-e_interfacebased_workflow/src/interface_based_content_workflows/__init__.py
===================================================================

Added: Zope3/branches/jack-e_interfacebased_workflow/src/interface_based_content_workflows/configure.zcml
===================================================================
--- Zope3/branches/jack-e_interfacebased_workflow/src/interface_based_content_workflows/configure.zcml	2004-10-12 10:31:21 UTC (rev 27995)
+++ Zope3/branches/jack-e_interfacebased_workflow/src/interface_based_content_workflows/configure.zcml	2004-10-12 10:33:56 UTC (rev 27996)
@@ -0,0 +1,35 @@
+<configure
+    xmlns="http://namespaces.zope.org/zope"
+    xmlns:browser="http://namespaces.zope.org/browser"
+    i18n_domain="zope">
+
+<!-- Roles -->
+
+<role
+    id="workflow.Reviewer"
+    title="Content Reviewer"
+    description="Users that actually can review content"
+    />
+
+<!-- Permissions -->
+
+<permission
+    id="workflow.ReviewContent"
+    title="Review content"
+    description="Reviewing content allows to publish content"
+    />
+
+<permission
+    id="workflow.RetractContent"
+    title="Retract content"
+    description="Retract content allows to retract content"
+    />
+
+<grant
+    permission="workflow.ReviewContent"
+    role="workflow.Reviewer"
+    />
+
+<include package=".contentworkflow_defs" />
+
+</configure>

Added: Zope3/branches/jack-e_interfacebased_workflow/src/interface_based_content_workflows/contentworkflow_defs/README.txt
===================================================================
--- Zope3/branches/jack-e_interfacebased_workflow/src/interface_based_content_workflows/contentworkflow_defs/README.txt	2004-10-12 10:31:21 UTC (rev 27995)
+++ Zope3/branches/jack-e_interfacebased_workflow/src/interface_based_content_workflows/contentworkflow_defs/README.txt	2004-10-12 10:33:56 UTC (rev 27996)
@@ -0,0 +1,18 @@
+$Id: $
+
+Content workflow definition
+-----------------------------
+
+State : 
+
+ - private
+ - pending 
+ - published
+
+Transitions : 
+
+ - submit
+ - publish
+ - reject
+ - retract
+ - unpublish

Added: Zope3/branches/jack-e_interfacebased_workflow/src/interface_based_content_workflows/contentworkflow_defs/__init__.py
===================================================================

Added: Zope3/branches/jack-e_interfacebased_workflow/src/interface_based_content_workflows/contentworkflow_defs/browser/__init__.py
===================================================================

Added: Zope3/branches/jack-e_interfacebased_workflow/src/interface_based_content_workflows/contentworkflow_defs/browser/configure.zcml
===================================================================
--- Zope3/branches/jack-e_interfacebased_workflow/src/interface_based_content_workflows/contentworkflow_defs/browser/configure.zcml	2004-10-12 10:31:21 UTC (rev 27995)
+++ Zope3/branches/jack-e_interfacebased_workflow/src/interface_based_content_workflows/contentworkflow_defs/browser/configure.zcml	2004-10-12 10:33:56 UTC (rev 27996)
@@ -0,0 +1,88 @@
+<configure
+   xmlns="http://namespaces.zope.org/zope"
+   xmlns:browser="http://namespaces.zope.org/browser"
+   i18n_domain="zope"
+   >
+
+   <!-- Private state actions -->
+   <browser:page
+       name="wf_submit.html"
+       for="..interfaces.IStateContentWorkflowPrivate"
+       template="content_wf_submit.pt"
+       menu="zmi_views" title="Make public"
+       permission="zope.View"
+       />
+
+   <!-- Pending state actions -->
+
+   <browser:page
+       name="wf_retract.html"
+       for="..interfaces.IStateContentWorkflowPending"
+       template="content_wf_retract.pt"
+       menu="zmi_views" title="Retract"
+       permission="zope.View"
+       />
+
+   <browser:page
+       name="wf_publish.html"
+       for="..interfaces.IStateContentWorkflowPending"
+       template="content_wf_publish.pt"
+       menu="zmi_views" title="Publish"
+       permission="zope.ManageContent"
+       />
+
+   <browser:page
+       name="wf_reject.html"
+       for="..interfaces.IStateContentWorkflowPending"
+       template="content_wf_reject.pt"
+       menu="zmi_views" title="Reject"
+       permission="zope.ManageContent"
+       />
+
+   <!-- Publish actions -->
+
+   <browser:page
+       name="wf_unpublish.html"
+       for="..interfaces.IStateContentWorkflowPublished"
+       template="content_wf_unpublish.pt"
+       menu="zmi_views" title="Un Publish"
+       permission="zope.ManageContent"
+       />
+
+   <!-- Transition change -->
+
+   <browser:page
+       name="transition_change.py"
+       for="..interfaces.IContentWorkflowDefinition"
+       class="zope.app.workflow.stateful.browser.transitionchangeform.TransitionChangeForm"
+       attribute="sendTransitionUserTriggeredEvent"
+       permission="zope.View"
+       />
+
+   <!-- Status -->
+
+   <browser:page
+       name="content_status.html"
+       for="..interfaces.IStateContentWorkflowPublished"
+       template="content_wf_status.pt"
+       menu="zmi_views" title="Status"
+       permission="zope.View"
+       />
+
+   <browser:page
+       name="content_status.html"
+       for="..interfaces.IStateContentWorkflowPending"
+       template="content_wf_status.pt"
+       menu="zmi_views" title="Status"
+       permission="zope.View"
+       />
+
+   <browser:page
+       name="content_status.html"
+       for="..interfaces.IStateContentWorkflowPrivate"
+       template="content_wf_status.pt"
+       menu="zmi_views" title="Status"
+       permission="zope.View"
+       />
+
+</configure>

Added: Zope3/branches/jack-e_interfacebased_workflow/src/interface_based_content_workflows/contentworkflow_defs/browser/content_wf_publish.pt
===================================================================
--- Zope3/branches/jack-e_interfacebased_workflow/src/interface_based_content_workflows/contentworkflow_defs/browser/content_wf_publish.pt	2004-10-12 10:31:21 UTC (rev 27995)
+++ Zope3/branches/jack-e_interfacebased_workflow/src/interface_based_content_workflows/contentworkflow_defs/browser/content_wf_publish.pt	2004-10-12 10:33:56 UTC (rev 27996)
@@ -0,0 +1,27 @@
+<html metal:use-macro='context/@@standard_macros/view'
+      i18n:domain='zope'>
+<body>
+<div metal:fill-slot='body'>
+<h1>UnPublish the content</h1>
+<form action='transition_change.py' method='POST'>
+<table>
+ <tr>
+  <td i18n:translate=''>
+    Comments :
+  </td>
+  <td>
+    <textarea name="comment"></textarea>
+  </td>
+ </tr>
+ <tr>
+  <td colspan='2'>
+    <input type="hidden" name="transition" value="publish" />
+    <input type='submit' value='Submit'/>
+  </td>
+ </tr>
+</table>
+</form>
+<br/>
+</div>
+</body>
+</html>

Added: Zope3/branches/jack-e_interfacebased_workflow/src/interface_based_content_workflows/contentworkflow_defs/browser/content_wf_reject.pt
===================================================================
--- Zope3/branches/jack-e_interfacebased_workflow/src/interface_based_content_workflows/contentworkflow_defs/browser/content_wf_reject.pt	2004-10-12 10:31:21 UTC (rev 27995)
+++ Zope3/branches/jack-e_interfacebased_workflow/src/interface_based_content_workflows/contentworkflow_defs/browser/content_wf_reject.pt	2004-10-12 10:33:56 UTC (rev 27996)
@@ -0,0 +1,28 @@
+<html metal:use-macro='context/@@standard_macros/view'
+      i18n:domain='zope'>
+<body>
+<div metal:fill-slot='body'>
+<h1>Reject the content</h1>
+<form action='transition_change.py' method='POST'>
+<table>
+ <tr>
+  <td i18n:translate=''>
+    Comments :
+  </td>
+  <td>
+    <textarea name="comment"></textarea>
+  </td>
+ </tr>
+ <tr>
+  <td colspan='2'>
+    <input type="hidden" name="transition" value="reject" />
+    <input type='submit' value='Submit'/>
+  </td>
+ </tr>
+</table>
+</form>
+
+<br/>
+</div>
+</body>
+</html>

Added: Zope3/branches/jack-e_interfacebased_workflow/src/interface_based_content_workflows/contentworkflow_defs/browser/content_wf_retract.pt
===================================================================
--- Zope3/branches/jack-e_interfacebased_workflow/src/interface_based_content_workflows/contentworkflow_defs/browser/content_wf_retract.pt	2004-10-12 10:31:21 UTC (rev 27995)
+++ Zope3/branches/jack-e_interfacebased_workflow/src/interface_based_content_workflows/contentworkflow_defs/browser/content_wf_retract.pt	2004-10-12 10:33:56 UTC (rev 27996)
@@ -0,0 +1,27 @@
+<html metal:use-macro='context/@@standard_macros/view'
+      i18n:domain='zope'>
+<body>
+<div metal:fill-slot='body'>
+<h1>Retract the submission</h1>
+<form action='transition_change.py' method='POST'>
+<table>
+ <tr>
+  <td i18n:translate=''>
+    Comments :
+  </td>
+  <td>
+    <textarea name="comment"></textarea>
+  </td>s
+ </tr>
+ <tr>
+  <td colspan='2'>
+    <input type="hidden" name="transition" value="retract" />
+    <input type='submit' value='Submit'/>
+  </td>
+ </tr>
+</table>
+</form>
+<br/>
+</div>
+</body>
+</html>

Added: Zope3/branches/jack-e_interfacebased_workflow/src/interface_based_content_workflows/contentworkflow_defs/browser/content_wf_status.pt
===================================================================
--- Zope3/branches/jack-e_interfacebased_workflow/src/interface_based_content_workflows/contentworkflow_defs/browser/content_wf_status.pt	2004-10-12 10:31:21 UTC (rev 27995)
+++ Zope3/branches/jack-e_interfacebased_workflow/src/interface_based_content_workflows/contentworkflow_defs/browser/content_wf_status.pt	2004-10-12 10:33:56 UTC (rev 27996)
@@ -0,0 +1,9 @@
+<html metal:use-macro='context/@@standard_macros/view'
+      i18n:domain='zope'>
+<body>
+<div metal:fill-slot='body'>
+<h1>Workflow status of <span tal:replace="context" /> </h1>
+<br/>
+</div>
+</body>
+</html>

Added: Zope3/branches/jack-e_interfacebased_workflow/src/interface_based_content_workflows/contentworkflow_defs/browser/content_wf_submit.pt
===================================================================
--- Zope3/branches/jack-e_interfacebased_workflow/src/interface_based_content_workflows/contentworkflow_defs/browser/content_wf_submit.pt	2004-10-12 10:31:21 UTC (rev 27995)
+++ Zope3/branches/jack-e_interfacebased_workflow/src/interface_based_content_workflows/contentworkflow_defs/browser/content_wf_submit.pt	2004-10-12 10:33:56 UTC (rev 27996)
@@ -0,0 +1,28 @@
+<html metal:use-macro='context/@@standard_macros/view'
+      i18n:domain='zope'>
+<body>
+<div metal:fill-slot='body'>
+<h1>Publish your content</h1>
+<form action='transition_change.py' method='POST'>
+<table>
+ <tr>
+  <td i18n:translate=''>
+    Comments :
+  </td>
+  <td>
+    <textarea name="comment"></textarea>
+  </td>
+ </tr>
+ <tr>
+  <td colspan='2'>
+    <input type="hidden" name="transition" value="submit" />
+    <input type='submit' value='Submit'/>
+  </td>
+ </tr>
+</table>
+</form>
+
+<br/>
+</div>
+</body>
+</html>

Added: Zope3/branches/jack-e_interfacebased_workflow/src/interface_based_content_workflows/contentworkflow_defs/browser/content_wf_unpublish.pt
===================================================================
--- Zope3/branches/jack-e_interfacebased_workflow/src/interface_based_content_workflows/contentworkflow_defs/browser/content_wf_unpublish.pt	2004-10-12 10:31:21 UTC (rev 27995)
+++ Zope3/branches/jack-e_interfacebased_workflow/src/interface_based_content_workflows/contentworkflow_defs/browser/content_wf_unpublish.pt	2004-10-12 10:33:56 UTC (rev 27996)
@@ -0,0 +1,27 @@
+<html metal:use-macro='context/@@standard_macros/view'
+      i18n:domain='zope'>
+<body>
+<div metal:fill-slot='body'>
+<h1>UnPublish content</h1>
+<form action='transition_change.py' method='POST'>
+<table>
+ <tr>
+  <td i18n:translate=''>
+    Comments :
+  </td>
+  <td>
+    <textarea name="comment"></textarea>
+  </td>
+ </tr>
+ <tr>
+  <td colspan='2'>
+    <input type="hidden" name="transition" value="unpublish" />
+    <input type='submit' value='Submit'/>
+  </td>
+ </tr>
+</table>
+</form>
+<br/>
+</div>
+</body>
+g</html>

Added: Zope3/branches/jack-e_interfacebased_workflow/src/interface_based_content_workflows/contentworkflow_defs/configure.zcml
===================================================================
--- Zope3/branches/jack-e_interfacebased_workflow/src/interface_based_content_workflows/contentworkflow_defs/configure.zcml	2004-10-12 10:31:21 UTC (rev 27995)
+++ Zope3/branches/jack-e_interfacebased_workflow/src/interface_based_content_workflows/contentworkflow_defs/configure.zcml	2004-10-12 10:33:56 UTC (rev 27996)
@@ -0,0 +1,43 @@
+<configure
+   xmlns="http://namespaces.zope.org/zope"
+   xmlns:browser="http://namespaces.zope.org/browser"
+   i18n_domain="zope"
+   >
+
+  <!-- content workflow -->
+
+  <adapter
+      factory="zope.app.workflow.stateful.instance.StatefulPIAdapter"
+      provides="zope.app.workflow.stateful.interfaces.IStatefulPIAdapter"
+      for=".interfaces.IContentWorkflowDefinition"
+      trusted="true"
+      permission="zope.Public"
+   />
+
+
+  <interface
+      interface=".interfaces.IContentWorkflowDefinition"
+      />
+
+  <!-- content workflow states -->
+
+  <interface
+      interface=".interfaces.IStateContentWorkflowPrivate"
+      />
+
+  <interface
+      interface=".interfaces.IStateContentWorkflowPending"
+      />
+
+  <interface
+      interface=".interfaces.IStateContentWorkflowPublished"
+      />
+
+<!--
+  <include package=".setup" />
+
+-->
+
+ <include package=".browser" />
+
+</configure>

Added: Zope3/branches/jack-e_interfacebased_workflow/src/interface_based_content_workflows/contentworkflow_defs/interfaces.py
===================================================================
--- Zope3/branches/jack-e_interfacebased_workflow/src/interface_based_content_workflows/contentworkflow_defs/interfaces.py	2004-10-12 10:31:21 UTC (rev 27995)
+++ Zope3/branches/jack-e_interfacebased_workflow/src/interface_based_content_workflows/contentworkflow_defs/interfaces.py	2004-10-12 10:33:56 UTC (rev 27996)
@@ -0,0 +1,33 @@
+from zope import interface
+
+#
+# Interface represnting the process itself
+#
+
+class IContentWorkflowDefinition(interface.Interface):
+    """Content Process Definition Interface
+
+    Interface representing the the content process definition for Z3 content
+    objects
+    """
+
+    # XXX we are not suppposed to be in need of that
+    # event subscriber needs to find it to find the
+    __processdefinition_name__ = interface.Attribute('Process Definition Name')
+
+
+#
+# Interfaces representing states
+#
+
+class IStateContentWorkflowPrivate(IContentWorkflowDefinition):
+    """ Private State for used by content workflow
+    """
+
+class IStateContentWorkflowPending(IContentWorkflowDefinition):
+    """ Pending State for used by content workflow
+    """
+
+class IStateContentWorkflowPublished(IContentWorkflowDefinition):
+    """ Published State for used by content workflow
+    """

Added: Zope3/branches/jack-e_interfacebased_workflow/src/interface_based_content_workflows/contentworkflow_defs/setup/__init__.py
===================================================================

Added: Zope3/branches/jack-e_interfacebased_workflow/src/interface_based_content_workflows/contentworkflow_defs/setup/configure.zcml
===================================================================
--- Zope3/branches/jack-e_interfacebased_workflow/src/interface_based_content_workflows/contentworkflow_defs/setup/configure.zcml	2004-10-12 10:31:21 UTC (rev 27995)
+++ Zope3/branches/jack-e_interfacebased_workflow/src/interface_based_content_workflows/contentworkflow_defs/setup/configure.zcml	2004-10-12 10:33:56 UTC (rev 27996)
@@ -0,0 +1,8 @@
+<configure xmlns="http://namespaces.zope.org/zope">
+
+  <subscriber
+      factory="setup.contentWorkflowSetup"
+      for="zope.app.appsetup.IDatabaseOpenedEvent"
+      />
+
+</configure>

Added: Zope3/branches/jack-e_interfacebased_workflow/src/interface_based_content_workflows/contentworkflow_defs/setup/setup.py
===================================================================
--- Zope3/branches/jack-e_interfacebased_workflow/src/interface_based_content_workflows/contentworkflow_defs/setup/setup.py	2004-10-12 10:31:21 UTC (rev 27995)
+++ Zope3/branches/jack-e_interfacebased_workflow/src/interface_based_content_workflows/contentworkflow_defs/setup/setup.py	2004-10-12 10:33:56 UTC (rev 27996)
@@ -0,0 +1,4 @@
+def contentWorkflowSetup(event):
+    """
+    """
+    pass

Added: Zope3/branches/jack-e_interfacebased_workflow/src/interface_based_content_workflows/contentworkflow_defs/xmldef/__init__.py
===================================================================



More information about the Zope3-Checkins mailing list