Skip to content

/ Zope / gocept svn checkins / Archive / 2007 / 2007-05 / SVN: r4771 - in AlphaFlow/trunk: activities doc/proposals editor editor/resources editor/resources/images

[ << ] [ >> ]

[ SVN: r4745 - in AlphaFlow/trunk: . activities ... ] [ SVN: r4803 - in gocept.rdbmanagement/trunk: . ... ]

SVN: r4771 - in AlphaFlow/trunk: activities doc/proposals editor editor/resources editor/resources/images
Christian Theune <ct(at)gocept.com>
2007-05-06 15:06:38 [ FULL ]
Author: ctheune
Date: Sun May  6 15:06:35 2007
New Revision: 4771

Log:
 - some detailed work on forms
 - added display of check points



Added:
   AlphaFlow/trunk/editor/activity_details.pt   (contents, props changed)
   AlphaFlow/trunk/editor/resources/images/bodybg.png   (contents, props
changed)
   AlphaFlow/trunk/editor/resources/images/errorbg.png   (contents, props
changed)
Modified:
   AlphaFlow/trunk/activities/interfaces.py
   AlphaFlow/trunk/doc/proposals/ASPECTS.txt
   AlphaFlow/trunk/editor/activity.pt
   AlphaFlow/trunk/editor/activity.py
   AlphaFlow/trunk/editor/configure.zcml
   AlphaFlow/trunk/editor/index.pt
   AlphaFlow/trunk/editor/resources/editor.js
   AlphaFlow/trunk/editor/resources/style.css

