Index: openacs-4/packages/imsld/tcl/imsld-install-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/tcl/imsld-install-procs.tcl,v diff -u -N -r1.23 -r1.24 --- openacs-4/packages/imsld/tcl/imsld-install-procs.tcl 18 May 2006 11:13:00 -0000 1.23 +++ openacs-4/packages/imsld/tcl/imsld-install-procs.tcl 19 May 2006 17:26:02 -0000 1.24 @@ -369,11 +369,11 @@ rel_types::new imsld_role_group_rel "ims-ld role - imsld_role_group" "ims-ld roles - imsld_role_groups" \ content_item 0 {} \ imsld_role_group 0 {} - - - rel_types::new imsld_roleinstance_club_rel "imsld role instance - dotlrn club" "imsld role groups - dotlrn clubs" \ + + # ims-ld role instance - ims-ld run + rel_types::new imsld_roleinstance_run_rel "imsld role instance - imsld run" "imsld role instances - ims_ld_run_groups" \ imsld_role_group 0 {} \ - dotlrn_club 0 {} + imsld_run_users_group 0 {} # ims-ld run - oacs users 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 -N -r1.64 -r1.65 --- openacs-4/packages/imsld/tcl/imsld-procs.tcl 19 May 2006 13:59:40 -0000 1.64 +++ openacs-4/packages/imsld/tcl/imsld-procs.tcl 19 May 2006 17:26:02 -0000 1.65 @@ -822,7 +822,8 @@ set completed_act_p 1 set rel_defined_p 0 - set user_roles_list [imsld::roles::get_user_roles -user_id $user_id -imsld_id $imsld_id] + + set user_roles_list [imsld::roles::get_user_roles -user_id $user_id -run_id $run_id] db_foreach referenced_role_part { select ar.object_id_two as role_part_item_id, rp.role_part_id @@ -1375,7 +1376,7 @@ set send_mail_node_li [$dom_doc createElement li] set a_node [$dom_doc createElement a] - $a_node setAttribute href "[export_vars -base "[dotlrn_community::get_community_url [dotlrn_community::get_community_id]]imsld/imsld-sendmail" {{send_mail_id $sendmail_id}}]" + $a_node setAttribute href "[export_vars -base "[dotlrn_community::get_community_url [dotlrn_community::get_community_id]]imsld/imsld-sendmail" {{send_mail_id $sendmail_id} {run_id $run_id}}]" set service_title [$dom_doc createTextNode "$send_mail_title"] $a_node setAttribute target "content" $a_node appendChild $service_title @@ -3462,8 +3463,8 @@ where run_id = :run_id } # start with the role parts - set user_roles_list [imsld::roles::get_user_roles -user_id $user_id -imsld_id $imsld_id] + set user_roles_list [imsld::roles::get_user_roles -user_id $user_id -run_id $run_id] foreach role_part_list [db_list_of_lists referenced_role_parts { *SQL* }] { set type [lindex $role_part_list 0] set activity_id [lindex $role_part_list 1] @@ -3677,7 +3678,8 @@ # 2.2.1.2 if it is an activity structure we have verify which activities are already completed and return the next # activity in the activity structure, handling the case when the next activity is also an activity structure - set user_roles_list [imsld::roles::get_user_roles -user_id $user_id -imsld_id $imsld_id] + + set user_roles_list [imsld::roles::get_user_roles -user_id $user_id -run_id $run_id] set next_activity_id_list [list] foreach act_item_id $next_act_item_id_list { foreach role_part_id [db_list act_role_parts " Index: openacs-4/packages/imsld/tcl/imsld-roles-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/tcl/imsld-roles-procs.tcl,v diff -u -N -r1.2 -r1.3 --- openacs-4/packages/imsld/tcl/imsld-roles-procs.tcl 18 May 2006 11:13:00 -0000 1.2 +++ openacs-4/packages/imsld/tcl/imsld-roles-procs.tcl 19 May 2006 17:26:02 -0000 1.3 @@ -14,6 +14,7 @@ ad_proc -public imsld::roles::create_instance { -role_id:required + -run_id:required -parent_group_id } { Create a instance of a role (a party) for the role and for all the subroles with the "create-new" attribute set to true. @@ -26,6 +27,8 @@ set user_id [ad_conn user_id] set peeraddr [ad_conn peeraddr] +#get the run_users_group + db_1row get_group_from_run {} #create the party db_transaction { set group_id [db_exec_plsql create_new_group {}] @@ -37,17 +40,17 @@ if {[info exist parent_group_id] } { relation_add composition_rel $parent_group_id $group_id } -#map group with the community or class +#map group with the run set club_id [dotlrn_community::get_community_id] - relation_add imsld_roleinstance_club_rel $group_id $club_id + relation_add imsld_roleinstance_run_rel $group_id $run_group_id #check for subroles set subroles_list [imsld::roles::get_subroles -role_id $role_id] if {[llength $subroles_list]} { foreach role $subroles_list { if {[string eq "t" [db_string get_create_new_p {}] ]} { - set sub_instance [imsld::roles::create_instance -role_id $role -parent_group_id $group_id] + set sub_instance [imsld::roles::create_instance -role_id $role -parent_group_id $group_id -run_id $run_id] } } } @@ -140,11 +143,12 @@ ad_proc -private imsld::roles::get_role_instances { -role_id - -community_id + -run_id + } { @param roles_list the list of roles to get the name } { - if {[info exist community_id]} { + if {[info exist run_id]} { set groups [db_list get_community_related_groups {}] } else { set groups [db_list get_related_groups {}] @@ -198,6 +202,7 @@ ad_proc -private imsld::roles::get_mail_recipients { -role_destination_ref -role_source_id + -run_id } { Get the list of recipients of a send-mail service. Its called from a user belonging to a role into an specific imsld run and must get a list of users from the destination role. } { @@ -208,8 +213,7 @@ # set root_source_parent_role [imsld::roles::get_parent_role -role_id $role_source_id -root_parent] set root_destination_parent_role [imsld::roles::get_parent_role -role_id $role_destination_ref] - set community_id [dotlrn_community::get_community_id] - set list_of_groups [imsld::roles::get_role_instances -role_id $role_destination_ref -community_id $community_id] + set list_of_groups [imsld::roles::get_role_instances -role_id $role_destination_ref -run_id $run_id] # if { $root_source_parent_role == $root_destination_parent_role } { #get community_id # set group_id @@ -223,45 +227,16 @@ } ad_proc -public imsld::roles::get_user_roles { -user_id - -imsld_id + -run_id } { Returns a list with all the roles_id from which the user are member. If imsld_id is given, restrict the list to the roles of the imsld. } { - set roles_list [db_list get_user_roles_list {}] - - if {[info exist imsld_id]} { - set new_roles_list [list] - foreach role $roles_list { - set role_imsld_id [imsld::roles::get_imsld_from_role -role_id $role] - if { $role_imsld_id == $imsld_id } { - lappend new_roles_list $role - } - } - set roles_list $new_roles_list + if {[info exist run_id]} { + set roles_list [db_list get_user_roles_list {}] + } else { + set roles_list [db_list get_raw_user_roles_list {}] } return $roles_list } -ad_proc -public imsld::roles::get_imsld_from_role { - -role_id -} { - get the imsld_id of the given role -} { - return [db_string get_imsld {}] -} -ad_proc -public imsld::roles::get_role_instances { - -role_id - -community_id -} { - get all the instances of a given role. If community_id is given, restrict the output to the groups of this community -} { - set groups_list [db_list get_list_of_groups {}] -# -# if {[info exist community_id]} { -# set groups_list [db_list get_list_of_community_groups ""] -# } - return $groups_list -} - - Index: openacs-4/packages/imsld/tcl/imsld-roles-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/tcl/imsld-roles-procs.xql,v diff -u -N -r1.2 -r1.3 --- openacs-4/packages/imsld/tcl/imsld-roles-procs.xql 18 May 2006 11:13:00 -0000 1.2 +++ openacs-4/packages/imsld/tcl/imsld-roles-procs.xql 19 May 2006 17:26:02 -0000 1.3 @@ -1,7 +1,16 @@ - + + select group_id as run_group_id + from imsld_run_users_group_ext + where run_id=:run_id + + + + + + select role_type,item_id as role_item_id from imsld_rolesi where role_id=:role_id @@ -121,12 +130,14 @@ select ar.object_id_two from acs_rels ar, acs_rels ar2, - imsld_rolesi iri + imsld_rolesi iri, + imsld_run_users_group_ext iruge where ar.object_id_one=iri.item_id and ar.rel_type='imsld_role_group_rel' and ar.object_id_two=ar2.object_id_one - and ar2.rel_type='imsld_roleinstance_club_rel' - and ar2.object_id_two=:community_id + and ar2.rel_type='imsld_roleinstance_run_rel' + and ar2.object_id_two=iruge.group_id + and iruge.run_id=:run_id and iri.role_id=:role_id @@ -164,28 +175,44 @@ - select ir.role_id - from imsld_rolesi ir, - group_member_map gmm, - acs_objects ao, - acs_rels ar - where ao.object_id = gmm.group_id - and ao.object_type = 'imsld_role_group' - and ar.object_id_two = gmm.group_id - and ir.item_id = ar.object_id_one - and gmm.member_id = :user_id + select iri.role_id + from imsld_rolesi iri, + group_member_map gmm, + acs_objects ao, + acs_rels ar, + acs_rels ar2 , + imsld_run_users_group_ext iruge + where ao.object_id=gmm.group_id + and ao.object_type='imsld_role_group' + and ar.object_id_one=gmm.group_id + and ar.rel_type='imsld_roleinstance_run_rel' + and gmm.member_id=:user_id + and iruge.group_id=ar.object_id_two + and iruge.run_id=:run_id + and ar2.object_id_two=gmm.group_id + and ar2.rel_type='imsld_role_group_rel' + and ar2.object_id_one=iri.item_id + - + - select iii.imsld_id - from imsld_imsldsi iii, - imsld_roles ir, - imsld_componentsi ici - where iii.item_id = ici.imsld_id - and ici.item_id = ir.component_id - and ir.role_id = :role_id + select iri.role_id + from imsld_rolesi iri, + group_member_map gmm, + acs_objects ao, + acs_rels ar, + acs_rels ar2 + where ao.object_id=gmm.group_id + and ao.object_type='imsld_role_group' + and ar.object_id_one=gmm.group_id + and ar.rel_type='imsld_roleinstance_run_rel' + and gmm.member_id=:user_id + and ar2.object_id_two=gmm.group_id + and ar2.rel_type='imsld_role_group_rel' + and ar2.object_id_one=iri.item_id + Index: openacs-4/packages/imsld/www/activity-frame.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/www/activity-frame.adp,v diff -u -N -r1.6 -r1.7 --- openacs-4/packages/imsld/www/activity-frame.adp 18 May 2006 11:13:01 -0000 1.6 +++ openacs-4/packages/imsld/www/activity-frame.adp 19 May 2006 17:26:02 -0000 1.7 @@ -25,7 +25,7 @@ - + @activities;noquote@ Index: openacs-4/packages/imsld/www/imsld-sendmail-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/www/imsld-sendmail-2.tcl,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/imsld/www/imsld-sendmail-2.tcl 18 May 2006 11:13:01 -0000 1.1 +++ openacs-4/packages/imsld/www/imsld-sendmail-2.tcl 19 May 2006 17:26:02 -0000 1.2 @@ -2,9 +2,10 @@ } { recipients role_recipient + run_id } -set users_list [imsld::roles::get_mail_recipients -role_destination_ref $role_recipient] +set users_list [imsld::roles::get_mail_recipients -role_destination_ref $role_recipient -run_id $run_id] set users_list [lindex $users_list 0] if {[string eq $recipients all-in-role]} { Index: openacs-4/packages/imsld/www/imsld-sendmail.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/www/imsld-sendmail.tcl,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/imsld/www/imsld-sendmail.tcl 18 May 2006 11:13:01 -0000 1.1 +++ openacs-4/packages/imsld/www/imsld-sendmail.tcl 19 May 2006 17:26:02 -0000 1.2 @@ -1,6 +1,7 @@ ad_page_contract { } { send_mail_id + run_id } @@ -10,5 +11,5 @@ db_multirow -extend {send_mail_url} all_email_data get_all_email_data {} { - set send_mail_url [export_vars -base imsld-sendmail-2 {{recipients $recipients} {role_recipient $group_recipient} }] + set send_mail_url [export_vars -base imsld-sendmail-2 {{recipients $recipients} {role_recipient $group_recipient} {run_id $run_id}}] } Index: openacs-4/packages/imsld/www/support-activity-roles.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/www/support-activity-roles.tcl,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/imsld/www/support-activity-roles.tcl 18 May 2006 11:13:01 -0000 1.1 +++ openacs-4/packages/imsld/www/support-activity-roles.tcl 19 May 2006 17:26:02 -0000 1.2 @@ -12,7 +12,7 @@ set supported_role_instances [list] foreach role $supported_roles { - set supported_instances_temp [imsld::roles::get_role_instances -role_id $role -community_id $community_id] + set supported_instances_temp [imsld::roles::get_role_instances -role_id $role -run_id $run_id] lappend supported_role_instances $supported_instances_temp } Index: openacs-4/packages/imsld/www/admin/imsld-create-instance.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/www/admin/imsld-create-instance.tcl,v diff -u -N -r1.2 -r1.3 --- openacs-4/packages/imsld/www/admin/imsld-create-instance.tcl 16 May 2006 09:24:36 -0000 1.2 +++ openacs-4/packages/imsld/www/admin/imsld-create-instance.tcl 19 May 2006 17:26:02 -0000 1.3 @@ -27,10 +27,10 @@ } if {[info exist parent_group_id] } { - set new_instance [imsld::roles::create_instance -role_id $role -parent_group_id $parent_group_id] + set new_instance [imsld::roles::create_instance -role_id $role -parent_group_id $parent_group_id -run_id $run_id] ad_returnredirect [export_vars -base imsld-admin-roles {{role $role} {imsld_id $imsld_id} {run_id $run_id} {group_instance $new_instance}}] } elseif { ![db_0or1row has_role_parent_p {}] } { - set new_instance [imsld::roles::create_instance -role_id $role] + set new_instance [imsld::roles::create_instance -role_id $role -run_id $run_id] ad_returnredirect [export_vars -base imsld-admin-roles {{role $role} {imsld_id $imsld_id} {run_id $run_id} {group_instance $new_instance}}] } else { set flag on Index: openacs-4/packages/imsld/www/admin/imsld-create-instance.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/www/admin/imsld-create-instance.xql,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/imsld/www/admin/imsld-create-instance.xql 30 Mar 2006 16:01:46 -0000 1.1 +++ openacs-4/packages/imsld/www/admin/imsld-create-instance.xql 19 May 2006 17:26:03 -0000 1.2 @@ -24,11 +24,17 @@ g.group_id as parent_id from groups g, imsld_rolesi iri, - acs_rels ar + acs_rels ar, + acs_rels ar2, + imsld_run_users_group_ext iruge where iri.role_id=:role and ar.object_id_one=iri.parent_role_id and ar.rel_type='imsld_role_group_rel' and g.group_id=ar.object_id_two + and ar2.rel_type='imsld_roleinstance_run_rel' + and ar2.object_id_one=g.group_id + and ar2.object_id_two=iruge.group_id + and iruge.run_id=:run_id Index: openacs-4/packages/imsld/www/admin/imsld-groups.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/www/admin/imsld-groups.xql,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/imsld/www/admin/imsld-groups.xql 30 Mar 2006 16:01:46 -0000 1.1 +++ openacs-4/packages/imsld/www/admin/imsld-groups.xql 19 May 2006 17:26:03 -0000 1.2 @@ -2,9 +2,16 @@ - select group_name,group_id - from groups - where group_name like ('%' || :role || '%') + select gr.group_id, + gr.group_name + from groups gr, + acs_rels ar, + imsld_run_users_group_ext iruge + where ar.rel_type='imsld_roleinstance_run_rel' + and ar.object_id_one=gr.group_id + and ar.object_id_two=iruge.group_id + and iruge.run_id=:run_id + and group_name like ('%' || :role || '%')