Index: openacs-4/packages/lors-central/www/course-dotlrn-assoc.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/course-dotlrn-assoc.tcl,v
diff -u -r1.1 -r1.1.2.1
--- openacs-4/packages/lors-central/www/course-dotlrn-assoc.tcl 17 May 2005 16:21:19 -0000 1.1
+++ openacs-4/packages/lors-central/www/course-dotlrn-assoc.tcl 13 Jun 2005 15:10:42 -0000 1.1.2.1
@@ -8,8 +8,8 @@
item_id:integer,optional
}
-# Checking swa privilege over lors-central
-lors_central::is_swa
+# Checking privilege over lors-central
+lors_central::check_permissions
set title [_ lors-central.associate_to]
@@ -25,7 +25,17 @@
set user_id [ad_conn user_id]
+if { ![acs_user::site_wide_admin_p] } {
+ set extra_query_class "and drf.role = 'instructor' and drf.community_id = dc.class_instance_id and drf.user_id = :user_id "
+ set extra_query_community "and dm.community_id = dc.community_id
+ and dm.user_id = :user_id
+ and dm.role = 'admin'"
+} else {
+ set extra_query_class ""
+ set extra_query_community ""
+}
+
##################################### TO ASSOCIATE ##########################################################
db_multirow -extend { rel type } classes_list get_dotlrn_classes { } {
@@ -155,3 +165,98 @@
}
}
+
+##################################### COMMUNITIES ###########################################################
+##################################### TO ASSOCIATE ##########################################################
+
+db_multirow -extend { rel type } coms_list get_dotlrn_coms { } {
+ set rel [lors_central::relation_between -item_id $item_id -community_id $com_id]
+ set type dotlrn_club
+}
+
+template::list::create \
+ -name coms_list \
+ -multirow coms_list \
+ -key community_id \
+ -has_checkboxes\
+ -bulk_actions {
+ "\#lors-central.associate\#" "course-associate" "\#lors-central.associate_to_class\#" \
+ } \
+ -bulk_action_method post \
+ -bulk_action_export_vars {
+ item_id
+ type
+ }\
+ -row_pretty_plural "[_ lors-central.dotlrn_communities]" \
+ -elements {
+ check_box {
+ class "list-narrow"
+ label ""
+ display_template {
+
+ }
+ }
+ class {
+ label "[_ lors-central.community_name]"
+ display_template {
+ @coms_list.pretty_name@
+ }
+ }
+ associate {
+ display_template {
+
+ #lors-central.associated#
+
+ }
+ }
+ }
+
+
+############################## TO DROP ASSOCIATION ######################################
+
+db_multirow -extend { rel type } coms_list_drop get_dotlrn_coms_drop { } {
+ set rel [lors_central::relation_between -item_id $item_id -community_id $com_id]
+}
+
+template::list::create \
+ -name coms_list_drop \
+ -multirow coms_list_drop \
+ -key community_id \
+ -has_checkboxes\
+ -bulk_actions {
+ "\#lors-central.drop\#" "course-association-drop" "\#lors-central.drop_association\#" \
+ } \
+ -bulk_action_method post \
+ -bulk_action_export_vars {
+ item_id
+ type
+ }\
+ -row_pretty_plural "[_ lors-central.dotlrn_classes]" \
+ -elements {
+ check_box {
+ class "list-narrow"
+ label ""
+ display_template {
+
+ }
+ }
+ class {
+ label "[_ lors-central.community_name]"
+ display_template {
+ @coms_list_drop.pretty_name@
+ }
+ }
+ associate {
+ display_template {
+
+ #lors-central.associated#
+
+ }
+ }
+ }