Modified: AlphaFlow/trunk/activities/interfaces.py
==============================================================================
--- AlphaFlow/trunk/activities/interfaces.py	(original)
+++ AlphaFlow/trunk/activities/interfaces.py	Sun May  6 15:06:35 2007
(at)(at) -167,10 +167,11 (at)(at)
 
 class IEMailActivity(IAutomaticActivity):
     """Sends an email to certain interested users about activities in
-    this workflow."""
+    this workflow.
+    """
 
     def getRecipientModes():
-        """Return list of IEMailRecipientMode instances (possible
recipents)."""
+        """Return list of IEMailRecipientMode instances (possible
recipients)."""
 
 
 class IEMailWorkItem(IAutomaticWorkItem):

Modified: AlphaFlow/trunk/doc/proposals/ASPECTS.txt
==============================================================================
--- AlphaFlow/trunk/doc/proposals/ASPECTS.txt	(original)
+++ AlphaFlow/trunk/doc/proposals/ASPECTS.txt	Sun May  6 15:06:35 2007
(at)(at) -75,16 +75,22 (at)(at)
 
 Business activities
 
-  task
-  decision
-  alarm
-  switch
-  ntask
-  configuration
-  route
+Bases:
 
-  expression
-  email
+    - assignable (real list of roles, verify the combinations of expression,
+      roles and mode)
+
+    - noneditable fields?
+
+X decision
+X alarm
+~ switch  (exit configuration missing)
+~ ntask   (exit configuration missing)
+X configuration
+~ route   (gates)
+
+X expression
+~ email   (recipient modes)
 
 
 Aspects

Modified: AlphaFlow/trunk/editor/activity.pt
==============================================================================
--- AlphaFlow/trunk/editor/activity.pt	(original)
+++ AlphaFlow/trunk/editor/activity.pt	Sun May  6 15:06:35 2007
(at)(at) -6,7 +6,7 (at)(at)
   tal:attributes="action python:request.URL"
   method="post">
 
-  <div class="form-status"
+  <div class="form-status errorbox"
     tal:define="status python:view.status"
     tal:condition="status">
 
(at)(at) -61,8 +61,6 (at)(at)
     <span class="actionButtons">
       <input type="button" class="button" name="form.actions.apply"
         id="submitForm" value="Save" />
-      <input type="button" class="button" name="closeEditPane"
-        id="closeEditPane" value="Back" />
     </span>
   </div>
 

Modified: AlphaFlow/trunk/editor/activity.py
==============================================================================
--- AlphaFlow/trunk/editor/activity.py	(original)
+++ AlphaFlow/trunk/editor/activity.py	Sun May  6 15:06:35 2007
(at)(at) -136,3 +136,9 (at)(at)
 
     form_fields = zope.formlib.form.FormFields(
         Products.AlphaFlow.activities.interfaces.IRouteActivity)
+
+
+class EditEMailActivity(EditForm):
+
+    form_fields = zope.formlib.form.FormFields(
+        Products.AlphaFlow.activities.interfaces.IEMailActivity)

Added: AlphaFlow/trunk/editor/activity_details.pt
==============================================================================
--- (empty file)
+++ AlphaFlow/trunk/editor/activity_details.pt	Sun May  6 15:06:35 2007
(at)(at) -0,0 +1,36 (at)(at)
+<div id="activityOverview">
+
+  <div class="box"
+    tal:define="checkpoint context/CHECKPOINT_START">
+    <h3>When this activity starts ... </h3>
+    <metal:block define-macro="checkpoint">
+      <p tal:condition="checkpoint/activities">... start those
activities: 
+        <a tal:attributes="href string:activity://$activity"
+          tal:repeat="activity checkpoint/activities"
+          tal:content="activity"/>
+      </p>
+    </metal:block>
+  </div>
+
+  <div class="box">
+    <h3 tal:content="context/title"></h3>
+    <p><a tal:attributes="href
+        string:edit-activity://${context/getId}">Edit</a></p>
+  </div>
+
+  <div style="padding-left:1em;">
+    <tal:block repeat="checkpoint context/getExits">
+      <div class="box">
+        <h3>Exit: <span
tal:content="checkpoint/getId"/></h3>
+        <metal:block use-macro="template/macros/checkpoint"/>
+      </div>
+    </tal:block>
+  </div>
+
+  <div class="box"
+    tal:define="checkpoint context/CHECKPOINT_COMPLETE">
+    <h3>When this activity ends ... </h3>
+    <metal:block use-macro="template/macros/checkpoint"/>
+  </div>
+
+</div>

Modified: AlphaFlow/trunk/editor/configure.zcml
==============================================================================
--- AlphaFlow/trunk/editor/configure.zcml	(original)
+++ AlphaFlow/trunk/editor/configure.zcml	Sun May  6 15:06:35 2007
(at)(at) -37,6 +37,14 (at)(at)
     permission="zope2.View"
     />
 
+  <browser:page
+    for="Products.AlphaFlow.interfaces.IActivity"
+    template="activity_details.pt"
+    class=".editor.ActivityPanel"
+    name="activity_details"
+    permission="zope2.View"
+    />
+
   <!-- The various activity edit views -->
   <browser:page
     for="Products.AlphaFlow.activities.interfaces.IExpressionActivity"
(at)(at) -87,6 +95,13 (at)(at)
     permission="zope2.View"
     />
 
+  <browser:page
+    for="Products.AlphaFlow.activities.interfaces.IEMailActivity"
+    class=".activity.EditEMailActivity"
+    name="edit_activity"
+    permission="zope2.View"
+    />
+
   <!-- Resources -->
   <browser:resource
     name="style.css"

Modified: AlphaFlow/trunk/editor/index.pt
==============================================================================
--- AlphaFlow/trunk/editor/index.pt	(original)
+++ AlphaFlow/trunk/editor/index.pt	Sun May  6 15:06:35 2007
(at)(at) -49,7 +49,7 (at)(at)
   <body>
 
     <div id="header">
-      <h1 tal:content="here/title_or_id"/>
+      <h1><a href="#" id="title"
tal:content="here/title_or_id"/></h1>
     </div>
 
     <div id="container">
(at)(at) -62,6 +62,9 (at)(at)
         <img tal:attributes="src
string:${context/(at)(at)absolute_url}/(at)(at)graph" />
       </div>
 
+      <div style="clear:both">
+      </div>
+
     </div>
 
   </body>

Modified: AlphaFlow/trunk/editor/resources/editor.js
==============================================================================
--- AlphaFlow/trunk/editor/resources/editor.js	(original)
+++ AlphaFlow/trunk/editor/resources/editor.js	Sun May  6 15:06:35 2007
(at)(at) -7,38 +7,72 (at)(at)
     this.canvas = getElement('graph');
     this.canvas_img = getFirstElementByTagAndClassName('img', '',
this.contentElement);
     this.canvas_url = this.canvas_img.src;
+
+    connect('title', 'onclick', this, 'loadActivityPanel');
 };
 
 Editor.prototype._loadPanel = function(panel, query) {
-    var url = this.baseURL + '/' + panel;
+    var editor = this;
+
+    var url = editor.baseURL + '/' + panel;
     if (query == null) {
         query = {};
     }
     var d = doSimpleXMLHttpRequest(url, query);
     d.addCallbacks(
         function(result) {
-            this.editor.sidebar.innerHTML = result.responseText;
+            editor.sidebar.innerHTML = result.responseText;
             return result;
         }, alert);
+    d.addCallbacks(function(result)
+        { return editor._parse_panel_links(result); }, alert);
     return d;
-}
+};
+
+/* General link parsing.
+
+   I use special protocol names to mark up loading certain panels. This is the
+   generalization.
+
+*/
+
+Editor.prototype._parse_panel_links = function(result) {
+    var editor = this;
+
+    var protocols = Array(
+        Array("activity", "loadActivityDetailsPanel"),
+         Array("edit-activity", "loadActivityEditPanel")
+        ); 
+
+    links = getElementsByTagAndClassName('a', null, parent=editor.sidebar);
+
+
+    forEach(links, function(link) {
+        forEach(protocols, function(protocol) {
+            /* This function is partially programming by accident. The
+             * behaviour of regexp is kind of weird. 
+             */
+            var match = link.href.match(/^(.*):\/\//)
+            if (match) {
+                if (match[1] == protocol[0]) {
+                    link.activity = link.href.replace(/^(.*):\/\//, "");
+                    link.href = "#";
+                    connect(link, "onclick", editor, protocol[1]);
+                }
+            }
+        }); 
+    }); 
+};
 
-/* ACTIVITY LIST */
+/* Activity listing */
 
 Editor.prototype.loadActivityPanel = function() {
     var editor = this;
     var d = editor._loadPanel('activitypanel');
     d.addCallback(function (result) {
-      /* Connect the activity links to the "loadEditor" panel */
-      activities = getElementsByTagAndClassName('a', null,
parent=editor.sidebar);
-      forEach(activities, function(x) {
-          x.activity = x.href.replace(/activity:\/\//, "");
-          x.href = "#";
-          connect(x, 'onclick', editor, 'loadEditActivityPanel');
-      });
-      connect('addActivity', 'onclick', editor, 'submitAddActivityForm');
+        connect('addActivity', 'onclick', editor, 'submitAddActivityForm');
     });
-}
+};
 
 Editor.prototype.submitAddActivityForm = function() {
     var editor = this;
(at)(at) -46,10 +80,23 (at)(at)
         function() {editor.loadActivityPanel();});
 };
 
+/* Activity details */
+
+Editor.prototype.loadActivityDetailsPanel = function(activity_link) {
+    var editor = this;
+
+    activity = activity_link.src().activity;
+    editor.activity = activity;
+    var d = editor._loadPanel(activity+'/activity_details');
+
+    editor.reloadCanvas(activity);
+    return false;
+}
+
 
-/* EDIT ACTIVITY */
+/* Activity edit form */
 
-Editor.prototype.loadEditActivityPanel = function(activity_link) {
+Editor.prototype.loadActivityEditPanel = function(activity_link) {
     var editor = this;
 
     activity = activity_link.src().activity;
(at)(at) -62,7 +109,6 (at)(at)
 }
 
 Editor.prototype.initEditActivityPanel = function() { 
-    connect('closeEditPane', 'onclick', this, 'loadActivityPanel');
     connect('submitForm', 'onclick', this, 'submitEditActivityForm');
 }
 

Added: AlphaFlow/trunk/editor/resources/images/bodybg.png
==============================================================================
Binary file. No diff available.

Added: AlphaFlow/trunk/editor/resources/images/errorbg.png
==============================================================================
Binary file. No diff available.

Modified: AlphaFlow/trunk/editor/resources/style.css
==============================================================================
--- AlphaFlow/trunk/editor/resources/style.css	(original)
+++ AlphaFlow/trunk/editor/resources/style.css	Sun May  6 15:06:35 2007
(at)(at) -23,10 +23,11 (at)(at)
    padding: 0.5em;
    padding-left:1.5em;
    background-image: url("++resource++images/headerbg.png");
-   margin-bottom:0.5em;
+   background-repeat: repeat-x;
 }
 
 #container {
+   padding-top:0.5em;
 }
 
 #sidepane {
(at)(at) -39,6 +40,21 (at)(at)
    padding: 1em;
 }
 
+.box {
+   background-image: url("++resource++images/bodybg.png");
+   background-repeat: repeat-x;
+}
+
+.errorbox {
+   background-image: url("++resource++images/errorbg.png");
+   background-repeat: repeat-x;
+}
+
+#activityOverview h3 {
+  font-size:120%;
+  padding:0.2em 0.5em;
+}
+
 /* Form styling */
 
 .field {
(at)(at) -47,8 +63,6 (at)(at)
 }
 
 .form-status {
-  background:#EEE;
-  border:1px solid red;
   padding:0.5em 1em;
   margin-right:-1em;
 }
(at)(at) -81,3 +95,5 (at)(at)
 textarea {
   font-size:100%;
 }
+
+

SVN: r4772 - in AlphaFlow/trunk/editor: . resources resources/images
Christian Theune <ct(at)gocept.com>
2007-05-06 18:23:12 [ FULL ]
Author: ctheune
Date: Sun May  6 18:23:09 2007
New Revision: 4772

Log:
Snapshot. On the way to allow adding exits and some more style.



Added:
   AlphaFlow/trunk/editor/ntask.py   (contents, props changed)
   AlphaFlow/trunk/editor/resources/images/bodybg2.png   (contents, props
changed)
   AlphaFlow/trunk/editor/resources/images/headerbg2.png   (contents, props
changed)
Modified:
   AlphaFlow/trunk/editor/activity.pt
   AlphaFlow/trunk/editor/activity_details.pt
   AlphaFlow/trunk/editor/configure.zcml
   AlphaFlow/trunk/editor/resources/images/headerbg.png
   AlphaFlow/trunk/editor/resources/style.css

Modified: AlphaFlow/trunk/editor/activity.pt
==============================================================================
--- AlphaFlow/trunk/editor/activity.pt	(original)
+++ AlphaFlow/trunk/editor/activity.pt	Sun May  6 18:23:09 2007
(at)(at) -6,6 +6,16 (at)(at)
   tal:attributes="action python:request.URL"
   method="post">
 
+  <div
+      tal:define="id python:context.getId()">
+    <h2><span tal:replace="python:context.activity_type"/>: 
+      &#8220;<span tal:content="python:context.title"/>&#8221;
+
+      (<a tal:attributes="href
+        string:activity://$id">Back</a>)
+    </h2>
+  </div>
+
   <div class="form-status errorbox"
     tal:define="status python:view.status"
     tal:condition="status">

Modified: AlphaFlow/trunk/editor/activity_details.pt
==============================================================================
--- AlphaFlow/trunk/editor/activity_details.pt	(original)
+++ AlphaFlow/trunk/editor/activity_details.pt	Sun May  6 18:23:09 2007
(at)(at) -1,35 +1,51 (at)(at)
 <div id="activityOverview">
 
-  <div class="box"
-    tal:define="checkpoint context/CHECKPOINT_START">
-    <h3>When this activity starts ... </h3>
-    <metal:block define-macro="checkpoint">
-      <p tal:condition="checkpoint/activities">... start those
activities: 
-        <a tal:attributes="href string:activity://$activity"
-          tal:repeat="activity checkpoint/activities"
-          tal:content="activity"/>
-      </p>
-    </metal:block>
+  <div>
+    <h2><span tal:replace="context/activity_type"/>: 
+      &#8220;<span tal:content="context/title"/>&#8221;
+
+      (<a tal:attributes="href
+        string:edit-activity://${context/getId}">Edit</a>)
+    </h2>
+    <p>fhdaskjhfkdjs</p>
   </div>
 
   <div class="box">
-    <h3 tal:content="context/title"></h3>
-    <p><a tal:attributes="href
-        string:edit-activity://${context/getId}">Edit</a></p>
-  </div>
+    <h3>Exits
+      <a href="#"
tal:condition="nocall:context/(at)(at)add_exit|nothing">
+        (New)
+      </a>
+    </h3>
 
-  <div style="padding-left:1em;">
     <tal:block repeat="checkpoint context/getExits">
-      <div class="box">
-        <h3>Exit: <span
tal:content="checkpoint/getId"/></h3>
+      <div>
+        <h3 tal:content="checkpoint/getId"/>
         <metal:block use-macro="template/macros/checkpoint"/>
       </div>
     </tal:block>
+
   </div>
 
-  <div class="box"
+  <div class="box2"
+    tal:define="checkpoint context/CHECKPOINT_START">
+    <h3>When this activity starts ... (<a
href="checkpoint://">Edit</a>)</h3>
+    <metal:block define-macro="checkpoint">
+      <ol>
+        <li tal:condition="checkpoint/activities">Start the activities: 
+          <a tal:attributes="href string:activity://$activity"
+            tal:repeat="activity checkpoint/activities"
+            tal:content="activity"/>
+        </li>
+        <li tal:repeat="aspect checkpoint/objectValues"
+          tal:content="aspect/aspect_type"></li>
+      </ol>
+    </metal:block>
+  </div>
+
+
+  <div class="box2"
     tal:define="checkpoint context/CHECKPOINT_COMPLETE">
-    <h3>When this activity ends ... </h3>
+    <h3>When this activity ends ... (<a
href="checkpoint://">Edit</a>)</h3>
     <metal:block use-macro="template/macros/checkpoint"/>
   </div>
 

Modified: AlphaFlow/trunk/editor/configure.zcml
==============================================================================
--- AlphaFlow/trunk/editor/configure.zcml	(original)
+++ AlphaFlow/trunk/editor/configure.zcml	Sun May  6 18:23:09 2007
(at)(at) -102,6 +102,14 (at)(at)
     permission="zope2.View"
     />
 
+  <!-- Adding exits -->
+  <browser:page
+    for="Products.AlphaFlow.activities.interfaces.INTaskActivity"
+    class=".ntask.AddExit"
+    name="add_exit"
+    permission="zope2.View"
+    />
+
   <!-- Resources -->
   <browser:resource
     name="style.css"

Added: AlphaFlow/trunk/editor/ntask.py
==============================================================================
--- (empty file)
+++ AlphaFlow/trunk/editor/ntask.py	Sun May  6 18:23:09 2007
(at)(at) -0,0 +1,22 (at)(at)
+# -*- coding: latin-1 -*-
+# Copyright (c) 2007 gocept gmbh & co. kg
+# See also LICENSE.txt
+# $Id$
+"""Editor support for the NTask."""
+
+import AccessControl
+import Globals
+
+import Products.Five
+
+
+class AddExit(Products.Five.BrowserView):
+
+    security = AccessControl.ClassSecurityInfo()
+
+    security.declareProtected(
+        Products.AlphaFlow.config.MANAGE_WORKFLOW, '__call__')
+    def __call__(self):
+        pass
+
+Globals.InitializeClass(AddExit)

Added: AlphaFlow/trunk/editor/resources/images/bodybg2.png
==============================================================================
Binary file. No diff available.

Modified: AlphaFlow/trunk/editor/resources/images/headerbg.png
==============================================================================
Binary files. No diff available.

Added: AlphaFlow/trunk/editor/resources/images/headerbg2.png
==============================================================================
Binary file. No diff available.

Modified: AlphaFlow/trunk/editor/resources/style.css
==============================================================================
--- AlphaFlow/trunk/editor/resources/style.css	(original)
+++ AlphaFlow/trunk/editor/resources/style.css	Sun May  6 18:23:09 2007
(at)(at) -1,53 +1,58 (at)(at)
 body {
-   margin:0;
-   padding: 0;
-   font-family: "Lucida Grande",Verdana,Lucida,Helvetica,Arial,sans-serif;
-   font-size-adjust: none;
-   font-size: 69%;
-   line-height:1.5em;
+  margin:0;
+  padding: 0;
+  font-family: "Lucida Grande",Verdana,Lucida,Helvetica,Arial,sans-serif;
+  font-size-adjust: none;
+  font-size: 69%;
+  line-height:1.5em;
 }
 
 * {
-   font-family: "Lucida Grande",Verdana,Lucida,Helvetica,Arial,sans-serif;
+  font-family: "Lucida Grande",Verdana,Lucida,Helvetica,Arial,sans-serif;
 }
 
 h1 {
-   font-size: 150%;
+  font-size: 150%;
 }
 
 h2 {
-   font-size: 100%;
+  font-size: 100%;
 }
 
 #header {
-   padding: 0.5em;
-   padding-left:1.5em;
-   background-image: url("++resource++images/headerbg.png");
-   background-repeat: repeat-x;
+  padding: 0.5em;
+  padding-left:1.5em;
+  background-image: url("++resource++images/headerbg.png");
+  background-repeat: repeat-x;
 }
 
 #container {
-   padding-top:0.5em;
+  padding-top:0.5em;
 }
 
 #sidepane {
-   padding: 0.5em;
-   float:left;
+  padding: 0.5em;
+  float:left;
 }
 
 #graph {
-   float: right;
-   padding: 1em;
+  float: right;
+  padding: 1em;
 }
 
 .box {
-   background-image: url("++resource++images/bodybg.png");
-   background-repeat: repeat-x;
+  background-image: url("++resource++images/bodybg.png");
+  background-repeat: repeat-x;
+}
+
+.box2 {
+  background-image: url("++resource++images/bodybg2.png");
+  background-repeat: repeat-x;
 }
 
 .errorbox {
-   background-image: url("++resource++images/errorbg.png");
-   background-repeat: repeat-x;
+  background-image: url("++resource++images/errorbg.png");
+  background-repeat: repeat-x;
 }
 
 #activityOverview h3 {
(at)(at) -55,6 +60,14 (at)(at)
   padding:0.2em 0.5em;
 }
 
+#activityOverview h2, .edit-form h2 {
+  font-size:140%;
+  background-image: url("++resource++images/headerbg2.png");
+  background-repeat: repeat-x;
+  padding:0.2em 0.5em;
+}
+
+
 /* Form styling */
 
 .field {

SVN: r4775 - in AlphaFlow/trunk: . adapters editor editor/resources
Christian Theune <ct(at)gocept.com>
2007-05-06 19:41:13 [ FULL ]
Author: ctheune
Date: Sun May  6 19:41:08 2007
New Revision: 4775

Log:
 - snapshot on checkpoint work
 - integrated image-map support while waiting for checkpoints to be repaired.



Modified:
   AlphaFlow/trunk/adapters/renderableadapter.py
   AlphaFlow/trunk/editor/activity_details.pt
   AlphaFlow/trunk/editor/configure.zcml
   AlphaFlow/trunk/editor/editor.py
   AlphaFlow/trunk/editor/index.pt
   AlphaFlow/trunk/editor/ntask.py
   AlphaFlow/trunk/editor/resources/editor.js
   AlphaFlow/trunk/interfaces.py

Modified: AlphaFlow/trunk/adapters/renderableadapter.py
==============================================================================
--- AlphaFlow/trunk/adapters/renderableadapter.py	(original)
+++ AlphaFlow/trunk/adapters/renderableadapter.py	Sun May  6 19:41:08 2007
(at)(at) -50,6 +50,8 (at)(at)
             if value:
                 attributes[key] = value
 
+        attributes["URL"] = "activity://%s" % self.activity.getId()
+
         if self.inverse_recursions:
             self.record_cells.append("\\n".join(["recursive:"] +
                                                 self.inverse_recursions))
(at)(at) -321,6 +323,10 (at)(at)
     return image_data
 
 
+def dot2map(graph):
+    "Convert the graph to an image map"
+    return dotTheGraph(graph, 'cmapx')
+
 def dot2svg(graph):
     "Convert the graph to SVG format."
     svg = dotTheGraph(graph, 'svg')
(at)(at) -383,10 +389,12 (at)(at)
 
 dot_to_format = DictWithDefault()
 dot_to_format['svg'] = dot2svg
+dot_to_format['map'] = dot2map
 dot_to_format.setdefault('gif', dot2gif)
 
 format_contenttype = DictWithDefault()
 format_contenttype['svg'] = 'text/xml'
+format_contenttype['map'] = 'text/xml'
 format_contenttype.setdefault('gif', 'image/gif')
 
 class RenderableAdapter(adapter.Adapter):

Modified: AlphaFlow/trunk/editor/activity_details.pt
==============================================================================
--- AlphaFlow/trunk/editor/activity_details.pt	(original)
+++ AlphaFlow/trunk/editor/activity_details.pt	Sun May  6 19:41:08 2007
(at)(at) -36,8 +36,8 (at)(at)
             tal:repeat="activity checkpoint/activities"
             tal:content="activity"/>
         </li>
-        <li tal:repeat="aspect checkpoint/objectValues"
-          tal:content="aspect/aspect_type"></li>
+        <li tal:repeat="aspect checkpoint/objectValues">
+          <span tal:replace="aspect/aspect_type"/> (<a
tal:attributes="href
string:aspect://${aspect/getId}">Edit</a>)</li>
       </ol>
     </metal:block>
   </div>
(at)(at) -45,7 +45,7 (at)(at)
 
   <div class="box2"
     tal:define="checkpoint context/CHECKPOINT_COMPLETE">
-    <h3>When this activity ends ... (<a
href="checkpoint://">Edit</a>)</h3>
+    <h3>When this activity ends ... (<a tal:attributes="href
string:checkpoint://${checkpoint/getId}">Edit</a>)</h3>
     <metal:block use-macro="template/macros/checkpoint"/>
   </div>
 

Modified: AlphaFlow/trunk/editor/configure.zcml
==============================================================================
--- AlphaFlow/trunk/editor/configure.zcml	(original)
+++ AlphaFlow/trunk/editor/configure.zcml	Sun May  6 19:41:08 2007
(at)(at) -24,6 +24,14 (at)(at)
 
   <browser:page
     for="Products.AlphaFlow.interfaces.IProcess"
+    class=".editor.Graph"
+    permission="zope2.View"
+    name="map"
+    attribute="getMap"
+    />
+
+  <browser:page
+    for="Products.AlphaFlow.interfaces.IProcess"
     class=".editor.AddActivity"
     name="add_activity"
     permission="zope2.View"

Modified: AlphaFlow/trunk/editor/editor.py
==============================================================================
--- AlphaFlow/trunk/editor/editor.py	(original)
+++ AlphaFlow/trunk/editor/editor.py	Sun May  6 19:41:08 2007
(at)(at) -115,5 +115,11 (at)(at)
         return pm.renderProcess(self.context.id, kind='minimal',
                                 REQUEST=self.request)
 
+    def getMap(self):
+        """Returns map data for this process"""
+        pm = Products.CMFCore.utils.getToolByName(self, 'workflow_manager')
+        return pm.renderProcess(self.context.id, kind='minimal', format="map",
+                                REQUEST=self.request)
+
 
 Globals.InitializeClass(Graph)

Modified: AlphaFlow/trunk/editor/index.pt
==============================================================================
--- AlphaFlow/trunk/editor/index.pt	(original)
+++ AlphaFlow/trunk/editor/index.pt	Sun May  6 19:41:08 2007
(at)(at) -59,7 +59,8 (at)(at)
       </div>
 
       <div id="graph">
-        <img tal:attributes="src
string:${context/(at)(at)absolute_url}/(at)(at)graph" />
+        <img tal:attributes="src
string:${context/(at)(at)absolute_url}/(at)(at)graph"
+          usemap="#G" />
       </div>
 
       <div style="clear:both">
(at)(at) -67,5 +68,10 (at)(at)
 
     </div>
 
+    <!-- The map goes to the end. -->
+    <div id="map">
+      <map name="G"/>
+    </div>
+
   </body>
 </html>

Modified: AlphaFlow/trunk/editor/ntask.py
==============================================================================
--- AlphaFlow/trunk/editor/ntask.py	(original)
+++ AlphaFlow/trunk/editor/ntask.py	Sun May  6 19:41:08 2007
(at)(at) -17,6 +17,7 (at)(at)
     security.declareProtected(
         Products.AlphaFlow.config.MANAGE_WORKFLOW, '__call__')
     def __call__(self):
-        pass
+        exit = Products.AlphaFlow.interfaces.IExitDefinition(self.context)
+
 
 Globals.InitializeClass(AddExit)

Modified: AlphaFlow/trunk/editor/resources/editor.js
==============================================================================
--- AlphaFlow/trunk/editor/resources/editor.js	(original)
+++ AlphaFlow/trunk/editor/resources/editor.js	Sun May  6 19:41:08 2007
(at)(at) -7,6 +7,8 (at)(at)
     this.canvas = getElement('graph');
     this.canvas_img = getFirstElementByTagAndClassName('img', '',
this.contentElement);
     this.canvas_url = this.canvas_img.src;
+    this.map = $('map');
+    this.reloadCanvas();
 
     connect('title', 'onclick', this, 'loadActivityPanel');
 };
(at)(at) -41,11 +43,12 (at)(at)
 
     var protocols = Array(
         Array("activity", "loadActivityDetailsPanel"),
-         Array("edit-activity", "loadActivityEditPanel")
-        ); 
+        Array("edit-activity", "loadActivityEditPanel")
+    );
 
     links = getElementsByTagAndClassName('a', null, parent=editor.sidebar);
-
+    links = links.concat(getElementsByTagAndClassName('area', null,
+                                                      parent=editor.map));
 
     forEach(links, function(link) {
         forEach(protocols, function(protocol) {
(at)(at) -117,7 +120,8 (at)(at)
     var editor = this;
     this._submit_form('zc.page.browser_form',
         function(result) {
-            pane.innerHTML = result.responseText
+            pane.innerHTML = result.responseText;
+            editor._parse_panel_links();    /* XXX This is a hint that the
architecture is a little flawed. */
             editor.initEditActivityPanel();
             editor.reloadCanvas(editor.activity);
         });
(at)(at) -143,12 +147,25 (at)(at)
 
 
 Editor.prototype.reloadCanvas = function(highlight) {
+    var editor = this;
+
     if (highlight!=null) {
         query = queryString(['highlight'], ['highlight']);
     } else {
         query = '';
     }
-    this.canvas_img.src = this.canvas_url + '?' + (new Date()).getTime() +
query;
+    editor.canvas_img.src = editor.canvas_url + '?' + (new Date()).getTime() +
query;
+
+    /* Reload the image map */
+    var url = editor.baseURL + '/(at)(at)map?' + (new Date()).getTime();
+
+    var d = doSimpleXMLHttpRequest(url);
+    d.addCallbacks(
+        function(result) {
+            editor.map.innerHTML = result.responseText;
+            editor._parse_panel_links()
+            return result;
+        }, alert);
 }
 
 var editor;

Modified: AlphaFlow/trunk/interfaces.py
==============================================================================
--- AlphaFlow/trunk/interfaces.py	(original)
+++ AlphaFlow/trunk/interfaces.py	Sun May  6 19:41:08 2007
(at)(at) -296,6 +296,8 (at)(at)
 class IAspectDefinition(zope.interface.Interface):
     """Configuration data for an aspect."""
 
+    title = zope.schema.TextLine(title=u"Title")
+
 
 class ICheckpointDefinition(zope.interface.Interface):

SVN: r4779 - in AlphaFlow/trunk: . editor editor/resources
Christian Theune <ct(at)gocept.com>
2007-05-06 20:28:08 [ FULL ]
Author: ctheune
Date: Sun May  6 20:28:04 2007
New Revision: 4779

Log:
 - more work on making checkpoints editable



Added:
   AlphaFlow/trunk/editor/checkpoint.pt   (contents, props changed)
   AlphaFlow/trunk/editor/form.py
      - copied, changed from r4778, AlphaFlow/trunk/editor/activity.py
Removed:
   AlphaFlow/trunk/editor/activity.py
Modified:
   AlphaFlow/trunk/__init__.py
   AlphaFlow/trunk/editor/activity_details.pt
   AlphaFlow/trunk/editor/activitypanel.pt
   AlphaFlow/trunk/editor/configure.zcml
   AlphaFlow/trunk/editor/resources/editor.js
   AlphaFlow/trunk/editor/resources/style.css
   AlphaFlow/trunk/interfaces.py
   AlphaFlow/trunk/utils.py

Modified: AlphaFlow/trunk/__init__.py
==============================================================================
--- AlphaFlow/trunk/__init__.py	(original)
+++ AlphaFlow/trunk/__init__.py	Sun May  6 20:28:04 2007
(at)(at) -4,6 +4,7 (at)(at)
 """Zope initialization code"""
 
 from AccessControl import ModuleSecurityInfo
+from AccessControl.Permission import registerPermissions
 
 from Products.CMFCore import utils as cmfcoreutils
 from Products.CMFCore import DirectoryView
(at)(at) -11,13 +12,8 (at)(at)
 from App.ImageFile import ImageFile
 
 from Products.AlphaFlow import config
-from Products.AlphaFlow.utils import registerPermission
 
 
-#patch
-
-from Products.AlphaFlow import patch_plone_types
-
 misc_ = { 'zopestyle.css':ImageFile('www/zopestyle.css.dtml',
                                     globals()),
           'valid_error.gif':ImageFile('www/exclamation.gif',
(at)(at) -29,9 +25,12 (at)(at)
          }
 
 
+def registerPermission(permission, default_roles):
+    registerPermissions([(permission, [])], default_roles)
+
+
 def initialize_permissions(context):
-    registerPermission(config.CONTROL_PROCESS,
-        ('Manager', 'Owner'))
+    registerPermission(config.CONTROL_PROCESS, ('Manager', 'Owner'))
 
 
 def initialize_content(context):
(at)(at) -83,6 +82,8 (at)(at)
 
 
 def initialize(context):
+    from Products.AlphaFlow import patch_plone_types
+
     DirectoryView.registerDirectory(config.SKINS_DIR, config.GLOBALS)
     initialize_permissions(context)
     initialize_tools(context)

Modified: AlphaFlow/trunk/editor/activity_details.pt
==============================================================================
--- AlphaFlow/trunk/editor/activity_details.pt	(original)
+++ AlphaFlow/trunk/editor/activity_details.pt	Sun May  6 20:28:04 2007
(at)(at) -28,7 +28,8 (at)(at)
 
   <div class="box2"
     tal:define="checkpoint context/CHECKPOINT_START">
-    <h3>When this activity starts ... (<a
href="checkpoint://">Edit</a>)</h3>
+    <h3>When this activity starts ... (<a tal:attributes="href
+        string:checkpoint://${checkpoint/getId}">Edit</a>)</h3>
     <metal:block define-macro="checkpoint">
       <ol>
         <li tal:condition="checkpoint/activities">Start the activities: 

Modified: AlphaFlow/trunk/editor/activitypanel.pt
==============================================================================
--- AlphaFlow/trunk/editor/activitypanel.pt	(original)
+++ AlphaFlow/trunk/editor/activitypanel.pt	Sun May  6 20:28:04 2007
(at)(at) -1,5 +1,8 (at)(at)
 <div class="ActivitiesPanel">
-  <h2>Activities</h2>
+
+  <div>
+    <h2>Activities</h2>
+
   <table>
     <tr tal:repeat="activity view/listProcessActivities">
       <td>

Added: AlphaFlow/trunk/editor/checkpoint.pt
==============================================================================
--- (empty file)
+++ AlphaFlow/trunk/editor/checkpoint.pt	Sun May  6 20:28:04 2007
(at)(at) -0,0 +1,76 (at)(at)
+<form
+  action="."
+  id="zc.page.browser_form"
+  class="edit-form" 
+  enctype="multipart/form-data"
+  tal:attributes="action python:request.URL"
+  method="post">
+
+  <div
+      tal:define="id python:context.getId()">
+    <h2><span tal:replace="id"/>: 
+      &#8220;<span tal:content="python:context.title"/>&#8221;
+
+      (<a href="#">Back</a>)
+    </h2>
+  </div>
+
+  <div class="form-status errorbox"
+    tal:define="status python:view.status"
+    tal:condition="status">
+
+    <div class="summary"
+      i18n:translate=""
+      tal:content="status">
+      Form status summary
+    </div>
+
+    <ul class="errors" tal:condition="python:view.errors">
+      <li tal:repeat="error python:view.error_views()">
+        <span tal:replace="structure error">Error Type</span>
+      </li>
+    </ul>
+  </div>
+
+  <div
+    class="field"
+    tal:repeat="widget python:list(view.widgets)">
+
+    <div class="label">
+      <label tal:attributes="for python:widget.name">
+        <span tal:content="python:widget.label">
+          label
+        </span>
+      </label>
+    </div>
+
+    <div class="hint"
+      i18n:translate=""
+      tal:define="hint python:widget.hint"
+      tal:content="hint"
+      tal:condition="hint">
+      Title of this content object.
+    </div>
+
+    <div class="error"
+      tal:condition="python:widget.error()">
+      <span tal:replace="structure python:widget.error()">
+        error
+      </span>
+    </div>
+
+    <div class="widget" tal:content="structure widget">
+        Widget goes here
+    </div>
+
+
+  </div>
+
+  <div id="actionsView">
+    <span class="actionButtons">
+      <input type="button" class="button" name="form.actions.apply"
+        id="submitForm" value="Save" />
+    </span>
+  </div>
+
+</form>

Modified: AlphaFlow/trunk/editor/configure.zcml
==============================================================================
--- AlphaFlow/trunk/editor/configure.zcml	(original)
+++ AlphaFlow/trunk/editor/configure.zcml	Sun May  6 20:28:04 2007
(at)(at) -56,60 +56,67 (at)(at)
   <!-- The various activity edit views -->
   <browser:page
     for="Products.AlphaFlow.activities.interfaces.IExpressionActivity"
-    class=".activity.EditExpressionActivity"
+    class=".form.EditExpressionActivity"
     name="edit_activity"
     permission="zope2.View"
     />
 
   <browser:page
     for="Products.AlphaFlow.activities.interfaces.IAlarmActivity"
-    class=".activity.EditAlarmActivity"
+    class=".form.EditAlarmActivity"
     name="edit_activity"
     permission="zope2.View"
     />
 
   <browser:page
     for="Products.AlphaFlow.activities.interfaces.IDecisionActivity"
-    class=".activity.EditDecisionActivity"
+    class=".form.EditDecisionActivity"
     name="edit_activity"
     permission="zope2.View"
     />
 
   <browser:page
     for="Products.AlphaFlow.activities.interfaces.IConfigurationActivity"
-    class=".activity.EditConfigurationActivity"
+    class=".form.EditConfigurationActivity"
     name="edit_activity"
     permission="zope2.View"
     />
 
   <browser:page
     for="Products.AlphaFlow.activities.interfaces.ISwitchActivity"
-    class=".activity.EditSwitchActivity"
+    class=".form.EditSwitchActivity"
     name="edit_activity"
     permission="zope2.View"
     />
 
   <browser:page
     for="Products.AlphaFlow.activities.interfaces.INTaskActivity"
-    class=".activity.EditNTaskActivity"
+    class=".form.EditNTaskActivity"
     name="edit_activity"
     permission="zope2.View"
     />
 
   <browser:page
     for="Products.AlphaFlow.activities.interfaces.IRouteActivity"
-    class=".activity.EditRouteActivity"
+    class=".form.EditRouteActivity"
     name="edit_activity"
     permission="zope2.View"
     />
 
   <browser:page
     for="Products.AlphaFlow.activities.interfaces.IEMailActivity"
-    class=".activity.EditEMailActivity"
+    class=".form.EditEMailActivity"
     name="edit_activity"
     permission="zope2.View"
     />
 
+  <browser:page
+    for="Products.AlphaFlow.interfaces.ICheckpointDefinition"
+    name="edit_checkpoint"
+    permission="zope2.View"
+    class=".form.EditCheckpoint"
+    />
+
   <!-- Adding exits -->
   <browser:page
     for="Products.AlphaFlow.activities.interfaces.INTaskActivity"

Copied: AlphaFlow/trunk/editor/form.py (from r4778,
AlphaFlow/trunk/editor/activity.py)
==============================================================================
--- AlphaFlow/trunk/editor/activity.py	(original)
+++ AlphaFlow/trunk/editor/form.py	Sun May  6 20:28:04 2007
(at)(at) -17,6 +17,7 (at)(at)
 from zope.app.i18n import ZopeMessageFactory as _
 
 import Products.AlphaFlow.activities.interfaces
+import Products.AlphaFlow.interfaces
 from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile
 
 # taken and adapted from zope.publisher.browser.BrowserRequest
(at)(at) -142,3 +143,11 (at)(at)
 
     form_fields = zope.formlib.form.FormFields(
         Products.AlphaFlow.activities.interfaces.IEMailActivity)
+
+
+class EditCheckpoint(EditForm):
+
+    template = ViewPageTemplateFile('checkpoint.pt')
+
+    form_fields = zope.formlib.form.FormFields(
+        Products.AlphaFlow.interfaces.ICheckpointDefinition)

Modified: AlphaFlow/trunk/editor/resources/editor.js
==============================================================================
--- AlphaFlow/trunk/editor/resources/editor.js	(original)
+++ AlphaFlow/trunk/editor/resources/editor.js	Sun May  6 20:28:04 2007
(at)(at) -13,6 +13,8 (at)(at)
     connect('title', 'onclick', this, 'loadActivityPanel');
 };
 
+/******************** Helper functions *****************************/
+
 Editor.prototype._loadPanel = function(panel, query) {
     var editor = this;
 
(at)(at) -31,6 +33,24 (at)(at)
     return d;
 };
 
+
+Editor.prototype._submit_form = function(form, callback) {
+    /* Generic helper function for submitting a form. */
+    var form = getElement(form);
+    var data = map(function(element) {
+            return element.name + "=" + encodeURIComponent(element.value)
+        }, form.elements);
+    data = data.join('&');
+    var d = doXHR(form.getAttribute('action'), {
+        'method': 'POST',
+        'headers': {
+            'Content-Type': 'application/x-www-form-urlencoded'},
+        'sendContent': data});
+    d.addCallbacks(callback, alert);
+}
+
+
+
 /* General link parsing.
 
    I use special protocol names to mark up loading certain panels. This is the
(at)(at) -43,7 +63,8 (at)(at)
 
     var protocols = Array(
         Array("activity", "loadActivityDetailsPanel"),
-        Array("edit-activity", "loadActivityEditPanel")
+        Array("edit-activity", "loadActivityEditPanel"),
+        Array("checkpoint", "loadCheckpointEditPanel")
     );
 
     links = getElementsByTagAndClassName('a', null, parent=editor.sidebar);
(at)(at) -58,7 +79,7 (at)(at)
             var match = link.href.match(/^(.*):\/\//)
             if (match) {
                 if (match[1] == protocol[0]) {
-                    link.activity = link.href.replace(/^(.*):\/\//, "");
+                    link.reference = link.href.replace(/^(.*):\/\//, "");
                     link.href = "#";
                     connect(link, "onclick", editor, protocol[1]);
                 }
(at)(at) -67,6 +88,8 (at)(at)
     }); 
 };
 
+/******************** Actual business functions ************************/
+
 /* Activity listing */
 
 Editor.prototype.loadActivityPanel = function() {
(at)(at) -88,7 +111,7 (at)(at)
 Editor.prototype.loadActivityDetailsPanel = function(activity_link) {
     var editor = this;
 
-    activity = activity_link.src().activity;
+    activity = activity_link.src().reference;
     editor.activity = activity;
     var d = editor._loadPanel(activity+'/activity_details');
 
(at)(at) -102,7 +125,7 (at)(at)
 Editor.prototype.loadActivityEditPanel = function(activity_link) {
     var editor = this;
 
-    activity = activity_link.src().activity;
+    activity = activity_link.src().reference;
     editor.activity = activity;
     var d = editor._loadPanel(activity+'/edit_activity');
     d.addCallback(function() {editor.initEditActivityPanel();});
(at)(at) -111,37 +134,54 (at)(at)
     return false;
 }
 
+
 Editor.prototype.initEditActivityPanel = function() { 
     connect('submitForm', 'onclick', this, 'submitEditActivityForm');
 }
 
+
 Editor.prototype.submitEditActivityForm = function() {
     var pane = this.sidebar;
     var editor = this;
     this._submit_form('zc.page.browser_form',
         function(result) {
             pane.innerHTML = result.responseText;
-            editor._parse_panel_links();    /* XXX This is a hint that the
architecture is a little flawed. */
+            /* XXX This is a hint that the architecture is a little flawed. */
+            editor._parse_panel_links();    
             editor.initEditActivityPanel();
             editor.reloadCanvas(editor.activity);
         });
 }
 
-Editor.prototype._submit_form = function(form, callback) {
-    /* Generic helper function for submitting a form. */
-    var form = getElement(form);
-    var data = map(function(element) {
-            return element.name + "=" + encodeURIComponent(element.value)
-        }, form.elements);
-    data = data.join('&');
-    var d = doXHR(form.getAttribute('action'), {
-        'method': 'POST',
-        'headers': {
-            'Content-Type': 'application/x-www-form-urlencoded'},
-        'sendContent': data});
-    d.addCallbacks(callback, alert);
+/* Checkpoint edit form */
+
+Editor.prototype.loadCheckpointEditPanel = function(checkpoint) {
+    var editor = this;
+
+    editor.checkpoint = checkpoint.src().reference;
+    var d = editor._loadPanel(editor.activity+'/'+editor.checkpoint+
+                              '/edit_checkpoint');
+    d.addCallback(function() {editor.initEditCheckpointPanel();});
+    return false;
+}
+
+Editor.prototype.initEditCheckpointPanel = function() {
+    var editor = this;
+    connect('submitForm', 'onclick', editor, 'submitEditCheckpointForm');
 }
 
+Editor.prototype.submitEditCheckpointForm = function() {
+    var pane = this.sidebar;
+    var editor = this;
+    this._submit_form('zc.page.browser_form',
+        function(result) {
+            pane.innerHTML = result.responseText;
+            /* XXX This is a hint that the architecture is a little flawed. */
+            editor._parse_panel_links();
+            editor.initEditCheckpointPanel();
+            editor.reloadCanvas(editor.activity);
+        });
+}
 
 /* Workflow graph */
 

Modified: AlphaFlow/trunk/editor/resources/style.css
==============================================================================
--- AlphaFlow/trunk/editor/resources/style.css	(original)
+++ AlphaFlow/trunk/editor/resources/style.css	Sun May  6 20:28:04 2007
(at)(at) -18,7 +18,10 (at)(at)
 }
 
 h2 {
-  font-size: 100%;
+  font-size:140%;
+  background-image: url("++resource++images/headerbg2.png");
+  background-repeat: repeat-x;
+  padding:0.2em 0.5em;
 }
 
 #header {
(at)(at) -62,13 +65,6 (at)(at)
   padding:0.2em 0.5em;
 }
 
-#activityOverview h2, .edit-form h2 {
-  font-size:140%;
-  background-image: url("++resource++images/headerbg2.png");
-  background-repeat: repeat-x;
-  padding:0.2em 0.5em;
-}
-
 
 /* Form styling */
 

Modified: AlphaFlow/trunk/interfaces.py
==============================================================================
--- AlphaFlow/trunk/interfaces.py	(original)
+++ AlphaFlow/trunk/interfaces.py	Sun May  6 20:28:04 2007
(at)(at) -10,6 +10,7 (at)(at)
 
 import zope.app.event.interfaces
 
+import Products.AlphaFlow.sources
 
 ############
 # management
(at)(at) -301,7 +302,12 (at)(at)
 
 class ICheckpointDefinition(zope.interface.Interface):
 
-    activities = zope.interface.Attribute("List of activity ids to start.")
+    activities = zope.schema.List(
+        title=u"Start activities",
+        description=u"Select the activities that should be started when this "
+                    u"checkpoint is passed.",
+        value_type=zope.schema.Choice(
+            source=Products.AlphaFlow.sources.ActivitySource()))
 
 
 class IExitDefinition(ICheckpointDefinition):

Modified: AlphaFlow/trunk/utils.py
==============================================================================
--- AlphaFlow/trunk/utils.py	(original)
+++ AlphaFlow/trunk/utils.py	Sun May  6 20:28:04 2007
(at)(at) -20,13 +20,12 (at)(at)
 from AccessControl.SecurityManagement import \
     getSecurityManager, newSecurityManager, setSecurityManager
 from AccessControl.Role import gather_permissions
-from AccessControl.Permission import Permission, registerPermissions
+from AccessControl.Permission import Permission
 
 from Products.CMFCore.utils import getToolByName
 
 from Products.AlphaFlow import config
-from Products.AlphaFlow.interfaces import \
-        IWorkItem, IActivity, ILifeCycleController
+import Products.AlphaFlow.interfaces
 from Products.AlphaFlow.TrustedExpression import getEngine
 
 _www = os.path.join(os.path.dirname(__file__), 'www')
(at)(at) -213,10 +212,6 (at)(at)
     return filtered_members
 
 
-def registerPermission(permission, default_roles):
-    registerPermissions([(permission, [])], default_roles)
-
-
 def unique(alist):
     d = {}
     for item in alist:
(at)(at) -418,7 +413,7 (at)(at)
             continue
         stack.extend(wi.getGeneratedWorkItems())
         if wi.state in ['active', 'failed']:
-            ILifeCycleController(wi).terminate(
+            Products.AlphaFlow.interfaces.ILifeCycleController(wi).terminate(
                 reason + " (recursive termination)")
 
 
(at)(at) -474,10 +469,10 (at)(at)
     workitem = None
     activity = None
 
-    if IWorkItem.providedBy(context):
+    if Products.AlphaFlow.interfaces.IWorkItem.providedBy(context):
         workitem = context
         activity = workitem.getActivity()
-    elif IActivity.providedBy(context):
+    elif Products.AlphaFlow.interfaces.IActivity.providedBy(context):
         workitem = None
         activity = context

SVN: r4789 - in AlphaFlow/trunk: . compatibility editor editor/resources
Christian Theune <ct(at)gocept.com>
2007-05-07 14:09:36 [ FULL ]
Author: ctheune
Date: Mon May  7 14:09:33 2007
New Revision: 4789

Log:
 - allow editing the start activities of checkpoints



Added:
   AlphaFlow/trunk/editor/resources/widgetsupport.js
Modified:
   AlphaFlow/trunk/README.txt
   AlphaFlow/trunk/compatibility/configure.zcml
   AlphaFlow/trunk/compatibility/source.py
   AlphaFlow/trunk/editor/activity_details.pt
   AlphaFlow/trunk/editor/configure.zcml
   AlphaFlow/trunk/editor/index.pt
   AlphaFlow/trunk/interfaces.py
   AlphaFlow/trunk/sources.py

Modified: AlphaFlow/trunk/README.txt
==============================================================================
--- AlphaFlow/trunk/README.txt	(original)
+++ AlphaFlow/trunk/README.txt	Mon May  7 14:09:33 2007
(at)(at) -14,4 +14,4 (at)(at)
 
   - Zope 2.9.7
   - Plone 2.5.2
-  - zc.sourcefactory-0.2dev-r75607
+  - zc.sourcefactory-0.2dev-r75608

Modified: AlphaFlow/trunk/compatibility/configure.zcml
==============================================================================
--- AlphaFlow/trunk/compatibility/configure.zcml	(original)
+++ AlphaFlow/trunk/compatibility/configure.zcml	Mon May  7 14:09:33 2007
(at)(at) -1,12 +1,18 (at)(at)
 <configure xmlns="http://namespaces.zope.org/zope">
 
   <adapter
-      for="zope.schema.interfaces.ISet
-           zope.schema.interfaces.IIterableSource
-           zope.publisher.interfaces.browser.IBrowserRequest"
-      provides="zope.app.form.browser.interfaces.ISimpleInputWidget"
-      factory=".source.SourceMultiSelectSetWidget"
-      permission="zope.Public"
-      />
+    for="zope.schema.interfaces.ITuple
+      zope.schema.interfaces.IIterableSource
+      zope.publisher.interfaces.browser.IBrowserRequest"
+    provides="zope.app.form.browser.interfaces.ISimpleInputWidget"
+    factory=".source.SourceOrderedMultiSelectWidget"
+    permission="zope.Public"
+    />
+
+  <adapter
+    for="zope.app.form.browser.interfaces.IInputWidget"
+    provides="zope.app.traversing.interfaces.ITraversable"
+    factory="zope.app.traversing.adapters.DefaultTraversable"
+    />
 
 </configure>

Modified: AlphaFlow/trunk/compatibility/source.py
==============================================================================
--- AlphaFlow/trunk/compatibility/source.py	(original)
+++ AlphaFlow/trunk/compatibility/source.py	Mon May  7 14:09:33 2007
(at)(at) -77,3 +77,21 (at)(at)
     def __init__(self, field, source, request):
         super(SourceMultiSelectSetWidget, self).__init__(
             field, IterableSourceVocabulary(source, request), request)
+
+
+class OrderedMultiSelectWidget(OrderedMultiSelectWidget):
+    """A multi-selection widget with ordering support."""
+
+    _missing = []
+
+    def _toFieldValue(self, input):
+        value = super(OrderedMultiSelectWidget, self)._toFieldValue(input)
+        return tuple(value)
+
+
+class SourceOrderedMultiSelectWidget(OrderedMultiSelectWidget):
+    """A multi-selection widget with ordering support."""
+
+    def __init__(self, field, source, request):
+        super(SourceOrderedMultiSelectWidget, self).__init__(
+            field, IterableSourceVocabulary(source, request), request)

Modified: AlphaFlow/trunk/editor/activity_details.pt
==============================================================================
--- AlphaFlow/trunk/editor/activity_details.pt	(original)
+++ AlphaFlow/trunk/editor/activity_details.pt	Mon May  7 14:09:33 2007
(at)(at) -19,7 +19,6 (at)(at)
 
     <tal:block repeat="checkpoint context/getExits">
       <div>
-        <h3 tal:content="checkpoint/getId"/>
         <metal:block use-macro="template/macros/checkpoint"/>
       </div>
     </tal:block>
(at)(at) -28,9 +27,9 (at)(at)
 
   <div class="box2"
     tal:define="checkpoint context/CHECKPOINT_START">
-    <h3>When this activity starts ... (<a tal:attributes="href
-        string:checkpoint://${checkpoint/getId}">Edit</a>)</h3>
     <metal:block define-macro="checkpoint">
+      <h3><span tal:replace="checkpoint/title_or_id"/> (<a
tal:attributes="href
+         
string:checkpoint://${checkpoint/getId}">Edit</a>)</h3>
       <ol>
         <li tal:condition="checkpoint/activities">Start the activities: 
           <a tal:attributes="href string:activity://$activity"
(at)(at) -46,7 +45,6 (at)(at)
 
   <div class="box2"
     tal:define="checkpoint context/CHECKPOINT_COMPLETE">
-    <h3>When this activity ends ... (<a tal:attributes="href
string:checkpoint://${checkpoint/getId}">Edit</a>)</h3>
     <metal:block use-macro="template/macros/checkpoint"/>
   </div>
 

Modified: AlphaFlow/trunk/editor/configure.zcml
==============================================================================
--- AlphaFlow/trunk/editor/configure.zcml	(original)
+++ AlphaFlow/trunk/editor/configure.zcml	Mon May  7 14:09:33 2007
(at)(at) -148,4 +148,9 (at)(at)
     file="resources/editor.js"
     />
 
+  <browser:resource
+    name="widgetsupport.js"
+    file="resources/widgetsupport.js"
+    />
+
 </configure>

Modified: AlphaFlow/trunk/editor/index.pt
==============================================================================
--- AlphaFlow/trunk/editor/index.pt	(original)
+++ AlphaFlow/trunk/editor/index.pt	Mon May  7 14:09:33 2007
(at)(at) -8,7 +8,8 (at)(at)
     <title>Workflow editor: <span
tal:replace="here/title_or_id"/></title>
 
     <tal:dummy
-      tal:define="dummy python:request.response.setHeader('Content-Type',
'text/xml;; charset=UTF-8')"/>
+      tal:define="dummy python:request.response.setHeader('Content-Type',
+      'text/html;; charset=UTF-8')"/>
 
     <style type="text/css" media="all"
       tal:content="string:(at)import url(++resource++style.css);">
(at)(at) -44,6 +45,10 (at)(at)
       tal:attributes="src
string:${context/(at)(at)absolute_url}/++resource++editor.js">
     </script>
 
+    <script type="text/javascript"
+      tal:attributes="src
string:${context/(at)(at)absolute_url}/++resource++widgetsupport.js">
+    </script>
+
   </head>
 
   <body>

Added: AlphaFlow/trunk/editor/resources/widgetsupport.js
==============================================================================
--- (empty file)
+++ AlphaFlow/trunk/editor/resources/widgetsupport.js	Mon May  7 14:09:33 2007
(at)(at) -0,0 +1,135 (at)(at)
+function moveItems(from, to)
+  {
+  // shortcuts for selection fields
+  var src = document.getElementById(from);
+  var tgt = document.getElementById(to);
+
+  if (src.selectedIndex == -1) selectionError();
+  else
+    {
+    // iterate over all selected items
+    // --> attribute "selectedIndex" doesn't support multiple selection.
+    // Anyway, it works here, as a moved item isn't selected anymore,
+    // thus "selectedIndex" indicating the "next" selected item :)
+    while (src.selectedIndex > -1)
+      if (src.options[src.selectedIndex].selected)
+        {
+        // create a new virtal object with values of item to copy
+        temp = new Option(src.options[src.selectedIndex].text,
+                      src.options[src.selectedIndex].value);
+        // append virtual object to targe
+        tgt.options[tgt.length] = temp;
+        // want to select newly created item
+        temp.selected = true;
+        // delete moved item in source
+        src.options[src.selectedIndex] = null;
+      }
+    }
+  }
+
+// move item from "from" selection to "to" selection
+function from2to(name)
+  {
+  moveItems(name+".from", name+".to");
+  copyDataForSubmit(name);
+  }
+
+// move item from "to" selection back to "from" selection
+function to2from(name)
+  {
+  moveItems(name+".to", name+".from");
+  copyDataForSubmit(name);
+  }
+
+function swapFields(a, b)
+  {
+  // swap text
+  var temp = a.text;
+  a.text = b.text;
+  b.text = temp;
+  // swap value
+  temp = a.value;
+  a.value = b.value;
+  b.value = temp;
+  // swap selection
+  temp = a.selected;
+  a.selected = b.selected;
+  b.selected = temp;
+  }
+
+// move selected item in "to" selection one up
+function moveUp(name)
+  {
+  // shortcuts for selection field
+  var toSel = document.getElementById(name+".to");
+
+  if (toSel.selectedIndex == -1)
+      selectionError();
+  else if (toSel.options[0].selected)
+      alert("Cannot move further up!");
+  else for (var i = 0; i < toSel.length; i++)
+    if (toSel.options[i].selected)
+      {
+      swapFields(toSel.options[i-1], toSel.options[i]);
+      copyDataForSubmit(name);
+      }
+  }
+
+// move selected item in "to" selection one down
+function moveDown(name)
+  {
+    // shortcuts for selection field
+    var toSel = document.getElementById(name+".to");
+
+    if (toSel.selectedIndex == -1) {
+        selectionError();
+    } else if (toSel.options[toSel.length-1].selected) {
+        alert("Cannot move further down!");
+    } else {
+      for (var i = toSel.length-1; i >= 0; i--) {
+        if (toSel.options[i].selected) {
+          swapFields(toSel.options[i+1], toSel.options[i]);
+        }
+      }
+      copyDataForSubmit(name);
+    }
+  }
+
+// copy each item of "toSel" into one hidden input field
+function copyDataForSubmit(name)
+  {
+  // shortcuts for selection field and hidden data field
+  var toSel = document.getElementById(name+".to");
+  var toDataContainer = document.getElementById(name+".toDataContainer");
+
+  // delete all child nodes (--> complete content) of "toDataContainer"
span
+  while (toDataContainer.hasChildNodes())
+      toDataContainer.removeChild(toDataContainer.firstChild);
+
+  // create new hidden input fields - one for each selection item of
+  // "to" selection
+  for (var i = 0; i < toSel.options.length; i++)
+    {
+    // create virtual node with suitable attributes
+    var newNode = document.createElement("input");
+    var newAttr = document.createAttribute("name");
+    newAttr.nodeValue = name;
+    newNode.setAttributeNode(newAttr);
+
+    newAttr = document.createAttribute("type");
+    newAttr.nodeValue = "hidden";
+    newNode.setAttributeNode(newAttr);
+
+    newAttr = document.createAttribute("value");
+    newAttr.nodeValue = toSel.options[i].value;
+    newNode.setAttributeNode(newAttr);
+
+    // actually append virtual node to DOM tree
+    toDataContainer.appendChild(newNode);
+    }
+  }
+
+// error message for missing selection
+function selectionError()
+  {alert("Must select something!")}
+

Modified: AlphaFlow/trunk/interfaces.py
==============================================================================
--- AlphaFlow/trunk/interfaces.py	(original)
+++ AlphaFlow/trunk/interfaces.py	Mon May  7 14:09:33 2007
(at)(at) -306,10 +306,11 (at)(at)
 
     id = zope.interface.Attribute("ID")
 
-    title = zope.schema.TextLine(title=u"Title")
+    title = zope.schema.TextLine(title=u"Title", readonly=True)
 
-    activities = zope.schema.List(
+    activities = zope.schema.Tuple(
         title=u"Start activities",
+        default=(),
         description=u"Select the activities that should be started when this "
                     u"checkpoint is passed.",
         value_type=zope.schema.Choice(

Modified: AlphaFlow/trunk/sources.py
==============================================================================
--- AlphaFlow/trunk/sources.py	(original)
+++ AlphaFlow/trunk/sources.py	Mon May  7 14:09:33 2007
(at)(at) -15,7 +15,8 (at)(at)
 
     def getValues(self, context):
         process = context.acquireProcess()
-        return process.objectValues()
+        return process.objectIds()
 
-    def getTitle(self, item):
-        return item.title or item.getId()
+    def getTitle(self, context, value):
+        process = context.acquireProcess()
+        return process[value].title or value

SVN: r4796 - in AlphaFlow/trunk: . activities aspects editor editor/resources
Christian Theune <ct(at)gocept.com>
2007-05-07 17:43:29 [ FULL ]
Author: ctheune
Date: Mon May  7 17:43:24 2007
New Revision: 4796

Log:
 - form template refactoring
 - made expression aspect editable
 - made expression a textline instead of text



Added:
   AlphaFlow/trunk/editor/aspect.pt   (contents, props changed)
   AlphaFlow/trunk/editor/form.pt   (contents, props changed)
   AlphaFlow/trunk/editor/workflow.pt   (contents, props changed)
Removed:
   AlphaFlow/trunk/editor/ntask.py
Modified:
   AlphaFlow/trunk/activities/interfaces.py
   AlphaFlow/trunk/aspects/interfaces.py
   AlphaFlow/trunk/editor/activity.pt
   AlphaFlow/trunk/editor/activity_details.pt
   AlphaFlow/trunk/editor/checkpoint.pt
   AlphaFlow/trunk/editor/configure.zcml
   AlphaFlow/trunk/editor/form.py
   AlphaFlow/trunk/editor/index.pt
   AlphaFlow/trunk/editor/resources/editor.js
   AlphaFlow/trunk/editor/resources/style.css
   AlphaFlow/trunk/interfaces.py

Modified: AlphaFlow/trunk/activities/interfaces.py
==============================================================================
--- AlphaFlow/trunk/activities/interfaces.py	(original)
+++ AlphaFlow/trunk/activities/interfaces.py	Mon May  7 17:43:24 2007
(at)(at) -191,7 +191,8 (at)(at)
         portal - the portal root object
     """
 
