Index: openacs-4/packages/lors-central/www/lc-admin/grant-permissions.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/lc-admin/grant-permissions.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/lc-admin/grant-permissions.adp 31 May 2005 23:00:53 -0000 1.1 @@ -0,0 +1,19 @@ + + @page_title@ + @context@ + + + + + + + +
+
+ #lors-central.search_courses#: + + +
+
+ +
Index: openacs-4/packages/lors-central/www/lc-admin/grant-permissions.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/lc-admin/grant-permissions.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/lc-admin/grant-permissions.tcl 31 May 2005 23:00:53 -0000 1.1 @@ -0,0 +1,98 @@ +ad_page_contract { + @author Miguel Marin (miguelmarin@viaro.net) + @author Viaro Networks www.viaro.net + Page to grant permissions to a user over one course +} { + keyword:optional +} + +# Check lors-central privileges +lors_central::check_permissions -check_inst t + +set page_title [_ lors-central.grant_permissions] +set context [list [list "." [_ lors-central.lors_admin]] $page_title] + + +# To search courses +if { [info exist keyword] } { + if { [string equal $keyword [_ lors-central.please_type]] } { + set extra_query "" + } else { + set items "(0" + set keyword "%$keyword%" + db_foreach get_items_like { } { + append items ",$item_id" + } + append items ")" + set extra_query "and cr.item_id in $items" + } +} else { + set extra_query "" +} + +# If user is not site wide we just show the courses where he/she has admin privilege over +if { ![acs_user::site_wide_admin_p] } { + append extra_query " and p.object_id = acs.object_id and p.privilege = 'admin' and p.grantee_id = :user_id" +} + +set package_id [ad_conn package_id] +set user_id [ad_conn user_id] + +set actions "" + +template::list::create \ + -name get_courses \ + -multirow get_courses \ + -html {width 50%} \ + -actions $actions \ + -has_checkboxes \ + -key item_id \ + -no_data "[_ lorsm.No_Courses]" \ + -elements { + course_name { + label "[_ lorsm.Available_Courses]" + display_col course_name + link_url_eval {[export_vars -base "../one-course" { item_id } ]} + } + versions { + label "[_ lors-central.versions]" + display_template { +
+ @get_courses.versions@ +
+ } + } + creation_user { + label "[_ lorsm.Owner]" + display_eval {[person::name -person_id $creation_user]} + link_url_eval {[acs_community_member_url -user_id $creation_user]} + } + creation_date { + label "[_ lorsm.Creation_Date]" + display_eval {[lc_time_fmt $creation_date "%x %X"]} + } + grant_permissions { + label "[_ lors-central.grant_permissions]" + display_template { +
+ [_ lors-central.grant_rev] +
+ } + } + } + +# Get the root folder where the manifests will be stored uploading from lors-central +set manifest_root [lors_central::get_root_manifest_folder_id] + +# Get all folders inside manifest_root, to check that man_id is in one of this folders +set folders "(" +db_foreach get_subfolders { } { + append folders "${item_id}," +} + +append folders "0)" + +db_multirow -extend { course_name versions } get_courses select_courses { } { + set course_name [db_string get_item_name "select name from cr_items where item_id = :item_id"] + set versions [lors_central::count_versions -item_id $item_id] +} Index: openacs-4/packages/lors-central/www/lc-admin/grant-permissions.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/lc-admin/grant-permissions.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/lc-admin/grant-permissions.xql 31 May 2005 23:00:53 -0000 1.1 @@ -0,0 +1,46 @@ + + + + + + select + item_id + from + cr_items + where + parent_id = :manifest_root + + + + + + select distinct + cr.item_id, + acs.creation_user, + acs.creation_date + from + cr_revisions cr, acs_objects acs, cr_items ci, acs_permissions p + where + acs.object_id = cr.item_id and + ci.item_id = cr.item_id and + ci.parent_id in $folders and + cr.revision_id in + ( + select man_id from ims_cp_manifests + ) + $extra_query + + + + + + select + item_id + from + cr_items + where + lower(name) like lower(:keyword) + + + + \ No newline at end of file Index: openacs-4/packages/lors-central/www/lc-admin/grant-user-list.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/lc-admin/grant-user-list.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/lc-admin/grant-user-list.adp 31 May 2005 23:00:53 -0000 1.1 @@ -0,0 +1,62 @@ + +@page_title@ +@context;noquote@ + + + + + + + +
+
+ #lors-central.search_users#: + + + + +
+
+ +
+ +
+

#lors-central.memberships#:

+
+ +

#lors-central.class_memberships#:

+
    + + + + + + + + + + + + +
  • @classes.pretty_name@
  • @classes.term_name@@classes.term_year@   @classes.grant_url;noquote@ / @classes.revoke_url;noquote@ #lors-central.priv_all_memb#
    +
