Index: openacs-4/packages/cms/sql/postgresql/cms-publishing-wf.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/sql/postgresql/cms-publishing-wf.sql,v diff -u -N -r1.6 -r1.7 --- openacs-4/packages/cms/sql/postgresql/cms-publishing-wf.sql 9 Mar 2002 02:00:02 -0000 1.6 +++ openacs-4/packages/cms/sql/postgresql/cms-publishing-wf.sql 24 Sep 2002 20:47:12 -0000 1.7 @@ -1,383 +1,316 @@ - -/* - * Business Process Definition: Simple Publishing Workflow (publishing_wf) - * - * Auto-generated by ACS Workflow Export, version 4.3 - * - * Context: default - */ - - -/* - * Cases table - */ -create table publishing_wf_cases ( - case_id integer primary key - references wf_cases on delete cascade +create table cr_workflows ( + case_id integer + constraint cr_workflows_pk + primary key + constraint cr_workflows_case_id_fk + references wf_cases ); -/* - * Declare the object type - */ +create function inline_0 () +returns integer as ' +declare + v_workflow_key varchar(100); - -create function inline_0 () returns integer as ' begin - PERFORM workflow__create_workflow ( - ''publishing_wf'', - ''Simple Publishing Workflow'', - ''Simple Publishing Workflows'', - ''A simple linear workflow for authoring, - editing and scheduling content items.'', - ''publishing_wf_cases'', - ''case_id'' - ); + raise notice ''creating publishing_wf workflow''; + v_workflow_key := workflow__create_workflow( + ''publishing_wf'', + ''Simple Publishing Workflow'', + ''Simple Publishing Workflows'', + ''A simple linear workflow for authoring, + editing and scheduling content items.'', + ''cr_workflows'', + ''case_id'' + ); - return null; + /***** + * Places + *****/ -end;' language 'plpgsql'; + perform workflow__add_place( + ''publishing_wf'', + ''start'', + ''Created'', + 1 + ); -select inline_0 (); -drop function inline_0 (); + perform workflow__add_place( + ''publishing_wf'', + ''authored'', + ''Authored'', + 2 + ); - + perform workflow__add_place( + ''publishing_wf'', + ''edited'', + ''Edited'', + 3 + ); + perform workflow__add_place( + ''publishing_wf'', + ''end'', + ''Approved'', + 4 + ); -/***** - * Places - *****/ + /***** + * Roles + *****/ - - select workflow__add_place( - 'publishing_wf', - 'start', - 'Created', + perform workflow__add_role( + ''publishing_wf'', + ''author'', + ''Author'', 1 ); - - - select workflow__add_place( - 'publishing_wf', - 'authored', - 'Authored', + perform workflow__add_role( + ''publishing_wf'', + ''editor'', + ''Editor'', 2 ); + /***** + * Transitions + *****/ - + perform workflow__add_transition( + ''publishing_wf'', + ''authoring'', + ''Authoring'', + ''author'', + 1, + ''user'' + ); - select workflow__add_place( - 'publishing_wf', - 'edited', - 'Edited', - 3 - ); + perform workflow__add_transition( + ''publishing_wf'', + ''editing'', + ''Editing'', + ''editor'', + 2, + ''user'' + ); - + perform workflow__add_transition( + ''publishing_wf'', + ''approval'', + ''Approval'', + ''editor'', + 3, + ''user'' + ); + return 0; +end;' language 'plpgsql'; - select workflow__add_place( - 'publishing_wf', - 'end', - 'Approved', - 4 - ); +select inline_0 (); - -/***** - * Roles - *****/ +drop function inline_0 (); +begin; - select workflow__add_role ( - 'publishing_wf', - 'approval', - 'Approval', - 3 - ); + select workflow__add_arc( + 'publishing_wf', + 'start', + 'authoring' + ); - + select workflow__add_arc( + 'publishing_wf', + 'authoring', + 'authored', + 'publishing_wf__is_next', + null, + null + ); - select workflow__add_role ( - 'publishing_wf', - 'authoring', - 'Authoring', - 1 - ); + select workflow__add_arc( + 'publishing_wf', + 'authoring', + 'start', + '#', + null, + null + ); - + select workflow__add_arc( + 'publishing_wf', + 'authored', + 'editing' + ); - select workflow__add_role ( - 'publishing_wf', - 'editing', - 'Editing', - 2 - ); + + select workflow__add_arc( + 'publishing_wf', + 'editing', + 'authored', + '#', + null, + null + ); - + select workflow__add_arc( + 'publishing_wf', + 'editing', + 'edited', + 'publishing_wf__is_next', + null, + null + ); -/***** - * Transitions - *****/ + select workflow__add_arc( + 'publishing_wf', + 'editing', + 'start', + 'publishing_wf__is_next', + null, + null + ); + select workflow__add_arc( + 'publishing_wf', + 'edited', + 'approval' + ); + select workflow__add_arc( + 'publishing_wf', + 'approval', + 'edited', + '#', + null, + null + ); - select workflow__add_transition ( - 'publishing_wf', - 'authoring', - 'Authoring', - 'authoring', - 1, - 'user' - ); - - + select workflow__add_arc( + 'publishing_wf', + 'approval', + 'end', + 'publishing_wf__is_next', + null, + null + ); - select workflow__add_transition ( - 'publishing_wf', - 'editing', - 'Editing', - 'editing', - 2, - 'user' - ); - - + select workflow__add_arc( + 'publishing_wf', + 'approval', + 'authored', + 'publishing_wf__is_next', + null, + null + ); - select workflow__add_transition ( - 'publishing_wf', - 'approval', - 'Approval', - 'approval', - 3, - 'user' - ); - - -/***** - * Arcs - *****/ + select workflow__add_arc( + 'publishing_wf', + 'approval', + 'start', + 'publishing_wf__is_next', + null, + null + ); +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; - select workflow__add_arc ( - 'publishing_wf', - 'approval', - 'authored', - 'out', - 'publishing_wf__is_next', - '', - '' - ); +-- show errors - +-- create or replace package body publishing_wf as +-- function is_next +create function publishing_wf__is_next (integer,varchar,varchar,varchar,varchar,varchar) +returns char as ' +declare + p_case_id alias for $1; + p_workflow_key alias for $2; + p_transition_key alias for $3; + p_place_key alias for $4; + p_direction alias for $5; + p_custom_arg alias for $6; + v_next_place varchar(100); + v_result boolean; +begin - select workflow__add_arc ( - 'publishing_wf', - 'approval', - 'edited', - 'out', - '#', - '', - '' - ); + v_next_place := workflow_case__get_attribute_value(p_case_id,''next_place''); - + if v_next_place = p_place_key then + v_result := ''t''; + end if; + + return v_result; + +end;' language 'plpgsql'; - select workflow__add_arc ( - 'publishing_wf', - 'approval', - 'edited', - 'in', - '', - '', - '' - ); - - - select workflow__add_arc ( - 'publishing_wf', - 'approval', - 'end', - 'out', - 'publishing_wf__is_next', - '', - '' - ); - - - - select workflow__add_arc ( - 'publishing_wf', - 'approval', - 'start', - 'out', - 'publishing_wf__is_next', - '', - '' - ); - - - - select workflow__add_arc ( - 'publishing_wf', - 'authoring', - 'authored', - 'out', - 'publishing_wf__is_next', - '', - '' - ); - - - - select workflow__add_arc ( - 'publishing_wf', - 'authoring', - 'start', - 'out', - '#', - '', - '' - ); - - - - select workflow__add_arc ( - 'publishing_wf', - 'authoring', - 'start', - 'in', - '', - '', - '' - ); - - - - select workflow__add_arc ( - 'publishing_wf', - 'editing', - 'authored', - 'out', - '#', - '', - '' - ); - - - - select workflow__add_arc ( - 'publishing_wf', - 'editing', - 'authored', - 'in', - '', - '', - '' - ); - - - - select workflow__add_arc ( - 'publishing_wf', - 'editing', - 'edited', - 'out', - 'publishing_wf__is_next', - '', - '' - ); - - - - select workflow__add_arc ( - 'publishing_wf', - 'editing', - 'start', - 'out', - 'publishing_wf__is_next', - '', - '' - ); - - - -/***** - * Attributes - *****/ - - - - select workflow__create_attribute( - 'publishing_wf', - 'next_place', - 'string', - 'Next Place', - null, - null, - null, - 'start', - 1, - 1, - null, - 'generic' +create function inline_2 () +returns integer as ' +declare + v_attribute_id acs_attributes.attribute_id%TYPE; +begin + v_attribute_id := workflow__create_attribute( + ''publishing_wf'', + ''next_place'', + ''string'', + ''Next Place'', + null, + null, + null, + ''start'', + 1, + 1, + null, + ''generic'' ); - + perform workflow__add_trans_attribute_map ( + ''publishing_wf'', + ''authoring'', + v_attribute_id, + 1); - select workflow__add_trans_attribute_map( - 'publishing_wf', - 'approval', - 'next_place', - 1 - ); + perform workflow__add_trans_attribute_map ( + ''publishing_wf'', + ''editing'', + v_attribute_id, + 1); + + perform workflow__add_trans_attribute_map ( + ''publishing_wf'', + ''approval'', + v_attribute_id, + 1); - + perform workflow__add_trans_role_assign_map( + ''publishing_wf'', + ''authoring'', + ''author''); - select workflow__add_trans_attribute_map( - 'publishing_wf', - 'authoring', - 'next_place', - 1 - ); + return 0; +end;' language 'plpgsql'; - +select inline_2 (); - select workflow__add_trans_attribute_map( - 'publishing_wf', - 'editing', - 'next_place', - 1 - ); +drop function inline_2 (); - -/***** - * Transition-role-assignment-map - *****/ +-- show errors - -/* - * Context/Transition info - * (for context = default) - */ - - - -/* - * Context/Role info - * (for context = default) - */ - - - -/* - * Context Task Panels - * (for context = default) - */ - - -commit; Index: openacs-4/packages/cms/www/modules/workflow/case-create-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/www/modules/workflow/case-create-oracle.xql,v diff -u -N -r1.3 -r1.4 --- openacs-4/packages/cms/www/modules/workflow/case-create-oracle.xql 19 Nov 2001 18:43:25 -0000 1.3 +++ openacs-4/packages/cms/www/modules/workflow/case-create-oracle.xql 24 Sep 2002 20:47:13 -0000 1.4 @@ -24,7 +24,7 @@ begin workflow_case.add_manual_assignment( case_id => :case_id, - role_key => :transition, + role_key => 'author', party_id => :value ); end; Index: openacs-4/packages/cms/www/modules/workflow/case-create-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/www/modules/workflow/case-create-postgresql.xql,v diff -u -N -r1.3 -r1.4 --- openacs-4/packages/cms/www/modules/workflow/case-create-postgresql.xql 19 Nov 2001 18:43:25 -0000 1.3 +++ openacs-4/packages/cms/www/modules/workflow/case-create-postgresql.xql 24 Sep 2002 20:47:13 -0000 1.4 @@ -25,7 +25,7 @@ select workflow_case__add_manual_assignment( :case_id, - :transition, + 'author', :value ); Index: openacs-4/packages/cms/www/modules/workflow/case-create.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/www/modules/workflow/case-create.tcl,v diff -u -N -r1.9 -r1.10 --- openacs-4/packages/cms/www/modules/workflow/case-create.tcl 22 Aug 2002 03:04:32 -0000 1.9 +++ openacs-4/packages/cms/www/modules/workflow/case-create.tcl 24 Sep 2002 20:47:13 -0000 1.10 @@ -124,20 +124,23 @@ ); end;"] + # make assignments for each transition foreach transition $transitions { foreach value [element get_values case_create \ ${transition}_assign] { - db_exec_plsql add_assignment " - begin - workflow_case.add_manual_assignment( - case_id => :case_id, - transition_key => :transition, - party_id => :value - ); - end; - " +# db_exec_plsql add_assignment " +# begin +# workflow_case.add_manual_assignment( +# case_id => :case_id, +# transition_key => :transition, +# party_id => :value +# ); +# end; +# " + + db_exec_plsql add_assignment "" } set deadline [element get_value case_create \ Index: openacs-4/packages/cms/www/modules/workflow/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/www/modules/workflow/index.tcl,v diff -u -N -r1.3 -r1.4 --- openacs-4/packages/cms/www/modules/workflow/index.tcl 22 Aug 2002 03:04:32 -0000 1.3 +++ openacs-4/packages/cms/www/modules/workflow/index.tcl 24 Sep 2002 20:47:13 -0000 1.4 @@ -7,7 +7,7 @@ # workflow totals -db_1row get_stats "" +db_1row get_stats "" -column_array wf_stats # workflow tasks by transition state: content items, overdue items Index: openacs-4/packages/cms/www/modules/workflow/overdue-items.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/www/modules/workflow/overdue-items.tcl,v diff -u -N -r1.3 -r1.4 --- openacs-4/packages/cms/www/modules/workflow/overdue-items.tcl 22 Aug 2002 03:04:32 -0000 1.3 +++ openacs-4/packages/cms/www/modules/workflow/overdue-items.tcl 24 Sep 2002 20:47:13 -0000 1.4 @@ -5,7 +5,7 @@ if { ![string equal $transition "all"] } { set transition_name [db_string get_transition_name ""] - set transition_sql "and ca.transition_key = :transition" + set transition_sql "and trans.transition_key = :transition" } else { set transition_name "All Tasks"