-    expression = zope.schema.Text(title=u"TALES expression")
+    expression = zope.schema.TextLine(title=u"TALES expression")
+
     runAs = zope.schema.TextLine(
         title=u"Run as user", 
         description=u"Give a TALES expression that evaluates to either a "

Modified: AlphaFlow/trunk/aspects/interfaces.py
==============================================================================
--- AlphaFlow/trunk/aspects/interfaces.py	(original)
+++ AlphaFlow/trunk/aspects/interfaces.py	Mon May  7 17:43:24 2007
(at)(at) -21,6 +21,13 (at)(at)
         portal - the portal root object
     """
 
+    expression = zope.schema.TextLine(title=u"TALES expression")
+
+    runAs = zope.schema.TextLine(
+        title=u"Run as user", 
+        description=u"Give a TALES expression that evaluates to either a "
+                     "username or a user object.",
+        default=u"alphaflow/systemUser")
 
 class IExpressionAspect(IAspect):
     """expression aspect"""

Modified: AlphaFlow/trunk/editor/activity.pt
==============================================================================
--- AlphaFlow/trunk/editor/activity.pt	(original)
+++ AlphaFlow/trunk/editor/activity.pt	Mon May  7 17:43:24 2007
(at)(at) -1,12 +1,6 (at)(at)
-<form
-  action="."
-  id="zc.page.browser_form"
-  class="edit-form" 
-  enctype="multipart/form-data"
-  tal:attributes="action python:request.URL"
-  method="post">
+<form metal:use-macro="context/(at)(at)editor_form/form">
 
-  <div
+  <div metal:fill-slot="header"
       tal:define="id python:context.getId()">
     <h2><span tal:replace="python:context.activity_type"/>: 
       &#8220;<span tal:content="python:context.title"/>&#8221;
(at)(at) -16,62 +10,4 (at)(at)
     </h2>
   </div>
 
-  <div class="form-status errorbox"
-    tal:define="status python:view.status"
-    tal:condition="status">
-
-    <div class="summary"
-      i18n:translate=""
-      tal:content="status">
-      Form status summary
-    </div>
-
-    <ul class="errors" tal:condition="python:view.errors">
-      <li tal:repeat="error python:view.error_views()">
-        <span tal:replace="structure error">Error Type</span>
-      </li>
-    </ul>
-  </div>
-
-  <div
-    class="field"
-    tal:repeat="widget python:list(view.widgets)">
-
-    <div class="label">
-      <label tal:attributes="for python:widget.name">
-        <span tal:content="python:widget.label">
-          label
-        </span>
-      </label>
-    </div>
-
-    <div class="hint"
-      i18n:translate=""
-      tal:define="hint python:widget.hint"
-      tal:content="hint"
-      tal:condition="hint">
-      Title of this content object.
-    </div>
-
-    <div class="error"
-      tal:condition="python:widget.error()">
-      <span tal:replace="structure python:widget.error()">
-        error
-      </span>
-    </div>
-
-    <div class="widget" tal:content="structure widget">
-        Widget goes here
-    </div>
-
-
-  </div>
-
-  <div id="actionsView">
-    <span class="actionButtons">
-      <input type="button" class="button" name="form.actions.apply"
-        id="submitForm" value="Save" />
-    </span>
-  </div>
-
 </form>

Modified: AlphaFlow/trunk/editor/activity_details.pt
==============================================================================
--- AlphaFlow/trunk/editor/activity_details.pt	(original)
+++ AlphaFlow/trunk/editor/activity_details.pt	Mon May  7 17:43:24 2007
(at)(at) -37,7 +37,7 (at)(at)
             tal:content="activity"/>
         </li>
         <li tal:repeat="aspect checkpoint/objectValues">
-          <span tal:replace="aspect/aspect_type"/> (<a
tal:attributes="href
string:aspect://${aspect/getId}">Edit</a>)</li>
+          <span tal:replace="aspect/title"/> (<a tal:attributes="href
string:aspect://${checkpoint/getId};;${aspect/getId}">Edit</a>)</li>
       </ol>
     </metal:block>
   </div>

Added: AlphaFlow/trunk/editor/aspect.pt
==============================================================================
--- (empty file)
+++ AlphaFlow/trunk/editor/aspect.pt	Mon May  7 17:43:24 2007
(at)(at) -0,0 +1,11 (at)(at)
+<form metal:use-macro="context/(at)(at)editor_form/form">
+
+  <div metal:fill-slot="header">
+      <h2><span tal:replace="context/aspect_type"/>: 
+        &#8220;<span tal:content="context/title"/>&#8221;
+        (<a tal:define="activity context/acquireActivity"
+          tal:attributes="href
string:activity://${activity/getId}">Back</a>)
+    </h2>
+  </div>
+
+</form>

Modified: AlphaFlow/trunk/editor/checkpoint.pt
==============================================================================
--- AlphaFlow/trunk/editor/checkpoint.pt	(original)
+++ AlphaFlow/trunk/editor/checkpoint.pt	Mon May  7 17:43:24 2007
(at)(at) -1,76 +1,13 (at)(at)
-<form
-  action="."
-  id="zc.page.browser_form"
-  class="edit-form" 
-  enctype="multipart/form-data"
-  tal:attributes="action python:request.URL"
-  method="post">
+<form metal:use-macro="context/(at)(at)editor_form/form">
 
-  <div
+  <div metal:fill-slot="header"
       tal:define="id python:context.getId()">
     <h2><span tal:replace="id"/>: 
       &#8220;<span tal:content="python:context.title"/>&#8221;
 
-      (<a href="#">Back</a>)
+      (<a tal:define="activity
nocall:python:context.acquireActivity().getId()"
+        tal:attributes="href string:activity://$activity" >Back</a>)
     </h2>
   </div>
 
-  <div class="form-status errorbox"
-    tal:define="status python:view.status"
-    tal:condition="status">
-
-    <div class="summary"
-      i18n:translate=""
-      tal:content="status">
-      Form status summary
-    </div>
-
-    <ul class="errors" tal:condition="python:view.errors">
-      <li tal:repeat="error python:view.error_views()">
-        <span tal:replace="structure error">Error Type</span>
-      </li>
-    </ul>
-  </div>
-
-  <div
-    class="field"
-    tal:repeat="widget python:list(view.widgets)">
-
-    <div class="label">
-      <label tal:attributes="for python:widget.name">
-        <span tal:content="python:widget.label">
-          label
-        </span>
-      </label>
-    </div>
-
-    <div class="hint"
-      i18n:translate=""
-      tal:define="hint python:widget.hint"
-      tal:content="hint"
-      tal:condition="hint">
-      Title of this content object.
-    </div>
-
-    <div class="error"
-      tal:condition="python:widget.error()">
-      <span tal:replace="structure python:widget.error()">
-        error
-      </span>
-    </div>
-
-    <div class="widget" tal:content="structure widget">
-        Widget goes here
-    </div>
-
-
-  </div>
-
-  <div id="actionsView">
-    <span class="actionButtons">
-      <input type="button" class="button" name="form.actions.apply"
-        id="submitForm" value="Save" />
-    </span>
-  </div>
-
 </form>

Modified: AlphaFlow/trunk/editor/configure.zcml
==============================================================================
--- AlphaFlow/trunk/editor/configure.zcml	(original)
+++ AlphaFlow/trunk/editor/configure.zcml	Mon May  7 17:43:24 2007
(at)(at) -7,6 +7,13 (at)(at)
   <include package="zope.formlib" />
 
   <browser:page
+    for="*"
+    template="form.pt"
+    name="editor_form"
+    permission="zope2.View"
+    />
+
+  <browser:page
     for="Products.AlphaFlow.interfaces.IProcess"
     template="index.pt"
     class=".editor.Editor"
(at)(at) -57,72 +64,78 (at)(at)
   <browser:page
     for="Products.AlphaFlow.activities.interfaces.IExpressionActivity"
     class=".form.EditExpressionActivity"
-    name="edit_activity"
+    name="edit"
     permission="zope2.View"
     />
 
   <browser:page
     for="Products.AlphaFlow.activities.interfaces.IAlarmActivity"
     class=".form.EditAlarmActivity"
-    name="edit_activity"
+    name="edit"
     permission="zope2.View"
     />
 
   <browser:page
     for="Products.AlphaFlow.activities.interfaces.IDecisionActivity"
     class=".form.EditDecisionActivity"
-    name="edit_activity"
+    name="edit"
     permission="zope2.View"
     />
 
   <browser:page
     for="Products.AlphaFlow.activities.interfaces.IConfigurationActivity"
     class=".form.EditConfigurationActivity"
-    name="edit_activity"
+    name="edit"
     permission="zope2.View"
     />
 
   <browser:page
     for="Products.AlphaFlow.activities.interfaces.ISwitchActivity"
     class=".form.EditSwitchActivity"
-    name="edit_activity"
+    name="edit"
     permission="zope2.View"
     />
 
   <browser:page
     for="Products.AlphaFlow.activities.interfaces.INTaskActivity"
     class=".form.EditNTaskActivity"
-    name="edit_activity"
+    name="edit"
     permission="zope2.View"
     />
 
   <browser:page
     for="Products.AlphaFlow.activities.interfaces.IRouteActivity"
     class=".form.EditRouteActivity"
-    name="edit_activity"
+    name="edit"
     permission="zope2.View"
     />
 
   <browser:page
     for="Products.AlphaFlow.activities.interfaces.IEMailActivity"
     class=".form.EditEMailActivity"
-    name="edit_activity"
+    name="edit"
     permission="zope2.View"
     />
 
   <browser:page
     for="Products.AlphaFlow.interfaces.ICheckpointDefinition"
-    name="edit_checkpoint"
+    name="edit"
     permission="zope2.View"
     class=".form.EditCheckpoint"
     />
 
-  <!-- Adding exits -->
   <browser:page
-    for="Products.AlphaFlow.activities.interfaces.INTaskActivity"
-    class=".ntask.AddExit"
-    name="add_exit"
+    for="Products.AlphaFlow.interfaces.IProcess"
+    name="edit"
+    permission="zope2.View"
+    class=".form.EditWorkflow"
+    />
+
+  <browser:page
+    for="Products.AlphaFlow.aspects.interfaces.IExpressionAspectDefinition"
+    name="edit"
     permission="zope2.View"
+    class=".form.EditExpressionAspect"
     />
 
   <!-- Resources -->

Added: AlphaFlow/trunk/editor/form.pt
==============================================================================
--- (empty file)
+++ AlphaFlow/trunk/editor/form.pt	Mon May  7 17:43:24 2007
(at)(at) -0,0 +1,70 (at)(at)
+<form
+  action="."
+  metal:define-macro="form"
+  id="zc.page.browser_form"
+  class="edit-form" 
+  enctype="multipart/form-data"
+  tal:attributes="action python:request.URL"
+  method="post">
+
+  <metal:block define-slot="header" />
+
+  <div class="form-status errorbox"
+    tal:define="status python:view.status"
+    tal:condition="status">
+
+    <div class="summary"
+      i18n:translate=""
+      tal:content="status">
+      Form status summary
+    </div>
+
+    <ul class="errors" tal:condition="python:view.errors">
+      <li tal:repeat="error python:view.error_views()">
+        <span tal:replace="structure error">Error Type</span>
+      </li>
+    </ul>
+  </div>
+
+  <div
+    class="field"
+    tal:repeat="widget python:list(view.widgets)">
+
+    <div class="label">
+      <label tal:attributes="for python:widget.name">
+        <span tal:content="python:widget.label">
+          label
+        </span>
+      </label>
+    </div>
+
+    <div class="hint"
+      i18n:translate=""
+      tal:define="hint python:widget.hint"
+      tal:content="hint"
+      tal:condition="hint">
+      Title of this content object.
+    </div>
+
+    <div class="error"
+      tal:condition="python:widget.error()">
+      <span tal:replace="structure python:widget.error()">
+        error
+      </span>
+    </div>
+
+    <div class="widget" tal:content="structure widget">
+        Widget goes here
+    </div>
+
+
+  </div>
+
+  <div id="actionsView">
+    <span class="actionButtons">
+      <input type="button" class="button" name="form.actions.apply"
+        id="submitForm" value="Save" />
+    </span>
+  </div>
+
+</form>

Modified: AlphaFlow/trunk/editor/form.py
==============================================================================
--- AlphaFlow/trunk/editor/form.py	(original)
+++ AlphaFlow/trunk/editor/form.py	Mon May  7 17:43:24 2007
(at)(at) -18,7 +18,8 (at)(at)
 
 import Products.AlphaFlow.activities.interfaces
 import Products.AlphaFlow.interfaces
-from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile
+import Products.AlphaFlow.aspects.interfaces
+from Products.Five.browser.pagetemplatefile import ZopeTwoPageTemplateFile
 
 # taken and adapted from zope.publisher.browser.BrowserRequest
 def _decode(text, charsets):
(at)(at) -64,12 +65,12 (at)(at)
 class EditForm(Acquisition.Explicit, zope.formlib.form.EditForm):
 
     # Overrides the formlib.form.FormBase.template attributes implemented 
-    # using NamedTemplates. NamedTemplates using ViewPageTemplateFile (like
+    # using NamedTemplates. NamedTemplates using ZopeTwoPageTemplateFile (like
     # formlib does by default) cannot work in Zope2.
 
     # XXX Maybe we need to have Five-compatible NamedTemplates?
 
-    template = ViewPageTemplateFile('activity.pt')
+    template = ZopeTwoPageTemplateFile('activity.pt')
 
     # Overrides formlib.form.FormBase.update. Make sure user input is
     # decoded first and the page encoding is set before proceeding.
(at)(at) -147,7 +148,26 (at)(at)
 
 class EditCheckpoint(EditForm):
 
-    template = ViewPageTemplateFile('checkpoint.pt')
+    template = ZopeTwoPageTemplateFile('checkpoint.pt')
 
     form_fields = zope.formlib.form.FormFields(
         Products.AlphaFlow.interfaces.ICheckpointDefinition)
+
+
+class EditWorkflow(EditForm):
+
+    template = ZopeTwoPageTemplateFile('workflow.pt')
+
+    form_fields = zope.formlib.form.FormFields(
+        Products.AlphaFlow.interfaces.IProcess)
+
+
+class AspectEditForm(EditForm):
+
+    template = ZopeTwoPageTemplateFile('aspect.pt')
+
+
+class EditExpressionAspect(AspectEditForm):
+
+    form_fields = zope.formlib.form.FormFields(
+        Products.AlphaFlow.aspects.interfaces.IExpressionAspectDefinition)

Modified: AlphaFlow/trunk/editor/index.pt
==============================================================================
--- AlphaFlow/trunk/editor/index.pt	(original)
+++ AlphaFlow/trunk/editor/index.pt	Mon May  7 17:43:24 2007
(at)(at) -54,7 +54,7 (at)(at)
   <body>
 
     <div id="header">
-      <h1><a href="#" id="title"
tal:content="here/title_or_id"/></h1>
+      <h1><a href="#" id="title" tal:content="here/title_or_id"/>
(<a href="workflow://">Edit</a>)</h1>
     </div>
 
     <div id="container">

Modified: AlphaFlow/trunk/editor/resources/editor.js
==============================================================================
--- AlphaFlow/trunk/editor/resources/editor.js	(original)
+++ AlphaFlow/trunk/editor/resources/editor.js	Mon May  7 17:43:24 2007
(at)(at) -63,8 +63,10 (at)(at)
     var protocols = Array(
         Array("activity", "loadActivityDetailsPanel"),
         Array("edit-activity", "loadActivityEditPanel"),
-        Array("checkpoint", "loadCheckpointEditPanel")
-    );
+        Array("checkpoint", "loadCheckpointEditPanel"),
+        Array("aspect", "loadAspectEditPanel"),
+        Array("workflow", "loadWorkflowEditPanel"));
+
     links = getElementsByTagAndClassName('a');
     links = links.concat(getElementsByTagAndClassName('area'));
 
(at)(at) -85,6 +87,32 (at)(at)
     }); 
 };
 
+
+Editor.prototype.submitForm = function() {
+    var pane = this.sidebar;
+    var editor = this;
+    this._submit_form('zc.page.browser_form',
+        function(result) {
+            pane.innerHTML = result.responseText;
+            editor._parse_panel_links();
+            editor.initEditPanel();
+            editor.reloadCanvas(editor.activity);
+        });
+};
+
+
+Editor.prototype.initEditPanel = function() {
+    connect('submitForm', 'onclick', this, 'submitForm');
+};
+
+
+Editor.prototype._load_edit_panel = function(edit_view) {
+    var editor = this;
+    var d = editor._loadPanel(edit_view+'/edit');
+    d.addCallback(function() {editor.initEditPanel();});
+    editor.reloadCanvas(editor.activity);
+};
+
 /******************** Actual business functions ************************/
 
 /* Activity listing */
(at)(at) -92,7 +120,7 (at)(at)
 Editor.prototype.loadActivityPanel = function() {
     var editor = this;
     var d = editor._loadPanel('activitypanel');
-    d.addCallback(function (result) {
+    d.addCallback(function (result) { 
         connect('addActivity', 'onclick', editor, 'submitAddActivityForm');
     });
 };
(at)(at) -121,65 +149,40 (at)(at)
 
 Editor.prototype.loadActivityEditPanel = function(activity_link) {
     var editor = this;
-
     activity = activity_link.src().reference;
     editor.activity = activity;
-    var d = editor._loadPanel(activity+'/edit_activity');
-    d.addCallback(function() {editor.initEditActivityPanel();});
-
-    editor.reloadCanvas(activity);
+    editor._load_edit_panel(activity);
     return false;
 }
 
-
-Editor.prototype.initEditActivityPanel = function() { 
-    connect('submitForm', 'onclick', this, 'submitEditActivityForm');
-}
-
-
-Editor.prototype.submitEditActivityForm = function() {
-    var pane = this.sidebar;
-    var editor = this;
-    this._submit_form('zc.page.browser_form',
-        function(result) {
-            pane.innerHTML = result.responseText;
-            /* XXX This is a hint that the architecture is a little flawed. */
-            editor._parse_panel_links();    
-            editor.initEditActivityPanel();
-            editor.reloadCanvas(editor.activity);
-        });
-}
-
 /* Checkpoint edit form */
 
 Editor.prototype.loadCheckpointEditPanel = function(checkpoint) {
     var editor = this;
-
     editor.checkpoint = checkpoint.src().reference;
-    var d = editor._loadPanel(editor.activity+'/'+editor.checkpoint+
-                              '/edit_checkpoint');
-    d.addCallback(function() {editor.initEditCheckpointPanel();});
+    editor._load_edit_panel(editor.activity+'/'+editor.checkpoint);
     return false;
 }
 
-Editor.prototype.initEditCheckpointPanel = function() {
+/* Aspect edit form */
+
+Editor.prototype.loadAspectEditPanel = function(aspect) {
     var editor = this;
-    connect('submitForm', 'onclick', editor, 'submitEditCheckpointForm');
+    var aspect = aspect.src().reference.split(";");
+    var checkpoint = aspect[0];
+    aspect = aspect[1];
+    editor._load_edit_panel(editor.activity+'/'+checkpoint+'/'+aspect);
+    return false;
 }
 
-Editor.prototype.submitEditCheckpointForm = function() {
-    var pane = this.sidebar;
-    var editor = this;
-    this._submit_form('zc.page.browser_form',
-        function(result) {
-            pane.innerHTML = result.responseText;
-            /* XXX This is a hint that the architecture is a little flawed. */
-            editor._parse_panel_links();
-            editor.initEditCheckpointPanel();
-            editor.reloadCanvas(editor.activity);
-        });
+/* Edit workflow */
+
+Editor.prototype.loadWorkflowEditPanel = function(workflow_link) {
+    this._load_edit_panel("");
+    return false;
 }
 
+
 /* Workflow graph */
 
 

Modified: AlphaFlow/trunk/editor/resources/style.css
==============================================================================
--- AlphaFlow/trunk/editor/resources/style.css	(original)
+++ AlphaFlow/trunk/editor/resources/style.css	Mon May  7 17:43:24 2007
(at)(at) -68,6 +68,10 (at)(at)
 
 /* Form styling */
 
+form.edit-form {
+    width:30em;
+}
+
 .field {
   padding-bottom:0.5em;
   padding-left:1em;

Added: AlphaFlow/trunk/editor/workflow.pt
==============================================================================
--- (empty file)
+++ AlphaFlow/trunk/editor/workflow.pt	Mon May  7 17:43:24 2007
(at)(at) -0,0 +1,5 (at)(at)
+<form metal:use-macro="context/(at)(at)editor_form/form">
+
+  <h2 metal:fill-slot="header">Edit workflow</h2>
+
+</form>

Modified: AlphaFlow/trunk/interfaces.py
==============================================================================
--- AlphaFlow/trunk/interfaces.py	(original)
+++ AlphaFlow/trunk/interfaces.py	Mon May  7 17:43:24 2007
(at)(at) -207,8 +207,23 (at)(at)
 
     id = zope.interface.Attribute("Id of this process definition.")
 
-    object_name = zope.interface.Attribute(
-        "Name of the context object in TALES expressions.")
+    title = zope.schema.TextLine(title=u"Title")
+
+    description = zope.schema.Text(title=u"Description")
+
+    startActivity = zope.schema.Tuple(
+        title=u"Start activities",
+        default=(),
+        description=u"Select the activities that should be started when this "
+                    u"workflow is started.",
+        value_type=zope.schema.Choice(
+            source=Products.AlphaFlow.sources.ActivitySource()))
+
+    object_name = zope.schema.TextLine(
+        title=u"Context object variable",
+        description=u"The variable name under which the content object can "
+                    u"be accessed in TALES expressions.",
+        default=u"object")
 
     validation_errors = zope.interface.Attribute(
         "String indicating validation errors.")

SVN: r4817 - in AlphaFlow/trunk: . activities editor
Christian Theune <ct(at)gocept.com>
2007-05-08 14:57:10 [ FULL ]
Author: ctheune
Date: Tue May  8 14:57:07 2007
New Revision: 4817

Log:
 - fixed title position in switch cases
 - better navigation through mini-breadcrumbs



Modified:
   AlphaFlow/trunk/activities/interfaces.py
   AlphaFlow/trunk/editor/activity.pt
   AlphaFlow/trunk/editor/activity_details.pt
   AlphaFlow/trunk/editor/aspect.pt
   AlphaFlow/trunk/editor/checkpoint.pt
   AlphaFlow/trunk/editor/configure.zcml
   AlphaFlow/trunk/editor/form.py
   AlphaFlow/trunk/interfaces.py

Modified: AlphaFlow/trunk/activities/interfaces.py
==============================================================================
--- AlphaFlow/trunk/activities/interfaces.py	(original)
+++ AlphaFlow/trunk/activities/interfaces.py	Tue May  8 14:57:07 2007
(at)(at) -17,6 +17,9 (at)(at)
 class ICaseDefinition(IExitDefinition):
     """Case for ISwitchActivity."""
 
+    title = zope.schema.TextLine(title=u"Title", readonly=False)
+    title.order = 10
+
     condition = zope.schema.TextLine(
         title=u"Condition",
         description=u"A TALES expression that returns a boolean value.")

Modified: AlphaFlow/trunk/editor/activity.pt
==============================================================================
--- AlphaFlow/trunk/editor/activity.pt	(original)
+++ AlphaFlow/trunk/editor/activity.pt	Tue May  8 14:57:07 2007
(at)(at) -1,12 +1,13 (at)(at)
 <form metal:use-macro="context/(at)(at)editor_form/form">
 
   <div metal:fill-slot="header"
-      tal:define="id python:context.getId()">
-    <h2><span tal:replace="python:context.activity_type"/>: 
-      &#8220;<span tal:content="python:context.title"/>&#8221;
-
-      (<a tal:attributes="href
-        string:activity://$id">Back</a>)
+    tal:define="id python:context.getId()">
+    <h2>
+      <a tal:attributes="href
+        string:activity://${context/getId}"
+        tal:content="context/title">Back</a>
+      &raquo;
+      Edit
     </h2>
   </div>
 

Modified: AlphaFlow/trunk/editor/activity_details.pt
==============================================================================
--- AlphaFlow/trunk/editor/activity_details.pt	(original)
+++ AlphaFlow/trunk/editor/activity_details.pt	Tue May  8 14:57:07 2007
(at)(at) -1,13 +1,11 (at)(at)
 <div id="activityOverview">
 
   <div>
-    <h2><span tal:replace="context/activity_type"/>: 
-      &#8220;<span tal:content="context/title"/>&#8221;
+    <h2><span tal:content="context/title"/>
 
       (<a tal:attributes="href
         string:edit-activity://${context/getId}">Edit</a>)
     </h2>
-    <p>fhdaskjhfkdjs</p>
   </div>
 
   <div class="box">

Modified: AlphaFlow/trunk/editor/aspect.pt
==============================================================================
--- AlphaFlow/trunk/editor/aspect.pt	(original)
+++ AlphaFlow/trunk/editor/aspect.pt	Tue May  8 14:57:07 2007
(at)(at) -1,10 +1,15 (at)(at)
 <form metal:use-macro="context/(at)(at)editor_form/form">
 
   <div metal:fill-slot="header">
-      <h2><span tal:replace="context/aspect_type"/>: 
-        &#8220;<span tal:content="context/title"/>&#8221;
-        (<a tal:define="activity context/acquireActivity"
-          tal:attributes="href
string:activity://${activity/getId}">Back</a>)
+    <h2>
+      <a tal:define="activity context/acquireActivity"
+        tal:attributes="href string:activity://${activity/getId}"
+        tal:content="activity/title">Back</a>
+      &raquo;
+      <span tal:define="cp context/getParentNode"
+        tal:content="cp/title"/>
+      &raquo;
+      <span tal:content="context/title"/>
     </h2>
   </div>
 

Modified: AlphaFlow/trunk/editor/checkpoint.pt
==============================================================================
--- AlphaFlow/trunk/editor/checkpoint.pt	(original)
+++ AlphaFlow/trunk/editor/checkpoint.pt	Tue May  8 14:57:07 2007
(at)(at) -1,12 +1,13 (at)(at)
 <form metal:use-macro="context/(at)(at)editor_form/form">
 
   <div metal:fill-slot="header"
-      tal:define="id python:context.getId()">
-    <h2><span tal:replace="id"/>: 
-      &#8220;<span tal:content="python:context.title"/>&#8221;
-
-      (<a tal:define="activity
nocall:python:context.acquireActivity().getId()"
-        tal:attributes="href string:activity://$activity" >Back</a>)
+    tal:define="id python:context.getId()">
+    <h2>
+      <a tal:define="activity context/acquireActivity"
+        tal:attributes="href string:activity://${activity/getId}"
+        tal:content="activity/title">Back</a>
+      &raquo;
+      <span tal:replace="context/title"/>
     </h2>
   </div>
 

Modified: AlphaFlow/trunk/editor/configure.zcml
==============================================================================
--- AlphaFlow/trunk/editor/configure.zcml	(original)
+++ AlphaFlow/trunk/editor/configure.zcml	Tue May  8 14:57:07 2007
(at)(at) -125,6 +125,13 (at)(at)
     />
 
   <browser:page
+    for="Products.AlphaFlow.activities.interfaces.ICaseDefinition"
+    name="edit"
+    permission="zope2.View"
+    class=".form.EditSwitchCase"
+    />
+
+  <browser:page
     for="Products.AlphaFlow.interfaces.IProcess"
     name="edit"
     permission="zope2.View"

Modified: AlphaFlow/trunk/editor/form.py
==============================================================================
--- AlphaFlow/trunk/editor/form.py	(original)
+++ AlphaFlow/trunk/editor/form.py	Tue May  8 14:57:07 2007
(at)(at) -151,7 +151,13 (at)(at)
     template = ZopeTwoPageTemplateFile('checkpoint.pt')
 
     form_fields = zope.formlib.form.FormFields(
-        Products.AlphaFlow.interfaces.ICheckpointDefinition)
+        Products.AlphaFlow.interfaces.ICheckpointDefinition).omit('title')
+
+
+class EditSwitchCase(EditCheckpoint):
+
+    form_fields = zope.formlib.form.FormFields(
+        Products.AlphaFlow.activities.interfaces.ICaseDefinition)
 
 
 class EditWorkflow(EditForm):

Modified: AlphaFlow/trunk/interfaces.py
==============================================================================
--- AlphaFlow/trunk/interfaces.py	(original)
+++ AlphaFlow/trunk/interfaces.py	Tue May  8 14:57:07 2007
(at)(at) -322,6 +322,7 (at)(at)
     id = zope.interface.Attribute("ID")
 
     title = zope.schema.TextLine(title=u"Title", readonly=True)
+    title.order = 10
 
     activities = zope.schema.Tuple(
         title=u"Start activities",
(at)(at) -330,6 +331,7 (at)(at)
                     u"checkpoint is passed.",
         value_type=zope.schema.Choice(
             source=Products.AlphaFlow.sources.ActivitySource()))
+    activities.order = 20
 
 
 class IExitDefinition(ICheckpointDefinition):

SVN: r4823 - in AlphaFlow/trunk: . activities aspects editor editor/resources
Christian Theune <ct(at)gocept.com>
2007-05-09 11:35:22 [ FULL ]
Author: ctheune
Date: Wed May  9 11:35:15 2007
New Revision: 4823

Log:
 - added adding of aspects
 - better editing of checkpoints



Modified:
   AlphaFlow/trunk/activities/interfaces.py
   AlphaFlow/trunk/aspects/expression.py
   AlphaFlow/trunk/aspects/interfaces.py
   AlphaFlow/trunk/editor/activity_details.pt
   AlphaFlow/trunk/editor/checkpoint.pt
   AlphaFlow/trunk/editor/configure.zcml
   AlphaFlow/trunk/editor/editor.py
   AlphaFlow/trunk/editor/form.pt
   AlphaFlow/trunk/editor/form.py
   AlphaFlow/trunk/editor/resources/editor.js
   AlphaFlow/trunk/editor/resources/style.css
   AlphaFlow/trunk/interfaces.py

Modified: AlphaFlow/trunk/activities/interfaces.py
==============================================================================
--- AlphaFlow/trunk/activities/interfaces.py	(original)
+++ AlphaFlow/trunk/activities/interfaces.py	Wed May  9 11:35:15 2007
(at)(at) -17,9 +17,6 (at)(at)
 class ICaseDefinition(IExitDefinition):
     """Case for ISwitchActivity."""
 
-    title = zope.schema.TextLine(title=u"Title", readonly=False)
-    title.order = 10
-
     condition = zope.schema.TextLine(
         title=u"Condition",
         description=u"A TALES expression that returns a boolean value.")

Modified: AlphaFlow/trunk/aspects/expression.py
==============================================================================
--- AlphaFlow/trunk/aspects/expression.py	(original)
+++ AlphaFlow/trunk/aspects/expression.py	Wed May  9 11:35:15 2007
(at)(at) -25,6 +25,8 (at)(at)
     aspect_type = "expression"
     icon = "misc_/AlphaFlow/expression"
 
+    expression = u"nothing"
+    runAs = u"alphaflow/systemUser"
 
 InitializeClass(ExpressionAspectDefinition)
 

Modified: AlphaFlow/trunk/aspects/interfaces.py
==============================================================================
--- AlphaFlow/trunk/aspects/interfaces.py	(original)
+++ AlphaFlow/trunk/aspects/interfaces.py	Wed May  9 11:35:15 2007
(at)(at) -21,7 +21,9 (at)(at)
         portal - the portal root object
     """
 
-    expression = zope.schema.TextLine(title=u"TALES expression")
+    expression = zope.schema.TextLine(
+        default=u"nothing",
+        title=u"TALES expression")
 
     runAs = zope.schema.TextLine(
         title=u"Run as user", 

Modified: AlphaFlow/trunk/editor/activity_details.pt
==============================================================================
--- AlphaFlow/trunk/editor/activity_details.pt	(original)
+++ AlphaFlow/trunk/editor/activity_details.pt	Wed May  9 11:35:15 2007
(at)(at) -10,9 +10,9 (at)(at)
 
   <div class="box">
     <h3>Exits
-      <a href="#"
tal:condition="nocall:context/(at)(at)add_exit|nothing">
-        (New)
-      </a>
+      <tal:block
tal:condition="nocall:context/(at)(at)add_exit|nothing">
+        (<a href="new-exit://">New</a>)
+      </tal:block>
     </h3>
 
     <tal:block repeat="checkpoint context/getExits">
(at)(at) -37,6 +37,7 (at)(at)
         <li tal:repeat="aspect checkpoint/objectValues">
           <span tal:replace="aspect/title"/> (<a tal:attributes="href
string:aspect://${checkpoint/getId};;${aspect/getId}">Edit</a>)</li>
       </ol>
+
     </metal:block>
   </div>
 

Modified: AlphaFlow/trunk/editor/checkpoint.pt
==============================================================================
--- AlphaFlow/trunk/editor/checkpoint.pt	(original)
+++ AlphaFlow/trunk/editor/checkpoint.pt	Wed May  9 11:35:15 2007
(at)(at) -1,14 +1,53 (at)(at)
-<form metal:use-macro="context/(at)(at)editor_form/form">
+<div>
+  <form metal:use-macro="context/(at)(at)editor_form/form">
 
-  <div metal:fill-slot="header"
-    tal:define="id python:context.getId()">
-    <h2>
-      <a tal:define="activity context/acquireActivity"
-        tal:attributes="href string:activity://${activity/getId}"
-        tal:content="activity/title">Back</a>
-      &raquo;
-      <span tal:replace="context/title"/>
-    </h2>
-  </div>
+    <div metal:fill-slot="header"
+      tal:define="id python:context.getId()">
+      <h2>
+        <a tal:define="activity context/acquireActivity"
+          tal:attributes="href string:activity://${activity/getId}"
+          tal:content="activity/title">Back</a>
+        &raquo;
+        <span tal:replace="context/title"/>
+      </h2>
+    </div>
+
+  </form>
+
+  <div>
+    <h2>Aspects</h2>
+
+    <p class="hint">Aspects are executed in the given order when this
+      checkpoint is reached.</p>
+
+    <ol>
+      <li tal:condition="context/activities">Start the activities: 
+        <a tal:attributes="href string:activity://$activity"
+          tal:repeat="activity context/activities"
+          tal:content="activity"/>
+      </li>
+      <li tal:repeat="aspect context/objectValues">
+        <span tal:replace="aspect/title"/> (<a tal:attributes="href
+         
string:aspect://${context/getId};;${aspect/getId}">Edit</a>)</li>
+    </ol>
 
-</form>
+    <h3>Add new aspect</h3>
+
+    <form
+      name="addAspectForm"
+      id="addAspectForm"
+      tal:attributes="action
string:${context/(at)(at)absolute_url}/add_aspect">
+
+      <select name="aspect_type">
+        <option 
+          tal:repeat="asp view/getAspectTypes"
+          tal:attributes="value asp"
+          tal:content="asp">start</option>
+      </select>
+
+      <input type="button" name="addAspect" id="addAspect"
+        value="Add"/>
+
+    </form>
+  </div>
+</div>

Modified: AlphaFlow/trunk/editor/configure.zcml
==============================================================================
--- AlphaFlow/trunk/editor/configure.zcml	(original)
+++ AlphaFlow/trunk/editor/configure.zcml	Wed May  9 11:35:15 2007
(at)(at) -45,6 +45,13 (at)(at)
     />
 
   <browser:page
+    for="Products.AlphaFlow.interfaces.ICheckpointDefinition"
+    class=".editor.AddAspect"
+    name="add_aspect"
+    permission="zope2.View"
+    />
+
+  <browser:page
     for="Products.AlphaFlow.interfaces.IProcess"
     template="activitypanel.pt"
     class=".editor.ActivityPanel"
(at)(at) -125,10 +132,10 (at)(at)
     />
 
   <browser:page
-    for="Products.AlphaFlow.activities.interfaces.ICaseDefinition"
+    for="Products.AlphaFlow.interfaces.IExitDefinition"
     name="edit"
     permission="zope2.View"
-    class=".form.EditSwitchCase"
+    class=".form.EditExit"
     />
 
   <browser:page
(at)(at) -145,6 +152,21 (at)(at)
     class=".form.EditExpressionAspect"
     />
 
+  <!-- Adding exits -->
+  <browser:page
+    for="Products.AlphaFlow.activities.interfaces.ISwitchActivity"
+    class=".editor.AddExit"
+    name="add_exit"
+    permission="zope2.View"
+    />
+
+  <browser:page
+    for="Products.AlphaFlow.activities.interfaces.INTaskActivity"
+    class=".editor.AddExit"
+    name="add_exit"
+    permission="zope2.View"
+    />
+
   <!-- Resources -->
   <browser:resource
     name="style.css"

Modified: AlphaFlow/trunk/editor/editor.py
==============================================================================
--- AlphaFlow/trunk/editor/editor.py	(original)
+++ AlphaFlow/trunk/editor/editor.py	Wed May  9 11:35:15 2007
(at)(at) -49,9 +49,7 (at)(at)
         """Returns a generator obj of addable activities to this
            process.
         """
-        activities = list(self.context.listPossibleActivities())
-        activities.sort()
-        return activities
+        return sorted(list(self.context.listPossibleActivities()))
 
     security.declareProtected(Products.AlphaFlow.config.MANAGE_WORKFLOW,
                               'listProcessActivities')
(at)(at) -63,6 +61,7 (at)(at)
         result = []
 
         for act in activities:
+            __traceback_info__ = {'activity':act}
             info = {'title': act.title or act.getId(),
                     'id' : act.getId(),
                     'type': act.activity_type,
(at)(at) -72,7 +71,6 (at)(at)
 
         return result
 
-
 Globals.InitializeClass(ActivityPanel)
 
 
(at)(at) -116,3 +114,36 (at)(at)
 
 
 Globals.InitializeClass(Graph)
+
+
+class AddExit(Products.Five.BrowserView):
+
+    security = AccessControl.ClassSecurityInfo()
+
+    security.declareProtected(Products.AlphaFlow.config.MANAGE_WORKFLOW,
+                              '__call__')
+    def __call__(self):
+        exit = Products.AlphaFlow.interfaces.IExitDefinition(self.context)
+        exit.id = Products.AlphaFlow.utils.generateUniqueId('exit')
+        self.context._setObject(exit.id, exit)
+        return exit.id
+
+Globals.InitializeClass(AddExit)
+
+
+class AddAspect(Products.Five.BrowserView):
+
+    security = AccessControl.ClassSecurityInfo()
+
+    security.declareProtected(Products.AlphaFlow.config.MANAGE_WORKFLOW,
+                              '__call__')
+    def __call__(self, aspect_type):
+        factory = zope.component.getUtility(
+            Products.AlphaFlow.interfaces.IAspectDefinitionClass,
name=aspect_type)
+        aspect = factory()
+        aspect.id = Products.AlphaFlow.utils.generateUniqueId(aspect_type)
+        self.context[aspect.id] = aspect
+        return aspect.id
+
+
+Globals.InitializeClass(AddAspect)

Modified: AlphaFlow/trunk/editor/form.pt
==============================================================================
--- AlphaFlow/trunk/editor/form.pt	(original)
+++ AlphaFlow/trunk/editor/form.pt	Wed May  9 11:35:15 2007
(at)(at) -67,4 +67,6 (at)(at)
     </span>
   </div>
 
+  <metal:block define-slot="footer" />
+
 </form>

Modified: AlphaFlow/trunk/editor/form.py
==============================================================================
--- AlphaFlow/trunk/editor/form.py	(original)
+++ AlphaFlow/trunk/editor/form.py	Wed May  9 11:35:15 2007
(at)(at) -153,11 +153,19 (at)(at)
     form_fields = zope.formlib.form.FormFields(
         Products.AlphaFlow.interfaces.ICheckpointDefinition).omit('title')
 
+    def getAspectTypes(self):
+        """Returns a generator obj of addable aspects to this
+           process.
+        """
+        aspects = zope.component.getUtilitiesFor(
+            Products.AlphaFlow.interfaces.IAspectDefinitionClass)
+        return sorted(map(lambda x:x[0], aspects))
 
-class EditSwitchCase(EditCheckpoint):
+
+class EditExit(EditCheckpoint):
 
     form_fields = zope.formlib.form.FormFields(
-        Products.AlphaFlow.activities.interfaces.ICaseDefinition)
+        Products.AlphaFlow.activities.interfaces.IExitDefinition)
 
 
 class EditWorkflow(EditForm):

Modified: AlphaFlow/trunk/editor/resources/editor.js
==============================================================================
--- AlphaFlow/trunk/editor/resources/editor.js	(original)
+++ AlphaFlow/trunk/editor/resources/editor.js	Wed May  9 11:35:15 2007
(at)(at) -1,4 +1,5 (at)(at)
 function Editor() {
+    createLoggingPane();
     this.sidebar = getElement('sidepane');
     this.baseURL = this.sidebar.getAttribute('base');
 
(at)(at) -15,22 +16,26 (at)(at)
 
 /******************** Helper functions *****************************/
 
-Editor.prototype._loadPanel = function(panel, query) {
+Editor.prototype._do_request = function(path, query, callback) {
     var editor = this;
 
-    var url = editor.baseURL + '/' + panel;
+    var url = editor.baseURL + '/' + path;
     if (query == null) {
         query = {};
     }
     var d = doSimpleXMLHttpRequest(url, query);
-    d.addCallbacks(
+    d.addCallbacks(callback, log);
+    return d;
+}
+
+Editor.prototype._loadPanel = function(panel, query) {
+    var editor = this;
+    return editor._do_request(panel, query, 
         function(result) {
             editor.sidebar.innerHTML = result.responseText;
+            editor._parse_panel_links(result);
             return result;
-        }, alert);
-    d.addCallbacks(function(result)
-        { return editor._parse_panel_links(result); }, alert);
-    return d;
+        });
 };
 
 
(at)(at) -46,7 +51,7 (at)(at)
         'headers': {
             'Content-Type': 'application/x-www-form-urlencoded'},
         'sendContent': data});
-    d.addCallbacks(callback, alert);
+    d.addCallbacks(callback, log);
 }
 
 
(at)(at) -65,7 +70,8 (at)(at)
         Array("edit-activity", "loadActivityEditPanel"),
         Array("checkpoint", "loadCheckpointEditPanel"),
         Array("aspect", "loadAspectEditPanel"),
-        Array("workflow", "loadWorkflowEditPanel"));
+        Array("workflow", "loadWorkflowEditPanel"),
+        Array("new-exit", "addExit"));
 
     links = getElementsByTagAndClassName('a');
     links = links.concat(getElementsByTagAndClassName('area'));