+
+ + +

#lors-central.com_memberships#:

+
    + + + + + + + + + + +
  • @clubs.pretty_name@
  •     @clubs.grant_url;noquote@ / @clubs.revoke_url;noquote@ #lors-central.priv_all_memb#
    +
+
+
+ Index: openacs-4/packages/lors-central/www/lc-admin/grant-user-list.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/lc-admin/grant-user-list.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/lc-admin/grant-user-list.tcl 31 May 2005 23:00:53 -0000 1.1 @@ -0,0 +1,87 @@ +ad_page_contract { + @author Miguel Marin (miguelmarin@viaro.net) + @author Viaro Networks www.viaro.net + +} { + { keyword "" } + man_id:notnull + creation_user:notnull +} + +set user_id [ad_conn user_id] +# Check for privileges +lors_central::check_permissions -check_inst t + +set page_title "[_ lors-central.search_users_to]" +set context [list [list "." [_ lors-central.lors_admin]] \ + [list "grant-permissions" [_ lors-central.grant_permissions]] $page_title] + +if { [string equal $keyword [_ lors-central.please_type]] || [empty_string_p $keyword]} { + set query all_users +} else { + set query search_users +} + +db_multirow -extend { privilege email } grant_list $query { } { + set privilege [permission::permission_p -party_id $p_user_id -object_id $man_id -privilege "admin"] + if { [catch { set email [email_image::get_user_email -user_id $p_user_id] } errmsg] } { + set email $db_email + } else { + set email [email_image::get_user_email -user_id $p_user_id] + } +} + +template::list::create \ + -name grant_list \ + -multirow grant_list \ + -key p_user_id \ + -bulk_actions {"\#lors-central.grant\#" "grant" "\#lors-central.grant_per\#"\ + "\#lors-central.revoke\#" "revoke" "\#lors-central.revoke_per\#" }\ + -bulk_action_method post \ + -bulk_action_export_vars { + keyword + man_id + back_url + }\ + -row_pretty_plural "[_ lors-central.user_to_grant]" \ + -elements { + name { + label "[_ lors-central.username]" + display_template { + @grant_list.first_names@ @grant_list.last_name@ + } + } + email { + label "[_ lors-central.email]" + display_template { + @grant_list.email;noquote@ + } + } + permission { + label "[_ lors-central.privilege_on]" + display_template { +
+ + #lors-central.admin# + + + [_ lors-central.not_allowed] + +
+ } + } + } + + +db_multirow -extend { associated_p grant_url revoke_url } classes select_member_classes { } { + set grant_url "#lors-central.grant#" + set revoke_url "#lors-central.revoke#" + set associated_p [lors_central::relation_between -item_id $man_id -community_id $class_instance_id] +} + +db_multirow -extend { associated_p grant_url revoke_url } clubs select_member_clubs { } { + set grant_url "#lors-central.grant#" + set revoke_url "#lors-central.revoke#" + set associated_p [lors_central::relation_between -item_id $man_id -community_id $community_id] +} + Index: openacs-4/packages/lors-central/www/lc-admin/grant-user-list.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/lc-admin/grant-user-list.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/lc-admin/grant-user-list.xql 31 May 2005 23:00:53 -0000 1.1 @@ -0,0 +1,114 @@ + + + + + + select + first_names, + last_name, + user_id as p_user_id, + email as db_email + from + cc_users + where + user_id in ( + select + grantee_id + from + acs_permissions + where + object_id = :man_id and + privilege = 'admin' + ) and + user_id <> :user_id and + user_id in ( + select + distinct user_id + from + dotlrn_member_rels_full + where + community_id in ( + select + community_id + from + dotlrn_member_rels_full + where + user_id = :user_id and + ( role = 'instructor' or role = 'admin') + ) + ) + + + + + + select + first_names, + last_name, + user_id as p_user_id, + email as db_email + from + cc_users + where + user_id <> :user_id and + ( + lower(first_names) like lower('%$keyword%') or + lower(last_name) like lower('%$keyword%') or + lower(email) like lower('%$keyword%') + ) and + user_id in ( + select + distinct user_id + from + dotlrn_member_rels_full + where + community_id in ( + select + community_id + from + dotlrn_member_rels_full + where + user_id = :user_id and + ( role = 'instructor' or role = 'admin') + ) + ) + order by last_name, first_names, email + + + + + + select dotlrn_class_instances_full.*, + dotlrn_member_rels_approved.rel_type, + dotlrn_member_rels_approved.role, + '' as role_pretty_name + from dotlrn_class_instances_full, + dotlrn_member_rels_approved + where dotlrn_member_rels_approved.user_id = :user_id + and dotlrn_member_rels_approved.role = 'instructor' + and dotlrn_member_rels_approved.community_id = dotlrn_class_instances_full.class_instance_id + order by dotlrn_class_instances_full.department_name, + dotlrn_class_instances_full.department_key, + dotlrn_class_instances_full.pretty_name, + dotlrn_class_instances_full.community_key + + + + + + select dotlrn_communities_full.*, + dotlrn_member_rels_approved.rel_type, + dotlrn_member_rels_approved.role, + '' as role_pretty_name + from dotlrn_clubs_full, + dotlrn_member_rels_approved + where dotlrn_member_rels_approved.user_id = :user_id + and dotlrn_member_rels_approved.role = 'admin' + and dotlrn_member_rels_approved.community_id = dotlrn_communities_full.community_id + order by dotlrn_communities_full.pretty_name, + dotlrn_communities_full.community_key + + + + + Index: openacs-4/packages/lors-central/www/lc-admin/grant.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/lc-admin/grant.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/lc-admin/grant.tcl 31 May 2005 23:00:53 -0000 1.1 @@ -0,0 +1,31 @@ +ad_page_contract { + @author Miguel Marin (miguelmarin@viaro.net) + @author Viaro Networks www.viaro.net + + Gives users admin privilege over man_id +} { + p_user_id:multiple,optional + class_com_id:optional + man_id:notnull +} + +set user_id [ad_conn user_id] + +# Check for privileges over lors-central +lors_central::check_permissions -check_inst t + + +if { [info exist class_com_id] } { + # Grant admin privilige to all users in this class or community + db_foreach get_all_members { } { + permission::grant -party_id $user_id -object_id $man_id -privilege "admin" + } +} else { + # Grants Permission for all the users in p_user_id + foreach user $p_user_id { + permission::grant -party_id $user -object_id $man_id -privilege "admin" + } +} + + +ad_returnredirect [get_referrer] Index: openacs-4/packages/lors-central/www/lc-admin/grant.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/lc-admin/grant.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/lc-admin/grant.xql 31 May 2005 23:00:53 -0000 1.1 @@ -0,0 +1,16 @@ + + + + + + select + user_id + from + dotlrn_member_rels_full + where + community_id = :class_com_id and + user_id <> :user_id + + + + \ No newline at end of file Index: openacs-4/packages/lors-central/www/lc-admin/index.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/lc-admin/index.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/lc-admin/index.adp 31 May 2005 23:00:53 -0000 1.1 @@ -0,0 +1,7 @@ + + @page_title@ + @context@ + + \ No newline at end of file Index: openacs-4/packages/lors-central/www/lc-admin/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/lc-admin/index.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/lc-admin/index.tcl 31 May 2005 23:00:53 -0000 1.1 @@ -0,0 +1,13 @@ +ad_page_contract { + @author Miguel Marin (miguelmarin@viaro.net) + @author Viaro Networks www.viaro.net + Admin index page +} { + +} + +lors_central::check_permissions -check_inst t + +set page_title [_ lors-central.lors_admin] +set context [list $page_title] + Index: openacs-4/packages/lors-central/www/lc-admin/revoke.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/lc-admin/revoke.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/lc-admin/revoke.tcl 31 May 2005 23:00:53 -0000 1.1 @@ -0,0 +1,34 @@ +ad_page_contract { + @author Miguel Marin (miguelmarin@viaro.net) + @author Viaro Networks www.viaro.net + + Removes users admin privilege over man_id +} { + p_user_id:multiple,optional + class_com_id:optional + man_id:notnull +} + +set user_id [ad_conn user_id] + +# Check for privileges over lors-central +lors_central::check_permissions -check_inst t + + +if { [info exist class_com_id] } { + # Grant admin privilige to all users in this class or community + db_foreach get_all_members { } { + if { ![lors_central::owner -user_id $user_id -object_id $man_id] } { + permission::revoke -party_id $user_id -object_id $man_id -privilege "admin" + } + } +} else { + # Grants Permission for all the users in p_user_id + foreach user $p_user_id { + if { ![lors_central::owner -user_id $user -object_id $man_id] } { + permission::revoke -party_id $user -object_id $man_id -privilege "admin" + } + } +} + +ad_returnredirect [get_referrer] Index: openacs-4/packages/lors-central/www/lc-admin/revoke.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/lors-central/www/lc-admin/revoke.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/lors-central/www/lc-admin/revoke.xql 31 May 2005 23:00:53 -0000 1.1 @@ -0,0 +1,16 @@ + + + + + + select + user_id + from + dotlrn_member_rels_full + where + community_id = :class_com_id and + user_id <> :user_id + + + + \ No newline at end of file