Index: openacs-4/packages/xowf/xowf.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowf/xowf.info,v diff -u -N -r1.7 -r1.8 --- openacs-4/packages/xowf/xowf.info 17 May 2018 14:04:29 -0000 1.7 +++ openacs-4/packages/xowf/xowf.info 21 May 2018 16:15:00 -0000 1.8 @@ -17,7 +17,7 @@ WU Vienna 2 - + Index: openacs-4/packages/xowf/tcl/test/xowf-test-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowf/tcl/test/xowf-test-procs.tcl,v diff -u -N -r1.3 -r1.4 --- openacs-4/packages/xowf/tcl/test/xowf-test-procs.tcl 18 May 2018 09:15:17 -0000 1.3 +++ openacs-4/packages/xowf/tcl/test/xowf-test-procs.tcl 21 May 2018 16:15:00 -0000 1.4 @@ -1,7 +1,7 @@ namespace eval ::xowf::test { aa_register_case -cats {web} -procs { - "::xowf::Pacakge instproc initialize" + "::xowf::Package instproc initialize" } create_folder_with_page { Create a folder in a xowf instance with a form page and edit this @@ -65,6 +65,117 @@ } } + + aa_register_case -cats {web} -procs { + "::xowf::Package instproc initialize" + } create_workflow_with_instance { + + Create a xowf workflow and a instance in a folder + } { + + # run the test under the current user_id. + set user_id [ad_conn user_id] + ns_log notice USER=$user_id + + set instance /xowf + set testfolder .testfolder + + try { + # + # Make sure we have a test folder + # + set folder_info [::xowiki::test::require_test_folder \ + -user_id $user_id \ + -instance $instance \ + -folder_name $testfolder \ + -fresh \ + ] + + set folder_id [dict get $folder_info folder_id] + set package_id [dict get $folder_info package_id] + + aa_true "folder_id '$folder_id' is not 0" {$folder_id != 0} + + ::xowiki::test::create_form \ + -user_id $user_id \ + -instance $instance \ + -path $testfolder \ + -parent_id $folder_id \ + -name en:tip.form \ + -update { + title "TIP Form" + nls_language en_US + text {

@_text@

+

State: @wf_current_state@

+ } + text.format text/html + form {
@_text@ @wf_current_state@  @_description@
} + form.format text/html + form_constraints { + {wf_current_state:current_state} + _page_order:hidden + } + } + aa_log "===== Form en:tip.form created" + + # + # Create the TIP workflow + # + ::xowiki::test::create_form_page \ + -user_id $user_id \ + -instance $instance \ + -path $testfolder \ + -parent_id $folder_id \ + -form_name Workflow.form \ + -update { + _title "TIP Workflow" + _name en:tip.wf + workflow_definition { + # Actions are used here with the following parameters: + # next_state: state after activation of action + # roles: a list of roles; if the current user has one of these + # roles, he is allowed to perform the action + # Currently implemented roles: + # all, swa, registered_user, unregistered user, admin, + # creator, app_group_member, community_member + # + Action save -roles admin + Action propose -next_state proposed -proc activate {obj} { + my msg "$obj is going to state [my next_state]" + } + Action accept -next_state accepted + Action reject -next_state rejected + Action mark_implemented -next_state implemented + + # States + # - form: the form to be used in a state + # - view_method: Typically "view" (default) or "edit" + #State parameter {{form "en:tip-form"} {view_method edit}} + #assigns the specified form to all states + + State parameter {{form "en:tip.form"} {extra_js 1.js}} + + State initial -actions {save propose} + State proposed -actions {save accept reject} + State accepted -actions {save mark_implemented} + State rejected -actions {save} + State implemented -actions {save} + } + form_constraints {@table:_name,wf_current_state,_creator,_last_modified} + } + + aa_log "===== Workflow en:tip.wf created" + + + + } on error {errorMsg} { + aa_true "Error msg: $errorMsg" 0 + } finally { + #calendar::delete -calendar_id $temp_calendar_id + + } + } + } #