(at)(at) -109,8 +115,11 (at)(at)
 Editor.prototype._load_edit_panel = function(edit_view) {
     var editor = this;
     var d = editor._loadPanel(edit_view+'/edit');
-    d.addCallback(function() {editor.initEditPanel();});
-    editor.reloadCanvas(editor.activity);
+    d.addCallback(function() {
+        editor.initEditPanel();
+        editor.reloadCanvas(editor.activity);
+    });
+    return d;
 };
 
 /******************** Actual business functions ************************/
(at)(at) -120,9 +129,6 (at)(at)
 Editor.prototype.loadActivityPanel = function() {
     var editor = this;
     var d = editor._loadPanel('activitypanel');
-    d.addCallback(function (result) { 
-        connect('addActivity', 'onclick', editor, 'submitAddActivityForm');
-    });
 };
 
 Editor.prototype.submitAddActivityForm = function() {
(at)(at) -139,10 +145,9 (at)(at)
     activity = activity_link.src().reference;
     editor.activity = activity;
     var d = editor._loadPanel(activity+'/activity_details');
-
     editor.reloadCanvas(activity);
     return false;
-}
+};
 
 
 /* Activity edit form */
(at)(at) -153,33 +158,66 (at)(at)
     editor.activity = activity;
     editor._load_edit_panel(activity);
     return false;
