Index: openacs-4/packages/cms/sql/oracle/cms-publishing-wf.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/cms/sql/oracle/cms-publishing-wf.sql,v
diff -u -r1.3 -r1.4
--- openacs-4/packages/cms/sql/oracle/cms-publishing-wf.sql	9 Mar 2002 02:00:02 -0000	1.3
+++ openacs-4/packages/cms/sql/oracle/cms-publishing-wf.sql	25 Sep 2002 04:11:22 -0000	1.4
@@ -2,7 +2,6 @@
 /*
  * Business Process Definition: Simple Publishing Workflow (publishing_wf)
  *
- * Auto-generated by ACS Workflow Export, version 4.3
  *
  * Context: default
  */
@@ -178,52 +177,52 @@
 begin
     workflow.add_arc(
         workflow_key          => 'publishing_wf',
-        transition_key        => 'approval',
-        place_key             => 'authored',
-        direction             => 'out',
-        guard_callback        => 'publishing_wf.is_next',
+        transition_key        => 'authoring',
+        place_key             => 'start',
+        direction             => 'in',
+        guard_callback        => '',
         guard_custom_arg      => '',
         guard_description     => ''
     );
 end;
 /
 show errors
-        
+
 begin
     workflow.add_arc(
         workflow_key          => 'publishing_wf',
-        transition_key        => 'approval',
-        place_key             => 'edited',
-        direction             => 'in',
-        guard_callback        => '',
+        transition_key        => 'authoring',
+        place_key             => 'authored',
+        direction             => 'out',
+        guard_callback        => 'publishing_wf.is_next',
         guard_custom_arg      => '',
         guard_description     => ''
     );
 end;
 /
 show errors
-        
+
 begin
     workflow.add_arc(
         workflow_key          => 'publishing_wf',
-        transition_key        => 'approval',
-        place_key             => 'end',
+        transition_key        => 'authoring',
+        place_key             => 'start',
         direction             => 'out',
-        guard_callback        => 'publishing_wf.is_next',
+        guard_callback        => '#',
         guard_custom_arg      => '',
         guard_description     => ''
     );
 end;
 /
 show errors
-        
+
 begin
     workflow.add_arc(
         workflow_key          => 'publishing_wf',
-        transition_key        => 'approval',
-        place_key             => 'start',
-        direction             => 'out',
-        guard_callback        => 'publishing_wf.is_next',
+        transition_key        => 'editing',
+        place_key             => 'authored',
+        direction             => 'in',
+        guard_callback        => '',
         guard_custom_arg      => '',
         guard_description     => ''
     );
