Index: openacs-4/packages/imsld/www/admin/monitor/resource-permission-edit.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/www/admin/monitor/resource-permission-edit.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/imsld/www/admin/monitor/resource-permission-edit.adp 2 Feb 2009 09:46:30 -0000 1.1
@@ -0,0 +1,2 @@
+ +
Index: openacs-4/packages/imsld/www/admin/monitor/resource-permission-edit.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/www/admin/monitor/resource-permission-edit.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/imsld/www/admin/monitor/resource-permission-edit.tcl 2 Feb 2009 09:46:30 -0000 1.1
@@ -0,0 +1,55 @@
+#
+
+ad_page_contract {
+
+ Sets the propper resource permissions
+
+ @author Derick Leony (derick@inv.it.uc3m.es)
+ @creation-date 2008-11-22
+ @arch-tag:
+ @cvs-id $Id: resource-permission-edit.tcl,v 1.1 2009/02/02 09:46:30 derickl Exp $
+} {
+ object_id:integer,notnull
+ role_id:integer,notnull
+} -properties {
+} -validate {
+} -errors {
+}
+
+set form [ns_getform]
+set privilege [ns_set get $form "privilege_${object_id}_${role_id}"]
+
+set role_item_id [content::revision::item_id -revision_id $role_id]
+set role_type [acs_object::get_element -object_id $role_id -element object_type]
+
+set group_id_list [list]
+
+if { $role_type eq "imsld_role" } {
+ db_foreach select_group {
+ select object_id_two
+ from acs_rels
+ where object_id_one = :role_item_id
+ and rel_type = 'imsld_role_group_rel'
+ } {
+ lappend group_id_list $object_id_two
+ }
+} else {
+ lappend group_id_list $role_item_id
+}
+
+foreach group_id $group_id_list {
+ switch $privilege {
+ none {
+ permission::revoke -party_id $group_id -object_id $object_id -privilege read
+ permission::revoke -party_id $group_id -object_id $object_id -privilege write
+ }
+ read {
+ permission::grant -party_id $group_id -object_id $object_id -privilege read
+ permission::revoke -party_id $group_id -object_id $object_id -privilege write
+ }
+ write {
+ permission::grant -party_id $group_id -object_id $object_id -privilege read
+ permission::grant -party_id $group_id -object_id $object_id -privilege write
+ }
+ }
+}
Index: openacs-4/packages/imsld/www/admin/monitor/resource-permissions-act.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/www/admin/monitor/resource-permissions-act.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/imsld/www/admin/monitor/resource-permissions-act.adp 2 Feb 2009 09:46:30 -0000 1.1
@@ -0,0 +1,42 @@
+
+
+
+
+
+
+
+
+
+
+ |
+
+
+ Activity @activities.rownum@
+ |
+
+
+
+
+
+ @roles.name@
+ |
+
+
+ +
+ |
+
+
+
+
+
+
Index: openacs-4/packages/imsld/www/admin/monitor/resource-permissions-act.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/www/admin/monitor/resource-permissions-act.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/imsld/www/admin/monitor/resource-permissions-act.tcl 2 Feb 2009 09:46:30 -0000 1.1
@@ -0,0 +1,71 @@
+#
+
+ad_page_contract {
+
+ Script to set permissions on the UoL resources (XoWiki)
+
+ @author Derick Leony (derick@inv.it.uc3m.es)
+ @creation-date 2008-10-16
+ @arch-tag:
+ @cvs-id $Id: resource-permissions-act.tcl,v 1.1 2009/02/02 09:46:30 derickl Exp $
+} {
+ run_id
+ act_id
+} -properties {
+} -validate {
+} -errors {
+}
+
+db_1row imsld_info {
+ select imsld_id
+ from imsld_runs
+ where run_id = :run_id
+}
+
+multirow create roles group_id name role_p
+
+set involved_roles [imsld::roles::get_list_of_roles -imsld_id $imsld_id]
+set role_names [imsld::roles::get_roles_names -roles_list $involved_roles]
+
+set involved_users [list]
+foreach role $involved_roles name $role_names {
+ set role_id [lindex $role 0]
+ multirow append roles $role_id $name t
+ set involved_users [concat $involved_users [imsld::roles::get_users_in_role -role_id [lindex $role 0] -run_id $run_id]]
+
+ set groups [imsld::roles::get_role_instances -role_id $role_id -run_id $run_id]
+ foreach group_id $groups {
+ set group_name [group::get_element -group_id $group_id -element group_name]
+ multirow append roles $group_id $group_name f
+ }
+}
+
+multirow create activities activity_id activity_title activity_item_id
+
+db_foreach select_activitiess {
+select role_part_id, title as role_part_title, item_id as role_part_item_id,
+learning_activity_id, support_activity_id, activity_structure_id
+from imsld_role_partsi
+where act_id = :act_id
+} {
+ if { $learning_activity_id ne "" } {
+ db_1row select_la {
+ select activity_id, title as activity_title, item_id as activity_item_id
+ from imsld_learning_activitiesi
+ where item_id = :learning_activity_id
+ }
+ } elseif { $support_activity_id ne ""} {
+ db_1row select_sa {
+ select activity_id, title as activity_title, item_id as activity_item_id
+ from imsld_support_activitiesi
+ where item_id = :support_activity_id
+ }
+ } elseif { $activity_structure_id } {
+ db_1row select_as {
+ select structure_id as activity_id, title as activity_title, item_id as activity_item_id
+ from imsld_activity_structuresi
+ where item_id = :activity_structure_id
+ }
+ }
+ multirow append activities $activity_id $activity_title $activity_item_id
+}
Index: openacs-4/packages/imsld/www/admin/monitor/resource-permissions-play.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/www/admin/monitor/resource-permissions-play.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/imsld/www/admin/monitor/resource-permissions-play.adp 2 Feb 2009 09:46:30 -0000 1.1
@@ -0,0 +1,52 @@
+
+
+
+
+
+
+
Index: openacs-4/packages/imsld/www/admin/monitor/resource-permissions-play.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/www/admin/monitor/resource-permissions-play.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/imsld/www/admin/monitor/resource-permissions-play.tcl 2 Feb 2009 09:46:30 -0000 1.1
@@ -0,0 +1,47 @@
+#
+
+ad_page_contract {
+
+ Script to set permissions on the UoL resources (XoWiki)
+
+ @author Derick Leony (derick@inv.it.uc3m.es)
+ @creation-date 2008-10-16
+ @arch-tag:
+ @cvs-id $Id: resource-permissions-play.tcl,v 1.1 2009/02/02 09:46:30 derickl Exp $
+} {
+ run_id
+ play_id
+} -properties {
+} -validate {
+} -errors {
+}
+
+db_1row imsld_info {
+ select imsld_id
+ from imsld_runs
+ where run_id = :run_id
+}
+
+multirow create roles group_id name role_p
+
+set involved_roles [imsld::roles::get_list_of_roles -imsld_id $imsld_id]
+set role_names [imsld::roles::get_roles_names -roles_list $involved_roles]
+
+set involved_users [list]
+foreach role $involved_roles name $role_names {
+ set role_id [lindex $role 0]
+ multirow append roles $role_id $name t
+ set involved_users [concat $involved_users [imsld::roles::get_users_in_role -role_id [lindex $role 0] -run_id $run_id]]
+
+ set groups [imsld::roles::get_role_instances -role_id $role_id -run_id $run_id]
+ foreach group_id $groups {
+ set group_name [group::get_element -group_id $group_id -element group_name]
+ multirow append roles $group_id $group_name f
+ }
+}
+
+db_multirow acts select_acts {
+select act_id, title as act_title, item_id as act_item_id
+from imsld_actsi
+where play_id = :play_id
+}
Index: openacs-4/packages/imsld/www/admin/monitor/resource-permissions.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/www/admin/monitor/resource-permissions.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/imsld/www/admin/monitor/resource-permissions.adp 2 Feb 2009 09:46:30 -0000 1.1
@@ -0,0 +1,52 @@
+
+
+
+
+
+
+
Index: openacs-4/packages/imsld/www/admin/monitor/resource-permissions.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/www/admin/monitor/resource-permissions.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/imsld/www/admin/monitor/resource-permissions.tcl 2 Feb 2009 09:46:30 -0000 1.1
@@ -0,0 +1,111 @@
+#
+
+ad_page_contract {
+
+ Script to set permissions on the UoL resources (XoWiki)
+
+ @author Derick Leony (derick@inv.it.uc3m.es)
+ @creation-date 2008-10-16
+ @arch-tag:
+ @cvs-id $Id: resource-permissions.tcl,v 1.1 2009/02/02 09:46:30 derickl Exp $
+} {
+ run_id
+} -properties {
+} -validate {
+} -errors {
+}
+
+db_1row imsld_info {
+ select imsld_id
+ from imsld_runs
+ where run_id = :run_id
+}
+
+multirow create roles group_id name role_p
+
+set involved_roles [imsld::roles::get_list_of_roles -imsld_id $imsld_id]
+set role_names [imsld::roles::get_roles_names -roles_list $involved_roles]
+
+set involved_users [list]
+foreach role $involved_roles name $role_names {
+ set role_id [lindex $role 0]
+ multirow append roles $role_id $name t
+ set involved_users [concat $involved_users [imsld::roles::get_users_in_role -role_id [lindex $role 0] -run_id $run_id]]
+
+ set groups [imsld::roles::get_role_instances -role_id $role_id -run_id $run_id]
+ foreach group_id $groups {
+ set group_name [group::get_element -group_id $group_id -element group_name]
+ multirow append roles $group_id $group_name f
+ }
+}
+
+set imsld_item_id [content::revision::item_id -revision_id $imsld_id]
+
+multirow create objects object_id name
+db_1row select_methods {
+ select method_id, object_title as method_title, item_id as method_item_id
+ from imsld_methodsi
+ where imsld_id = :imsld_item_id
+}
+
+db_multirow plays select_plays {
+ select play_id, title as play_title, item_id as play_item_id
+ from imsld_playsi
+ where method_id = :method_item_id
+}
+
+multirow append objects $method_id $method_title
+
+db_foreach select_plays {
+ select play_id, title as play_title, item_id as play_item_id
+ from imsld_playsi
+ where method_id = :method_item_id
+} {
+ set prefix [string repeat " " 2]
+ multirow append objects $play_id "$prefix$play_title"
+
+ set acts_list [db_list_of_lists select_acts {
+ select act_id, title as act_title, item_id as act_item_id
+ from imsld_actsi
+ where play_id = :play_item_id
+ }]
+ foreach act_list $acts_list {
+ foreach {act_id act_title act_item_id} $act_list {}
+ set prefix [string repeat " " 4]
+ multirow append objects $act_id "$prefix$act_title"
+
+ db_foreach select_role_part {
+ select role_part_id, title as role_part_title, item_id as role_part_item_id,
+ learning_activity_id, support_activity_id, activity_structure_id
+ from imsld_role_partsi
+ where act_id = :act_item_id
+ } {
+ set prefix [string repeat " " 6]
+ multirow append objects $role_part_id "$prefix$role_part_title"
+
+ if { $learning_activity_id ne "" } {
+ db_1row select_la {
+ select activity_id, title as activity_title, item_id as activity_item_id
+ from imsld_learning_activitiesi
+ where item_id = :learning_activity_id
+ }
+ } elseif { $support_activity_id ne ""} {
+ db_1row select_sa {
+ select activity_id, title as activity_title, item_id as activity_item_id
+ from imsld_support_activitiesi
+ where item_id = :support_activity_id
+ }
+ } elseif { $activity_structure_id } {
+ db_1row select_as {
+ select structure_id as activity_id, title as activity_title, item_id as activity_item_id
+ from imsld_activity_structuresi
+ where item_id = :activity_structure_id
+ }
+ }
+
+ set prefix [string repeat " " 8]
+ multirow append objects $activity_id "$prefix$activity_title"
+
+ }
+ }
+}