-}
+};
 
 /* Checkpoint edit form */
 
 Editor.prototype.loadCheckpointEditPanel = function(checkpoint) {
     var editor = this;
-    editor.checkpoint = checkpoint.src().reference;
-    editor._load_edit_panel(editor.activity+'/'+editor.checkpoint);
+    log(checkpoint);
+    if (checkpoint.src != undefined) {
+        checkpoint = checkpoint.src().reference;
+    };
+    editor.checkpoint = checkpoint;
+    d = editor._load_edit_panel(editor.activity+'/'+editor.checkpoint);
+    d.addCallback(function() {
+        connect('addAspect', 'onclick', editor, 'addAspect');
+    });
     return false;
-}
+};
+
+/* Add a new aspect */
+
+Editor.prototype.addAspect = function() {
+    var editor = this;
+    d = editor._submit_form('addAspectForm',
+        function(result) {
+           
editor.loadAspectEditPanel(editor.checkpoint+';'+result.responseText);
+    });
+};
+
 
 /* Aspect edit form */
 
 Editor.prototype.loadAspectEditPanel = function(aspect) {
     var editor = this;
-    var aspect = aspect.src().reference.split(";");
+    if (aspect.src != undefined) {
+        var aspect = aspect.src().reference;
+    };
+    var aspect = aspect.split(";");
+
     var checkpoint = aspect[0];
     aspect = aspect[1];
     editor._load_edit_panel(editor.activity+'/'+checkpoint+'/'+aspect);
     return false;
-}
+};
+
 
 /* Edit workflow */
 
 Editor.prototype.loadWorkflowEditPanel = function(workflow_link) {
     this._load_edit_panel("");
     return false;
+};
+
+/* Add a new exit */
+
+Editor.prototype.addExit = function() {
+    var editor = this;
+    editor._do_request(editor.activity+'/add_exit', null,
+        function(result) {
+        editor.loadCheckpointEditPanel(result.responseText);
+    });
 }
 
 
(at)(at) -205,7 +243,7 (at)(at)
             editor.map.innerHTML = result.responseText;
             editor._parse_panel_links()
             return result;
-        }, alert);
+        }, log);
 }
 
 var editor;

Modified: AlphaFlow/trunk/editor/resources/style.css
==============================================================================
--- AlphaFlow/trunk/editor/resources/style.css	(original)
+++ AlphaFlow/trunk/editor/resources/style.css	Wed May  9 11:35:15 2007
(at)(at) -65,6 +65,7 (at)(at)
   padding:0.2em 0.5em;
 }
 
+p { padding:0.5em; }
 
 /* Form styling */
 
(at)(at) -98,7 +99,7 (at)(at)
   padding-top:1em;
 }
 
-.field .hint {
+.hint {
   color:#555;
   padding-bottom:0.5em;
 }

Modified: AlphaFlow/trunk/interfaces.py
==============================================================================
--- AlphaFlow/trunk/interfaces.py	(original)
+++ AlphaFlow/trunk/interfaces.py	Wed May  9 11:35:15 2007
(at)(at) -333,6 +333,8 (at)(at)
 class IExitDefinition(ICheckpointDefinition):
     """An exit."""
 
+    title = zope.schema.TextLine(title=u"Title")
+    title.order = 10
 
 #######################
 # content related stuff

SVN: r4824 - in AlphaFlow/trunk: activities doc/proposals tests xmlimport
Thomas Lotze <tl(at)gocept.com>
2007-05-09 11:42:03 [ FULL ]
Author: thomas
Date: Wed May  9 11:41:58 2007
New Revision: 4824

Log:
removed RoleAssign activity as it is unclear how to turn it into an aspect
while it's configurable


Removed:
   AlphaFlow/trunk/activities/roleassign.py
   AlphaFlow/trunk/tests/test_roleassign.py
Modified:
   AlphaFlow/trunk/activities/__init__.py
   AlphaFlow/trunk/activities/configure.zcml
   AlphaFlow/trunk/activities/interfaces.py
   AlphaFlow/trunk/doc/proposals/ASPECTS.txt
   AlphaFlow/trunk/tests/test_editor.py
   AlphaFlow/trunk/xmlimport/configure.zcml
   AlphaFlow/trunk/xmlimport/domimporters.py

Modified: AlphaFlow/trunk/activities/__init__.py
==============================================================================
--- AlphaFlow/trunk/activities/__init__.py	(original)
+++ AlphaFlow/trunk/activities/__init__.py	Wed May  9 11:41:58 2007
(at)(at) -1,4 +1,4 (at)(at)
 # Make this a python package
 from Products.AlphaFlow.activities import \
     alarm, configuration, dcworkflow, decision, expression, gates, notify, \
-    ntask, permission, roleassign, routing, simpledecision, switch
+    ntask, permission, routing, simpledecision, switch

Modified: AlphaFlow/trunk/activities/configure.zcml
==============================================================================
--- AlphaFlow/trunk/activities/configure.zcml	(original)
+++ AlphaFlow/trunk/activities/configure.zcml	Wed May  9 11:41:58 2007
(at)(at) -68,12 +68,6 (at)(at)
         />
 
     <utility
-        component=".roleassign.RoleAssignActivity"
-        name="roleassign"
-        provides="..interfaces.IActivityClass"
-        />
-
-    <utility
         component=".routing.RouteActivity"
         name="route"
         provides="..interfaces.IActivityClass"
(at)(at) -149,12 +143,6 (at)(at)
         />
 
     <utility
-        component=".roleassign.RoleAssignWorkItem"
-        name="roleassign"
-        provides="..interfaces.IWorkItemClass"
-        />
-
-    <utility
         component=".routing.RouteWorkItem"
         name="route"
         provides="..interfaces.IWorkItemClass"

Modified: AlphaFlow/trunk/activities/interfaces.py
==============================================================================
--- AlphaFlow/trunk/activities/interfaces.py	(original)
+++ AlphaFlow/trunk/activities/interfaces.py	Wed May  9 11:41:58 2007
(at)(at) -234,16 +234,3 (at)(at)
 
 class IDCWorkFlowWorkItem(IAutomaticWorkItem):
     """WorkItem simulating DC Workflow state changes"""
-
-
-class IRoleAssignActivity(IAutomaticActivity):
-    """Sets a given set of roles to the configured users."""
-
-    def getPossibleUsers():
-        """return a sequence of users which possibly might be given the role
-
-        returns [(user_id, readable_name), ...]
-        """
-
-class IRoleAssignWorkItem(IAutomaticWorkItem):
-    """Sets a given set of roles to the configured users."""

Modified: AlphaFlow/trunk/doc/proposals/ASPECTS.txt
==============================================================================
--- AlphaFlow/trunk/doc/proposals/ASPECTS.txt	(original)
+++ AlphaFlow/trunk/doc/proposals/ASPECTS.txt	Wed May  9 11:41:58 2007
(at)(at) -98,7 +98,6 (at)(at)
   dcworkflow
   expression
   email
-  role-assign
   parent
 
 

Modified: AlphaFlow/trunk/tests/test_editor.py
==============================================================================
--- AlphaFlow/trunk/tests/test_editor.py	(original)
+++ AlphaFlow/trunk/tests/test_editor.py	Wed May  9 11:41:58 2007
(at)(at) -54,7 +54,7 (at)(at)
 
         ap = ActivityPanel(process, request)
         activities = ap.getActivities()
-        self.assertEquals(13, len(list(activities)))
+        self.assertEquals(12, len(list(activities)))
 
     def test_listProcessActivities(self):
         self._import_wf('workflows/permission.alf')

Modified: AlphaFlow/trunk/xmlimport/configure.zcml
==============================================================================
--- AlphaFlow/trunk/xmlimport/configure.zcml	(original)
+++ AlphaFlow/trunk/xmlimport/configure.zcml	Wed May  9 11:41:58 2007
(at)(at) -140,11 +140,6 (at)(at)
         />
 
     <adapter
-        factory=".domimporters.RoleAssign"
-        name="roleassign"
-        />
-
-    <adapter
         factory=".domimporters.Route"
         name="route"
         />

Modified: AlphaFlow/trunk/xmlimport/domimporters.py
==============================================================================
--- AlphaFlow/trunk/xmlimport/domimporters.py	(original)
+++ AlphaFlow/trunk/xmlimport/domimporters.py	Wed May  9 11:41:58 2007
(at)(at) -411,15 +411,6 (at)(at)
         )
 
 
-class RoleAssign(BaseAutomaticActivity):
-
-    attributes = BaseAutomaticActivity.attributes + (
-        WorkflowAttribute('roles', 'roles', (),
-                          'Roles to assign on content object.',
-                          encoding="ascii", datatype=tuple),
-        )
-
-
 class Route(BaseAutomaticActivity):
 
     def __call__(self, node, route=None):

SVN: r4828 - in AlphaFlow/trunk: adapters editor/resources
Christian Theune <ct(at)gocept.com>
2007-05-09 16:50:45 [ FULL ]
Author: ctheune
Date: Wed May  9 16:50:43 2007
New Revision: 4828

Log:
 - removed scrollbar



Modified:
   AlphaFlow/trunk/adapters/renderableadapter.py
   AlphaFlow/trunk/editor/resources/style.css

Modified: AlphaFlow/trunk/adapters/renderableadapter.py
==============================================================================
--- AlphaFlow/trunk/adapters/renderableadapter.py	(original)
+++ AlphaFlow/trunk/adapters/renderableadapter.py	Wed May  9 16:50:43 2007
(at)(at) -139,6 +139,7 (at)(at)
     "Returns a graph definition in DOT format."
     data = StringIO()
     data.write("""digraph G {
+        bgcolor="transparent";
         size="%s,%s!";\n""" % (zoom, zoom))
 
     nodes = {}

Modified: AlphaFlow/trunk/editor/resources/style.css
==============================================================================
--- AlphaFlow/trunk/editor/resources/style.css	(original)
+++ AlphaFlow/trunk/editor/resources/style.css	Wed May  9 16:50:43 2007
(at)(at) -52,7 +52,7 (at)(at)
   left:0.5em;
   width:35em;
   bottom:0.5em;
-  top:5em;
+  top:4em;
   overflow:auto;
 }
 
(at)(at) -61,9 +61,14 (at)(at)
   right:0.5em;
   left:37em;
   padding: 1em;
-  overflow:auto;
+  overflow:hidden;
   bottom:0.5em;
