Index: openacs-4/packages/dotlrn-catalog/dotlrn-catalog.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-catalog/dotlrn-catalog.info,v diff -u -r1.2 -r1.3 --- openacs-4/packages/dotlrn-catalog/dotlrn-catalog.info 15 Feb 2005 17:06:36 -0000 1.2 +++ openacs-4/packages/dotlrn-catalog/dotlrn-catalog.info 2 Nov 2005 20:30:21 -0000 1.3 @@ -8,22 +8,22 @@ t dotlrn-catalog - + Miguel Marin - 2005-02-02 + 2005-05-11 Viaro Networks - 0 - + - + + Index: openacs-4/packages/dotlrn-catalog/catalog/dotlrn-catalog.en_US.ISO-8859-1.xml =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-catalog/catalog/dotlrn-catalog.en_US.ISO-8859-1.xml,v diff -u -r1.9 -r1.10 --- openacs-4/packages/dotlrn-catalog/catalog/dotlrn-catalog.en_US.ISO-8859-1.xml 3 Mar 2005 22:32:16 -0000 1.9 +++ openacs-4/packages/dotlrn-catalog/catalog/dotlrn-catalog.en_US.ISO-8859-1.xml 2 Nov 2005 20:30:21 -0000 1.10 @@ -1,14 +1,16 @@ - + Actions + Active Add this course to one category. Admin Manage Category Tree Admin This Course and has And has one association to dotLRN class or community. Assessment + Assessment ID Associate Associate this course Associate to this class @@ -27,9 +29,12 @@ DotLRN Catalog Index Course Details Description: + Course Information Course Key: + Course Key Your Course List Course Name: + Course Name Courses Create Create a new version of @@ -46,6 +51,7 @@ DotLRN List New Course Version Email: + End Date Enroll Enroll Not Available Grant @@ -61,6 +67,7 @@ Check/uncheck all rows Make This Course Live Manage Permissions + Already a member <b>The course key is already taken</b> New Course New Course Version @@ -69,11 +76,13 @@ Not Associate Not Associated One Course Information + DotLRN Catalog Permission Please type a keyword Privilege on Privilege on dotLRN-Catalog: Professor: + <img src=/resources/dotlrn/request.gif alt="Request Membership" border="0" title="Request Membership"> Revision List Revisions Revoke @@ -87,6 +96,7 @@ Search for user Email: Search Users To Grant Permissions On See All Versions + Start Date Subject Name Term Name This course has Index: openacs-4/packages/dotlrn-catalog/lib/course-chunk.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-catalog/lib/course-chunk.adp,v diff -u -r1.9 -r1.10 --- openacs-4/packages/dotlrn-catalog/lib/course-chunk.adp 9 May 2005 21:59:07 -0000 1.9 +++ openacs-4/packages/dotlrn-catalog/lib/course-chunk.adp 2 Nov 2005 20:30:21 -0000 1.10 @@ -6,7 +6,6 @@ } - @@ -82,12 +81,8 @@ - #dotlrn-catalog.enroll# + #dotlrn-catalog.enroll# - -
- #dotlrn-catalog.enroll_not# -
Index: openacs-4/packages/dotlrn-catalog/lib/course-chunk.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-catalog/lib/course-chunk.tcl,v diff -u -r1.8 -r1.9 --- openacs-4/packages/dotlrn-catalog/lib/course-chunk.tcl 10 May 2005 14:14:52 -0000 1.8 +++ openacs-4/packages/dotlrn-catalog/lib/course-chunk.tcl 2 Nov 2005 20:30:21 -0000 1.9 @@ -4,9 +4,15 @@ @author Viaro Networks www.viaro.net @creation-date 08-01-2005 } { - + {enroll_p "1"} } +db_0or1row get_course_dates { } +set referer "[ad_conn url]?course_id=$course_id" +if {[exists_and_not_null start_date] && [exists_and_not_null end_date]} { + set enroll_p [dotlrn_catalog::get_enroll_p -start_date $start_date -end_date $end_date] +} + set dotlrn_url [dotlrn::get_url] if { ![info exists index] } { set index "" @@ -31,12 +37,12 @@ } set category_p [db_string get_category { } -default -1] + set info [ad_html_text_convert -from text/enhanced -to text/plain $info] -set reg_asm_id [parameter::get -parameter AsmForRegisterId -package_id [ad_conn subsite_id]] -set cc_package_id [apm_package_id_from_key "dotlrn-catalog"] +set reg_asm_id [parameter::get -parameter RegistrationId -package_id [subsite::main_site_id]] +set cc_package_id [ad_conn package_id] set tree_id [db_string get_tree_id { } -default "-1"] - # Get the category name set category_name "[category::get_name [category::get_mapped_categories $course_id]]" @@ -46,18 +52,19 @@ set item_id [dotlrn_catalog::get_item_id -revision_id $course_id] if { [permission::permission_p -object_id $course_id -privilege "admin"] } { set admin_p 1 - } else { - set admin_p 0 } } +if { [acs_user::site_wide_admin_p] } { + set admin_p 1 +} set obj_n 0 set dotlrn_class "(" set dotlrn_com "(" # For dotlrn associations -db_multirow -extend { obj_n admin_p } relations relation { } { +db_multirow -extend { obj_n } relations relation { } { set obj_n 1 if { [string equal $type "dotlrn_catalog_class_rel" ]} { append dotlrn_class "'$object_id'" @@ -70,75 +77,127 @@ append dotlrn_class "0)" append dotlrn_com "0)" -db_multirow classes_list get_dotlrn_classes { } +db_multirow -extend { join } classes_list get_dotlrn_classes { } { + if {![dotlrn_community::member_p $object_id [ad_conn user_id]]} { + if { $asmid == -1 } { + if {[dotlrn_community::member_pending_p -community_id $object_id -user_id [ad_conn user_id]]} { + set join "\[ \#dotlrn.Pending_Approval\# \]" + } elseif {![dotlrn_community::not_closed_p -community_id $object_id]} { + set join "" + } elseif {[dotlrn_community::needs_approval_p -community_id $object_id]} { + set label "Request Membership" + set join "\#dotlrn-catalog.request_membership_link\#" + } else { + set join "#dotlrn.join_link#" + } + } + } else { + set join "\[[_ dotlrn-catalog.member_p] \]" + } +} +set elements { + class { + label "[_ dotlrn-catalog.class_name]" + display_template { + + @classes_list.pretty_name@ + + + @classes_list.pretty_name@ + + } + } + dep_name { + label "[_ dotlrn-catalog.dep_name]" + display_template { + @classes_list.department_name@ + } + } + term_name { + label "[_ dotlrn-catalog.term_name]" + display_template { + @classes_list.term_name@ + } + } + subject { + label "[_ dotlrn-catalog.subject_name]" + display_template { + @classes_list.class_name@ + } + } + join { + display_template { + @classes_list.join;noquote@ + } + } +} + + + template::list::create \ -name dotlrn_classes \ -multirow classes_list \ -key object_id \ -row_pretty_plural "[_ dotlrn-catalog.dotlrn_classes]" \ - -elements { - class { - label "[_ dotlrn-catalog.class_name]" - display_template { - - @classes_list.pretty_name@ - - - @classes_list.pretty_name@ - - } - } - dep_name { - label "[_ dotlrn-catalog.dep_name]" - display_template { - @classes_list.department_name@ - } - } - term_name { - label "[_ dotlrn-catalog.term_name]" - display_template { - @classes_list.term_name@ - } - } - subject { - label "[_ dotlrn-catalog.subject_name]" - display_template { - @classes_list.class_name@ - } - } + -elements $elements + +set elements { + community { + label "[_ dotlrn-catalog.com_name]" + display_template { + + @com_list.pretty_name@ + + + @com_list.pretty_name@ + + } } + join { + display_template { + @com_list.join;noquote@ + } + } +} -db_multirow com_list get_dotlrn_communities { } +db_multirow -extend {join} com_list get_dotlrn_communities {} { + if {![dotlrn_community::member_p $object_id [ad_conn user_id]]} { + if { $asmid == -1 } { + if {[dotlrn_community::member_pending_p -community_id $object_id -user_id [ad_conn user_id]]} { + set join "\[ \#dotlrn.Pending_Approval\# \]" + } elseif {![dotlrn_community::not_closed_p -community_id $object_id]} { + set join "" + } elseif {[dotlrn_community::needs_approval_p -community_id $object_id]} { + set label "Request Membership" + set join "\#dotlrn-catalog.request_membership_link\#" + } else { + set join "#dotlrn.join_link#" + } + } + } else { + set join "\[[_ dotlrn-catalog.member_p] \]" + } +} + template::list::create \ -name dotlrn_communities \ -multirow com_list \ -key object_id \ -row_pretty_plural "[_ dotlrn-catalog.dotlrn_com]" \ - -elements { - community { - label "[_ dotlrn-catalog.com_name]" - display_template { - - @com_list.pretty_name@ - - - @com_list.pretty_name@ - - } - } - } + -elements $elements #Send the registration assessment_id -set reg_chunck "assessment_id=$asmid" +set ret_chunck "../assessment/assessment?assessment_id=$asmid" if { ![string eq $reg_asm_id 0] } { + if { [ad_conn user_id] == 0} { - set reg_chunck "assessment_id=$reg_asm_id&next_asm=$asmid" + set ret_chunck "../assessment/assessment?assessment_id=$reg_asm_id&next_asm=$asmid" } } Index: openacs-4/packages/dotlrn-catalog/lib/course-chunk.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-catalog/lib/course-chunk.xql,v diff -u -r1.5 -r1.6 --- openacs-4/packages/dotlrn-catalog/lib/course-chunk.xql 9 May 2005 21:59:07 -0000 1.5 +++ openacs-4/packages/dotlrn-catalog/lib/course-chunk.xql 2 Nov 2005 20:30:21 -0000 1.6 @@ -34,7 +34,20 @@ where community_id in $dotlrn_com order by pretty_name + + + + select start_date,end_date from dotlrn_catalog where course_id=:course_id + + + + + + select package_id from cr_folders where folder_id=(select context_id from acs_objects where object_id=:assessment_id) + + + \ No newline at end of file Index: openacs-4/packages/dotlrn-catalog/lib/tree-chunk.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-catalog/lib/tree-chunk.xql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/dotlrn-catalog/lib/tree-chunk.xql 19 Feb 2005 02:32:07 -0000 1.2 +++ openacs-4/packages/dotlrn-catalog/lib/tree-chunk.xql 2 Nov 2005 20:30:21 -0000 1.3 @@ -5,7 +5,7 @@ select dc.course_id, dc.course_key, dc.course_name, dc.assessment_id from dotlrn_catalog dc, cr_items ci - where dc.course_id = ci.live_revision + where active_p = 't', dc.course_id = ci.live_revision [template::list::filter_where_clauses -and -name course_list] Index: openacs-4/packages/dotlrn-catalog/tcl/apm-callback-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-catalog/tcl/apm-callback-procs.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/dotlrn-catalog/tcl/apm-callback-procs.tcl 21 Feb 2005 19:22:13 -0000 1.2 +++ openacs-4/packages/dotlrn-catalog/tcl/apm-callback-procs.tcl 2 Nov 2005 20:30:21 -0000 1.3 @@ -21,8 +21,8 @@ # lets create the CR type tables to support the course catalog content::type::new -content_type "dotlrn_catalog" \ - -pretty_name "DotLRN Catalog" \ - -pretty_plural "DotLRN Catalog" \ + -pretty_name "\#dotlrn-catalog.package_pretty_name\#" \ + -pretty_plural "\#dotlrn-catalog.package_pretty_name\#" \ -table_name "dotlrn_catalog" \ -id_column "course_id" @@ -31,35 +31,59 @@ -content_type "dotlrn_catalog" \ -attribute_name "course_key" \ -datatype "string" \ - -pretty_name "Course Key" \ - -pretty_plural "Course Key" \ + -pretty_name "\#dotlrn-catalog.course_key_pretty_name\#" \ + -pretty_plural "\#dotlrn-catalog.course_key_pretty_name\#" \ -sort_order 1 \ -column_spec "varchar(50)" content::type::attribute::new \ -content_type "dotlrn_catalog" \ -attribute_name "course_name" \ -datatype "string" \ - -pretty_name "Course Name" \ + -pretty_name "\#dotlrn-catalog.course_name_pretty_name\#" \ -sort_order 2 \ -column_spec "varchar(200)" content::type::attribute::new \ -content_type "dotlrn_catalog" \ -attribute_name "course_info" \ -datatype "text" \ - -pretty_name "Course Information" \ + -pretty_name "\#dotlrn-catalog.course_info_pretty_name\#" \ -sort_order 3 \ -column_spec "text" content::type::attribute::new \ -content_type "dotlrn_catalog" \ -attribute_name "assessment_id" \ -datatype "integer" \ - -pretty_name "Assessment ID" \ + -pretty_name "\#dotlrn-catalog.asm_id_pretty_name\#" \ -sort_order 4 \ -column_spec "integer" + content::type::attribute::new \ + -content_type "dotlrn_catalog" \ + -attribute_name "start_date" \ + -datatype "date" \ + -pretty_name "\#dotlrn-catalog.start_date_pretty_name\#" \ + -sort_order 5 \ + -column_spec "date" + + content::type::attribute::new \ + -content_type "dotlrn_catalog" \ + -attribute_name "end_date" \ + -datatype "date" \ + -pretty_name "\#dotlrn-catalog.end_date_pretty_name\#" \ + -sort_order 6 \ + -column_spec "date" + + content::type::attribute::new \ + -content_type "dotlrn_catalog" \ + -attribute_name "active_p" \ + -datatype "boolean" \ + -pretty_name "\#dotlrn-catalog.active_p\#" \ + -sort_order 7 \ + -column_spec "boolean" + # To store the courses in the content repository set folder_id [content::folder::new -name "DotLRN Catalog" -label "DotLRN Catalog"] content::folder::register_content_type -folder_id $folder_id -content_type "dotlrn_catalog" @@ -103,3 +127,50 @@ content::folder::delete -folder_id $folder_id -cascade_p "t" content::type::delete -content_type "dotlrn_catalog" } + +ad_proc -private dotlrn-catalog::package_upgrade { + {-from_version_name:required} + {-to_version_name:required} + +} { + Upgrade procs + + @author Anny Flores (annyflores@viaro.net) Viaro Networks (www.viaro.net) + @creation-date 2005-05-11 +} { + apm_upgrade_logic \ + -from_version_name $from_version_name \ + -to_version_name $to_version_name \ + -spec { + 0.1a4 0.1a5 { + content::type::attribute::new \ + -content_type "dotlrn_catalog" \ + -attribute_name "start_date" \ + -datatype "date" \ + -pretty_name "Start Date" \ + -sort_order 5 \ + -column_spec "date" + + + content::type::attribute::new \ + -content_type "dotlrn_catalog" \ + -attribute_name "end_date" \ + -datatype "date" \ + -pretty_name "End Date" \ + -sort_order 6 \ + -column_spec "date" + + } + 0.1a5 0.1a6 { + + content::type::attribute::new \ + -content_type "dotlrn_catalog" \ + -attribute_name "active_p" \ + -datatype "boolean" \ + -pretty_name "\#dotlrn-catalog.active_p\#" \ + -sort_order 7 \ + -column_spec "boolean" + + } + } +} \ No newline at end of file Index: openacs-4/packages/dotlrn-catalog/tcl/dotlrn-catalog-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-catalog/tcl/dotlrn-catalog-procs.tcl,v diff -u -r1.4 -r1.5 --- openacs-4/packages/dotlrn-catalog/tcl/dotlrn-catalog-procs.tcl 3 Mar 2005 22:33:36 -0000 1.4 +++ openacs-4/packages/dotlrn-catalog/tcl/dotlrn-catalog-procs.tcl 2 Nov 2005 20:30:21 -0000 1.5 @@ -248,7 +248,7 @@ } { set return_list "" set name "" - set cc_package_id [apm_package_id_from_key "dotlrn-catalog"] + set cc_package_id [ad_conn package_id] # The tree id from categories set tree_list [category_tree::get_mapped_trees $cc_package_id] @@ -273,3 +273,29 @@ return $return_list } + +ad_proc -private dotlrn_catalog::get_enroll_p { + {-start_date:required} + {-end_date:required} +} { + Returns 1 if sysdate is between start_date and end_date else return 0 + @sysdate@ Date to compare + +} { + set date [clock format [clock seconds] -format "%Y-%m-%d"] + if { $date >= $start_date && $date <= $end_date } { + return 1 + } else { + return 0 + } +} + +ad_proc -public dotlrn_catalog::get_course_data { + {-course_id:required} +} { + Returns the course information (name,key and description) in the array course_data + +} { + upvar course_data course_data + return [db_0or1row get_data {} -column_array course_data] +} Index: openacs-4/packages/dotlrn-catalog/tcl/dotlrn-catalog-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-catalog/tcl/dotlrn-catalog-procs.xql,v diff -u -r1.3 -r1.4 --- openacs-4/packages/dotlrn-catalog/tcl/dotlrn-catalog-procs.xql 22 Feb 2005 14:54:40 -0000 1.3 +++ openacs-4/packages/dotlrn-catalog/tcl/dotlrn-catalog-procs.xql 2 Nov 2005 20:30:21 -0000 1.4 @@ -141,5 +141,13 @@ + + + select course_name as name, course_key as key, course_info as description + from dotlrn_catalog + where course_id=:course_id + + + Index: openacs-4/packages/dotlrn-catalog/www/course-info.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-catalog/www/course-info.adp,v diff -u -r1.1 -r1.2 --- openacs-4/packages/dotlrn-catalog/www/course-info.adp 14 Feb 2005 22:46:11 -0000 1.1 +++ openacs-4/packages/dotlrn-catalog/www/course-info.adp 2 Nov 2005 20:30:22 -0000 1.2 @@ -2,5 +2,5 @@ @page_title@ @context;noquote@
- + Index: openacs-4/packages/dotlrn-catalog/www/course-info.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-catalog/www/course-info.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/dotlrn-catalog/www/course-info.tcl 22 Feb 2005 14:54:40 -0000 1.2 +++ openacs-4/packages/dotlrn-catalog/www/course-info.tcl 2 Nov 2005 20:30:22 -0000 1.3 @@ -5,16 +5,18 @@ @creation-date 09-02-2005 } { course_id:notnull - course_key:notnull - course_name:notnull + } + +db_1row get_course_info { } set page_title "$course_key [_ dotlrn-catalog.course_info]" set context [list "[_ dotlrn-catalog.one_course_info]"] set return_url "index" +dotlrn_catalog::get_course_data -course_id $course_id -db_1row get_course_info { } + set asm_name [db_string get_asm_name { } -default "[_ dotlrn-catalog.not_associated]"] set item_id [dotlrn_catalog::get_item_id -revision_id $course_id] set creation_user [dotlrn_catalog::get_creation_user -object_id $item_id] Index: openacs-4/packages/dotlrn-catalog/www/course-info.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-catalog/www/course-info.xql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/dotlrn-catalog/www/course-info.xql 22 Feb 2005 14:54:40 -0000 1.2 +++ openacs-4/packages/dotlrn-catalog/www/course-info.xql 2 Nov 2005 20:30:22 -0000 1.3 @@ -3,7 +3,7 @@ - select dc.course_info, dc.assessment_id, cr.item_id + select dc.course_info, dc.course_name, dc.course_key, dc.assessment_id, cr.item_id from dotlrn_catalog dc, cr_revisions cr where cr.revision_id = :course_id and dc.course_id = :course_id Index: openacs-4/packages/dotlrn-catalog/www/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-catalog/www/index.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/dotlrn-catalog/www/index.tcl 14 Feb 2005 22:55:39 -0000 1.2 +++ openacs-4/packages/dotlrn-catalog/www/index.tcl 2 Nov 2005 20:30:22 -0000 1.3 @@ -11,7 +11,7 @@ set context "" set return_url "dt-admin/course-list" -set cc_package_id [apm_package_id_from_key "dotlrn-catalog"] +set cc_package_id [ad_conn package_id] set user_id [ad_conn user_id] Index: openacs-4/packages/dotlrn-catalog/www/admin/grant-list.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-catalog/www/admin/grant-list.tcl,v diff -u -r1.3 -r1.4 --- openacs-4/packages/dotlrn-catalog/www/admin/grant-list.tcl 16 Feb 2005 22:21:30 -0000 1.3 +++ openacs-4/packages/dotlrn-catalog/www/admin/grant-list.tcl 2 Nov 2005 20:30:22 -0000 1.4 @@ -6,14 +6,12 @@ @creation-date 28-01-2005 } { { return_url "" } - { user_name "" } - { user_email "" } - + { keyword "" } } set user_id [ad_conn user_id] # dotlrn-catalog package_id -set cc_package_id [apm_package_id_from_key "dotlrn-catalog"] +set cc_package_id [ad_conn package_id] set page_title "[_ dotlrn-catalog.grant_list]" if {[string equal $return_url ""]} { @@ -24,31 +22,14 @@ # To search for users ad_form -name search_user -form { - {user_name:text(text),optional + {keyword:text(text),optional {label "[_ dotlrn-catalog.search_user]"} - {help_text "[_ dotlrn-catalog.search_help]"} + {help_text "[_ dotlrn-catalog.search_help], [_ dotlrn-catalog.search_email_help]"} } - {user_email:text(text),optional - {label "[_ dotlrn-catalog.search_user_email]"} - {help_text "[_ dotlrn-catalog.search_email_help]"} - } } -# Establish what query to use in order to the values of the form elements -if {![string equal $user_name ""]} { - set query select_users_name - if {![string equal $user_email ""]} { - set query select_users_name_email - } -} else { - set query select_users - if {![string equal $user_email ""]} { - set query select_users_email - } -} - -db_multirow -extend { privilege email } grant_list $query {} { +db_multirow -extend { privilege email } grant_list select_users_name_email {} { set privilege [permission::permission_p -party_id $p_user_id -object_id $cc_package_id -privilege "create"] if { [catch { set email [email_image::get_user_email -user_id $p_user_id] } errmsg] } { set email $db_email @@ -65,8 +46,7 @@ "\#dotlrn-catalog.revoke\#" "revoke-users?" "\#dotlrn-catalog.revoke_per\#" }\ -bulk_action_method post \ -bulk_action_export_vars { - user_name - user_email + keyword }\ -row_pretty_plural "[_ dotlrn-catalog.users_to_grant]" \ -elements { Index: openacs-4/packages/dotlrn-catalog/www/admin/grant-list.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-catalog/www/admin/grant-list.xql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/dotlrn-catalog/www/admin/grant-list.xql 16 Feb 2005 22:21:30 -0000 1.2 +++ openacs-4/packages/dotlrn-catalog/www/admin/grant-list.xql 2 Nov 2005 20:30:22 -0000 1.3 @@ -1,38 +1,12 @@ - - - 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 = :cc_package_id - and privilege = 'create') - - - - - - - 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('%$user_name%') - or lower(last_name) like lower('%$user_name%')) order by first_names, last_name - - - - - - 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(email) like lower('%$user_email%') - order by email - - - 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('%$user_name%') or lower(last_name) like lower('%$user_name%')) - and lower(email) like lower('%$user_email%') + lower(first_names) like lower('%$keyword%') or lower(last_name) like lower('%$keyword%') + or lower(email) like lower('%$keyword%')) and :keyword <> '' order by email Index: openacs-4/packages/dotlrn-catalog/www/admin/grant-users.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-catalog/www/admin/grant-users.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/dotlrn-catalog/www/admin/grant-users.tcl 16 Feb 2005 00:22:12 -0000 1.2 +++ openacs-4/packages/dotlrn-catalog/www/admin/grant-users.tcl 2 Nov 2005 20:30:22 -0000 1.3 @@ -6,17 +6,16 @@ @creation-date 29-01-2005 } { p_user_id:multiple - { user_name "" } - { user_email "" } + { keyword ""} } # dotlrn_catalog package_id -set cc_package_id [apm_package_id_from_key "dotlrn-catalog"] +set cc_package_id [ad_conn package_id] # Grants Permission for all the users in p_user_id foreach user $p_user_id { permission::grant -party_id $user -object_id $cc_package_id -privilege "create" } -ad_returnredirect "grant-list?user_name=$user_name&user_email=$user_email" +ad_returnredirect "grant-list?keyword=$keyword" Index: openacs-4/packages/dotlrn-catalog/www/admin/revoke-users.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-catalog/www/admin/revoke-users.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/dotlrn-catalog/www/admin/revoke-users.tcl 16 Feb 2005 00:22:12 -0000 1.2 +++ openacs-4/packages/dotlrn-catalog/www/admin/revoke-users.tcl 2 Nov 2005 20:30:22 -0000 1.3 @@ -6,17 +6,18 @@ @creation date 29-01-2005 } { p_user_id:multiple - { user_name "" } - { user_email "" } + {keyword ""} } -# dotlrn_catalog package_id -set cc_package_id [apm_package_id_from_key "dotlrn-catalog"] - # Grants Permission for all the users in p_user_id foreach user $p_user_id { - permission::revoke -party_id $user -object_id $cc_package_id -privilege "create" + set courses [db_list_of_lists user_courses {}] + + foreach course $courses { + permission::revoke -party_id $user -object_id $course -privilege "admin" + } + permission::revoke -party_id $user -object_id [ad_conn package_id] -privilege "create" } -ad_returnredirect "grant-list?user_name=$user_name&user_email=$user_email" +ad_returnredirect "grant-list?keyword=$keyword" Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/packages/dotlrn-catalog/www/admin/revoke-users.xql'. Fisheye: No comparison available. Pass `N' to diff? Index: openacs-4/packages/dotlrn-catalog/www/dt-admin/associate-course.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-catalog/www/dt-admin/associate-course.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/dotlrn-catalog/www/dt-admin/associate-course.tcl 17 Feb 2005 22:56:10 -0000 1.2 +++ openacs-4/packages/dotlrn-catalog/www/dt-admin/associate-course.tcl 2 Nov 2005 20:30:22 -0000 1.3 @@ -17,10 +17,19 @@ set type "dotlrn_catalog_dotcom_rel" } +set item_id [db_string get_item_id "select item_id from cr_revisions where revision_id = $course_id"] + foreach object $object_id { dotlrn_catalog::add_relation -course_id $course_id -object_id $object -type $type -} + set admin_users [db_list_of_lists community_admin_users {}] + + foreach user $admin_users { + permission::grant -party_id $user -object_id [ad_conn package_id] -privilege "create" + permission::grant -party_id $user -object_id $item_id -privilege "admin" + + } +} if { [string equal $return_url ""] } { ad_returnredirect "dotlrn-list?course_id=$course_id" } Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/packages/dotlrn-catalog/www/dt-admin/associate-course.xql'. Fisheye: No comparison available. Pass `N' to diff? Index: openacs-4/packages/dotlrn-catalog/www/dt-admin/course-add-edit.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-catalog/www/dt-admin/course-add-edit.tcl,v diff -u -r1.7 -r1.8 --- openacs-4/packages/dotlrn-catalog/www/dt-admin/course-add-edit.tcl 3 Mar 2005 22:32:16 -0000 1.7 +++ openacs-4/packages/dotlrn-catalog/www/dt-admin/course-add-edit.tcl 2 Nov 2005 20:30:22 -0000 1.8 @@ -22,7 +22,7 @@ set context "" set user_id [ad_conn user_id] -set cc_package_id [apm_package_id_from_key "dotlrn-catalog"] +set cc_package_id [ad_conn package_id] # Check for create permissions over dotlrn-catalog package @@ -48,12 +48,14 @@ # Get a list of all the attributes asociated to dotlrn_catalog set attribute_list [package_object_attribute_list -start_with dotlrn_catalog dotlrn_catalog] set elements "" +set i 0 - # Creates the elements to show with ad_form foreach attribute $attribute_list { + set element_mode "" set aditional_type "" + set aditional_elements_2 "" set aditional_elements "" switch [lindex $attribute 4] { string { @@ -76,8 +78,25 @@ set aditional_elements [list options $asm_list] } } + boolean { + if { [string equal [lindex $attribute 2] "active_p"]} { + set aditional_type "(checkbox)" + } + } + date { + if { [string equal [lindex $attribute 2] "start_date"] } { + set aditional_type "(text),optional" + set aditional_elements {html { id sel1}} + set aditional_elements_2 {after_html { \[y-m-d\] }} + } + if { [string equal [lindex $attribute 2] "end_date"] } { + set aditional_type "(text),optional" + set aditional_elements {html { id sel2}} + set aditional_elements_2 {after_html { \[y-m-d\] }} + } + } } - set element [list [lindex $attribute 2]:text${aditional_type} [list label [lindex $attribute 3]] $aditional_elements $element_mode] + set element [list [lindex $attribute 2]:text${aditional_type} [list label [lindex $attribute 3]] $aditional_elements $aditional_elements_2 $element_mode] lappend elements $element } @@ -100,15 +119,17 @@ } ad_form -extend -name add_course -new_data { + # New item and revision in the CR set folder_id [dotlrn_catalog::get_folder_id] set attribute_list [package_object_attribute_list -start_with dotlrn_catalog dotlrn_catalog] set form_attributes [list] - + foreach attribute $attribute_list { set attr_name [lindex $attribute 2] lappend form_attributes [list $attr_name [set $attr_name]] } + if { [dotlrn_catalog::check_name -name $course_key] } { set item_id [content::item::new -name $course_key -parent_id $folder_id \ -content_type "dotlrn_catalog" -creation_user $user_id \ @@ -134,15 +155,15 @@ set attr_name [lindex $attribute 2] lappend form_attributes [list $attr_name [set $attr_name]] } - + set course_id [content::revision::new -item_id $item_id -attributes $form_attributes -content_type "dotlrn_catalog"] - + # Set the new revision live dotlrn_catalog::set_live -revision_id $course_id if { ![string equal $category_ids "-1"] } { category::map_object -object_id $course_id $category_ids } - + if { [string equal $return_url "course-list"] } { set return_url "$return_url" } else { @@ -152,7 +173,7 @@ } -new_request { set context [list [list course-list "[_ dotlrn-catalog.course_list]"] "[_ dotlrn-catalog.new_course]"] set page_title "[_ dotlrn-catalog.new_course]" - + } -edit_request { set context [list [list course-list "[_ dotlrn-catalog.course_list]"] "[_ dotlrn-catalog.edit_course]"] set page_title "[_ dotlrn-catalog.edit_course]" Index: openacs-4/packages/dotlrn-catalog/www/dt-admin/course-categorize.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-catalog/www/dt-admin/course-categorize.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/dotlrn-catalog/www/dt-admin/course-categorize.tcl 14 Feb 2005 22:46:11 -0000 1.1 +++ openacs-4/packages/dotlrn-catalog/www/dt-admin/course-categorize.tcl 2 Nov 2005 20:30:22 -0000 1.2 @@ -10,7 +10,7 @@ # Check for create permissions over dotlrn-catalog set user_id [ad_conn user_id] -set cc_package_id [apm_package_id_from_key "dotlrn-catalog"] +set cc_package_id [ad_conn package_id] permission::require_permission -party_id $user_id -object_id $cc_package_id -privilege "create" set context [list "[_ dotlrn-catalog.categorize] $name"] Index: openacs-4/packages/dotlrn-catalog/www/dt-admin/course-delete.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-catalog/www/dt-admin/course-delete.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/dotlrn-catalog/www/dt-admin/course-delete.tcl 14 Feb 2005 22:46:11 -0000 1.1 +++ openacs-4/packages/dotlrn-catalog/www/dt-admin/course-delete.tcl 2 Nov 2005 20:30:22 -0000 1.2 @@ -14,7 +14,7 @@ # Check for create permissions over dotlrn-catalog set user_id [ad_conn user_id] -set cc_package_id [apm_package_id_from_key "dotlrn-catalog"] +set cc_package_id [ad_conn package_id] permission::require_permission -party_id $user_id -object_id $cc_package_id -privilege "create" Index: openacs-4/packages/dotlrn-catalog/www/dt-admin/course-list.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-catalog/www/dt-admin/course-list.tcl,v diff -u -r1.8 -r1.9 --- openacs-4/packages/dotlrn-catalog/www/dt-admin/course-list.tcl 3 Mar 2005 22:32:16 -0000 1.8 +++ openacs-4/packages/dotlrn-catalog/www/dt-admin/course-list.tcl 2 Nov 2005 20:30:22 -0000 1.9 @@ -14,7 +14,7 @@ set context [list "[_ dotlrn-catalog.course_list]"] set page_title "[_ dotlrn-catalog.course_list]" -set cc_package_id [apm_package_id_from_key "dotlrn-catalog"] +set cc_package_id [ad_conn package_id] permission::require_permission -party_id $user_id -object_id $cc_package_id -privilege "create" Index: openacs-4/packages/dotlrn-catalog/www/dt-admin/grant-permission.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-catalog/www/dt-admin/grant-permission.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/dotlrn-catalog/www/dt-admin/grant-permission.tcl 14 Feb 2005 22:46:11 -0000 1.1 +++ openacs-4/packages/dotlrn-catalog/www/dt-admin/grant-permission.tcl 2 Nov 2005 20:30:22 -0000 1.2 @@ -6,8 +6,7 @@ @creation date 03-02-2005 } { p_user_id:multiple - { user_name "" } - { user_email "" } + { keyword "" } object_id:notnull creation_user:notnull course_key:notnull @@ -18,4 +17,4 @@ dotlrn_catalog::grant_permissions -party_id $user -object_id $object_id -creation_user $creation_user } -ad_returnredirect "grant-user-list?user_name=$user_name&user_email=$user_email&object_id=$object_id&creation_user=$creation_user&course_key=$course_key" +ad_returnredirect "grant-user-list?keyword=$keyword&object_id=$object_id&creation_user=$creation_user&course_key=$course_key" Index: openacs-4/packages/dotlrn-catalog/www/dt-admin/grant-user-list.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-catalog/www/dt-admin/grant-user-list.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/dotlrn-catalog/www/dt-admin/grant-user-list.tcl 16 Feb 2005 22:21:30 -0000 1.2 +++ openacs-4/packages/dotlrn-catalog/www/dt-admin/grant-user-list.tcl 2 Nov 2005 20:30:22 -0000 1.3 @@ -7,16 +7,15 @@ @creation date 03-01-2005 } { { return_url "" } - { user_name "" } - { user_email "" } + { keyword "" } course_key:notnull object_id:notnull creation_user:notnull } # Check for create permissions over dotlrn-catalog set user_id [ad_conn user_id] -set cc_package_id [apm_package_id_from_key "dotlrn-catalog"] +set cc_package_id [ad_conn package_id] permission::require_permission -party_id $user_id -object_id $cc_package_id -privilege "create" set page_title "[_ dotlrn-catalog.search_users_to] $course_key" @@ -36,30 +35,13 @@ {course_key:text(hidden) {value "$course_key"} } - {user_name:text(text),optional + {keyword:text(text),optional {label "[_ dotlrn-catalog.search_user]"} - {help_text "[_ dotlrn-catalog.search_help]"} + {help_text "[_ dotlrn-catalog.search_help] or [_ dotlrn-catalog.search_email_help]"} } - {user_email:text(text),optional - {label "[_ dotlrn-catalog.search_user_email]"} - {help_text "[_ dotlrn-catalog.search_email_help]"} - } } -# Establish what query to use in order to the values of the form elements -if {![string equal $user_name ""]} { - set query select_users_name - if {![string equal $user_email ""]} { - set query select_users_name_email - } -} else { - set query select_users - if {![string equal $user_email ""]} { - set query select_users_email - } -} - -db_multirow -extend { privilege email } grant_list $query {} { +db_multirow -extend { privilege email } grant_list select_users_name_email {} { set privilege [permission::permission_p -party_id $p_user_id -object_id $object_id -privilege "admin"] if { [catch { set email [email_image::get_user_email -user_id $p_user_id] } errmsg] } { set email $db_email @@ -76,8 +58,7 @@ "\#dotlrn-catalog.revoke\#" "revoke-permission" "\#dotlrn-catalog.revoke_per\#" }\ -bulk_action_method post \ -bulk_action_export_vars { - user_name - user_email + keyword object_id creation_user course_key Index: openacs-4/packages/dotlrn-catalog/www/dt-admin/grant-user-list.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-catalog/www/dt-admin/grant-user-list.xql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/dotlrn-catalog/www/dt-admin/grant-user-list.xql 16 Feb 2005 22:21:30 -0000 1.2 +++ openacs-4/packages/dotlrn-catalog/www/dt-admin/grant-user-list.xql 2 Nov 2005 20:30:22 -0000 1.3 @@ -1,38 +1,12 @@ - - - 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 = :object_id - and privilege = 'admin') and user_id <> :user_id - - - - - - 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('%$user_name%') - or lower(last_name) like '%$user_name%') order by first_names, last_name - - - - - - 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(email) like lower('%$user_email%') order by email - - - 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('%$user_name%') or lower(last_name) like lower('%$user_name%')) - and lower(email) like lower('%$user_email%') order by email + lower(first_names) like lower('%$keyword%') or lower(last_name) like lower('%$keyword%') or + lower(email) like lower('%$keyword%')) order by email Index: openacs-4/packages/dotlrn-catalog/www/dt-admin/revision-list.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-catalog/www/dt-admin/revision-list.tcl,v diff -u -r1.3 -r1.4 --- openacs-4/packages/dotlrn-catalog/www/dt-admin/revision-list.tcl 3 Mar 2005 22:32:16 -0000 1.3 +++ openacs-4/packages/dotlrn-catalog/www/dt-admin/revision-list.tcl 2 Nov 2005 20:30:22 -0000 1.4 @@ -17,7 +17,7 @@ } set user_id [ad_conn user_id] -set cc_package_id [apm_package_id_from_key "dotlrn-catalog"] +set cc_package_id [ad_conn package_id] # Check for create permissions over dotlrn-catalog permission::require_permission -party_id $user_id -object_id $cc_package_id -privilege "create" Index: openacs-4/packages/dotlrn-catalog/www/dt-admin/revoke-permission.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-catalog/www/dt-admin/revoke-permission.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/dotlrn-catalog/www/dt-admin/revoke-permission.tcl 14 Feb 2005 22:46:11 -0000 1.1 +++ openacs-4/packages/dotlrn-catalog/www/dt-admin/revoke-permission.tcl 2 Nov 2005 20:30:22 -0000 1.2 @@ -6,8 +6,7 @@ @creation date 03-01-2005 } { p_user_id:multiple - { user_name "" } - { user_email "" } + { keyword "" } object_id:notnull creation_user:notnull course_key:notnull @@ -20,4 +19,4 @@ } -ad_returnredirect "grant-user-list?user_name=$user_name&user_email=$user_email&object_id=$object_id&creation_user=$creation_user&course_key=$course_key" \ No newline at end of file +ad_returnredirect "grant-user-list?keyword=$keyword&object_id=$object_id&creation_user=$creation_user&course_key=$course_key" \ No newline at end of file