Index: openacs-4/packages/workflow/tcl/workflow-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/workflow/tcl/workflow-procs.tcl,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/workflow/tcl/workflow-procs.tcl 10 Jan 2003 13:38:37 -0000 1.1 +++ openacs-4/packages/workflow/tcl/workflow-procs.tcl 14 Jan 2003 15:09:16 -0000 1.2 @@ -7,9 +7,20 @@ @cvs-id $Id$ } -namespace eval ::workflow {} +namespace eval workflow {} +namespace eval workflow::service_contract {} -ad_proc -public ::workflow::add { +##### +# +# workflow namespace +# +##### + +ad_proc -public workflow::package_key {} { + return "workflow" +} + +ad_proc -public workflow::add { {-short_name:required} {-pretty_name:required} {-object_id:required} @@ -42,5 +53,92 @@ # that sets the scope of the workflow set context_id $object_id - db_dml do_insert {} + return [db_string do_insert {}] } + +ad_proc -public workflow::delete { + {-workflow_id:required} +} { + Delete a generic workflow and all data attached to it (states, actions etc.). + + @param workflow_id The id of the workflow to delete. + + @author Peter Marklund +} { + return [db_string do_delete {}] +} + +ad_proc -public workflow::get_id { + {-object_id:required} + {-short_name:required} +} { + Get workflow_id by short_name and object_id. + + @param object_id The ID of the object the workflow's for (typically a package instance) + @param short_name the short name of the workflow you want + + @author Lars Pind (lars@collaboraid.biz) +} { + return [db_string select_workflow_id {} -default {}] +} + +ad_proc -public workflow::action::get_initial_action { + {-workflow_id:required} +} { + Get the action_id of the special 'open' action of a workflow. + + @param workflow_id The ID of the workflow + @return action_id of the magic 'open' action + + @author Lars Pind (lars@collaboraid.biz) +} { + return [db_string select_initial_action {}] +} + +ad_proc -private workflow::default_sort_order { + {-workflow_id:required} + table_name +} { + By default the sort_order will be the highest current sort order plus 1. + This reflects the order in which states and actions are added to the + workflow starting with 1 + + @author Peter Marklund +} { + set sort_order_current \ + [db_string max_sort_order "select max(sort_order) \ + from $table_name \ + where workflow_id = $workflow_id" \ + -default 0] + + set sort_order [expr $sort_order_current + 1] + + return $sort_order +} + +##### +# +# workflow::service_contract +# +##### + +ad_proc -public workflow::service_contract::role_default_assignee {} { + return "Role_DefaultAssignees" +} + +ad_proc -public workflow::service_contract::role_assignee_pick_list {} { + return "Role_AssigneePickList" +} + +ad_proc -public workflow::service_contract::role_assignee_subquery {} { + return "Role_AssigneeSubQuery" +} + +ad_proc -public workflow::service_contract::action_side_effect {} { + return "Action_SideEffect" +} + +ad_proc -public workflow::service_contract::activity_log_format_title {} { + return "ActivityLog_FormatTitle" +} +