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.33 -r1.34 --- openacs-4/packages/imsld/tcl/imsld-procs.tcl 8 Feb 2006 17:37:59 -0000 1.33 +++ openacs-4/packages/imsld/tcl/imsld-procs.tcl 9 Feb 2006 13:28:06 -0000 1.34 @@ -686,6 +686,36 @@ # now that we have the necessary info, mark the finished element completed and return db_dml insert_element_entry { *SQL* } + + switch $type { + learning { + set table_name "imsld_learning_activities" + set element_name "activity_id" + } + support { + set table_name "imsld_support_activities" + set element_name "activity_id" + } + method { + set table_name "imsld_methods" + set element_name "method_id" + } + play { + set table_name "imsld_plays" + set element_name "play_id" + } + act { + set table_name "imsld_acts" + set element_name "act_id" + } + } + + if { [info exists table_name] } { + if { [db_0or1row get_related_on_completion_id ""] } { + db_1row get_related_resource_id {} + imsld::grant_permissions -resources_activities_list $related_resource -user_id $user_id + } + } if { [string eq $type "learning"] || [string eq $type "support"] || [string eq $type "structure"] } { foreach referencer_structure_list [db_list_of_lists referencer_structure { select ias.structure_id, @@ -2517,10 +2547,13 @@ permission::grant -party_id $user_id -object_id $the_object_id -privilege "read" } } else { + if {[db_0or1row is_forum {}]} { + permission::grant -party_id $user_id -object_id $the_object_id -privilege "forum_moderate" + } + permission::grant -party_id $user_id -object_id $the_object_id -privilege "read" } - } - + } } ad_register_proc GET /finish-component-element* imsld::finish_component_element ad_register_proc POST /finish-component-element* imsld::finish_component_element Index: openacs-4/packages/imsld/tcl/imsld-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/tcl/imsld-procs.xql,v diff -u -r1.9 -r1.10 --- openacs-4/packages/imsld/tcl/imsld-procs.xql 8 Feb 2006 17:37:59 -0000 1.9 +++ openacs-4/packages/imsld/tcl/imsld-procs.xql 9 Feb 2006 13:28:06 -0000 1.10 @@ -235,6 +235,14 @@ + + + select 1 + from forums_forums ff + where ff.forum_id=:the_object_id + + + select acs_object_id as the_object_id @@ -432,6 +440,28 @@ + + + select on_completion_id as related_on_completion + from $table_name + where $element_name=:element_id and + on_completion_id is not null + + + + + + + select ar2.object_id_two as related_resource + from acs_rels ar1, + acs_rels ar2 + where ar2.object_id_one=ar1.object_id_two and + ar2.rel_type='imsld_item_res_rel' and + ar1.rel_type='imsld_feedback_rel' and + ar1.object_id_one=:related_on_completion + + + insert into imsld_status_user (