-  top:5em;
+  top:5.5em;
+  border:1px solid #DDD;
+}
+
+#graph img {
+  cursor:move;
 }
 
 .box {

SVN: r4831 - in AlphaFlow/trunk: . activities adapters aspects editor editor/resources
Christian Theune <ct(at)gocept.com>
2007-05-09 21:07:06 [ FULL ]
Author: ctheune
Date: Wed May  9 21:07:01 2007
New Revision: 4831

Log:
 - more editing and display of aspects and activities



Added:
   AlphaFlow/trunk/editor/display.pt   (contents, props changed)
Modified:
   AlphaFlow/trunk/activities/expression.py
   AlphaFlow/trunk/activities/interfaces.py
   AlphaFlow/trunk/activities/routing.py
   AlphaFlow/trunk/activity.py
   AlphaFlow/trunk/adapters/renderableadapter.py
   AlphaFlow/trunk/aspect.py
   AlphaFlow/trunk/aspects/interfaces.py
   AlphaFlow/trunk/aspects/parent.py
   AlphaFlow/trunk/editor/activity_details.pt
   AlphaFlow/trunk/editor/configure.zcml
   AlphaFlow/trunk/editor/form.py
   AlphaFlow/trunk/editor/index.pt
   AlphaFlow/trunk/editor/resources/editor.js
   AlphaFlow/trunk/editor/resources/style.css
   AlphaFlow/trunk/interfaces.py

Modified: AlphaFlow/trunk/activities/expression.py
==============================================================================
--- AlphaFlow/trunk/activities/expression.py	(original)
+++ AlphaFlow/trunk/activities/expression.py	Wed May  9 21:07:01 2007
(at)(at) -27,6 +27,8 (at)(at)
     activity_type = "expression"
     icon = "misc_/AlphaFlow/expression"
 
+    runAs = "alphaflow/systemUser"
+    expression = "nothing"
 
 InitializeClass(ExpressionActivity)
 

Modified: AlphaFlow/trunk/activities/interfaces.py
==============================================================================
--- AlphaFlow/trunk/activities/interfaces.py	(original)
+++ AlphaFlow/trunk/activities/interfaces.py	Wed May  9 21:07:01 2007
(at)(at) -103,8 +103,8 (at)(at)
     """Decide to accept or reject something.
     """
 
-    decision_notice = zope.interface.Attribute(
-        "Describes what the user(s) have to decide about.")
+    decision_notice = zope.schema.TextLine(
+      title=u"What is the decision about?")
 
 class IDecisionActivity(IAssignableActivity):
     """Decide to accept or reject.

Modified: AlphaFlow/trunk/activities/routing.py
==============================================================================
--- AlphaFlow/trunk/activities/routing.py	(original)
+++ AlphaFlow/trunk/activities/routing.py	Wed May  9 21:07:01 2007
(at)(at) -40,6 +40,7 (at)(at)
 
     meta_type = "AlphaFlow Routing Activity"
     icon = "misc_/AlphaFlow/route"
+    activity_type = "route"
 
     _properties = BaseActivity._properties + \
         ({'id': 'gates', 'type': 'multiple selection', 'mode': 'w',

Modified: AlphaFlow/trunk/activity.py
==============================================================================
--- AlphaFlow/trunk/activity.py	(original)
+++ AlphaFlow/trunk/activity.py	Wed May  9 21:07:01 2007
(at)(at) -67,11 +67,14 (at)(at)
     def graphGetPossibleChildren(self):
         "Return a list of possible successor activities as dictionaries."
         possible_children = []
-        for exit in self.getExits():
+        for exit in self.objectValues():
             possible_children.extend({'id': activity,
                                       'exit': exit.id,
-                                      'label': exit.id,
+                                      'label': exit.title or exit.id,
                                       } for activity in exit.activities)
+            for aspect in exit.objectValues():
+                possible_children.extend(aspect.graphGetPossibleChildren())
+
         return possible_children
 
     security.declareProtected(config.MANAGE_WORKFLOW,
'graphGetStartActivities')

Modified: AlphaFlow/trunk/adapters/renderableadapter.py
==============================================================================
--- AlphaFlow/trunk/adapters/renderableadapter.py	(original)
+++ AlphaFlow/trunk/adapters/renderableadapter.py	Wed May  9 21:07:01 2007
(at)(at) -147,7 +147,7 (at)(at)
     seen = set([])
 
     while queue:
-        node = queue.pop()
+        node = queue.pop(0)
         seen.add(node)
 
         if node.id == highlight:

Modified: AlphaFlow/trunk/aspect.py
==============================================================================
--- AlphaFlow/trunk/aspect.py	(original)
+++ AlphaFlow/trunk/aspect.py	Wed May  9 21:07:01 2007
(at)(at) -27,6 +27,9 (at)(at)
     def validate(self):
         pass
 
+    def graphGetPossibleChildren(self):
+        return []
+
 
 InitializeClass(AspectDefinition)
 

Modified: AlphaFlow/trunk/aspects/interfaces.py
==============================================================================
--- AlphaFlow/trunk/aspects/interfaces.py	(original)
+++ AlphaFlow/trunk/aspects/interfaces.py	Wed May  9 21:07:01 2007
(at)(at) -8,6 +8,7 (at)(at)
 import zope.interface
 
 from Products.AlphaFlow.interfaces import IAspectDefinition, IAspect
+import Products.AlphaFlow.sources
 
 
 class IExpressionAspectDefinition(IAspectDefinition):
(at)(at) -56,7 +57,11 (at)(at)
 class IParentAspectDefinition(IAspectDefinition):
     """continue with parent of a certain activity"""
 
-    parentOf = zope.interface.Attribute("continue with parent of these
activities")
+    parentOf = zope.schema.Choice(
+        title=u"Start parent of ...",
+        description=u"This aspect will start the activity that is"
+                    u"is the parent of the activity you select here.",
+        source=Products.AlphaFlow.sources.ActivitySource())
 
 
 class IParentAspect(IAspect):
(at)(at) -86,6 +91,10 (at)(at)
        Workflow compatible" state
     """
 
+    status = zope.schema.TextLine(
+        default=u"",
+        title=u"Workflow status")
+
 
 class IDCWorkflowAspect(IAspect):
     """Aspect simulating DC Workflow state changes"""

Modified: AlphaFlow/trunk/aspects/parent.py
==============================================================================
--- AlphaFlow/trunk/aspects/parent.py	(original)
+++ AlphaFlow/trunk/aspects/parent.py	Wed May  9 21:07:01 2007
(at)(at) -34,6 +34,11 (at)(at)
 
     parentOf = None
 
+    def graphGetPossibleChildren(self):
+        return [{'id': self.parentOf,
+                 'exit': 'parent',
+                 'label': 'parent of'}]
+
 
 InitializeClass(ParentAspectDefinition)
 

Modified: AlphaFlow/trunk/editor/activity_details.pt
==============================================================================
--- AlphaFlow/trunk/editor/activity_details.pt	(original)
+++ AlphaFlow/trunk/editor/activity_details.pt	Wed May  9 21:07:01 2007
(at)(at) -6,6 +6,8 (at)(at)
       (<a tal:attributes="href
         string:edit-activity://${context/getId}">Edit</a>)
     </h2>
+
+    <tal:block replace="structure context/(at)(at)display_form|nothing"
/>
   </div>
 
   <div class="box">

Modified: AlphaFlow/trunk/editor/configure.zcml
==============================================================================
--- AlphaFlow/trunk/editor/configure.zcml	(original)
+++ AlphaFlow/trunk/editor/configure.zcml	Wed May  9 21:07:01 2007
(at)(at) -51,6 +51,7 (at)(at)
     permission="zope2.View"
     />
 
+
   <browser:page
     for="Products.AlphaFlow.interfaces.IProcess"
     template="activitypanel.pt"
(at)(at) -76,6 +77,13 (at)(at)
     />
 
   <browser:page
+    for="Products.AlphaFlow.activities.interfaces.IExpressionActivity"
+    class=".form.ViewExpressionActivity"
+    name="display_form"
+    permission="zope2.View"
+    />
+
+  <browser:page
     for="Products.AlphaFlow.activities.interfaces.IAlarmActivity"
     class=".form.EditAlarmActivity"
     name="edit"
(at)(at) -83,6 +91,13 (at)(at)
     />
 
   <browser:page
+    for="Products.AlphaFlow.activities.interfaces.IAlarmActivity"
+    class=".form.ViewAlarmActivity"
+    name="display_form"
+    permission="zope2.View"
+    />
+
+  <browser:page
     for="Products.AlphaFlow.activities.interfaces.IDecisionActivity"
     class=".form.EditDecisionActivity"
     name="edit"
(at)(at) -90,6 +105,27 (at)(at)
     />
 
   <browser:page
+    for="Products.AlphaFlow.activities.interfaces.IDecisionActivity"
+    class=".form.ViewDecisionActivity"
+    name="display_form"
+    permission="zope2.View"
+    />
+
+  <browser:page
+    for="Products.AlphaFlow.activities.interfaces.IGateActivity"
+    class=".form.EditGateActivity"
+    name="edit"
+    permission="zope2.View"
+    />
+
+  <browser:page
+    for="Products.AlphaFlow.activities.interfaces.IGateActivity"
+    class=".form.ViewGateActivity"
+    name="display_form"
+    permission="zope2.View"
+    />
+
+  <browser:page
     for="Products.AlphaFlow.activities.interfaces.IConfigurationActivity"
     class=".form.EditConfigurationActivity"
     name="edit"
(at)(at) -97,6 +133,13 (at)(at)
     />
 
   <browser:page
+    for="Products.AlphaFlow.activities.interfaces.IConfigurationActivity"
+    class=".form.ViewConfigurationActivity"
+    name="display_form"
+    permission="zope2.View"
+    />
+
+  <browser:page
     for="Products.AlphaFlow.activities.interfaces.ISwitchActivity"
     class=".form.EditSwitchActivity"
     name="edit"
(at)(at) -104,6 +147,13 (at)(at)
     />
 
   <browser:page
+    for="Products.AlphaFlow.activities.interfaces.ISwitchActivity"
+    class=".form.ViewSwitchActivity"
+    name="display_form"
+    permission="zope2.View"
+    />
+
+  <browser:page
     for="Products.AlphaFlow.activities.interfaces.INTaskActivity"
     class=".form.EditNTaskActivity"
     name="edit"
(at)(at) -111,6 +161,13 (at)(at)
     />
 
   <browser:page
+    for="Products.AlphaFlow.activities.interfaces.INTaskActivity"
+    class=".form.ViewNTaskActivity"
+    name="display_form"
+    permission="zope2.View"
+    />
+
+  <browser:page
     for="Products.AlphaFlow.activities.interfaces.IRouteActivity"
     class=".form.EditRouteActivity"
     name="edit"
(at)(at) -118,6 +175,27 (at)(at)
     />
 
   <browser:page
+    for="Products.AlphaFlow.activities.interfaces.IRouteActivity"
+    class=".form.ViewRouteActivity"
+    name="display_form"
+    permission="zope2.View"
+    />
+
+  <browser:page
+    for="Products.AlphaFlow.activities.interfaces.ISimpleDecisionActivity"
+    class=".form.EditSimpleDecisionActivity"
+    name="edit"
+    permission="zope2.View"
+    />
+
+  <browser:page
+    for="Products.AlphaFlow.activities.interfaces.ISimpleDecisionActivity"
+    class=".form.ViewSimpleDecisionActivity"
+    name="display_form"
+    permission="zope2.View"
+    />
+
+  <browser:page
     for="Products.AlphaFlow.activities.interfaces.IEMailActivity"
     class=".form.EditEMailActivity"
     name="edit"
(at)(at) -139,6 +217,13 (at)(at)
     />
 
   <browser:page
+    for="Products.AlphaFlow.activities.interfaces.ICaseDefinition"
+    name="edit"
+    permission="zope2.View"
+    class=".form.EditCase"
+    />
+
+  <browser:page
     for="Products.AlphaFlow.interfaces.IProcess"
     name="edit"
     permission="zope2.View"
(at)(at) -152,6 +237,20 (at)(at)
     class=".form.EditExpressionAspect"
     />
 
+  <browser:page
+    for="Products.AlphaFlow.aspects.interfaces.IParentAspectDefinition"
+    name="edit"
+    permission="zope2.View"
+    class=".form.EditParentAspect"
+    />
+
+  <browser:page
+    for="Products.AlphaFlow.aspects.interfaces.IDCWorkflowAspectDefinition"
+    name="edit"
+    permission="zope2.View"
+    class=".form.EditDCWorkflowAspect"
+    />
+
   <!-- Adding exits -->
   <browser:page
     for="Products.AlphaFlow.activities.interfaces.ISwitchActivity"

Added: AlphaFlow/trunk/editor/display.pt
==============================================================================
--- (empty file)
+++ AlphaFlow/trunk/editor/display.pt	Wed May  9 21:07:01 2007
(at)(at) -0,0 +1,9 (at)(at)
+<form metal:use-macro="context/(at)(at)editor_form/form">
+
+  <div metal:fill-slot="header">
+    <p>
+      This is an activity of the type &laquo;<span
tal:replace="context/activity_type"/>&raquo;.
+    </p>
+  </div>
+
+</form>

Modified: AlphaFlow/trunk/editor/form.py
==============================================================================
--- AlphaFlow/trunk/editor/form.py	(original)
+++ AlphaFlow/trunk/editor/form.py	Wed May  9 21:07:01 2007
(at)(at) -79,6 +79,8 (at)(at)
 
     def __init__(self, context, request):
         super(EditForm, self).__init__(context, request)
+        # This needs to stay here, otherwise the publisher falls
+        # on its face. :/
         self.request.debug = None
 
     def update(self):
(at)(at) -104,41 +106,105 (at)(at)
             self.status = _('No changes')
 
 
+class DisplayForm(Acquisition.Explicit, zope.formlib.form.DisplayForm):
+
+    template = ZopeTwoPageTemplateFile('display.pt')
+
+
 class EditExpressionActivity(EditForm):
 
     form_fields = zope.formlib.form.FormFields(
         Products.AlphaFlow.activities.interfaces.IExpressionActivity)
 
+class ViewExpressionActivity(DisplayForm):
+
+    form_fields = zope.formlib.form.FormFields(
+       
Products.AlphaFlow.activities.interfaces.IExpressionActivity).omit('title')
+
 class EditAlarmActivity(EditForm):
 
     form_fields = zope.formlib.form.FormFields(
         Products.AlphaFlow.activities.interfaces.IAlarmActivity)
 
+class ViewAlarmActivity(DisplayForm):
+
+    form_fields = zope.formlib.form.FormFields(
+        Products.AlphaFlow.activities.interfaces.IAlarmActivity).omit('title')
+
 class EditDecisionActivity(EditForm):
 
     form_fields = zope.formlib.form.FormFields(
         Products.AlphaFlow.activities.interfaces.IDecisionActivity)
 
+    def setUpWidgets(self, ignore_request=False):
+        super(EditDecisionActivity, self).setUpWidgets(ignore_request)
+        self.widgets['decision_notice'].width = 35
+        self.widgets['decision_notice'].height = 7
+
+class ViewDecisionActivity(DisplayForm):
+
+    form_fields = zope.formlib.form.FormFields(
+       
Products.AlphaFlow.activities.interfaces.IDecisionActivity).omit('title')
+
 class EditConfigurationActivity(EditForm):
 
     form_fields = zope.formlib.form.FormFields(
         Products.AlphaFlow.activities.interfaces.IConfigurationActivity)
 
+class EditGateActivity(EditForm):
+
+    form_fields = zope.formlib.form.FormFields(
+        Products.AlphaFlow.activities.interfaces.IGateActivity)
+
+class ViewGateActivity(DisplayForm):
+
+    form_fields = zope.formlib.form.FormFields(
+        Products.AlphaFlow.activities.interfaces.IGateActivity).omit('title')
+
+class ViewConfigurationActivity(DisplayForm):
+
+    form_fields = zope.formlib.form.FormFields(
+       
Products.AlphaFlow.activities.interfaces.IConfigurationActivity).omit('title')
+
 class EditSwitchActivity(EditForm):
 
     form_fields = zope.formlib.form.FormFields(
         Products.AlphaFlow.activities.interfaces.ISwitchActivity)
 
+class ViewSwitchActivity(DisplayForm):
+
+    form_fields = zope.formlib.form.FormFields(
+       
Products.AlphaFlow.activities.interfaces.ISwitchActivity).omit('title')
+
 class EditNTaskActivity(EditForm):
 
     form_fields = zope.formlib.form.FormFields(
         Products.AlphaFlow.activities.interfaces.INTaskActivity)
 
+class ViewNTaskActivity(DisplayForm):
+
+    form_fields = zope.formlib.form.FormFields(
+        Products.AlphaFlow.activities.interfaces.INTaskActivity).omit('title')
+
 class EditRouteActivity(EditForm):
 
     form_fields = zope.formlib.form.FormFields(
         Products.AlphaFlow.activities.interfaces.IRouteActivity)
 
+class ViewRouteActivity(DisplayForm):
+
+    form_fields = zope.formlib.form.FormFields(
+        Products.AlphaFlow.activities.interfaces.IRouteActivity).omit('title')
+
+class EditSimpleDecisionActivity(EditForm):
+
+    form_fields = zope.formlib.form.FormFields(
+        Products.AlphaFlow.activities.interfaces.ISimpleDecisionActivity)
+
+class ViewSimpleDecisionActivity(DisplayForm):
+
+    form_fields = zope.formlib.form.FormFields(
+       
Products.AlphaFlow.activities.interfaces.ISimpleDecisionActivity).omit('title')
 
 class EditEMailActivity(EditForm):
 
(at)(at) -165,7 +231,13 (at)(at)
 class EditExit(EditCheckpoint):
 
     form_fields = zope.formlib.form.FormFields(
-        Products.AlphaFlow.activities.interfaces.IExitDefinition)
+        Products.AlphaFlow.interfaces.IExitDefinition)
+
+
+class EditCase(EditCheckpoint):
+
+    form_fields = zope.formlib.form.FormFields(
+        Products.AlphaFlow.activities.interfaces.ICaseDefinition)
 
 
 class EditWorkflow(EditForm):
(at)(at) -185,3 +257,13 (at)(at)
 
     form_fields = zope.formlib.form.FormFields(
         Products.AlphaFlow.aspects.interfaces.IExpressionAspectDefinition)
+
+class EditDCWorkflowAspect(AspectEditForm):
+
+    form_fields = zope.formlib.form.FormFields(
+        Products.AlphaFlow.aspects.interfaces.IDCWorkflowAspectDefinition)
+
+class EditParentAspect(AspectEditForm):
+
+    form_fields = zope.formlib.form.FormFields(
+        Products.AlphaFlow.aspects.interfaces.IParentAspectDefinition)

Modified: AlphaFlow/trunk/editor/index.pt
==============================================================================
--- AlphaFlow/trunk/editor/index.pt	(original)
+++ AlphaFlow/trunk/editor/index.pt	Wed May  9 21:07:01 2007
(at)(at) -83,7 +83,6 (at)(at)
 
     <!-- The map goes to the end. -->
     <div id="map">
-      <map name="G"/>
     </div>
 
   </body>

Modified: AlphaFlow/trunk/editor/resources/editor.js
==============================================================================
--- AlphaFlow/trunk/editor/resources/editor.js	(original)
+++ AlphaFlow/trunk/editor/resources/editor.js	Wed May  9 21:07:01 2007
(at)(at) -132,6 +132,10 (at)(at)
 Editor.prototype.loadActivityPanel = function() {
     var editor = this;
     var d = editor._loadPanel('activitypanel');
+    d.addCallback(function (result) {
+        connect('addActivity', 'onclick', editor,
+                'submitAddActivityForm');
+    });
     editor.activity = null;
     editor.reloadCanvas();
 };
(at)(at) -246,6 +250,8 (at)(at)
         function(result) {
             editor.map.innerHTML = result.responseText;
             editor._parse_panel_links()
+            editor.canvas_img.setAttribute('useMap', "#F");
+            editor.canvas_img.setAttribute('useMap', "#G");
             return result;
         }, log);
 }

Modified: AlphaFlow/trunk/editor/resources/style.css
==============================================================================
--- AlphaFlow/trunk/editor/resources/style.css	(original)
+++ AlphaFlow/trunk/editor/resources/style.css	Wed May  9 21:07:01 2007
(at)(at) -138,4 +138,23 (at)(at)
   font-size:100%;
 }
 
+/* Customization for the display form */
+#activityOverview #actionsView {
+    display:none;
+}
+
+#activityOverview form {
+  line-height:1em;
+}
+
+#activityOverview .label {
+  padding-top:0;
+}
+
+#activityOverview .hint {
+  display:none;
+}
 
+#activityOverview ul {
+    margin:0;
+  }

Modified: AlphaFlow/trunk/interfaces.py
==============================================================================
--- AlphaFlow/trunk/interfaces.py	(original)
+++ AlphaFlow/trunk/interfaces.py	Wed May  9 21:07:01 2007
(at)(at) -307,6 +307,15 (at)(at)
 
         """
 
+    def graphGetPossibleChildren():
+        """Return a list of possible successor activities as dictionaries.
+
+           The returned list of dictionaries has the following form:
+           [{'id': activity_id, ....}]
+           where everything apart from id will be used as attributes for the
+           edges of a graph of parent-child relationships between activities.
+        """
+
 
 class ICheckpointDefinition(zope.interface.Interface):

SVN: r4877 - in AlphaFlow/trunk: . aspects editor editor/resources
Christian Theune <ct(at)gocept.com>
2007-05-25 14:12:39 [ FULL ]
Author: ctheune
Date: Fri May 25 14:12:36 2007
New Revision: 4877

Log:
 - snapshot for editing permission aspects



Added:
   AlphaFlow/trunk/editor/permission.pt   (contents, props changed)
Modified:
   AlphaFlow/trunk/aspects/configure.zcml
   AlphaFlow/trunk/aspects/interfaces.py
   AlphaFlow/trunk/aspects/permission.py
   AlphaFlow/trunk/configure.zcml
   AlphaFlow/trunk/editor/activity_details.pt
   AlphaFlow/trunk/editor/aspect.pt
   AlphaFlow/trunk/editor/checkpoint.pt
   AlphaFlow/trunk/editor/configure.zcml
   AlphaFlow/trunk/editor/form.py
   AlphaFlow/trunk/editor/resources/editor.js
   AlphaFlow/trunk/editor/resources/style.css

Modified: AlphaFlow/trunk/aspects/configure.zcml
==============================================================================
--- AlphaFlow/trunk/aspects/configure.zcml	(original)
+++ AlphaFlow/trunk/aspects/configure.zcml	Fri May 25 14:12:36 2007
(at)(at) -1,70 +1,70 (at)(at)
 <configure
-    xmlns="http://namespaces.zope.org/zope"
-    i18n_domain="alphaflow">
-
-    <utility
-        component=".expression.ExpressionAspectDefinition"
-        name="expression"
-        provides="..interfaces.IAspectDefinitionClass"
-        />
-
-    <adapter
-        factory=".expression.ExpressionAspect"
-        for=".interfaces.IExpressionAspectDefinition
-             str"
-        provides="..interfaces.ILifeCycleObject"
-        />
-
-    <utility
-        component=".notify.EMailAspectDefinition"
-        name="email"
-        provides="..interfaces.IAspectDefinitionClass"
-        />
-
-    <adapter
-        factory=".notify.EMailAspect"
-        for=".interfaces.IEMailAspectDefinition
-             str"
-        provides="..interfaces.ILifeCycleObject"
-        />
-
-    <utility
-        component=".parent.ParentAspectDefinition"
-        name="parent"
-        provides="..interfaces.IAspectDefinitionClass"
-        />
-
-    <adapter
-        factory=".parent.ParentAspect"
-        for=".interfaces.IParentAspectDefinition
-             str"
-        provides="..interfaces.ILifeCycleObject"
-        />
-
-    <utility
-        component=".permission.PermissionAspectDefinition"
-        name="permission"
-        provides="..interfaces.IAspectDefinitionClass"
-        />
-
-    <adapter
-        factory=".permission.PermissionAspect"
-        for=".interfaces.IPermissionAspectDefinition
-             str"
-        provides="..interfaces.ILifeCycleObject"
-        />
-
-    <utility
-        component=".dcworkflow.DCWorkflowAspectDefinition"
-        name="dcworkflow"
-        provides="..interfaces.IAspectDefinitionClass"
-        />
-
-    <adapter
-        factory=".dcworkflow.DCWorkflowAspect"
-        for=".interfaces.IDCWorkflowAspectDefinition
-             str"
-        provides="..interfaces.ILifeCycleObject"
-        />
+  xmlns="http://namespaces.zope.org/zope"
+  xmlns:five="http://namespaces.zope.org/five"
+  i18n_domain="alphaflow">
+
+  <utility
+    component=".expression.ExpressionAspectDefinition"
+    name="expression"
+    provides="..interfaces.IAspectDefinitionClass"
+    />
+
+  <adapter
+    factory=".expression.ExpressionAspect"
+    for=".interfaces.IExpressionAspectDefinition str"
+    provides="..interfaces.ILifeCycleObject"
+    />
+
+  <utility
+    component=".notify.EMailAspectDefinition"
+    name="email"
+    provides="..interfaces.IAspectDefinitionClass"
+    />
+
+  <adapter
+    factory=".notify.EMailAspect"
+    for=".interfaces.IEMailAspectDefinition
+    str"
+    provides="..interfaces.ILifeCycleObject"
+    />
+
+  <utility
+    component=".parent.ParentAspectDefinition"
+    name="parent"
+    provides="..interfaces.IAspectDefinitionClass"
+    />
+
+  <adapter
+    factory=".parent.ParentAspect"
+    for=".interfaces.IParentAspectDefinition
+    str"
+    provides="..interfaces.ILifeCycleObject"
+    />
+
+  <utility
+    component=".permission.PermissionAspectDefinition"
+    name="permission"
+    provides="..interfaces.IAspectDefinitionClass"
+    />
+
+  <adapter
+    factory=".permission.PermissionAspect"
+    for=".interfaces.IPermissionAspectDefinition
+    str"
+    provides="..interfaces.ILifeCycleObject"
+    />
+
+  <utility
+    component=".dcworkflow.DCWorkflowAspectDefinition"
+    name="dcworkflow"
+    provides="..interfaces.IAspectDefinitionClass"
+    />
+
+  <adapter
+    factory=".dcworkflow.DCWorkflowAspect"
+    for=".interfaces.IDCWorkflowAspectDefinition
+    str"
+    provides="..interfaces.ILifeCycleObject"
+    />
 
 </configure>

Modified: AlphaFlow/trunk/aspects/interfaces.py
==============================================================================
--- AlphaFlow/trunk/aspects/interfaces.py	(original)
+++ AlphaFlow/trunk/aspects/interfaces.py	Fri May 25 14:12:36 2007
(at)(at) -80,8 +80,11 (at)(at)
 class IPermissionAspectDefinition(IAspectDefinition):
     """Modifies the permission configuration of the associated object."""
 
-    permission_changes = zope.interface.Attribute(
-        "sequence of PermissionSetting instances")
+    permission_changes = zope.schema.Tuple(
+        title=u"Permission settings",
+        description=u"A list of permission settings that should be applied"
+                     "by this aspect.",
+        value_type=zope.schema.Object(schema=IPermissionSetting))
 
 
 class IPermissionAspect(IAspect):

Modified: AlphaFlow/trunk/aspects/permission.py
==============================================================================
--- AlphaFlow/trunk/aspects/permission.py	(original)
+++ AlphaFlow/trunk/aspects/permission.py	Fri May 25 14:12:36 2007
(at)(at) -22,7 +22,7 (at)(at)
 
     zope.interface.implements(IPermissionSetting)
 
-    name = ""
+    permission = ""
     roles = None
     acquire = None
 
(at)(at) -64,6 +64,10 (at)(at)
 
     permission_changes = ()
 
+    def __bobo_traverse__(self, REQUEST, name):
+        name = int(name)
+        change = self.permission_changes[name]
+
     def validate(self):
         """Validate the permission configuration.
 
(at)(at) -101,3 +105,5 (at)(at)
 
 InitializeClass(PermissionAspect)
 registerType(PermissionAspect, config.PROJECTNAME)
+
+

Modified: AlphaFlow/trunk/configure.zcml
==============================================================================
--- AlphaFlow/trunk/configure.zcml	(original)
+++ AlphaFlow/trunk/configure.zcml	Fri May 25 14:12:36 2007
(at)(at) -14,7 +14,6 (at)(at)
     for="Products.CMFPlone.interfaces.IPloneSiteRoot" />
 
   <include file="security.zcml" />
-  <include package="zc.sourcefactory" file="configure-z2.zcml" />
   <include package=".compatibility" />
 
   <!-- Aspect components -->
(at)(at) -109,4 +108,7 (at)(at)
   <five:deprecatedManageAddDelete
     class=".tests.content.DummyFolder"/>
 
+  <include package="zope.app.annotation" />
+  <include package="zc.sourcefactory" file="configure-z2.zcml" />
+
 </configure>

Modified: AlphaFlow/trunk/editor/activity_details.pt
==============================================================================
--- AlphaFlow/trunk/editor/activity_details.pt	(original)
+++ AlphaFlow/trunk/editor/activity_details.pt	Fri May 25 14:12:36 2007
(at)(at) -37,7 +37,7 (at)(at)
             tal:content="activity"/>
         </li>
         <li tal:repeat="aspect checkpoint/objectValues">
