@@ -1815,7 +1830,7 @@
and im.imsld_id = ii.item_id
and ii.imsld_id = :imsld_id
and rp.role_id = iri.item_id
- and iri.role_id in ([join $user_roles_list ","])
+ and iri.role_id = :user_role_id
and content_revision__is_live(rp.role_part_id) = 't'
and attr.owner_id = ip.play_id
and attr.run_id = :run_id
Index: openacs-4/packages/imsld/www/imsld-content-serve.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/www/imsld-content-serve.tcl,v
diff -u -r1.10 -r1.11
--- openacs-4/packages/imsld/www/imsld-content-serve.tcl 25 Sep 2006 13:13:31 -0000 1.10
+++ openacs-4/packages/imsld/www/imsld-content-serve.tcl 27 Sep 2006 14:41:35 -0000 1.11
@@ -511,7 +511,7 @@
with_control_p
from imsld_attribute_instances
where run_id = :run_id
- and user_id = :user_id
+ and user_id = :owner_user_id
and identifier = :class_name
and type = 'class'
}] } {
Index: openacs-4/packages/imsld/www/imsld-tree.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/www/imsld-tree.adp,v
diff -u -r1.8 -r1.9
--- openacs-4/packages/imsld/www/imsld-tree.adp 6 Jun 2006 13:24:46 -0000 1.8
+++ openacs-4/packages/imsld/www/imsld-tree.adp 27 Sep 2006 14:41:35 -0000 1.9
@@ -5,6 +5,13 @@
+
+
+
+
+
+
@html_tree;noquote@
@user_message@
@@ -41,4 +66,9 @@
}
}
+
+
+
Index: openacs-4/packages/imsld/www/imsld-tree.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/www/imsld-tree.tcl,v
diff -u -r1.10 -r1.11
--- openacs-4/packages/imsld/www/imsld-tree.tcl 22 Sep 2006 10:58:13 -0000 1.10
+++ openacs-4/packages/imsld/www/imsld-tree.tcl 27 Sep 2006 14:41:35 -0000 1.11
@@ -3,6 +3,7 @@
@creation-date Mar 2006
} {
run_id:integer,notnull
+ {current_role_id ""}
}
# initialize variables
@@ -21,6 +22,49 @@
and run.run_id = :run_id
}
+# current role information.
+# the user must have an active role in the run
+
+if { ![empty_string_p $current_role_id] } {
+ # a role has been selected, update in db
+ db_dml update_current_role {
+ update imsld_run_users_group_rels
+ set active_role_id = :current_role_id
+ where rel_id = (select ar.rel_id
+ from acs_rels ar, imsld_run_users_group_ext iruge
+ where ar.object_id_one = iruge.group_id
+ and ar.object_id_two = :user_id
+ and iruge.run_id = :run_id)
+ }
+}
+
+set possible_user_roles [imsld::roles::get_user_roles -user_id $user_id -run_id $run_id]
+set possible_user_role_names [imsld::roles::get_roles_names -roles_list $possible_user_roles]
+# remove added in the previous proc
+regsub -all " " $possible_user_role_names "" $possible_user_role_names
+
+if { ![db_0or1row get_current_role {
+ select map.active_role_id as user_role_id
+ from imsld_run_users_group_rels map,
+ acs_rels ar,
+ imsld_run_users_group_ext iruge
+ where ar.rel_id = map.rel_id
+ and ar.object_id_one = iruge.group_id
+ and ar.object_id_two = :user_id
+ and iruge.run_id = :run_id
+}] } {
+ # generate the first option
+ set possible_user_roles [linsert $possible_user_roles 0 0]
+ set possible_user_role_names [linsert $possible_user_role_names 0 "<#_ Select role... #>"]
+ set user_role_id -1
+}
+
+template::multirow create possible_roles role_id role_name
+
+foreach role $possible_user_roles {
+ template::multirow append possible_roles $role [lindex $possible_user_role_names [lsearch -exact $possible_user_roles $role]]
+}
+
set user_message ""
set next_activity_id [imsld::get_next_activity_list -run_id $run_id -user_id $user_id]
@@ -62,12 +106,17 @@
set activities_node [$doc createElement ul]
-imsld::generate_activities_tree -run_id $run_id \
- -user_id $user_id \
- -next_activity_id_list $next_activity_id \
- -dom_node $activities_node \
- -dom_doc $doc
-
-$imsld_title_node appendChild $activities_node
-
-set html_tree [$dom_root asXML]
+if { $user_role_id == -1 } {
+ set html_tree ""
+} else {
+
+ imsld::generate_activities_tree -run_id $run_id \
+ -user_id $user_id \
+ -next_activity_id_list $next_activity_id \
+ -dom_node $activities_node \
+ -dom_doc $doc
+
+ $imsld_title_node appendChild $activities_node
+
+ set html_tree [$dom_root asXML]
+}