[Zope-CVS] CVS: Packages3/workflow/browser/stateful - contentworkflow.py:1.1 contentworkflow_index.pt:1.1 addtransition.pt:1.2 configure.zcml:1.3 definition.py:1.3

Ulrich Eck ueck@net-labs.de
Fri, 7 Feb 2003 16:51:23 -0500


Update of /cvs-repository/Packages3/workflow/browser/stateful
In directory cvs.zope.org:/tmp/cvs-serv15434/browser/stateful

Modified Files:
	addtransition.pt configure.zcml definition.py 
Added Files:
	contentworkflow.py contentworkflow_index.pt 
Log Message:
First usable state of Stateful Workflow :)
- Implemented ProcessInstanceContainer/Adapter + Views
- Implemented Dummy ContentWorkflowsUtility
- updated Readme
- fixed some bugs
 --> read the README for a small tutorial of what works


=== Added File Packages3/workflow/browser/stateful/contentworkflow.py ===
##############################################################################
#
# Copyright (c) 2002 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL).  A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
"""ContentWorkflow Utility views
 
$Id: contentworkflow.py,v 1.1 2003/02/07 21:50:52 jack-e Exp $
"""
__metaclass__ = type
 
from zope.component import getServiceManager
from zope.publisher.browser import BrowserView
from zope.app.form.utility import setUpWidgets, getWidgetsDataForContent
from zope.app.interfaces.workflow.stateful import IContentWorkflowsUtility

class ContentWorkflowsUtilityView(BrowserView):
 
    def getName(self):
        return """I'm a ContentWorkflows Utility"""





=== Added File Packages3/workflow/browser/stateful/contentworkflow_index.pt ===
<html metal:use-macro="views/standard_macros/page">
 
  <head>
    <title>Registration "Service" Control Page</title>
  </head>
 
  <body>
 
  <div metal:fill-slot="body">
 
    <h1>Subscription control</h1>
 
    <span tal:condition="request/callSubscribe|nothing" tal:omit-tag="">
        <span tal:define="dummy context/subscribe" tal:omit-tag=""/>
    </span>
    <span tal:condition="request/callUnsubscribe|nothing" tal:omit-tag="">
        <span tal:define="dummy context/unsubscribe" tal:omit-tag=""/>
    </span>
 
    <form method="POST">
       <span tal:condition="context/isSubscribed" tal:omit-tag="">
           Subscription state: ON
           <input type="submit" value="Unsubscribe" name="callUnsubscribe" />
       </span>
       <span tal:condition="not:context/isSubscribed" tal:omit-tag="">
           Subscription state: OFF
           <input type="submit" value="Subscribe" name="callSubscribe" />
       </span>
    </form>
 
  </div>
 
  </body>
 
</html>

=== Packages3/workflow/browser/stateful/addtransition.pt 1.1 => 1.2 ===
--- Packages3/workflow/browser/stateful/addtransition.pt:1.1	Fri Feb  7 10:29:27 2003
+++ Packages3/workflow/browser/stateful/addtransition.pt	Fri Feb  7 16:50:52 2003
@@ -9,7 +9,7 @@
     <form action="." method="post" enctype="multipart/form-data">
  
       <table>
-        <tbody>
+        <tbody tal:define="states view/getStateNames">
  
           <tr>
             <th>Id:</th>
@@ -21,14 +21,20 @@
           <tr>
             <th>Source State:</th>
             <td>
-              <input type="text" name="source" size="40" value="">
+              <select name="source">
+                <option tal:repeat="state states"
+                        tal:content="state" />
+              </select>
             </td>
           </tr>
  
           <tr>
             <th>Destination State:</th>
             <td>
-              <input type="text" name="destination" size="40" value="">
+              <select name="destination">
+                <option tal:repeat="state states"
+                        tal:content="state" />
+              </select>
             </td>
           </tr>
 


=== Packages3/workflow/browser/stateful/configure.zcml 1.2 => 1.3 ===
--- Packages3/workflow/browser/stateful/configure.zcml:1.2	Fri Feb  7 10:29:27 2003
+++ Packages3/workflow/browser/stateful/configure.zcml	Fri Feb  7 16:50:52 2003
@@ -1,6 +1,6 @@
 <zopeConfigure
-   xmlns='http://namespaces.zope.org/zope'
-   xmlns:browser='http://namespaces.zope.org/browser'>
+   xmlns="http://namespaces.zope.org/zope"
+   xmlns:browser="http://namespaces.zope.org/browser">
 
 
 <!-- Stateful Workflow Process Definition -->
@@ -9,7 +9,7 @@
   menu="add_component"
   for="zope.app.interfaces.container.IAdding"
   action="StatefulProcessDefinition"
-  title='Stateful Process Definition'
+  title="Stateful Process Definition"
   description="A stateful workflow process definition" />
 
 
@@ -83,6 +83,30 @@
   permission="zope.workflow.ManageProcessDefinitions"
   />
 
+
+<!-- ContentWorkflowsUtility -->
+<browser:menuItem
+  menu="add_component"
+  for="zope.app.interfaces.container.IAdding"
+  action="ContentWorkflowsUtility"
+  title="Content Workflows Utility"
+  description="An utility for creating/deleting workflow for content objects." />
+
+<browser:pages
+  for="zope.app.interfaces.workflow.stateful.IContentWorkflowsUtility"
+  class="zope.app.browser.workflow.stateful.contentworkflow.ContentWorkflowsUtilityView"
+  permission="zope.ManageServices">
+
+  <browser:page name="index.html" template="contentworkflow_index.pt" />
+
+</browser:pages>
+
+<browser:menuItem
+  menu="zmi_views"
+  for="zope.app.interfaces.workflow.stateful.IContentWorkflowsUtility"
+  action="index.html"
+  title="Overview"
+  description="ContentWorkflowsUtility Overview" />
 
 
 


=== Packages3/workflow/browser/stateful/definition.py 1.2 => 1.3 ===
--- Packages3/workflow/browser/stateful/definition.py:1.2	Fri Feb  7 10:29:27 2003
+++ Packages3/workflow/browser/stateful/definition.py	Fri Feb  7 16:50:52 2003
@@ -16,7 +16,8 @@
 $Id$
 """
 __metaclass__ = type
- 
+
+from zope.proxy.introspection import removeAllProxies
 from zope.component import getServiceManager
 from zope.publisher.browser import BrowserView
 from zope.app.form.utility import setUpWidgets, getWidgetsDataForContent
@@ -40,6 +41,12 @@
 
 
 class AddTransition(BrowserView):
+
+    def getStateNames(self):
+        pd = self.context.getProcessDefinition()
+        states = removeAllProxies(pd.getStateNames())
+        states.sort()
+        return states
 
     def action(self, id, source, destination, condition=None, permission=None):
         condition = condition or None