-          <span tal:replace="aspect/title"/> (<a tal:attributes="href
string:aspect://${checkpoint/getId};;${aspect/getId}">Edit</a>)</li>
+          <span tal:replace="aspect/title"/> (<a tal:attributes="href
string:aspect://${checkpoint/getId}/${aspect/getId}">Edit</a>)</li>
       </ol>
 
     </metal:block>

Modified: AlphaFlow/trunk/editor/aspect.pt
==============================================================================
--- AlphaFlow/trunk/editor/aspect.pt	(original)
+++ AlphaFlow/trunk/editor/aspect.pt	Fri May 25 14:12:36 2007
(at)(at) -1,16 +1,18 (at)(at)
-<form metal:use-macro="context/(at)(at)editor_form/form">
+<metal:block define-macro="form">
+  <form metal:use-macro="context/(at)(at)editor_form/form">
 
-  <div metal:fill-slot="header">
-    <h2>
-      <a tal:define="activity context/acquireActivity"
-        tal:attributes="href string:activity://${activity/getId}"
-        tal:content="activity/title">Back</a>
-      &raquo;
-      <span tal:define="cp context/getParentNode"
-        tal:content="cp/title"/>
-      &raquo;
-      <span tal:content="context/title"/>
-    </h2>
-  </div>
+    <div metal:fill-slot="header">
+      <h2>
+        <a tal:define="activity context/acquireActivity"
+          tal:attributes="href string:activity://${activity/getId}"
+          tal:content="activity/title">Back</a>
+        &raquo;
+        <span tal:define="cp context/getParentNode"
+          tal:content="cp/title"/>
+        &raquo;
+        <span tal:content="context/title"/>
+      </h2>
+    </div>
 
-</form>
+  </form>
+</metal:block>

Modified: AlphaFlow/trunk/editor/checkpoint.pt
==============================================================================
--- AlphaFlow/trunk/editor/checkpoint.pt	(original)
+++ AlphaFlow/trunk/editor/checkpoint.pt	Fri May 25 14:12:36 2007
(at)(at) -29,7 +29,7 (at)(at)
       </li>
       <li tal:repeat="aspect context/objectValues">
         <span tal:replace="aspect/title"/> (<a tal:attributes="href
-         
string:aspect://${context/getId};;${aspect/getId}">Edit</a>)</li>
+         
string:aspect://${context/getId}/${aspect/getId}">Edit</a>)</li>
     </ol>
 
     <h3>Add new aspect</h3>

Modified: AlphaFlow/trunk/editor/configure.zcml
==============================================================================
--- AlphaFlow/trunk/editor/configure.zcml	(original)
+++ AlphaFlow/trunk/editor/configure.zcml	Fri May 25 14:12:36 2007
(at)(at) -14,6 +14,13 (at)(at)
     />
 
   <browser:page
+    for="*"
+    template="aspect.pt"
+    name="aspect_form"
+    permission="zope2.View"
+    />
+
+  <browser:page
     for="Products.AlphaFlow.interfaces.IProcess"
     template="index.pt"
     class=".editor.Editor"
(at)(at) -51,7 +58,6 (at)(at)
     permission="zope2.View"
     />
 
-
   <browser:page
     for="Products.AlphaFlow.interfaces.IProcess"
     template="activitypanel.pt"
(at)(at) -259,6 +265,13 (at)(at)
     />
 
   <browser:page
+    for="Products.AlphaFlow.aspects.interfaces.IPermissionAspectDefinition"
+    name="edit"
+    permission="zope2.View"
+    class=".form.EditPermissionAspect"
+    />
+
+  <browser:page
     for="Products.AlphaFlow.aspects.interfaces.IDCWorkflowAspectDefinition"
     name="edit"
     permission="zope2.View"

Modified: AlphaFlow/trunk/editor/form.py
==============================================================================
--- AlphaFlow/trunk/editor/form.py	(original)
+++ AlphaFlow/trunk/editor/form.py	Fri May 25 14:12:36 2007
(at)(at) -296,3 +296,11 (at)(at)
     form_fields = zope.formlib.form.FormFields(
         Products.AlphaFlow.aspects.interfaces.IEMailAspectDefinition,
        
Products.AlphaFlow.editor.interfaces.ISimpleRecipientSchema).omit('recipient_modes')
+
+
+class EditPermissionAspect(AspectEditForm):
+
+    form_fields = zope.formlib.form.FormFields(
+       
Products.AlphaFlow.aspects.interfaces.IPermissionAspectDefinition).omit('permission_changes')
+
+    template = ZopeTwoPageTemplateFile('permission.pt')

Added: AlphaFlow/trunk/editor/permission.pt
==============================================================================
--- (empty file)
+++ AlphaFlow/trunk/editor/permission.pt	Fri May 25 14:12:36 2007
(at)(at) -0,0 +1,20 (at)(at)
+<div>
+  <form metal:use-macro="context/(at)(at)aspect_form/form"/>
+
+  <h2>Permission changes</h2>
+
+  <dl>
+    <tal:block repeat="change context/permission_changes">
+      <dt><span tal:content="change/permission"/> (<a
tal:attributes="href
+          string:permission://${repeat/change/index}">Edit</a>)
+      </dt>
+
+      <dd>
+        Set roles to: <span tal:content="python:',
'.join(change.roles)"/><br/>
+        <span tal:condition="change/acquire">Acquire additional
roles.</span>
+        <span tal:condition="not:change/acquire">Do not acquire
additional
+          roles.</span>
+      </dd>
+    </tal:block>
+  </dl>
+</div>

Modified: AlphaFlow/trunk/editor/resources/editor.js
==============================================================================
--- AlphaFlow/trunk/editor/resources/editor.js	(original)
+++ AlphaFlow/trunk/editor/resources/editor.js	Fri May 25 14:12:36 2007
(at)(at) -87,30 +87,43 (at)(at)
         Array("checkpoint", "loadCheckpointEditPanel"),
         Array("aspect", "loadAspectEditPanel"),
         Array("workflow", "loadWorkflowEditPanel"),
-        Array("new-exit", "addExit"));
+        Array("new-exit", "addExit"),
+        Array("permission", "loadPermissionEditPanel"));
 
     links = getElementsByTagAndClassName('a');
     links = links.concat(getElementsByTagAndClassName('area'));
 
     forEach(links, function(link) {
-        forEach(protocols, function(protocol) {
-            /* This function is partially programming by accident. The
-             * behaviour of regexp is kind of weird. 
-             */
-            var match = link.href.match(FIND_PROTOCOL)
-            if (match) {
-                if (match[1] == protocol[0]) {
-                    link.reference = link.href.replace(FIND_PROTOCOL, "");
-                    /* IE FIX. IE leaves a trailing slash. :/ */
-                    link.reference = link.reference.replace(/\/$/, "");
-                    link.href = "#";
-                    connect(link, "onclick", editor, protocol[1]);
+            forEach(protocols, function(protocol) {
+                /* This function is partially programming by accident. The
+                 * behaviour of regexp is kind of weird. 
+                 */
+                var match = link.href.match(FIND_PROTOCOL)
+                if (match) {
+                    if (match[1] == protocol[0]) {
+                        link.reference = link.href.replace(FIND_PROTOCOL, "");
+                        /* IE FIX. IE leaves a trailing slash. :/ */
+                        link.reference = link.reference.replace(/\/$/, "");
+                        link.href = "#";
+                        connect(link, "onclick", editor, function(url) {
+                                editor._load_panel_link(url, protocol[1]);
+                                });
+                    }
                 }
-            }
-        }); 
+            });
     }); 
 };
 
+Editor.prototype._load_panel_link = function(url, function_name) {
+/* Dispatch the panel link to the correct function. Split the 
+   positional arguments first and apply them to the function call. */ 
+    var editor = this;
+    if (url.src != undefined) {
+        var url = url.src().reference;
+    };
+    var args = url.split("/");
+    editor[function_name].apply(editor, args);
+};
 
 Editor.prototype.submitForm = function() {
     var pane = this.sidebar;
(at)(at) -130,9 +143,9 (at)(at)
 };
 
 
-Editor.prototype._load_edit_panel = function(edit_view) {
+Editor.prototype._load_edit_panel = function(path) {
     var editor = this;
-    var d = editor._loadPanel(edit_view+'/edit');
+    var d = editor._loadPanel(path+'/(at)(at)edit');
     d.addCallback(function() {
         editor.initEditPanel();
         editor.reloadCanvas();
(at)(at) -163,10 +176,8 (at)(at)
 
 /* Activity details */
 
-Editor.prototype.loadActivityDetailsPanel = function(activity_link) {
+Editor.prototype.loadActivityDetailsPanel = function(activity) {
     var editor = this;
-
-    activity = activity_link.src().reference;
     editor.activity = activity;
     var d = editor._loadPanel(activity+'/activity_details');
     editor.reloadCanvas();
(at)(at) -176,9 +187,8 (at)(at)
 
 /* Activity edit form */
 
-Editor.prototype.loadActivityEditPanel = function(activity_link) {
+Editor.prototype.loadActivityEditPanel = function(activity) {
     var editor = this;
-    activity = activity_link.src().reference;
     editor.activity = activity;
     editor._load_edit_panel(activity);
     return false;
(at)(at) -188,9 +198,6 (at)(at)
 
 Editor.prototype.loadCheckpointEditPanel = function(checkpoint) {
     var editor = this;
-    if (checkpoint.src != undefined) {
-        checkpoint = checkpoint.src().reference;
-    };
     editor.checkpoint = checkpoint;
     d = editor._load_edit_panel(editor.activity+'/'+editor.checkpoint);
     d.addCallback(function() {
(at)(at) -212,15 +219,11 (at)(at)
 
 /* Aspect edit form */
 
-Editor.prototype.loadAspectEditPanel = function(aspect) {
+Editor.prototype.loadAspectEditPanel = function(checkpoint, aspect) {
     var editor = this;
-    if (aspect.src != undefined) {
-        var aspect = aspect.src().reference;
-    };
-    var aspect = aspect.split(";");
+    editor.checkpoint = checkpoint;
+    editor.aspect = aspect;
 
-    var checkpoint = aspect[0];
-    aspect = aspect[1];
     editor._load_edit_panel(editor.activity+'/'+checkpoint+'/'+aspect);
     return false;
 };
(at)(at) -243,6 +246,12 (at)(at)
     });
 }
 
+/* Edit a permission setting */
+Editor.prototype.loadPermissionEditPanel = function(permission) {
+    var editor = this;
+    editor._load_edit_panel(editor.activity+'/'+editor.checkpoint+'/'+
+                            editor.aspect+'/'+permission);
+}
 
 /* Workflow graph */
 

Modified: AlphaFlow/trunk/editor/resources/style.css
==============================================================================
--- AlphaFlow/trunk/editor/resources/style.css	(original)
+++ AlphaFlow/trunk/editor/resources/style.css	Fri May 25 14:12:36 2007
(at)(at) -92,7 +92,7 (at)(at)
   padding:0.2em 0.5em;
 }
 
-p { padding:0.5em; }
+p, dl { padding:0.5em; }
 
 /* Form styling */
 
(at)(at) -172,3 +172,11 (at)(at)
 .select-controls .spacer {
   margin:0em 4em;
 }
+
+dl dt {
+  font-weight:bold;
+}
+
+dl dd {
+  margin-bottom:1em;
+}

SVN: r4883 - in AlphaFlow/trunk: compatibility editor/resources
Christian Theune <ct(at)gocept.com>
2007-05-29 18:45:46 [ FULL ]
Author: ctheune
Date: Tue May 29 18:45:42 2007
New Revision: 4883

Log:
 - fixed initialisation bug of the multi select widget



Modified:
   AlphaFlow/trunk/compatibility/orderedSelectionList.pt
   AlphaFlow/trunk/editor/resources/editor.js
   AlphaFlow/trunk/editor/resources/widgetsupport.js

Modified: AlphaFlow/trunk/compatibility/orderedSelectionList.pt
==============================================================================
--- AlphaFlow/trunk/compatibility/orderedSelectionList.pt	(original)
+++ AlphaFlow/trunk/compatibility/orderedSelectionList.pt	Tue May 29 18:45:42
2007
(at)(at) -1,142 +1,3 (at)(at)
-<script type="text/javascript">
-
-  function moveItems(from, to)
-  {
-  // shortcuts for selection fields
-  var src = document.getElementById(from);
-  var tgt = document.getElementById(to);
-
-  if (src.selectedIndex == -1) selectionError();
-  else
-  {
-  // iterate over all selected items
-  // --> attribute "selectedIndex" doesn't support multiple selection.
-  // Anyway, it works here, as a moved item isn't selected anymore,
-  // thus "selectedIndex" indicating the "next" selected item :)
-  while (src.selectedIndex > -1)
-  if (src.options[src.selectedIndex].selected)
-  {
-  // create a new virtal object with values of item to copy
-  temp = new Option(src.options[src.selectedIndex].text,
-  src.options[src.selectedIndex].value);
-  // append virtual object to targe
-  tgt.options[tgt.length] = temp;
-  // want to select newly created item
-  temp.selected = true;
-  // delete moved item in source
-  src.options[src.selectedIndex] = null;
-  }
-  }
-  }
-
-  // move item from "from" selection to "to" selection
-  function from2to(name)
-  {
-  moveItems(name+".from", name+".to");
-  copyDataForSubmit(name);
-  }
-
-  // move item from "to" selection back to "from" selection
-  function to2from(name)
-  {
-  moveItems(name+".to", name+".from");
-  copyDataForSubmit(name);
-  }
-
-  function swapFields(a, b)
-  {
-  // swap text
-  var temp = a.text;
-  a.text = b.text;
-  b.text = temp;
-  // swap value
-  temp = a.value;
-  a.value = b.value;
-  b.value = temp;
-  // swap selection
-  temp = a.selected;
-  a.selected = b.selected;
-  b.selected = temp;
-  }
-
-  // move selected item in "to" selection one up
-  function moveUp(name)
-  {
-  // shortcuts for selection field
-  var toSel = document.getElementById(name+".to");
-
-  if (toSel.selectedIndex == -1)
-  selectionError();
-  else if (toSel.options[0].selected)
-  alert("Cannot move further up!");
-  else for (var i = 0; i < toSel.length; i++)
-  if (toSel.options[i].selected)
-  {
-  swapFields(toSel.options[i-1], toSel.options[i]);
-  copyDataForSubmit(name);
-  }
-  }
-
-  // move selected item in "to" selection one down
-  function moveDown(name)
-  {
-  // shortcuts for selection field
-  var toSel = document.getElementById(name+".to");
-
-  if (toSel.selectedIndex == -1) {
-  selectionError();
-  } else if (toSel.options[toSel.length-1].selected) {
-  alert("Cannot move further down!");
-  } else {
-  for (var i = toSel.length-1; i >= 0; i--) {
-  if (toSel.options[i].selected) {
-  swapFields(toSel.options[i+1], toSel.options[i]);
-  }
-  }
-  copyDataForSubmit(name);
-  }
-  }
-
-  // copy each item of "toSel" into one hidden input field
-  function copyDataForSubmit(name)
-  {
-  // shortcuts for selection field and hidden data field
-  var toSel = document.getElementById(name+".to");
-  var toDataContainer = document.getElementById(name+".toDataContainer");
-
-  // delete all child nodes (--> complete content) of "toDataContainer"
span
-  while (toDataContainer.hasChildNodes())
-  toDataContainer.removeChild(toDataContainer.firstChild);
-
-  // create new hidden input fields - one for each selection item of
-  // "to" selection
-  for (var i = 0; i < toSel.options.length; i++)
-  {
-  // create virtual node with suitable attributes
-  var newNode = document.createElement("input");
-  var newAttr = document.createAttribute("name");
-  newAttr.nodeValue = name;
-  newNode.setAttributeNode(newAttr);
-
-  newAttr = document.createAttribute("type");
-  newAttr.nodeValue = "hidden";
-  newNode.setAttributeNode(newAttr);
-
-  newAttr = document.createAttribute("value");
-  newAttr.nodeValue = toSel.options[i].value;
-  newNode.setAttributeNode(newAttr);
-
-  // actually append virtual node to DOM tree
-  toDataContainer.appendChild(newNode);
-  }
-  }
-
-  // error message for missing selection
-  function selectionError()
-  {alert("Must select something!")}
-
-</script>
-
 <div class="ordered-selection-field">
 
   <div>
(at)(at) -151,11 +12,9 (at)(at)
       tal:attributes="name string:${view/name}-empty-marker"/>
     <span id="toDataContainer"
       tal:attributes="id string:${view/name}.toDataContainer">
-      <script type="text/javascript" tal:content="string:
-        copyDataForSubmit('${view/name}');">
-        // initial copying of field "field.to" --> "field"
-        copyDataForSubmit("<i tal:replace="${view/name}"/>");
-      </script>
+      <div style="display:none">
+        <a tal:attributes="href
string:call-function://copyDataForSubmit/${view/name}"/>
+      </div>
     </span>
   </div>
 

Modified: AlphaFlow/trunk/editor/resources/editor.js
==============================================================================
--- AlphaFlow/trunk/editor/resources/editor.js	(original)
+++ AlphaFlow/trunk/editor/resources/editor.js	Tue May 29 18:45:42 2007
(at)(at) -89,7 +89,8 (at)(at)
         Array("workflow", "loadWorkflowEditPanel"),
         Array("new-exit", "addExit"),
         Array("new-permission-setting", "addPermissionSetting"),
-        Array("permission", "loadPermissionEditPanel"));
+        Array("permission", "loadPermissionEditPanel"),
+        Array("call-function", null));
 
     links = getElementsByTagAndClassName('a');
     links = links.concat(getElementsByTagAndClassName('area'));
(at)(at) -106,15 +107,28 (at)(at)
                         /* IE FIX. IE leaves a trailing slash. :/ */
                         link.reference = link.reference.replace(/\/$/, "");
                         link.href = "#";
-                        connect(link, "onclick", editor, function(url) {
-                                editor._load_panel_link(url, protocol[1]);
-                                });
+
+                        if (match[1] == 'call-function') {
+                          /* XXX This is hacky. */
+                          args = link.reference.split('/')
+                          function_name = args.shift();
+                          editor[function_name].apply(editor, args);
+                        } else {
+                          connect(link, "onclick", editor, function(url) {
+                                  editor._load_panel_link(url, protocol[1]);
+                                  });
+                        };
                     }
                 }
             });
     }); 
 };
 
+Editor.prototype.copyDataForSubmit = function(name) {
+  /* Indirection to support our `href` model with `call-function` */
+  copyDataForSubmit(name);
+}
+
 Editor.prototype._load_panel_link = function(url, function_name) {
 /* Dispatch the panel link to the correct function. Split the 
    positional arguments first and apply them to the function call. */ 

Modified: AlphaFlow/trunk/editor/resources/widgetsupport.js
==============================================================================
--- AlphaFlow/trunk/editor/resources/widgetsupport.js	(original)
+++ AlphaFlow/trunk/editor/resources/widgetsupport.js	Tue May 29 18:45:42 2007
(at)(at) -132,4 +132,3 (at)(at)
 // error message for missing selection
 function selectionError()
   {alert("Must select something!")}
-

SVN: r4899 - in AlphaFlow/trunk: . activities adapters browser editor skins/alphaflow tests
Christian Theune <ct(at)gocept.com>
2007-05-30 20:49:21 [ FULL ]
Author: ctheune
Date: Wed May 30 20:49:15 2007
New Revision: 4899

Log:
 - fix permissions for editor and configlet
 - made skin methods work with new lifecycle controller



Modified:
   AlphaFlow/trunk/__init__.py
   AlphaFlow/trunk/activities/configuration.py
   AlphaFlow/trunk/activities/decision.py
   AlphaFlow/trunk/activities/simpledecision.py
   AlphaFlow/trunk/activity.py
   AlphaFlow/trunk/adapters/renderableadapter.py
   AlphaFlow/trunk/browser/configure.zcml
   AlphaFlow/trunk/config.py
   AlphaFlow/trunk/configure.zcml
   AlphaFlow/trunk/editor/configure.zcml
   AlphaFlow/trunk/instance.py
   AlphaFlow/trunk/skins/alphaflow/af_assign_process.py
   AlphaFlow/trunk/skins/alphaflow/af_edit_workitem.cpt
   AlphaFlow/trunk/skins/alphaflow/af_redirect_to_workitem_action.py
   AlphaFlow/trunk/tests/test_processmanager.py
   AlphaFlow/trunk/workitem.py

Modified: AlphaFlow/trunk/__init__.py
==============================================================================
--- AlphaFlow/trunk/__init__.py	(original)
+++ AlphaFlow/trunk/__init__.py	Wed May 30 20:49:15 2007
(at)(at) -29,10 +29,6 (at)(at)
     registerPermissions([(permission, [])], default_roles)
 
 
-def initialize_permissions(context):
-    registerPermission(config.CONTROL_PROCESS, ('Manager', 'Owner'))
-
-
 def initialize_content(context):
     from Products.AlphaFlow import instance
     import Products.AlphaFlow.activities
(at)(at) -85,7 +81,6 (at)(at)
     from Products.AlphaFlow import patch_plone_types
 
     DirectoryView.registerDirectory(config.SKINS_DIR, config.GLOBALS)
-    initialize_permissions(context)
     initialize_tools(context)
     initialize_content(context)
     initialize_index(context)
(at)(at) -105,3 +100,5 (at)(at)
 
 ModuleSecurityInfo("Products.AlphaFlow.utils").declarePublic(
     "urlAppendToQueryString")
+ModuleSecurityInfo("Products.AlphaFlow.interfaces").declarePublic(
+    "ILifeCycleController")

Modified: AlphaFlow/trunk/activities/configuration.py
==============================================================================
--- AlphaFlow/trunk/activities/configuration.py	(original)
+++ AlphaFlow/trunk/activities/configuration.py	Wed May 30 20:49:15 2007
(at)(at) -31,7 +31,6 (at)(at)
 
     configures = ()
 
-    security.declareProtected(config.EDIT_WORKFLOW, '__init__')
     def __init__(self, *args, **kwargs):
         ConfigurationActivity.inheritedAttribute("__init__")(
             self, *args, **kwargs)

Modified: AlphaFlow/trunk/activities/decision.py
==============================================================================
--- AlphaFlow/trunk/activities/decision.py	(original)
+++ AlphaFlow/trunk/activities/decision.py	Wed May 30 20:49:15 2007
(at)(at) -43,8 +43,6 (at)(at)
 
     # configurationschema gets modified by __init__!
     configurationSchema = BaseAssignableActivity.configurationSchema.copy()
-
-    security.declareProtected(config.EDIT_WORKFLOW, '__init__')
     def __init__(self):
         DecisionActivity.inheritedAttribute('__init__')(self)
         if self.configurationSchema:

Modified: AlphaFlow/trunk/activities/simpledecision.py
==============================================================================
--- AlphaFlow/trunk/activities/simpledecision.py	(original)
+++ AlphaFlow/trunk/activities/simpledecision.py	Wed May 30 20:49:15 2007
(at)(at) -64,7 +64,6 (at)(at)
         ({'id': 'decision_notice', 'type': 'text', 'mode': 'w'},
          )
 
-    security.declareProtected(config.EDIT_WORKFLOW, '__init__')
     def __init__(self):
         SimpleDecisionActivity.inheritedAttribute('__init__')(self)
         if self.configurationSchema:

Modified: AlphaFlow/trunk/activity.py
==============================================================================
--- AlphaFlow/trunk/activity.py	(original)
+++ AlphaFlow/trunk/activity.py	Wed May 30 20:49:15 2007
(at)(at) -35,7 +35,6 (at)(at)
 
     schema_to_validate = IActivity
 
-    security.declareProtected(config.EDIT_WORKFLOW, '__init__')
     def __init__(self, *args, **kwargs):
         BaseActivity.inheritedAttribute("__init__")(self, *args, **kwargs)
         self._setObject(config.CHECKPOINT_START,
(at)(at) -126,7 +125,6 (at)(at)
 
     schema_to_validate = IAutomaticActivity
 
-    security.declareProtected(config.EDIT_WORKFLOW, '__init__')
     def __init__(self, *args, **kwargs):
         BaseAutomaticActivity.inheritedAttribute("__init__")(
             self, *args, **kwargs)

Modified: AlphaFlow/trunk/adapters/renderableadapter.py
==============================================================================
--- AlphaFlow/trunk/adapters/renderableadapter.py	(original)
+++ AlphaFlow/trunk/adapters/renderableadapter.py	Wed May 30 20:49:15 2007
(at)(at) -5,15 +5,10 (at)(at)
 import os
 from StringIO import StringIO
 from tempfile import mkstemp
-from xml.dom import minidom
-try:
-  from lxml import etree
-  have_lxml = True
-except ImportError:
-  have_lxml = False
 
 import zope.interface
-from Products.AlphaFlow.interfaces import IProcess, IInstance,
IRenderableAdapter
+from Products.AlphaFlow.interfaces import (IProcess, IInstance,
+                                           IRenderableAdapter)
 from Products.AlphaFlow.adapters import adapter
 from Products.AlphaFlow import config
 from Products.AlphaFlow.utils import _www
(at)(at) -166,7 +161,7 (at)(at)
                 queue.append(child_node)
 
     data.write("}")
-    
+
     data = data.getvalue()
     if not isinstance(data, unicode):
         data = unicode(data, "utf-8")
(at)(at) -205,74 +200,32 (at)(at)
     "Convert the graph to an image map"
     return dotTheGraph(graph, 'cmapx')
 
-def dot2svg(graph):
-    "Convert the graph to SVG format."
-    svg = dotTheGraph(graph, 'svg')
-    # postprocess the SVG if libxml2 is installed
-    if have_lxml:
-        svg = postprocessSVG(svg)
-
-    # replace the group id with a meaningful activity name
-    svg = minidom.parseString(svg)
-    groups = svg.getElementsByTagName('g')
-    for g in groups:
-        if g.getAttribute('class') != 'node':
-            continue
-        title = g.firstChild
-        if title.nodeName == 'title':
-            # first pick the activity type
-            newid = title.firstChild.nodeValue
-            # change the node id
-            g.setAttribute('id', newid)
-    # strip the doctype declaration and the xml header
-    return svg.getElementsByTagName('svg')[0].toxml()
-
 
 def dot2png(graph):
     "Convert the graph to png format."
     return dotTheGraph(graph, 'png')
 
-def dot2gif(graph):
-    "Convert the graph to png format."
-    return dotTheGraph(graph, 'gif')
-
-def postprocessSVG(svg):
-    "post processes the SVG"
-    xslt_path = config.LOCATION + config.PP_XSLT
-    if not os.path.isfile(xslt_path):
-        return svg
-    else:
-        pp_xslt = etree.parse(xslt_path)
-    
-    style = etree.XSLT(pp_xslt)
-    doc = etree.ElementTree(etree.XML(svg))
-    result = style.apply(doc)
-    return etree.tostring(result.getroot())
-
 
 class DictWithDefault(dict):
-    
+
     default = None
-    
+
     def get(self, key, default=None):
         return dict.get(self, key, self.default)
-    
+
     def setdefault(self, key, default=None):
         self.default = default
         return dict.setdefault(self, key, default)
 
 dot_to_format = DictWithDefault()
-dot_to_format['svg'] = dot2svg
 dot_to_format['map'] = dot2map
-dot_to_format['gif'] = dot2gif
 dot_to_format.setdefault('png', dot2png)
 
 format_contenttype = {}
-format_contenttype['svg'] = 'text/xml'
 format_contenttype['map'] = 'text/xml'
-format_contenttype['gif'] = 'image/gif'
 format_contenttype['png'] = 'image/png'
 
+
 class RenderableAdapter(adapter.Adapter):
 
     zope.interface.implements(IRenderableAdapter)
(at)(at) -293,6 +246,5 (at)(at)
         image = dot_to_format.get(format)(graph) # convert to format
         return image
 
-
 # XXX 
 getRenderableAdapter = RenderableAdapter

Modified: AlphaFlow/trunk/browser/configure.zcml
==============================================================================
--- AlphaFlow/trunk/browser/configure.zcml	(original)
+++ AlphaFlow/trunk/browser/configure.zcml	Wed May 30 20:49:15 2007
(at)(at) -8,27 +8,27 (at)(at)
     name="manage_overview"
     template="instanceOverview.pt"
     class=".instance.ZMIOverview"
-    permission="zope2.View"
+    permission="alphaflow.ManageWorkflows"
     />
 
   <browser:page
     for="Products.AlphaFlow.interfaces.IWorkItem"
     name="overview"
     class=".workitem.Overview"
-    permission="zope2.View"
+    permission="alphaflow.ManageWorkflows"
     />
 
   <browser:page
     for="*"
     name="prefs_alphaflow"
     template="prefs_alphaflow.pt"
-    permission="zope2.View"
+    permission="alphaflow.ManageWorkflows"
     />
 
   <browser:pages
     for="*"
     class=".configlet.Configlet"
-    permission="zope2.View">
+    permission="alphaflow.ManageWorkflows">
 
     <browser:page
       name="addProcess"
(at)(at) -51,9 +51,9 (at)(at)
   <browser:page
     for="Products.AlphaFlow.interfaces.IProcess"
     name="statistics"
-    permission="zope2.View"
     class=".statistics.Statistics"
     template="statistics.pt"
+    permission="alphaflow.ManageWorkflows"
     />
 
 </configure>

Modified: AlphaFlow/trunk/config.py
==============================================================================
--- AlphaFlow/trunk/config.py	(original)
+++ AlphaFlow/trunk/config.py	Wed May 30 20:49:15 2007
(at)(at) -5,7 +5,7 (at)(at)
 
 
 # GRAPHVIZ
-#GRAPHVIZ_DOT = "dot"
+# GRAPHVIZ_DOT = "dot"
 # You might want to give the exact path:
 GRAPHVIZ_DOT = "/usr/bin/dot"
 
(at)(at) -21,7 +21,6 (at)(at)
 # relevant parts resulting in a *vast* amount of getCharset calls.
 # Being a skin method getCharset is utterly slow. Defining the site encoding
 # here too speeds up *a lot*.
-#
 
 
 # Default for workflow graph display
(at)(at) -51,16 +50,12 (at)(at)
 PROJECTNAME = "AlphaFlow"
 WORKFLOW_DIRS = ['workflow', 'workflows']
 
-# Postprocessing XSLT
-PP_XSLT = "www/postprocessSVG.xsl"
-
 # Permission definitions
 ADD_CONTENT_PERMISSION = "Add portal content"
 EDIT_CONTENT_PERMISSION = "Modify portal content"
 
 MANAGE_WORKFLOW = "Manage workflows"
 INIT_PROCESS = "Initialize workflow process"
-CONTROL_PROCESS = "Control workflow process"
 
 # Permission to protect informative methods
 WORK_WITH_PROCESS = "Work with process instance"
(at)(at) -68,9 +63,6 (at)(at)
 # Permission to protect workitem actions
 HANDLE_WORKITEM = "Handle Workitem" 
 
-# workflow editor permissions
-EDIT_WORKFLOW = "Edit workflows"
-
 # I need to know where I live
 import os
 LOCATION = os.path.split(__file__)[0]

Modified: AlphaFlow/trunk/configure.zcml
==============================================================================
--- AlphaFlow/trunk/configure.zcml	(original)
+++ AlphaFlow/trunk/configure.zcml	Wed May 30 20:49:15 2007
(at)(at) -5,6 +5,13 (at)(at)
   xmlns:five="http://namespaces.zope.org/five"
   i18n_domain="alphaflow">
 
+  <!-- Permissions -->
+  <!-- The titles have to be the same as the names of the permissions
+       in Zope 2! -->
+  <permission
+    id="alphaflow.ManageWorkflows"
+    title="Manage workflows"/>
+
   <gs:registerProfile
     name="default"
     title="AlphaFlow profile"

Modified: AlphaFlow/trunk/editor/configure.zcml
==============================================================================
--- AlphaFlow/trunk/editor/configure.zcml	(original)
+++ AlphaFlow/trunk/editor/configure.zcml	Wed May 30 20:49:15 2007
(at)(at) -10,35 +10,35 (at)(at)
     for="*"
     template="form.pt"
     name="editor_form"
-    permission="zope2.View"
+    permission="alphaflow.ManageWorkflows"
     />
 
   <browser:page
     for="*"
     template="aspect.pt"
     name="aspect_form"
-    permission="zope2.View"
+    permission="alphaflow.ManageWorkflows"
     />
 
   <browser:page
     for="Products.AlphaFlow.interfaces.IProcess"
     template="index.pt"
     class=".editor.Editor"
-    permission="zope2.View"
+    permission="alphaflow.ManageWorkflows"
     name="editor.html"
     />
 
   <browser:page
      for="Products.AlphaFlow.interfaces.IVersionedProcess"
      class=".editor.VersionedEditor"
-     permission="zope2.View"
+     permission="alphaflow.ManageWorkflows"
      name="editor.html"
      />
 
   <browser:page
     for="Products.AlphaFlow.interfaces.IProcess"
     class=".editor.Graph"
-    permission="zope2.View"
+    permission="alphaflow.ManageWorkflows"
     name="graph"
     attribute="getGraph"
     />
(at)(at) -46,7 +46,7 (at)(at)
   <browser:page
     for="Products.AlphaFlow.interfaces.IProcess"
     class=".editor.Graph"
-    permission="zope2.View"
+    permission="alphaflow.ManageWorkflows"
     name="map"
     attribute="getMap"
     />
(at)(at) -55,21 +55,21 (at)(at)
     for="Products.AlphaFlow.interfaces.IProcess"
     class=".editor.AddActivity"
     name="add_activity"
-    permission="zope2.View"
+    permission="alphaflow.ManageWorkflows"
     />
 
   <browser:page
     for="Products.AlphaFlow.interfaces.ICheckpointDefinition"
     class=".editor.AddAspect"
     name="add_aspect"
-    permission="zope2.View"
+    permission="alphaflow.ManageWorkflows"
     />
 
   <browser:page
     for="Products.AlphaFlow.aspects.interfaces.IPermissionAspectDefinition"
     class=".editor.AddPermissionSetting"
     name="add_setting"
-    permission="zope2.View"
+    permission="alphaflow.ManageWorkflows"
     />
 
   <browser:page
(at)(at) -77,7 +77,7 (at)(at)
     template="activitypanel.pt"
     class=".editor.ActivityPanel"
     name="activitypanel"
-    permission="zope2.View"
+    permission="alphaflow.ManageWorkflows"
     />
 
   <browser:page
(at)(at) -85,7 +85,7 (at)(at)
     template="activity_details.pt"
     class=".editor.ActivityPanel"
     name="activity_details"
-    permission="zope2.View"
+    permission="alphaflow.ManageWorkflows"
     />
 
   <!-- The various activity edit views -->
(at)(at) -93,209 +93,209 (at)(at)
     for="Products.AlphaFlow.activities.interfaces.IExpressionActivity"
     class=".form.EditExpressionActivity"
     name="edit"
-    permission="zope2.View"
+    permission="alphaflow.ManageWorkflows"
     />
 
   <browser:page
     for="Products.AlphaFlow.activities.interfaces.IExpressionActivity"
     class=".form.ViewExpressionActivity"
     name="display_form"
-    permission="zope2.View"
+    permission="alphaflow.ManageWorkflows"
     />
 
   <browser:page
     for="Products.AlphaFlow.activities.interfaces.IAlarmActivity"
     class=".form.EditAlarmActivity"
     name="edit"
-    permission="zope2.View"
+    permission="alphaflow.ManageWorkflows"
     />
 
   <browser:page
     for="Products.AlphaFlow.activities.interfaces.IAlarmActivity"
     class=".form.ViewAlarmActivity"
     name="display_form"
-    permission="zope2.View"
+    permission="alphaflow.ManageWorkflows"
     />
 
   <browser:page
     for="Products.AlphaFlow.activities.interfaces.IDecisionActivity"
     class=".form.EditDecisionActivity"
     name="edit"
-    permission="zope2.View"
+    permission="alphaflow.ManageWorkflows"
     />
 
   <browser:page
     for="Products.AlphaFlow.activities.interfaces.IDecisionActivity"
     class=".form.ViewDecisionActivity"
     name="display_form"
-    permission="zope2.View"
+    permission="alphaflow.ManageWorkflows"
     />
 
   <browser:page
     for="Products.AlphaFlow.activities.interfaces.IGateActivity"
     class=".form.EditGateActivity"
     name="edit"
-    permission="zope2.View"
+    permission="alphaflow.ManageWorkflows"
     />
 
   <browser:page
     for="Products.AlphaFlow.activities.interfaces.IGateActivity"
     class=".form.ViewGateActivity"
     name="display_form"
-    permission="zope2.View"
+    permission="alphaflow.ManageWorkflows"
     />
 
   <browser:page
     for="Products.AlphaFlow.activities.interfaces.IConfigurationActivity"
     class=".form.EditConfigurationActivity"
     name="edit"
-    permission="zope2.View"
+    permission="alphaflow.ManageWorkflows"
     />
 
   <browser:page
     for="Products.AlphaFlow.activities.interfaces.IConfigurationActivity"
     class=".form.ViewConfigurationActivity"
     name="display_form"
-    permission="zope2.View"
+    permission="alphaflow.ManageWorkflows"
     />
 
   <browser:page
     for="Products.AlphaFlow.activities.interfaces.ISwitchActivity"
     class=".form.EditSwitchActivity"
     name="edit"
-    permission="zope2.View"
+    permission="alphaflow.ManageWorkflows"
     />
 
   <browser:page
     for="Products.AlphaFlow.activities.interfaces.ISwitchActivity"
     class=".form.ViewSwitchActivity"
     name="display_form"
-    permission="zope2.View"
+    permission="alphaflow.ManageWorkflows"
     />
 
   <browser:page
     for="Products.AlphaFlow.activities.interfaces.INTaskActivity"
     class=".form.EditNTaskActivity"
     name="edit"
-    permission="zope2.View"
+    permission="alphaflow.ManageWorkflows"
     />
 
   <browser:page
     for="Products.AlphaFlow.activities.interfaces.INTaskActivity"
     class=".form.ViewNTaskActivity"
     name="display_form"
-    permission="zope2.View"
+    permission="alphaflow.ManageWorkflows"
     />
 
   <browser:page
     for="Products.AlphaFlow.activities.interfaces.IRouteActivity"
     class=".form.EditRouteActivity"
     name="edit"
-    permission="zope2.View"
+    permission="alphaflow.ManageWorkflows"
     />
 
   <browser:page
     for="Products.AlphaFlow.activities.interfaces.IRouteActivity"
     class=".form.ViewRouteActivity"
     name="display_form"
-    permission="zope2.View"
+    permission="alphaflow.ManageWorkflows"
     />
 
   <browser:page
     for="Products.AlphaFlow.activities.interfaces.ISimpleDecisionActivity"
     class=".form.EditSimpleDecisionActivity"
     name="edit"
-    permission="zope2.View"
+    permission="alphaflow.ManageWorkflows"
     />
 
   <browser:page
     for="Products.AlphaFlow.activities.interfaces.ISimpleDecisionActivity"
     class=".form.ViewSimpleDecisionActivity"
     name="display_form"
-    permission="zope2.View"
+    permission="alphaflow.ManageWorkflows"
     />
 
   <browser:page
     for="Products.AlphaFlow.activities.interfaces.IEMailActivity"
     class=".form.EditEMailActivity"
     name="edit"
-    permission="zope2.View"
+    permission="alphaflow.ManageWorkflows"
     />
 
   <browser:page
     for="Products.AlphaFlow.activities.interfaces.IEMailActivity"
     class=".form.ViewEMailActivity"
     name="display_form"
-    permission="zope2.View"
+    permission="alphaflow.ManageWorkflows"
     />
 
   <browser:page
     for="Products.AlphaFlow.interfaces.ICheckpointDefinition"
     name="edit"
-    permission="zope2.View"
+    permission="alphaflow.ManageWorkflows"
     class=".form.EditCheckpoint"
     />
 
   <browser:page
     for="Products.AlphaFlow.interfaces.IExitDefinition"
     name="edit"
-    permission="zope2.View"
+    permission="alphaflow.ManageWorkflows"
     class=".form.EditExit"
     />
 
   <browser:page
     for="Products.AlphaFlow.activities.interfaces.ICaseDefinition"
     name="edit"
-    permission="zope2.View"
+    permission="alphaflow.ManageWorkflows"
     class=".form.EditCase"
     />
 
   <browser:page
     for="Products.AlphaFlow.interfaces.IProcess"
     name="edit"
-    permission="zope2.View"
+    permission="alphaflow.ManageWorkflows"
     class=".form.EditWorkflow"
     />
 
   <browser:page
     for="Products.AlphaFlow.aspects.interfaces.IExpressionAspectDefinition"
     name="edit"
-    permission="zope2.View"
+    permission="alphaflow.ManageWorkflows"
     class=".form.EditExpressionAspect"
     />
 
   <browser:page
     for="Products.AlphaFlow.aspects.interfaces.IParentAspectDefinition"
     name="edit"
-    permission="zope2.View"
+    permission="alphaflow.ManageWorkflows"
     class=".form.EditParentAspect"
     />
 
   <browser:page
     for="Products.AlphaFlow.aspects.interfaces.IEMailAspectDefinition"
     name="edit"
-    permission="zope2.View"
+    permission="alphaflow.ManageWorkflows"
     class=".form.EditEMailAspect"
     />
 
   <browser:page
     for="Products.AlphaFlow.aspects.interfaces.IPermissionAspectDefinition"
     name="edit"
-    permission="zope2.View"
+    permission="alphaflow.ManageWorkflows"
     class=".form.EditPermissionAspect"
     />
 
   <browser:page
     for="Products.AlphaFlow.aspects.interfaces.IPermissionSetting"
     name="edit"
-    permission="zope2.View"
+    permission="alphaflow.ManageWorkflows"
     class=".form.EditPermissionSetting"
     />
 
   <browser:page
     for="Products.AlphaFlow.aspects.interfaces.IDCWorkflowAspectDefinition"
     name="edit"
-    permission="zope2.View"
+    permission="alphaflow.ManageWorkflows"
     class=".form.EditDCWorkflowAspect"
     />
 
(at)(at) -304,14 +304,14 (at)(at)
     for="Products.AlphaFlow.activities.interfaces.ISwitchActivity"
     class=".editor.AddExit"
     name="add_exit"
-    permission="zope2.View"
+    permission="alphaflow.ManageWorkflows"
     />
 
   <browser:page
     for="Products.AlphaFlow.activities.interfaces.INTaskActivity"
     class=".editor.AddExit"
     name="add_exit"
-    permission="zope2.View"
+    permission="alphaflow.ManageWorkflows"
     />
 
   <!-- Resources -->

Modified: AlphaFlow/trunk/instance.py
==============================================================================
--- AlphaFlow/trunk/instance.py	(original)
+++ AlphaFlow/trunk/instance.py	Wed May 30 20:49:15 2007
(at)(at) -119,10 +119,6 (at)(at)
     ###########
     # IInstance
 
-    def start(self, comment=""):
-        import pdb; pdb.set_trace() 
-        return ILifeCycleController(self).start(comment)
-
     def onStart(self):
         Instance.inheritedAttribute("onStart")(self)
         start_activities = self.getProcess().startActivity

Modified: AlphaFlow/trunk/skins/alphaflow/af_assign_process.py
==============================================================================
--- AlphaFlow/trunk/skins/alphaflow/af_assign_process.py	(original)
+++ AlphaFlow/trunk/skins/alphaflow/af_assign_process.py	Wed May 30 20:49:15
2007
(at)(at) -2,11 +2,11 (at)(at)
 # Copyright (c) 2004-2006 gocept gmbh & co. kg
 # See also LICENSE.txt
 # af_assign_process.py,v 1.5.6.2 2005/05/02 10:08:52 zagy Exp
-
+from Products.AlphaFlow.interfaces import ILifeCycleController
 request = context.REQUEST
 
 context.assignProcess(process_id)
-instance = context.getInstance()
+instance = ILifeCycleController(context.getInstance())
 instance.start("started through plone ui")
 
 context.af_redirect_to_workitem_view(context.translate("Workflow started.",

Modified: AlphaFlow/trunk/skins/alphaflow/af_edit_workitem.cpt
==============================================================================
--- AlphaFlow/trunk/skins/alphaflow/af_edit_workitem.cpt	(original)
+++ AlphaFlow/trunk/skins/alphaflow/af_edit_workitem.cpt	Wed May 30 20:49:15
2007
(at)(at) -1,16 +1,16 (at)(at)
 <html xmlns="http://www.w3.org/1999/xhtml"
-      xml:lang="en-US"
-      lang="en-US"
-      xmlns:tal="http://xml.zope.org/namespaces/tal"
-      xmlns:metal="http://xml.zope.org/namespaces/metal"
-      xmlns:i18n="http://xml.zope.org/namespaces/i18n"
-      metal:use-macro="here/main_template/macros/master"
-      i18n:domain="plone">
+  xml:lang="en-US"
+  lang="en-US"
+  xmlns:tal="http://xml.zope.org/namespaces/tal"
+  xmlns:metal="http://xml.zope.org/namespaces/metal"
+  xmlns:i18n="http://xml.zope.org/namespaces/i18n"
+  metal:use-macro="here/main_template/macros/master"
+  i18n:domain="plone">
 
   <metal:block fill-slot="javascript_head_slot"
-        tal:define="here python:here.getInstance(wrapped=True)">
+    tal:define="here python:here.getInstance(wrapped=True)">
     <tal:block define="macro
here/archetypes_custom_js/macros/javascript_head | nothing"
-	       condition="macro">
+      condition="macro">
       <metal:block use-macro="macro" />
     </tal:block>
   </metal:block>
(at)(at) -18,55 +18,56 (at)(at)
   <body>
 
     <div metal:fill-slot="main"
-         tal:define="here python:here.getWorkItem(request['workitem'])">
+      tal:define="old_here nocall:here;
+                  here python:here.getWorkItem(request['workitem'])">
       <div metal:define-macro="main"
-	       tal:define="errors options/state/getErrors|nothing;
-	   Iterator python:modules['Products.Archetypes'].IndexIterator;
-	   tabindex python:Iterator(pos=7000);
-       grouped_schema here/getGroupedSchema;"
-	   tal:omit-tag="">
+        tal:define="errors options/state/getErrors|nothing;
+        Iterator python:modules['Products.Archetypes'].IndexIterator;
+        tabindex python:Iterator(pos=7000);
+        grouped_schema here/getGroupedSchema;"
+        tal:omit-tag="">
 
-     <h1 tal:content="python:here.getActivity().title_or_id()">Complete
work item</h1>
+        <h1
tal:content="python:here.getActivity().title_or_id()">Complete work
item</h1>
 
         <!-- Display the form -->
         <form name="edit_form" 
-              method="post"
-              enctype="multipart/form-data"
-              tal:attributes="
-                action string:${here/absolute_url}/${template/getId}" >
-
-            <tal:fields>
-                <fieldset tal:repeat="group grouped_schema">
-                    <legend
-                      tal:content="group/Title">Write
document</legend>
-                    <tal:fields repeat="field group/fields">
-                      <tal:block tal:condition="not:field/isMetadata">
-                        <metal:fieldMacro 
-                          use-macro="python: here.widget(field.getName(),
mode='edit')"/>
-                      </tal:block>
-                    </tal:fields>
-
-                </fieldset>
-            </tal:fields>
-
-
-            <!-- Need to carry context with us. -->
-            <input type="hidden" name="workitem" 
-                   tal:attributes="value request/workitem"/>
-
-
-            <input type="hidden" name="form.submitted" value="1" />
-
-            <div class="field">
-              <input 
-                 class="context"
-                 tabindex=""
-                 type="submit"
-                 name="form_submit"
-                 i18n:attributes="value"
-                 value="Submit"
-                 tal:attributes="tabindex tabindex/next;" />
-            </div>
+          method="post"
+          enctype="multipart/form-data"
+          tal:attributes="
+          action string:${old_here/absolute_url}/${template/getId}" >
+
+          <tal:fields>
+            <fieldset tal:repeat="group grouped_schema">
+              <legend
+                tal:content="group/Title">Write document</legend>
+              <tal:fields repeat="field group/fields">
+                <tal:block tal:condition="not:field/isMetadata">
+                  <metal:fieldMacro 
+                    use-macro="python: here.widget(field.getName(),
mode='edit')"/>
+                </tal:block>
+              </tal:fields>
+
+            </fieldset>
+          </tal:fields>
+
+
+          <!-- Need to carry context with us. -->
+          <input type="hidden" name="workitem" 
+            tal:attributes="value request/workitem"/>
+
+
+          <input type="hidden" name="form.submitted" value="1" />
+
+          <div class="field">
+            <input 
+              class="context"
+              tabindex=""
+              type="submit"
+              name="form_submit"
+              i18n:attributes="value"
+              value="Submit"
+              tal:attributes="tabindex tabindex/next;" />
+          </div>
 
         </form>
 

Modified: AlphaFlow/trunk/skins/alphaflow/af_redirect_to_workitem_action.py
==============================================================================
---
AlphaFlow/trunk/skins/alphaflow/af_redirect_to_workitem_action.py	(original)
+++ AlphaFlow/trunk/skins/alphaflow/af_redirect_to_workitem_action.py	Wed May
30 20:49:15 2007
(at)(at) -24,4 +24,3 (at)(at)
                              "portal_status_message=%s" % message)
 
 return response.redirect(url)
-

Modified: AlphaFlow/trunk/tests/test_processmanager.py
==============================================================================
--- AlphaFlow/trunk/tests/test_processmanager.py	(original)
+++ AlphaFlow/trunk/tests/test_processmanager.py	Wed May 30 20:49:15 2007
(at)(at) -23,8 +23,8 (at)(at)
         pm = self.portal.workflow_manager
         pid = pm.getProcess('test').getId()
         # gif (by default)
-        image = pm.renderProcess(pid, format="gif", kind='detailed')
-        self.assertEquals('GIF', image[0:3])
+        image = pm.renderProcess(pid, format="png", kind='detailed')
+        self.assertEquals('\x89PNG', image[0:4])
 
     def test_getInstance(self):
         self._import_wf('workflows/permission.alf')

Modified: AlphaFlow/trunk/workitem.py
==============================================================================
--- AlphaFlow/trunk/workitem.py	(original)
+++ AlphaFlow/trunk/workitem.py	Wed May 30 20:49:15 2007
(at)(at) -504,7 +504,7 (at)(at)
             return None
 
         activity = self.getActivity()
-        if activity.completionUrlExpression is not None:
+        if activity.completionUrlExpression:
             url = utils.evaluateTales(self, activity.completionUrlExpression)
             response.redirect(url)
         else:

MailBoxer