[Zope3-checkins] CVS: Packages3/workflow/browser - configure.zcml:1.14 definition.py:1.10 importexport_index.pt:1.4

Michael Howitz mh+zope@gocept.com
Thu, 27 Mar 2003 11:26:43 -0500


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

Modified Files:
	configure.zcml definition.py importexport_index.pt 
Log Message:
import and export of stateful workflow now works


=== Packages3/workflow/browser/configure.zcml 1.13 => 1.14 ===
--- Packages3/workflow/browser/configure.zcml:1.13	Thu Mar 27 08:31:53 2003
+++ Packages3/workflow/browser/configure.zcml	Thu Mar 27 11:26:13 2003
@@ -72,7 +72,8 @@
      permission="zope.workflow.ManageProcessDefinitions"
      class=".definition.ImportExportView">
      
-    <browser:page name="import.html" attribute="testimport" />
+    <browser:page name="import.html" attribute="importDefinition" />
+    <browser:page name="export.html" attribute="exportDefinition" />
 </browser:pages>
 
 


=== Packages3/workflow/browser/definition.py 1.9 => 1.10 ===
--- Packages3/workflow/browser/definition.py:1.9	Thu Mar 27 09:00:50 2003
+++ Packages3/workflow/browser/definition.py	Thu Mar 27 11:26:13 2003
@@ -64,52 +64,12 @@
     def _getUtil(self):
         return getUtility(self.context, IProcessDefinitionImportExport)
 
-    def testimport(self):
-        xml = """<?xml version="1.0"?>
-<workflow type="Zope3Workflow" title="PublishReview">
-  <schema name="newssite.workflow.schema.TestSchema"/>
-  <states>
-    <state name="INITIAL" title=""/>
-    <state name="private" title="Private"/>
-    <state name="pending" title="Pending"/>
-    <state name="published" title="Public"/>
-  </states>
-  <transitions>
-     
-      <transition destinationState="private"
-                  sourceState="INITIAL" title="make private"
-                  triggerMode="Automatic"
-                  name="initial_private"/>
-    
-     
-      <transition destinationState="pending"
-                  sourceState="private" title="submit"
-                  triggerMode="Manual"
-                  name="private_pending"/>
-    
-     
-      <transition destinationState="published"
-                  permission="zope.ManageContent"
-                  sourceState="pending" title="publicate"
-                  triggerMode="Manual"
-                  name="pending_published"/>
-    
-     
-      <transition destinationState="private"
-                  sourceState="pending"
-                  title="cancel submission"
-                  triggerMode="Manual"
-                  name="pending_private"/>
-    
-     
-      <transition destinationState="private"
-                  sourceState="published" title="take back"
-                  triggerMode="Manual"
-                  name="published_private"/>
-    
-  </transitions>
-  
-</workflow>
-"""
-        self.doImport(xml)
-        return 'import successful'
+    def importDefinition(self):
+        import pdb; pdb.set_trace()
+        xml = self.request.get('definition')
+        if xml:
+            self.doImport(xml)
+        self.request.response.redirect('@@importexport.html?success=1')
+
+    def exportDefinition(self):
+        return self.doExport()


=== Packages3/workflow/browser/importexport_index.pt 1.3 => 1.4 ===
--- Packages3/workflow/browser/importexport_index.pt:1.3	Thu Mar 27 08:31:53 2003
+++ Packages3/workflow/browser/importexport_index.pt	Thu Mar 27 11:26:13 2003
@@ -1,14 +1,19 @@
-<html metal:use-macro="context/@@standard_macros/page">
-<body>
-  <div metal:fill-slot="body">
+  <html metal:use-macro="context/@@standard_macros/page">
+    <body>
+      <div metal:fill-slot="body">
+        <span tal:define="success request/success | nothing"
+          tal:condition="success"><br/>Import was successfull!<br/></span>
 
-    <p>Import / Export ProcessDefinitions:</p>
-
-        Import: <a href="@@import.html">testimport</a>
-        <p>
-        Export:<br/>
-    <pre tal:content="view/doExport" />
-
-  </div>
-</body>
-</html>
+        <p>Import / Export ProcessDefinitions:</p>
+        Import:
+        <form action="@@import.html" method="post" encoding="multipart/form-data">
+          <textarea cols="50" rows="10" name="definition"></textarea><br/>
+            <input type="submit" value="do import"/>
+        </form>
+        <p></p>
+        Export: <a href="@@export.html">save as file</a><br/>
+          <pre tal:content="view/doExport"/>
+      </div>
+    </body>
+  </html>
+  
\ No newline at end of file