Index: openacs-4/packages/imsld/tcl/imsld-condition-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/tcl/imsld-condition-procs.tcl,v diff -u -r1.18 -r1.19 --- openacs-4/packages/imsld/tcl/imsld-condition-procs.tcl 25 Sep 2006 13:55:53 -0000 1.18 +++ openacs-4/packages/imsld/tcl/imsld-condition-procs.tcl 10 Oct 2006 10:58:02 -0000 1.19 @@ -14,8 +14,13 @@ ad_proc -public imsld::condition::execute_all { -run_id + -user_id } { } { + if {![info exist user_id]} { + set user_id [ad_conn user_id] + } + set imsld_rev_id [db_string get_imsld_rev_id {SELECT imsld_id FROM imsld_runs WHERE run_id = :run_id}] set imsld_id [db_string get_item_id {SELECT item_id FROM cr_revisions WHERE revision_id = :imsld_rev_id}] set method_rev_id [db_string get_method_rev_id {SELECT method_id FROM imsld_methods WHERE imsld_id = :imsld_id}] @@ -26,30 +31,36 @@ }] { dom parse $condition_xml document $document documentElement condition - imsld::condition::execute -run_id $run_id -condition $condition + imsld::condition::execute -run_id $run_id -condition $condition -user_id $user_id } } ad_proc -public imsld::condition::execute { -run_id -condition + -user_id } { } { + + if {![info exist user_id]} { + set user_id [ad_conn user_id] + } + set ifNodes [$condition selectNodes {*[local-name()='if']}] set thenNodes [$condition selectNodes {*[local-name()='then']}] set elseNodes [$condition selectNodes {*[local-name()='else']}] foreach ifNode $ifNodes { - if {[imsld::expression::eval -run_id $run_id -expression [$ifNode childNodes]]} { + if {[imsld::expression::eval -user_id $user_id -run_id $run_id -expression [$ifNode childNodes]]} { foreach thenNode $thenNodes { - imsld::statement::execute -run_id $run_id -statement [$thenNode childNodes] + imsld::statement::execute -run_id $run_id -statement [$thenNode childNodes] -user_id $user_id } } else { foreach elseNode $elseNodes { #an else node may contain an expression or another if_then_else if { [string eq [ [$elseNode selectNodes {*[position()=1] } ] localName] "if" ] } { - imsld::condition::execute -run_id $run_id -condition $elseNode + imsld::condition::execute -run_id $run_id -condition $elseNode -user_id $user_id } else { - imsld::statement::execute -run_id $run_id -statement [$elseNode childNodes] + imsld::statement::execute -run_id $run_id -statement [$elseNode childNodes] -user_id $user_id } } } @@ -612,6 +623,7 @@ ad_proc -public imsld::statement::execute { -run_id -statement + -user_id } { } { if {![info exist user_id]} { @@ -633,7 +645,8 @@ ns_log notice "imsld::statement::execute: class ref is empty" continue } - imsld::runtime::class::show_hide -class $class -run_id $run_id -title $title -with_control_p $with_control_p -action "show" + imsld::runtime::class::show_hide -class $class -run_id $run_id -title $title \ + -with_control_p $with_control_p -action "show" -user_id $user_id } {environment-ref} { # the environments doesn't have any isvisible attribute, @@ -647,16 +660,16 @@ # NOT IMPLEMENTED: noop } {item-ref} { - imsld::runtime::isvisible::show_hide -run_id $run_id -identifier [$refNodes getAttribute "ref"] -action "show" + imsld::runtime::isvisible::show_hide -run_id $run_id -identifier [$refNodes getAttribute "ref"] -action "show" -user_id $user_id } {learning-activity-ref} { - imsld::runtime::isvisible::show_hide -run_id $run_id -identifier [$refNodes getAttribute "ref"] -action "show" + imsld::runtime::isvisible::show_hide -run_id $run_id -identifier [$refNodes getAttribute "ref"] -action "show" -user_id $user_id } {support-activity-ref} { - imsld::runtime::isvisible::show_hide -run_id $run_id -identifier [$refNodes getAttribute "ref"] -action "show" + imsld::runtime::isvisible::show_hide -run_id $run_id -identifier [$refNodes getAttribute "ref"] -action "show" -user_id $user_id } {play-ref} { - imsld::runtime::isvisible::show_hide -run_id $run_id -identifier [$refNodes getAttribute "ref"] -action "show" + imsld::runtime::isvisible::show_hide -run_id $run_id -identifier [$refNodes getAttribute "ref"] -action "show" -user_id $user_id } } } @@ -674,7 +687,8 @@ ns_log notice "imsld::statement::execute: class ref is empty" continue } - imsld::runtime::class::show_hide -class $class -run_id $run_id -title $title -with_control_p $with_control_p -action "hide" + imsld::runtime::class::show_hide -class $class -run_id $run_id -title $title \ + -with_control_p $with_control_p -action "hide" -user_id $user_id } {environment-ref} { # the environments doesn't have any isvisible attribute, @@ -688,16 +702,16 @@ # NOT IMPLEMENTED: noop } {item-ref} { - imsld::runtime::isvisible::show_hide -run_id $run_id -identifier [$refNodes getAttribute "ref"] -action "hide" + imsld::runtime::isvisible::show_hide -run_id $run_id -identifier [$refNodes getAttribute "ref"] -action "hide" -user_id $user_id } {learning-activity-ref} { - imsld::runtime::isvisible::show_hide -run_id $run_id -identifier [$refNodes getAttribute "ref"] -action "hide" + imsld::runtime::isvisible::show_hide -run_id $run_id -identifier [$refNodes getAttribute "ref"] -action "hide" -user_id $user_id } {support-activity-ref} { - imsld::runtime::isvisible::show_hide -run_id $run_id -identifier [$refNodes getAttribute "ref"] -action "hide" + imsld::runtime::isvisible::show_hide -run_id $run_id -identifier [$refNodes getAttribute "ref"] -action "hide" -user_id $user_id } {play-ref} { - imsld::runtime::isvisible::show_hide -run_id $run_id -identifier [$refNodes getAttribute "ref"] -action "hide" + imsld::runtime::isvisible::show_hide -run_id $run_id -identifier [$refNodes getAttribute "ref"] -action "hide" -user_id $user_id } } } Index: openacs-4/packages/imsld/tcl/imsld-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/tcl/imsld-procs.tcl,v diff -u -r1.87 -r1.88 --- openacs-4/packages/imsld/tcl/imsld-procs.tcl 4 Oct 2006 14:31:14 -0000 1.87 +++ openacs-4/packages/imsld/tcl/imsld-procs.tcl 10 Oct 2006 10:58:02 -0000 1.88 @@ -1879,7 +1879,6 @@ } # get associated urls db_foreach associated_urls { *SQL* } { - set a_node [$dom_doc createElement a] $a_node setAttribute href "[export_vars -base "[lindex [site_node::get_url_from_object_id -object_id $imsld_package_id] 0]imsld-finish-resource" { {file_url "[export_vars -base $url]"} resource_item_id run_id}]" set img_node [$dom_doc createElement img] Index: openacs-4/packages/imsld/tcl/imsld-runtime-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/tcl/imsld-runtime-procs.tcl,v diff -u -r1.12 -r1.13 --- openacs-4/packages/imsld/tcl/imsld-runtime-procs.tcl 25 Sep 2006 13:13:31 -0000 1.12 +++ openacs-4/packages/imsld/tcl/imsld-runtime-procs.tcl 10 Oct 2006 10:58:02 -0000 1.13 @@ -315,7 +315,6 @@ mark a class as showh or hidden. NOTE: not recursively } { set user_id [expr { [string eq "" $user_id] ? [ad_conn user_id] : $user_id }] - if { [string eq $action "show"] } { set is_visible_p "t" } else { @@ -347,9 +346,14 @@ -run_id -identifier -action + -user_id } { mark an environment as showh or hidden. NOTE: not recursively } { + + if {![info exist user_id]} { + set user_id [ad_conn user_id] + } # according to the spec, the environments doesn't have any isvisible attribute # so we show the referenced learning objects and services @@ -373,7 +377,7 @@ from imsld_learning_objects lo, imsld_environmentsi env where lo.environment_id = :environment_item_id } { - imsld::runtime::isvisible::show_hide -run_id $run_id -identifier $lo_identifier -action $action + imsld::runtime::isvisible::show_hide -run_id $run_id -identifier $lo_identifier -action $action -user_id $user_id } # 2. show the services @@ -383,7 +387,7 @@ from imsld_services serv where serv.environment_id = :environment_item_id } { - imsld::runtime::isvisible::show_hide -run_id $run_id -identifier $serv_identifier -action $action + imsld::runtime::isvisible::show_hide -run_id $run_id -identifier $serv_identifier -action $action -user_id $user_id } } @@ -392,9 +396,13 @@ -run_id -identifier -action + -user_id } { mark an activity structure as showh or hidden. NOTE: not recursively } { + if {![info exist user_id]} { + set user_id [ad_conn user_id] + } # according to the spec, the activity structures doesn't have any isvisible attribute # so we show the referenced activities, learning infos and environments @@ -417,7 +425,7 @@ where ar.object_id_one = :structure_item_id and ar.object_id_two = ii.item_id } { - imsld::runtime::isvisible::show -run_id $run_id -identifier $ii_identifier -action $action + imsld::runtime::isvisible::show -run_id $run_id -identifier $ii_identifier -action $action -user_id $user_id } # 2. show the learning activities @@ -428,7 +436,7 @@ where ar.object_id_one = :structure_item_id and ar.object_id_two = la.item_id } { - imsld::runtime::isvisible::show -run_id $run_id -identifier $la_identifier -action $action + imsld::runtime::isvisible::show -run_id $run_id -identifier $la_identifier -action $action -user_id $user_id } # 3. show the support activities @@ -439,7 +447,7 @@ where ar.object_id_one = :structure_item_id and ar.object_id_two = sa.item_id } { - imsld::runtime::isvisible::show -run_id $run_id -identifier $sa_identifier -action $action + imsld::runtime::isvisible::show -run_id $run_id -identifier $sa_identifier -action $action -user_id $user_id } # 4. show the activity structures @@ -450,7 +458,7 @@ where ar.object_id_one = :structure_item_id and ar.object_id_two = ias.item_id } { - imsld::runtime::isvisible::show -run_id $run_id -identifier $structure_identifier -action $action + imsld::runtime::isvisible::show -run_id $run_id -identifier $structure_identifier -action $action -user_id $user_id } # 5. show the environments @@ -461,7 +469,7 @@ where ar.object_id_one = :structure_item_id and ar.object_id_two = env.item_id } { - imsld::runtime::isvisible::show -run_id $run_id -identifier $structure_identifier -action $action + imsld::runtime::isvisible::show -run_id $run_id -identifier $structure_identifier -action $action -user_id $user_id } } Index: openacs-4/packages/imsld/www/admin/imsld-confirm-finish.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/www/admin/imsld-confirm-finish.tcl,v diff -u -r1.6 -r1.7 --- openacs-4/packages/imsld/www/admin/imsld-confirm-finish.tcl 25 Sep 2006 13:55:54 -0000 1.6 +++ openacs-4/packages/imsld/www/admin/imsld-confirm-finish.tcl 10 Oct 2006 10:58:02 -0000 1.7 @@ -22,7 +22,16 @@ } } -# excecute all conditions -imsld::condition::execute_all -run_id $run_id +# excecute all conditions for all users +set users_list [list] +foreach role_id [imsld::roles::get_list_of_roles -imsld_id $imsld_id] { + set users_list [concat $users_list [imsld::roles::get_users_in_role -role_id [lindex $role_id 0] -run_id $run_id]] +} + +foreach user_id $users_list { + imsld::condition::execute_all -run_id $run_id -user_id $user_id +} + + ad_returnredirect ..