Index: openacs-4/packages/xowf/tcl/atjob-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowf/tcl/atjob-procs.tcl,v diff -u -r1.1.2.1 -r1.1.2.2 --- openacs-4/packages/xowf/tcl/atjob-procs.tcl 2 Sep 2014 13:03:01 -0000 1.1.2.1 +++ openacs-4/packages/xowf/tcl/atjob-procs.tcl 2 Sep 2014 13:09:03 -0000 1.1.2.2 @@ -83,45 +83,45 @@ #my log "---run xowf jobs START" set items [::xowiki::FormPage instantiate_objects \ - -object_class ::xowiki::FormPage \ - -sql "select i.item_id, i.name, i.parent_id, i.publish_status, o.creation_user, + -object_class ::xowiki::FormPage \ + -sql "select i.item_id, i.name, i.parent_id, i.publish_status, o.creation_user, i.live_revision as revision_id, page_template, instance_attributes - from cr_items i, xowiki_page_instance t, acs_objects o - where i.item_id in ([join $item_ids ,]) and - i.live_revision = t.page_instance_id and o.object_id = i.item_id"] + from cr_items i, xowiki_page_instance t, acs_objects o + where i.item_id in ([join $item_ids ,]) and + i.live_revision = t.page_instance_id and o.object_id = i.item_id"] if {[llength [$items children]] > 0} { - + my log "--at we got [llength [$items children]] scheduled items" foreach item [$items children] { - #my log "--at *** job=[$item serialize] ***\n" - set owner_id [$item parent_id] - set party_id [$item creation_user] - set __ia [$item instance_attributes] - if {![dict exists $__ia cmd]} { - #ns_log notice "--at ignore strange entry [$item serialize]" - ns_log notice "--at ignore strange entry, no cmd in [$item instance_attributes]" - continue - } - set cmd [dict get $__ia cmd] + #my log "--at *** job=[$item serialize] ***\n" + set owner_id [$item parent_id] + set party_id [$item creation_user] + set __ia [$item instance_attributes] + if {![dict exists $__ia cmd]} { + #ns_log notice "--at ignore strange entry [$item serialize]" + ns_log notice "--at ignore strange entry, no cmd in [$item instance_attributes]" + continue + } + set cmd [dict get $__ia cmd] - # We assume, the owner object is a cr-item - ::xo::db::CrClass get_instance_from_db -item_id $owner_id + # We assume, the owner object is a cr-item + ::xo::db::CrClass get_instance_from_db -item_id $owner_id - # We assume, the package is from the xowiki family; make sure, the url looks like real - ::xo::Package initialize \ - -package_id [$owner_id package_id] \ - -user_id $party_id \ - -init_url 0 -actual_query "" - $package_id set_url -url [$package_id package_url][$owner_id name] + # We assume, the package is from the xowiki family; make sure, the url looks like real + ::xo::Package initialize \ + -package_id [$owner_id package_id] \ + -user_id $party_id \ + -init_url 0 -actual_query "" + $package_id set_url -url [$package_id package_url][$owner_id name] - my log "--at executing atjob $cmd" - if {[catch {eval $owner_id $cmd} errorMsg]} { - ns_log error "\n*** atjob $owner_id $cmd lead to error ***\n$errorMsg" - } else { - $item set_live_revision -revision_id [$item revision_id] -publish_status "expired" - } + my log "--at executing atjob $cmd" + if {[catch {eval $owner_id $cmd} errorMsg]} { + ns_log error "\n*** atjob $owner_id $cmd lead to error ***\n$errorMsg" + } else { + $item set_live_revision -revision_id [$item revision_id] -publish_status "expired" + } } my log "---run xowf jobs END" } @@ -156,7 +156,7 @@ and i2.name = 'en:atjob-form' and r.publish_date $op to_timestamp(:ansi_time,'YYYY-MM-DD HH24:MI') and i.publish_status = 'production' - and o.package_id is not null + and o.package_id is not null " ] my log "--at we got [llength $item_ids] scheduled items" @@ -170,14 +170,20 @@ # splitting the list and run multiple jobs in parallel. # if {[llength $item_ids]} { - set queue xowfatjobs - if {$queue ni [ns_job queues]} { - ns_job create $queue - } - ns_job queue -detached $queue [list ::xowf::atjob run_jobs $item_ids] + set queue xowfatjobs + if {$queue ni [ns_job queues]} { + ns_job create $queue + } + ns_job queue -detached $queue [list ::xowf::atjob run_jobs $item_ids] } my log "--at END" } - } + +# +# Local variables: +# mode: tcl +# tcl-indent-level: 2 +# indent-tabs-mode: nil +# End: Index: openacs-4/packages/xowf/tcl/test-item-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowf/tcl/test-item-procs.tcl,v diff -u -r1.1 -r1.1.2.1 --- openacs-4/packages/xowf/tcl/test-item-procs.tcl 28 Aug 2014 08:24:56 -0000 1.1 +++ openacs-4/packages/xowf/tcl/test-item-procs.tcl 2 Sep 2014 13:09:03 -0000 1.1.2.1 @@ -79,13 +79,13 @@ # switch -- [my question_type] { mc { # we should support as well: minChoices, maxChoices, shuffle - set interaction_class mc_interaction - set options nr_choices=[my nr_choices] - } + set interaction_class mc_interaction + set options nr_choices=[my nr_choices] + } sc { # we should support as well: minChoices, maxChoices, shuffle - set interaction_class mc_interaction - set options nr_choices=[my nr_choices],multiple=false - } + set interaction_class mc_interaction + set options nr_choices=[my nr_choices],multiple=false + } ot { set interaction_class text_interaction } default {error "unknown question type: [my question_type]"} } @@ -191,7 +191,7 @@ append form "