Index: openacs-4/packages/workflow/tcl/graph-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/workflow/tcl/graph-procs.tcl,v diff -u -N --- openacs-4/packages/workflow/tcl/graph-procs.tcl 30 Dec 2006 00:05:30 -0000 1.1.2.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,131 +0,0 @@ -ad_library { - Procedures in the workflow::graph namespace. - - @creation-date 5 April 2005 - @author jmhek@cs.ucla.edu - @cvs-id $Id: graph-procs.tcl,v 1.1.2.1 2006/12/30 00:05:30 avnik Exp $ -} - -namespace eval workflow::graph {} - -ad_proc -public workflow::graph::draw { - {-workflow_id:required} - {-filename ""} - {-highlight ""} - {-options_array_name ""} -} { - This procedure is used to generate .dot file of graphviz - @param workflow_id - @param filename - @param highlight A list of states to highlight, the first element in the list is the current state, all other elements are previous states. - @param options_array_name the string name of the hash of additional options. Keys are: - include_subject_count: If this option has a value of 1, then include the subject count by state. - subject_term_pl : the plural pretty name of the subject type (rats, tissues, subjects, etc) - subject_term : singular pretty name of the subject type (rat, tissue, subject, etc) - @return 0 if success, o.w. 1 -} { - # set filename - set path [acs_package_root_dir workflow] - append path /www/admin/graph - - if {![empty_string_p $options_array_name]} { - upvar $options_array_name options - } - - #check to see what options were passed in, init things that aren't there - set available_options [list "include_subject_count" "subject_term" "subject_term_pl"] - set option_names [array names options] - - foreach opt $available_options { - - #default the value - if {[lsearch $option_names $opt] == -1} { - set options($opt) "" - } - } - - - #exchange some defaults for more descriptive values - if {[string equal $options(subject_term) ""]} { - set options(subject_term) "subject" - set options(subject_term_pl) "subjects" - } - - - if {[empty_string_p $filename]} { - set filename workflow_$workflow_id - } - - set current_state "" - set previous_state "" - if {![empty_string_p $highlight]} { - set current_state [lindex $highlight 0] - set previous_state [lreplace $highlight 0 0] - } - - set dot "digraph workflow_$workflow_id \{\n" - #append dot " graph \[size=\"16,16\"\];\n" - append dot " node \[fontname=\"Courier\", color=lightblue2, style=filled\];\n" - append dot " edge \[fontname=\"Courier\"\];\n" - - set states [workflow::fsm::get_states -workflow_id $workflow_id] - - #get the subject counts for the workflow - if {$options(include_subject_count) == 1} { - ptracker::subject::get_subject_count_in_workflow -workflow_id $workflow_id\ - -array_name "subjects_in_workflow" - } - - foreach state_id $states { - workflow::state::fsm::get -state_id $state_id -array "state_info" - - set num_subjects_in_state "" - if {[array exists subjects_in_workflow]} { - set subject_count 0 - if {[lsearch [array names subjects_in_workflow] $state_id] != -1} { - set subject_count $subjects_in_workflow($state_id) - } - - set descriptor $options(subject_term_pl) - if {$subject_count == 1} { - set descriptor $options(subject_term) - } - set num_subjects_in_state "($subject_count $descriptor)" - } - - if {$state_id == $current_state} { - append dot " state_$state_id \[label=\"$state_info(pretty_name) $num_subjects_in_state\", color=darkorange1\];\n" - } elseif {[lsearch $previous_state $state_id]!=-1} { - append dot " state_$state_id \[label=\"$state_info(pretty_name) $num_subjects_in_state\", color=steelblue3\];\n" - } else { - append dot " state_$state_id \[label=\"$state_info(pretty_name) $num_subjects_in_state\"\];\n" - } - } - - set actions [workflow::action::fsm::get_ids -workflow_id $workflow_id] - foreach action_id $actions { - workflow::action::get -action_id $action_id -array "action_info" - - if {![empty_string_p $action_info(new_state)]} { - if {![empty_string_p $action_info(assigned_states)]} { - foreach x $action_info(assigned_state_ids) { - append dot " state_$x -> state_$action_info(new_state_id) \[label=\"$action_info(pretty_name)\"\];\n" - } - } - - if {![empty_string_p $action_info(enabled_states)]} { - foreach x $action_info(enabled_state_ids) { - append dot " state_$x -> state_$action_info(new_state_id) \[label=\"$action_info(pretty_name)\"\];\n" - } - } - } - } - append dot "\}\n" - - set flag [catch { - template::util::write_file $path/$filename\.dot $dot - exec /usr/bin/dot -Tjpg $path/$filename\.dot -o $path/$filename\.jpg - } errmsg] - - return $flag -} Index: openacs-4/packages/workflow/tcl/workflow-procs-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/workflow/tcl/workflow-procs-oracle.xql,v diff -u -N -r1.7.6.1 -r1.7.6.2 --- openacs-4/packages/workflow/tcl/workflow-procs-oracle.xql 30 Dec 2006 00:01:11 -0000 1.7.6.1 +++ openacs-4/packages/workflow/tcl/workflow-procs-oracle.xql 2 Jan 2007 18:50:36 -0000 1.7.6.2 @@ -19,7 +19,7 @@ where w.workflow_id = :workflow_id and w.workflow_id = a.workflow_id (+) and a.parent_action_id is null - and a.trigger_type(+) = 'init' + and (a.trigger_type = 'init' or a.trigger_type is null) Index: openacs-4/packages/workflow/tcl/workflow-tree-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/workflow/tcl/workflow-tree-procs.tcl,v diff -u -N --- openacs-4/packages/workflow/tcl/workflow-tree-procs.tcl 30 Dec 2006 00:05:30 -0000 1.1.2.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,238 +0,0 @@ - -ad_library { - Procs for building trees of data. - - @author helsleya@cs.ucr.edu - @creation-date 2004/09/27 - @cvs-id $Id: workflow-tree-procs.tcl,v 1.1.2.1 2006/12/30 00:05:30 avnik Exp $ - - @tree::sorter::create - @tree::sorter::make_full_key_for - @tree::sorter::sort -} - -namespace eval workflow::tree::sorter {} - -ad_proc -public workflow::tree::sorter::create { - {-multirow:required} - {-sort_by:required} -} { -

Initiliaze a bunch of state variables for a connect by ordered - tree.

- -

Example:

-

-    # Create a 'sorter' to sort the data
-    tree::sorter::create -multirow categories_tree -sort_by sort_key
-
-    # Get the data
-    db_multirow -extend {sort_key} categories_tree categories_tree_sql {
-        select  lpad(' ', 6*4*(level-1) + 1, ' ') || name as name,
-                category_id,
-                name as rawname,
-                level
-          from  categories
-        connect by prior category_id    = parent_category_id
-        start with parent_category_id   = category.lookup('//Personnel Title')
-    } {
-        set sort_key [tree::sorter::make_full_key_for      \ 
-                            -multirow     categories_tree  \ 
-                            -partial_key  $rawname         \ 
-                            -id           $category_id     \ 
-                            -level        $level]
-    }
-
-    # Sort the data
-    tree::sorter::sort -multirow categories_tree
-	

- - @author helsleya@cs.ucr.edu - - @param multirow The name of the multirow data-source to make sort-keys for. - @param sort_by The name of the column that will be populated with the - sort-key. - - @see tree::sorter::make_full_key_for - @see tree::sorter::sort -} { - # Get access to state-variables - upvar ${multirow}_tree_sorter_sort_stack stack - upvar ${multirow}_tree_sorter_sort_column saved_sort_by - - # Initialize state-variables - set stack [list] - set saved_sort_by $sort_by -} - -ad_proc -public workflow::tree::sorter::make_full_key_for { - {-multirow:required} - {-partial_key:required} - {-id:required} - {-level:required} -} { - Make a key that can be stored with the given row in a - connect by-ordered tree. This updates some state variables - and makes a key from their values. Once all rows are processed, a call to - tree::sorter::sort should be made to sort the multirow data. - - @author helsleya@cs.ucr.edu - - @param multirow The name of the multirow data-source to make a sort-key - for. - @param partial_key The primary field by which the tree will be - (hierarchically) sorted. - @param id The ID to be used as a tie-breaker when sorting. This - should be a candidate-key. - @param level The depth of the node uniquely identified by - id - @return A key for sorting rows in a tree - - @see tree::sorter::create - @see tree::sorter::sort -} { - # Get access to state-variables - upvar ${multirow}_tree_sorter_sort_stack stack - - set top [llength $stack] - set newtop [expr $level - 1] - - # Pop from the top of the stack and the sort-key if necessary - if {$newtop < $top && $newtop >= 0} { - set stack [lreplace $stack $newtop end] - } - - # Push current node onto stack and sort-key - lappend stack "$partial_key $id" - set full_sort_key "//[join $stack //]" - - return $full_sort_key -} - -ad_proc -public workflow::tree::sorter::sort { - {-multirow:required} -} { - Sort the given multirow using the full-sort-keys built earlier by the calls - to tree::sorter proc - tree::sorter::make_full_key_for created with - tree::sorter::create. - - @author helsleya@cs.ucr.edu - - @param multirow The name of the multirow data-source to be sorted. - - @see tree::sorter::create - @see tree::sorter::make_full_key_for -} { - # Get access to state-variables - upvar ${multirow}_tree_sorter_sort_column sort_by - upvar ${multirow}_tree_sorter_sorted_rows rows - - # Get access to the data - set rows [uplevel "template::util::multirow_to_list $multirow"] - - if {[llength $rows] > 1} { - # Find the correct index to sort by - set header_row [lindex $rows 0] - set sort_index [expr 1 + [lsearch -exact $header_row $sort_by]] - - # Sort the data - set rows [lsort -index $sort_index $rows] - - # Convert the data back into a multirow data-source - uplevel "template::util::list_to_multirow $multirow \$${multirow}_tree_sorter_sorted_rows" - } -} - -ad_proc -public workflow::tree::sorter::sort_list_of_lists { - {-list:required} - {-sort_by:required} - {-object_id:required} - {-parent_object_id:required} -} { -

Sort the given list-of-lists. The list should have 3-4 columns: -

-

- - The display name is the only column which is not critical for sorting the - tree. - -

Example:

-

-    # Get a list that can be used as the options of a 'select' widget in ad_form
-    set directories [db_list_of_lists get_directories {
-        select  lpad(' ', (level-1)*4*6 + 1, ' ') || directory_name as directory_name,
-                directory_id,
-                parent_directory_id,
-                directory_name
-          from  directories
-        start   with parent_directory_id    is null
-        connect by prior directory_id       = parent_directory_id
-    }]
-
-    # Sort the options
-    set directories [tree::sorter::sort_lists_of_lists -list $directories -sort_by 3 -object_id 1 -parent_object_id 2]
-	

- - @author helsleya@cs.ucr.edu - - @param list The list-of-lists that should be sorted as a tree. - @param sort_by The index of the element in each row which should - be used to sort by. - @param object_id The index of the element in each row which uniquely - identifies it. - @param parent_object_id The index of the element in each row which contains - the unique identifier of its parent. -} { - # Setup the format for sort-keys - set max_length_of_sort_by 0 - foreach row $list { - set length_of_sort_by [string length [lindex $row $sort_by]] - if {$length_of_sort_by > $max_length_of_sort_by} { - set max_length_of_sort_by $length_of_sort_by - } - } - set sort_key_format "%-${max_length_of_sort_by}s%08s" - - # Setup the list to save results in and two stacks - set tree [list] - set sort_key_stack [list] - set object_id_stack [list] - - # Make a full-sort-key for each row - foreach row $list { - set oid [lindex $row $object_id] - set parent_id [lindex $row $parent_object_id] - set sort_key [format $sort_key_format [lindex $row $sort_by] $parent_id] - - # Find parent in stack - set pos_in_stack [expr [lsearch $object_id_stack $parent_id] + 1] - - # Clear anything after parent from the stack - if {$pos_in_stack < [llength $object_id_stack]} { - set object_id_stack [lreplace $object_id_stack \ - $pos_in_stack \ - end ] - set sort_key_stack [lreplace $sort_key_stack \ - $pos_in_stack \ - end ] - } - - # Push the current object on the stack - lappend object_id_stack $oid - lappend sort_key_stack $sort_key - - # Save the full_sort_key with the row in the tree - set full_sort_key [join $sort_key_stack //] - lappend row $full_sort_key - lappend tree $row - } - - # Sort the rows - set tree [lsort -dictionary -index end $tree] - - return $tree -} Index: openacs-4/packages/workflow/www/admin/action-ae.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/workflow/www/admin/action-ae.adp,v diff -u -N --- openacs-4/packages/workflow/www/admin/action-ae.adp 30 Dec 2006 00:02:56 -0000 1.1.2.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,118 +0,0 @@ - - @title@ - @context@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Short Name:
Pretty Name:
Pretty Past Tense:
Description:
Trigger type:
Timeout Seconds only applicable for timer trigger type:
New State:
Insert or remove callbacks. Put a new callback on a seperate line:
Always Enabled? - - -
- - @formgroup.widget;noquote@ @formgroup.label@
-
-
-
- -
- -
-
-
- - - - Index: openacs-4/packages/workflow/www/admin/action-ae.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/workflow/www/admin/action-ae.tcl,v diff -u -N --- openacs-4/packages/workflow/www/admin/action-ae.tcl 30 Dec 2006 00:02:56 -0000 1.1.2.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,151 +0,0 @@ -ad_page_contract { - - Actio nAdd/Edit - - @author Jeff Wang (jeff@ctrl.ucla.edu) - @creation-date 3/17/2005 - - @cvs-id $Id: action-ae.tcl,v 1.1.2.1 2006/12/30 00:02:56 avnik Exp $ -} { - {return_url [get_referrer]} - {action_id:optional} - {workflow_id:notnull} -} - - -set title "Action Add or Edit" - -set context [list [list $return_url "Workflow Edit"] "Action AE"] -set yes_no_options [list [list "Yes" t] [list "No" f]] -set state_options [db_list_of_lists get_states {}] - -set trigger_options [list \ - [list "user" "user"] \ - [list "auto" "auto"] \ - [list "init" "init"] \ - [list "time" "time"] \ - [list "message" "message"] \ - [list "workflow" "workflow"] \ - [list "dynamic" "dynamic"] \ - [list "parallel" "parallel"] \ -] - -ad_form -name "add_edit" -form { - action_id:key - {short_name:text(text) {label {Short Name:}}} - {pretty_name:text(text) {label {Pretty Name:}}} - {pretty_past_tense:text(text),optional {label {Pretty Past Tense:}}} - {new_state_id:text(select),optional {options $state_options}} - {description:text(text),optional {label {Description:}}} - {trigger_type:text(select),optional {options $trigger_options }} - {timeout_seconds:text(text),optional } - {callbacks:text(textarea),optional,nospell {label {Insert or remove callbacks. Put a new callback on a seperate line:}} {html {rows 6 cols 35}}} - {always_enabled_p:text(radio) {label {Always Enabled?}} {options $yes_no_options}} - {enabled_states:text(checkbox),multiple,optional {label {Enabled States:}} {options $state_options}} - {assigned_states:text(checkbox),multiple,optional {label {Assigned States:}} {options $state_options}} - {sub:text(submit) {label {Submit}}} -} -new_data { - - set update_array(short_name) $short_name - set update_array(pretty_name) $pretty_name - set update_array(pretty_past_tense) $pretty_past_tense - set update_array(description) $description - set update_array(always_enabled_p) $always_enabled_p - set update_array(trigger_type) $trigger_type - set update_array(timeout_seconds) $timeout_seconds - - - set update_array(enabled_state_ids) $enabled_states - set update_array(assigned_state_ids) $assigned_states - set update_array(new_state_id) $new_state_id - - #callbacks - set callback_list [list] - foreach callback_name [split $callbacks "\n"] { - set callback_name [string trim $callback_name] - if {![empty_string_p $callback_name]} { - lappend callback_list $callback_name - } - } - - set update_array(callbacks) $callback_list - - set error_p 0 - db_transaction { - workflow::action::fsm::edit \ - -operation "insert" \ - -action_id $action_id \ - -workflow_id $workflow_id \ - -array "update_array" - } on_error { - set error_p 1 - } - - if {$error_p} { - ad_return_complaint 1 "There was an error creating the action:


$errmsg" - ad_script_abort - } - -} -edit_data { - set update_array(short_name) $short_name - set update_array(pretty_name) $pretty_name - set update_array(pretty_past_tense) $pretty_past_tense - set update_array(description) $description - set update_array(always_enabled_p) $always_enabled_p - set update_array(trigger_type) $trigger_type - set update_array(timeout_seconds) $timeout_seconds - - set update_array(enabled_state_ids) $enabled_states - set update_array(assigned_state_ids) $assigned_states - set update_array(new_state_id) $new_state_id - - #callbacks - set callback_list [list] - foreach callback_name [split $callbacks "\n"] { - set callback_name [string trim $callback_name] - if {![empty_string_p $callback_name]} { - lappend callback_list $callback_name - } - } - - set update_array(callbacks) $callback_list - - set error_p 0 - - db_transaction { - workflow::action::fsm::edit \ - -action_id $action_id \ - -array "update_array" - } on_error { - set error_p 1 - } - - if {$error_p} { - ad_return_complaint 1 "There was an error updating the action:


$errmsg" - ad_script_abort - } - - -} -edit_request { - workflow::action::get \ - -action_id $action_id \ - -array "action_info" - - set short_name $action_info(short_name) - set pretty_name $action_info(pretty_name) - set pretty_past_tense $action_info(pretty_past_tense) - set description $action_info(description) - set always_enabled_p $action_info(always_enabled_p) - set trigger_type $action_info(trigger_type) - set timeout_seconds $action_info(timeout_seconds) - - set enabled_states $action_info(enabled_state_ids) - set assigned_states $action_info(assigned_state_ids) - set new_state $action_info(new_state) - set new_state_id $action_info(new_state_id) - set callbacks [join $action_info(callbacks) "\n"] - -} -after_submit { - ad_returnredirect $return_url - ad_script_abort -} -export {return_url workflow_id} Index: openacs-4/packages/workflow/www/admin/action-ae.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/workflow/www/admin/action-ae.xql,v diff -u -N --- openacs-4/packages/workflow/www/admin/action-ae.xql 30 Dec 2006 00:02:56 -0000 1.1.2.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,13 +0,0 @@ - - - - - - select pretty_name, - state_id - from workflow_fsm_states - where workflow_id=:workflow_id - - - - Index: openacs-4/packages/workflow/www/admin/delete-confirm.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/workflow/www/admin/delete-confirm.adp,v diff -u -N --- openacs-4/packages/workflow/www/admin/delete-confirm.adp 30 Dec 2006 00:02:56 -0000 1.1.2.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,5 +0,0 @@ - - @title@ - @context@ - - Index: openacs-4/packages/workflow/www/admin/delete-confirm.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/workflow/www/admin/delete-confirm.tcl,v diff -u -N --- openacs-4/packages/workflow/www/admin/delete-confirm.tcl 30 Dec 2006 00:02:56 -0000 1.1.2.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,52 +0,0 @@ -ad_page_contract { - - State Add/Edit - - @author Jeff Wang (jeff@ctrl.ucla.edu) - @creation-date 3/17/2005 - - @cvs-id $Id: delete-confirm.tcl,v 1.1.2.1 2006/12/30 00:02:56 avnik Exp $ - - @param type The type to delete, either state, role, action, or workflow -} { - {return_url [get_referrer]} - {id:notnull} - {type:notnull} - {msg:notnull} -} - - -set title "Delete" -set context [list [list $return_url "Workflow Edit"] "Delete"] - - -ad_form -name "confirm" -form { - {warn:text(inform) {label {Confirm:}} {value $msg}} - {ok:text(submit) {label {Delete}}} - {cancel:text(submit) {label {Cancel}}} -} -on_submit { - - if {![empty_string_p $ok]} { - switch $type { - role { - workflow::role::edit \ - -operation "delete" \ - -role_id $id - } - state { - workflow::state::fsm::edit \ - -operation "delete" \ - -state_id $id - } - action { - workflow::action::fsm::edit -action_id $id -operation "delete" - } - workflow { - workflow::delete -workflow_id $id - } - } - } - -} -after_submit { - ad_returnredirect $return_url -} -export {id return_url type msg} Index: openacs-4/packages/workflow/www/admin/index.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/workflow/www/admin/index.adp,v diff -u -N --- openacs-4/packages/workflow/www/admin/index.adp 30 Dec 2006 00:02:56 -0000 1.1.2.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,72 +0,0 @@ - - @title@ - @context@ - -Edit a boiler plate so that all future uses of the workflow will have the changes. Note that current workflow instances using -this boiler plate will not be affected. If you want to change a specific instance, see below. -

- -
Workflow Boiler Plates - New Workflow - - - - - - - - - - - - - - - - - - -
Id Short name Pretty name Options
@get_bps.workflow_id@@get_bps.short_name@@get_bps.pretty_name@ Edit | - Delete | - View -
-
-
-
- -
-
-
- - -Editing a specific instance when you want to change a workflow that is already in use. -

- -
Workflow Instances - Clone an existing boiler plate workflow - - - - - - - - - - - - - - - - - - - -
Id Short name Pretty name Options
@get_instances.workflow_id@ @get_instances.short_name@ @get_instances.pretty_name@ Edit | - Delete | - View -
-
-
-
Index: openacs-4/packages/workflow/www/admin/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/workflow/www/admin/index.tcl,v diff -u -N --- openacs-4/packages/workflow/www/admin/index.tcl 30 Dec 2006 00:02:56 -0000 1.1.2.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,37 +0,0 @@ -ad_page_contract { - - Workflow index - - @author Jeff Wang (jeff@ctrl.ucla.edu) - @creation-date 3/17/2005 - - @cvs-id $Id: index.tcl,v 1.1.2.1 2006/12/30 00:02:56 avnik Exp $ -} { - {context "Workflow"} -} - -set title "Workflow Index" - -#get a listing of all the workflow boiler plates -set where_clause "object_id is null" -db_multirow -extend {edit_url delete_url view_url} get_bps get_wfs {} { - set edit_url "workflow-edit?[export_url_vars workflow_id]" - workflow::get -workflow_id $workflow_id -array "wf_info" - set msg "You are about to delete $wf_info(short_name). Are you sure?" - set delete_url "delete-confirm?[export_url_vars id=$workflow_id type=workflow msg]" - set view_url "workflow-graph?[export_url_vars workflow_id]" -} - - -#get a listing of all the workflow instances -set where_clause "object_id is not null" -db_multirow -extend {edit_url delete_url view_url} get_instances get_wfs {} { - set edit_url "workflow-edit?[export_url_vars workflow_id]" - workflow::get -workflow_id $workflow_id -array "wf_info" - set msg "You are about to delete $wf_info(short_name). Are you sure?" - set delete_url "delete-confirm?[export_url_vars id=$workflow_id type=workflow msg]" - set view_url "workflow-graph?[export_url_vars workflow_id]" -} - -set new_wf_url "workflow-ae" -set clone_url "workflow-clone" Index: openacs-4/packages/workflow/www/admin/index.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/workflow/www/admin/index.xql,v diff -u -N --- openacs-4/packages/workflow/www/admin/index.xql 30 Dec 2006 00:02:56 -0000 1.1.2.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,14 +0,0 @@ - - - - - - select workflow_id, - short_name, - pretty_name - from workflows - where $where_clause - - - - Index: openacs-4/packages/workflow/www/admin/layer-procs.js =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/workflow/www/admin/layer-procs.js,v diff -u -N --- openacs-4/packages/workflow/www/admin/layer-procs.js 30 Dec 2006 00:02:56 -0000 1.1.2.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,34 +0,0 @@ -/**** - * - * A library to manipulate layers - * - * Browser and OS Compatability: - * - * Internet Explorer 6+ (Windows XP, Max OSX) - * Netscape/Mozilla/FireFox 1.0 (Windows, Macs) - * Safari (Mac OSX) - * Opera (?) - * Konqueror (?) - * - * @cvs-id $Id: layer-procs.js,v 1.1.2.1 2006/12/30 00:02:56 avnik Exp $ - * - **/ - -/* Show or hide the layer - - @param action show or hide, if empty string will just toggle the layer -*/ -function showHideWidget(layerId,action) { - var edit_section = document.getElementById(layerId).style; - if (action == null || action == '') { - if (edit_section.display == '') { - edit_section.display='none'; - } else { - edit_section.display=''; - } - } else if (action == 'show') { - edit_section.display=''; - } else if (action == 'hide') { - edit_section.display='none'; - } -} Index: openacs-4/packages/workflow/www/admin/role-ae.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/workflow/www/admin/role-ae.adp,v diff -u -N --- openacs-4/packages/workflow/www/admin/role-ae.adp 30 Dec 2006 00:02:56 -0000 1.1.2.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,5 +0,0 @@ - - @title@ - @context@ - - Index: openacs-4/packages/workflow/www/admin/role-ae.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/workflow/www/admin/role-ae.tcl,v diff -u -N --- openacs-4/packages/workflow/www/admin/role-ae.tcl 30 Dec 2006 00:02:56 -0000 1.1.2.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,76 +0,0 @@ -ad_page_contract { - - State Add/Edit - - @author Jeff Wang (jeff@ctrl.ucla.edu) - @creation-date 3/17/2005 - - @cvs-id $Id: role-ae.tcl,v 1.1.2.1 2006/12/30 00:02:56 avnik Exp $ -} { - {return_url [get_referrer]} - {role_id:optional} - {workflow_id:notnull} -} - -set title "State Add or Edit" -set context [list [list $return_url "Workflow Edit"] "Role AE"] - - -ad_form -name "add-edit" -form { - role_id:key - {short_name:text(text) {label {Short Name:}}} - {pretty_name:text(text) {label {Pretty Name:}}} - {callbacks:text(textarea),optional,nospell {label {Insert or remove callbacks. Put a new callback on a seperate line:}} {html {rows 6 cols 35}}} - {sub:text(submit) {label {Submit}}} -} -new_data { - set update_array(short_name) $short_name - set update_array(pretty_name) $pretty_name - - #callbacks - set callback_list [list] - foreach callback_name [split $callbacks "\n"] { - set callback_name [string trim $callback_name] - if {![empty_string_p $callback_name]} { - lappend callback_list $callback_name - } - } - - set update_array(callbacks) $callback_list - - workflow::role::edit \ - -operation "insert" \ - -workflow_id $workflow_id \ - -array "update_array" - -} -edit_data { - set update_array(short_name) $short_name - set update_array(pretty_name) $pretty_name - - #callbacks - set callback_list [list] - foreach callback_name [split $callbacks "\n"] { - set callback_name [string trim $callback_name] - if {![empty_string_p $callback_name]} { - lappend callback_list $callback_name - } - } - - set update_array(callbacks) $callback_list - workflow::role::edit \ - -role_id $role_id \ - -array "update_array" - -} -edit_request { - - workflow::role::get \ - -role_id $role_id \ - -array "role_info" - - set short_name $role_info(short_name) - set pretty_name $role_info(pretty_name) - set callbacks [join $role_info(callbacks) "\n"] - -} -after_submit { - ad_returnredirect $return_url - ad_script_abort -} -export {return_url workflow_id} Index: openacs-4/packages/workflow/www/admin/state-ae.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/workflow/www/admin/state-ae.adp,v diff -u -N --- openacs-4/packages/workflow/www/admin/state-ae.adp 30 Dec 2006 00:02:56 -0000 1.1.2.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,5 +0,0 @@ - - @title@ - @context@ - - Index: openacs-4/packages/workflow/www/admin/state-ae.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/workflow/www/admin/state-ae.tcl,v diff -u -N --- openacs-4/packages/workflow/www/admin/state-ae.tcl 30 Dec 2006 00:02:56 -0000 1.1.2.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,56 +0,0 @@ -ad_page_contract { - - State Add/Edit - - @author Jeff Wang (jeff@ctrl.ucla.edu) - @creation-date 3/17/2005 - - @cvs-id $Id: state-ae.tcl,v 1.1.2.1 2006/12/30 00:02:56 avnik Exp $ -} { - {return_url [get_referrer]} - {state_id:optional} - {workflow_id:notnull} -} - -set title "State Add or Edit" - -set context [list [list $return_url "Workflow Edit"] "State AE"] - - -ad_form -name "add-edit" -form { - state_id:key - {short_name:text(text) {label {Short Name:}}} - {pretty_name:text(text) {label {Pretty Name:}}} - {sub:text(submit) {label {Submit}}} -} -new_data { - set update_array(short_name) $short_name - set update_array(pretty_name) $pretty_name - - workflow::state::fsm::edit \ - -operation "insert" \ - -workflow_id $workflow_id \ - -array "update_array" - -} -edit_data { - set update_array(short_name) $short_name - set update_array(pretty_name) $pretty_name - - - workflow::state::fsm::edit \ - -state_id $state_id \ - -array "update_array" - -} -edit_request { - - workflow::state::fsm::get \ - -state_id $state_id \ - -array "state_info" - - set short_name $state_info(short_name) - set pretty_name $state_info(pretty_name) - - -} -after_submit { - ad_returnredirect $return_url - ad_script_abort -} -export {return_url workflow_id} Index: openacs-4/packages/workflow/www/admin/workflow-ae-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/workflow/www/admin/Attic/workflow-ae-oracle.xql,v diff -u -N --- openacs-4/packages/workflow/www/admin/workflow-ae-oracle.xql 30 Dec 2006 00:02:56 -0000 1.1.2.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,17 +0,0 @@ - - - - - - select LPAD (' ', 3*(Level-2)) || name, - object_id, - name as rawname, - level - from site_nodes n - where name is not null - connect by prior node_id=parent_id - start with object_id=405 - - - - Index: openacs-4/packages/workflow/www/admin/workflow-ae-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/workflow/www/admin/workflow-ae-postgresql.xql,v diff -u -N --- openacs-4/packages/workflow/www/admin/workflow-ae-postgresql.xql 30 Dec 2006 00:02:56 -0000 1.1.2.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,16 +0,0 @@ - - - postgresql7.2 - - - select n.name, - n.object_id, - n.name as rawname, - tree_level(n2.tree_sortkey) as level - from site_nodes n, site_nodes n2 - where n.name is not null - and n.tree_sortkey between n2.tree_sortkey and tree_right(n2.tree_sortkey) - and n.object_id=405 - - - Index: openacs-4/packages/workflow/www/admin/workflow-ae.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/workflow/www/admin/workflow-ae.adp,v diff -u -N --- openacs-4/packages/workflow/www/admin/workflow-ae.adp 30 Dec 2006 00:02:56 -0000 1.1.2.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,4 +0,0 @@ - -@title@ -@context@ - Index: openacs-4/packages/workflow/www/admin/workflow-ae.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/workflow/www/admin/workflow-ae.tcl,v diff -u -N --- openacs-4/packages/workflow/www/admin/workflow-ae.tcl 30 Dec 2006 00:02:56 -0000 1.1.2.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,125 +0,0 @@ -ad_page_contract { - - Actio Add/Edit - - @author Jeff Wang (jeff@ctrl.ucla.edu) - @creation-date 3/17/2005 - - @cvs-id $Id: workflow-ae.tcl,v 1.1.2.1 2006/12/30 00:02:56 avnik Exp $ -} { - {return_url [get_referrer]} - {workflow_id:optional} -} - -set title "Edit" -set context [list [list $return_url "Workflow Edit"] "Edit Metadata"] - - -workflow::tree::sorter::create -multirow "package_options" -sort_by sort_key - -db_multirow -extend {sort_key} package_options get_packages {} { - set sort_key [workflow::tree::sorter::make_full_key_for -multirow "package_options" -partial_key $rawname -id $object_id -level $level] -} - -workflow::tree::sorter::sort -multirow "package_options" -set unprocessed_list [template::util::multirow_to_list "package_options"] - -# Replace leading spaces with ' ' -foreach item $unprocessed_list { - set name [lindex $item 7] - set new_lines "" - - for {set i 0} {$i < [string length $name]} {incr i} { - if {[string index $name $i] == " "} { - append new_lines " " - } else { - break; - } - } - - set name "$new_lines $name" - - set value [lindex $item 11] - lappend package_options [list $name $name] -} - -set package_options [db_list_of_lists get_package_options {}] - - -set the_form { - workflow_id:key - {package:text(select) {label {Package:}} {options $package_options}} - {short_name:text(text) {label {Short Name:}}} - {pretty_name:text(text) {label {Pretty Name:}}} - {callbacks:text(textarea),nospell,optional {label {Insert or remove callbacks. Put a new callback on a seperate line:}} {html {rows 6 cols 35}}} -} - - - -ad_form -name "add-edit" -form $the_form -new_data { - - set callback_list [list] - foreach callback_name [split $callbacks "\n"] { - set callback_name [string trim $callback_name] - if {![empty_string_p $callback_name]} { - lappend callback_list $callback_name - } - } - - - set error_p 0 - db_transaction { - workflow::new \ - -pretty_name $pretty_name \ - -short_name $short_name \ - -package_key $package \ - -callbacks $callback_list - } on_error { - set error_p 1 - } - - if {$error_p} { - ad_return_complaint 1 "There was an error creating the workflow:


$errmsg" - ad_script_abort - } - - -} -edit_data { - set update_array(short_name) $short_name - set update_array(pretty_name) $pretty_name - set update_array(package_key) $package - set callback_list [list] - foreach callback_name [split $callbacks "\n"] { - set callback_name [string trim $callback_name] - if {![empty_string_p $callback_name]} { - lappend callback_list $callback_name - } - } - - - set update_array(callbacks) $callback_list - - set error_p 0 - db_transaction { - workflow::edit \ - -workflow_id $workflow_id \ - -array update_array - } on_error { - set error_p 1 - } - - if {$error_p} { - ad_return_complaint 1 "There was an error updating the workflow:


$errmsg" - ad_script_abort - } - -} -edit_request { - workflow::get -workflow_id $workflow_id -array "wf_info" - set short_name $wf_info(short_name) - set pretty_name $wf_info(pretty_name) - set package $wf_info(package_key) - set callbacks $wf_info(callbacks) - set callbacks [join $callbacks "\n"] -} -after_submit { - ad_returnredirect $return_url -} -export {return_url} Index: openacs-4/packages/workflow/www/admin/workflow-ae.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/workflow/www/admin/workflow-ae.xql,v diff -u -N --- openacs-4/packages/workflow/www/admin/workflow-ae.xql 30 Dec 2006 00:02:56 -0000 1.1.2.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,10 +0,0 @@ - - - - - - select distinct package_key,package_key - from apm_packages - - - Index: openacs-4/packages/workflow/www/admin/workflow-clone-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/workflow/www/admin/Attic/workflow-clone-oracle.xql,v diff -u -N --- openacs-4/packages/workflow/www/admin/workflow-clone-oracle.xql 30 Dec 2006 00:02:56 -0000 1.1.2.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,15 +0,0 @@ - - - - - select LPAD (' ', 3*(Level-2)) || name, - object_id, - name as rawname, - level - from site_nodes n - where name is not null - connect by prior node_id=parent_id - start with object_id=(select object_id from site_nodes where parent_id is null) - - - Index: openacs-4/packages/workflow/www/admin/workflow-clone-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/workflow/www/admin/workflow-clone-postgresql.xql,v diff -u -N --- openacs-4/packages/workflow/www/admin/workflow-clone-postgresql.xql 30 Dec 2006 00:02:56 -0000 1.1.2.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,17 +0,0 @@ - - - postgresql7.2 - - - - select n.name, - n.object_id, - n.name as rawname, - tree_level(n2.tree_sortkey) as level - from site_nodes n, site_nodes n2 - where n.name is not null - and n.tree_sortkey between n2.tree_sortkey and tree_right(n2.tree_sortkey) - and n.object_id in (select s.object_id from site_nodes s where s.parent_id is null) - - - Index: openacs-4/packages/workflow/www/admin/workflow-clone.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/workflow/www/admin/workflow-clone.adp,v diff -u -N --- openacs-4/packages/workflow/www/admin/workflow-clone.adp 30 Dec 2006 00:02:56 -0000 1.1.2.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,5 +0,0 @@ - - @title@ - @context@ - - Index: openacs-4/packages/workflow/www/admin/workflow-clone.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/workflow/www/admin/workflow-clone.tcl,v diff -u -N --- openacs-4/packages/workflow/www/admin/workflow-clone.tcl 30 Dec 2006 00:02:56 -0000 1.1.2.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,65 +0,0 @@ -ad_page_contract { - - Workflow Edit page - - @author Jeff Wang (jeff@ctrl.ucla.edu) - @creation-date 3/17/2005 - - @cvs-id $Id: workflow-clone.tcl,v 1.1.2.1 2006/12/30 00:02:56 avnik Exp $ -} { - {return_url [get_referrer]} -} - - -set title "Workflow Clone" - -set context [list "Workflow Clone"] -set default_workflows [db_list_of_lists get_wfs {}] - - -workflow::tree::sorter::create -multirow "package_options" -sort_by sort_key - -db_multirow -extend {sort_key} package_options get_packages {} { - set sort_key [workflow::tree::sorter::make_full_key_for -multirow "package_options" -partial_key $rawname -id $object_id -level $level] -} - -workflow::tree::sorter::sort -multirow "package_options" -set unprocessed_list [template::util::multirow_to_list "package_options"] - -# Replace leading spaces with ' ' -foreach item $unprocessed_list { - set name [lindex $item 7] - set new_lines "" - - for {set i 0} {$i < [string length $name]} {incr i} { - if {[string index $name $i] == " "} { - append new_lines " " - } else { - break; - } - } - - set name "$new_lines $name" - - set value [lindex $item 11] - lappend package_options [list $name $value] -} - - -ad_form -name "clone" -form { - {wf:text(select) {label {Select a workflow to clone:}} {options $default_workflows} } - {short_name:text(text) {label {Short Name:}}} - {pretty_name:text(text) {label {Pretty Name:}}} - {package:text(select) {label {Select the package:}} {options $package_options}} -} -on_submit { - set update_array(short_name) $short_name - set update_array(pretty_name) $pretty_name - - workflow::fsm::clone \ - -workflow_id $wf \ - -object_id $package \ - -array "update_array" - -} -after_submit { - ad_returnredirect $return_url -} -export {return_url} Index: openacs-4/packages/workflow/www/admin/workflow-clone.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/workflow/www/admin/workflow-clone.xql,v diff -u -N --- openacs-4/packages/workflow/www/admin/workflow-clone.xql 30 Dec 2006 00:02:56 -0000 1.1.2.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,15 +0,0 @@ - - - - - - select pretty_name, - workflow_id - from workflows - where object_id is null - - - - - - Index: openacs-4/packages/workflow/www/admin/workflow-edit.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/workflow/www/admin/workflow-edit.adp,v diff -u -N --- openacs-4/packages/workflow/www/admin/workflow-edit.adp 30 Dec 2006 00:02:56 -0000 1.1.2.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,94 +0,0 @@ - - @title@ - @context;noquote@ - -Editing @wf_info.short_name@ - -

- Edit Workflow Metadata -

-
States - - Create new State - - - - - - - - - - - - - - - - - - -
Id Short name Pretty name Options
@get_states.state_id@@get_states.short_name@@get_states.pretty_name@ Edit | - Delete -
-
-
-
- -

- -
Actions - Create new Action - - - - - - - - - - - - - - - - - - - -
Id Short name Pretty name Options
@get_actions.action_id@@get_actions.short_name@@get_actions.pretty_name@ Edit | - Delete -
-
-
-
- -

- -
Roles - - Create new Role - - - - - - - - - - - - - - - - -
Id Pretty name Options
@get_roles.role_id@@get_roles.pretty_name@ Edit | - Delete -
-
-
-
Index: openacs-4/packages/workflow/www/admin/workflow-edit.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/workflow/www/admin/workflow-edit.tcl,v diff -u -N --- openacs-4/packages/workflow/www/admin/workflow-edit.tcl 30 Dec 2006 00:02:56 -0000 1.1.2.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,52 +0,0 @@ -ad_page_contract { - - Workflow Edit page - - @author Jeff Wang (jeff@ctrl.ucla.edu) - @creation-date 3/17/2005 - - @cvs-id $Id: workflow-edit.tcl,v 1.1.2.1 2006/12/30 00:02:56 avnik Exp $ -} { - {return_url [get_referrer]} - {workflow_id:integer,notnull} -} - -set title "Workflow Edit" - -workflow::get -workflow_id $workflow_id -array "wf_info" -set context [list "$wf_info(short_name)"] - -db_multirow -extend {edit_url delete_url} get_states get_states {} { - set edit_url "state-ae?[export_url_vars state_id workflow_id]" - workflow::state::fsm::get \ - -state_id $state_id \ - -array "state_info" - set msg "You are about to delete $state_info(pretty_name). Are you sure?" - set delete_url "delete-confirm?[export_url_vars id=$state_id type=state msg]" -} - -db_multirow -extend {edit_url delete_url} get_actions get_actions {} { - set edit_url "action-ae?[export_url_vars action_id workflow_id]" - workflow::action::fsm::get \ - -action_id $action_id \ - -array "action_info" - set msg "You are about to delete $action_info(pretty_name). Are you sure?" - set delete_url "delete-confirm?[export_url_vars id=$action_id type=action msg]" -} - - -db_multirow -extend {edit_url delete_url} get_roles get_roles {} { - set edit_url "role-ae?[export_url_vars role_id workflow_id]" - workflow::role::get \ - -role_id $role_id \ - -array "role_info" - set msg "You are about to delete $role_info(pretty_name). Are you sure?" - set delete_url "delete-confirm?[export_url_vars id=$role_id msg type=role]" -} - -set wf_meta_edit "workflow-ae?[export_url_vars workflow_id]" -set add_role_url "role-ae?[export_url_vars workflow_id]" -set add_state_url "state-ae?[export_url_vars workflow_id]" -set add_action_url "action-ae?[export_url_vars workflow_id]" - - Index: openacs-4/packages/workflow/www/admin/workflow-edit.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/workflow/www/admin/workflow-edit.xql,v diff -u -N --- openacs-4/packages/workflow/www/admin/workflow-edit.xql 30 Dec 2006 00:02:56 -0000 1.1.2.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,40 +0,0 @@ - - - - - - select state_id, - short_name, - pretty_name - from workflow_fsm_states - where workflow_id=:workflow_id - order by short_name - - - - - - - select a.action_id, - short_name, - pretty_name, - new_state - from workflow_actions a, - workflow_fsm_actions fa - where workflow_id=:workflow_id and - a.action_id=fa.action_id - order by short_name - - - - - - - select role_id, - pretty_name - from workflow_roles - where workflow_id=:workflow_id - - - - Index: openacs-4/packages/workflow/www/admin/workflow-graph.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/workflow/www/admin/workflow-graph.tcl,v diff -u -N --- openacs-4/packages/workflow/www/admin/workflow-graph.tcl 30 Dec 2006 00:02:56 -0000 1.1.2.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,17 +0,0 @@ -ad_page_contract { - to view workflow graph - @author jmhek@cs.ucla.edu - @creation-date 4/5/2005 - @cvs-id $Id: workflow-graph.tcl,v 1.1.2.1 2006/12/30 00:02:56 avnik Exp $ -} { - {workflow_id} - {states_to_highlight ""} -} - -set flag [workflow::graph::draw -workflow_id $workflow_id -highlight $states_to_highlight] -if {$flag==0} { - ad_returnredirect graph/workflow_$workflow_id\.jpg -} else { - ad_returnredirect [get_referrer] -} - Index: openacs-4/packages/workflow/www/admin/workflow-meta-edit.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/workflow/www/admin/workflow-meta-edit.adp,v diff -u -N --- openacs-4/packages/workflow/www/admin/workflow-meta-edit.adp 30 Dec 2006 00:02:56 -0000 1.1.2.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,4 +0,0 @@ - -@title@ -@context@ - Index: openacs-4/packages/workflow/www/admin/workflow-meta-edit.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/workflow/www/admin/workflow-meta-edit.tcl,v diff -u -N --- openacs-4/packages/workflow/www/admin/workflow-meta-edit.tcl 30 Dec 2006 00:02:56 -0000 1.1.2.1 +++ /dev/null 1 Jan 1970 00:00:00 -0000 @@ -1,94 +0,0 @@ -ad_page_contract { - - Actio Add/Edit - - @author Jeff Wang (jeff@ctrl.ucla.edu) - @creation-date 3/17/2005 - - @cvs-id $Id: workflow-meta-edit.tcl,v 1.1.2.1 2006/12/30 00:02:56 avnik Exp $ -} { - {return_url [get_referrer]} - {workflow_id:notnull} -} - - - -set title "Edit" -set context [list [list $return_url "Workflow Edit"] "Edit Metadata"] - -ad_form -name "add-edit" -form { - workflow_id:key - {short_name:text(text) {label {Short Name:}}} - {pretty_name:text(text) {label {Pretty Name:}}} - {callbacks:text(textarea),nospell,optional {label {Insert or remove callbacks. Put a new callback on a seperate line:}} {html {rows 6 cols 35}}} -} -new_data { - set update_array(short_name) $short_name - set update_array(pretty_name) $pretty_name - - set callback_list [list] - foreach callback_name [split $callbacks "\n"] { - set callback_name [string trim $callback_name] - if {![empty_string_p $callback_name]} { - lappend callback_list $callback_name - } - } - - if {[llength $callback_list] != 0} { - set update_array(callbacks) $callback_list - } - - set error_p 0 - db_transaction { - workflow::edit \ - -operation "insert" - -workflow_id $workflow_id \ - -array update_array - } on_error { - set error_p 1 - } - - if {$error_p} { - ad_return_complaint 1 "There was an error creating the workflow:


$errmsg" - ad_script_abort - } - - -} -edit_data { - set update_array(short_name) $short_name - set update_array(pretty_name) $pretty_name - - set callback_list [list] - foreach callback_name [split $callbacks "\n"] { - set callback_name [string trim $callback_name] - if {![empty_string_p $callback_name]} { - lappend callback_list $callback_name - } - } - - if {[llength $callback_list] != 0} { - set update_array(callbacks) $callback_list - } - - set error_p 0 - db_transaction { - workflow::edit \ - -workflow_id $workflow_id \ - -array update_array - } on_error { - set error_p 1 - } - - if {$error_p} { - ad_return_complaint 1 "There was an error updating the workflow:


$errmsg" - ad_script_abort - } - -} -edit_request { - workflow::get -workflow_id $workflow_id -array "wf_info" - set short_name $wf_info(short_name) - set pretty_name $wf_info(pretty_name) - set callbacks $wf_info(callbacks) - set callbacks [join $callbacks "\n"] -} -after_submit { - ad_returnredirect $return_url -} -export {return_url}