@@ -234,8 +233,8 @@
 begin
     workflow.add_arc(
         workflow_key          => 'publishing_wf',
-        transition_key        => 'approval',
-        place_key             => 'edited',
+        transition_key        => 'editing',
+        place_key             => 'authored',
         direction             => 'out',
         guard_callback        => '#',
         guard_custom_arg      => '',
@@ -245,11 +244,13 @@
 /
 show errors
         
+
+
 begin
     workflow.add_arc(
         workflow_key          => 'publishing_wf',
-        transition_key        => 'authoring',
-        place_key             => 'authored',
+        transition_key        => 'editing',
+        place_key             => 'edited',
         direction             => 'out',
         guard_callback        => 'publishing_wf.is_next',
         guard_custom_arg      => '',
@@ -258,14 +259,15 @@
 end;
 /
 show errors
+
         
 begin
     workflow.add_arc(
         workflow_key          => 'publishing_wf',
-        transition_key        => 'authoring',
+        transition_key        => 'editing',
         place_key             => 'start',
         direction             => 'out',
-        guard_callback        => '#',
+        guard_callback        => 'publishing_wf.is_next',
         guard_custom_arg      => '',
         guard_description     => ''
     );
@@ -276,8 +278,8 @@
 begin
     workflow.add_arc(
         workflow_key          => 'publishing_wf',
-        transition_key        => 'authoring',
-        place_key             => 'start',
+        transition_key        => 'approval',
+        place_key             => 'edited',
         direction             => 'in',
         guard_callback        => '',
         guard_custom_arg      => '',
@@ -287,25 +289,29 @@
 /
 show errors
         
+
+        
 begin
     workflow.add_arc(
         workflow_key          => 'publishing_wf',
-        transition_key        => 'editing',
-        place_key             => 'authored',
-        direction             => 'in',
-        guard_callback        => '',
+        transition_key        => 'approval',
+        place_key             => 'edited',
+        direction             => 'out',
+        guard_callback        => '#',
         guard_custom_arg      => '',
         guard_description     => ''
     );
 end;
 /
 show errors
-        
+               
+
+
 begin
     workflow.add_arc(
         workflow_key          => 'publishing_wf',
-        transition_key        => 'editing',
-        place_key             => 'edited',
+        transition_key        => 'approval',
+        place_key             => 'end',
         direction             => 'out',
         guard_callback        => 'publishing_wf.is_next',
         guard_custom_arg      => '',
@@ -314,12 +320,13 @@
 end;
 /
 show errors
-        
+                
+
 begin
     workflow.add_arc(
         workflow_key          => 'publishing_wf',
-        transition_key        => 'editing',
-        place_key             => 'start',
+        transition_key        => 'approval',
+        place_key             => 'authored',
         direction             => 'out',
         guard_callback        => 'publishing_wf.is_next',
         guard_custom_arg      => '',
@@ -329,21 +336,72 @@
 /
 show errors
         
+
 begin
     workflow.add_arc(
         workflow_key          => 'publishing_wf',
-        transition_key        => 'editing',
-        place_key             => 'authored',
+        transition_key        => 'approval',
+        place_key             => 'start',
         direction             => 'out',
-        guard_callback        => '#',
+        guard_callback        => 'publishing_wf.is_next',
         guard_custom_arg      => '',
         guard_description     => ''
     );
 end;
 /
 show errors
-        
 
+
+
+create or replace package publishing_wf as
+
+  -- simply check the 'next_place' attribute and return true if
+  -- it matches the submitted place_key
+
+  function is_next (
+    case_id           in number, 
+    workflow_key      in varchar, 
+    transition_key    in varchar, 
+    place_key         in varchar, 
+    direction	      in varchar, 
+    custom_arg	      in varchar
+  ) return char;
+
+end publishing_wf;
+/
+show errors
+
+create or replace package body publishing_wf as
+
+  function is_next (
+    case_id           in number, 
+    workflow_key      in varchar, 
+    transition_key    in varchar, 
+    place_key         in varchar, 
+    direction	      in varchar, 
+    custom_arg	      in varchar
+  ) return char is
+
+    v_next_place varchar(100);
+    v_result char(1) := 'f';
+
+  begin
+
+    v_next_place := workflow_case.get_attribute_value(case_id, 'next_place');
+
+    if v_next_place = place_key then
+      v_result := 't';
+    end if;
+     
+    return v_result;
+
+  end is_next;
+  
+end publishing_wf;
+/
+show errors
+
+
 /*****
  * Attributes
  *****/
@@ -366,36 +424,50 @@
 begin
     workflow.add_trans_attribute_map(
         workflow_key   => 'publishing_wf', 
-        transition_key => 'approval',
+        transition_key => 'authoring',
         attribute_name => 'next_place',
         sort_order     => 1
     );
 end;
 /
 show errors
+
         
 begin
     workflow.add_trans_attribute_map(
         workflow_key   => 'publishing_wf', 
-        transition_key => 'authoring',
+        transition_key => 'editing',
         attribute_name => 'next_place',
         sort_order     => 1
     );
 end;
 /
 show errors
-        
+
 begin
     workflow.add_trans_attribute_map(
         workflow_key   => 'publishing_wf', 
-        transition_key => 'editing',
+        transition_key => 'approval',
         attribute_name => 'next_place',
         sort_order     => 1
     );
 end;
 /
 show errors
         
+
+begin
+    workflow.add_trans_role_assign_map(
+        workflow_key   => 'publishing_wf', 
+        transition_key => 'authoring',
+        assign_role_key => 'authoring'
+    );
+end;
+/
+show errors
+        
+
+        
 /*****
  * Transition-role-assignment-map
  *****/
