Add this course to one category.
+ Manage Category Tree
and has
Assessment
Associate
@@ -11,6 +12,7 @@
Already Associated
Categories
Categorize
+ Categorized Courses
Class
Class Name
Community Name:
@@ -75,6 +77,7 @@
Check/uncheck this row, and select an action to perform below
To
associations to dotLRN classes or communities
+ Uncategorized Courses
User Name:
users to grant permissions that match that search
Version
Index: openacs-4/packages/courses/lib/course-chunk.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/courses/lib/course-chunk.adp,v
diff -u -r1.3 -r1.4
--- openacs-4/packages/courses/lib/course-chunk.adp 10 Feb 2005 22:45:22 -0000 1.3
+++ openacs-4/packages/courses/lib/course-chunk.adp 12 Feb 2005 01:45:31 -0000 1.4
@@ -3,7 +3,7 @@
-
Index: openacs-4/packages/courses/lib/tree-chunk.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/courses/lib/tree-chunk.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/courses/lib/tree-chunk.adp 12 Feb 2005 01:48:35 -0000 1.1
@@ -0,0 +1,11 @@
+#courses.categorized#:
+@tree_view;noquote@
+
+
+ #courses.uncategorized#:
+
+
\ No newline at end of file
Index: openacs-4/packages/courses/lib/tree-chunk.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/courses/lib/tree-chunk.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/courses/lib/tree-chunk.tcl 12 Feb 2005 01:48:35 -0000 1.1
@@ -0,0 +1,42 @@
+ad_page_contract {
+ Display an ident tree of categories and courses.
+ @author Miguel Marin (miguelmarin@viaro.net)
+ @author Viaro Networks www.viaro.net
+ @creation-date 11-02-2005
+
+} {
+
+}
+
+
+set tree_list [category_tree::get_tree -all $tree_id]
+set tree_view ""
+
+set cat_obj_list [course_catalog::get_categories_from_tree -tree_id $tree_id]
+
+# Display all courses associated to one category
+foreach element $tree_list {
+ set level [lindex $element 3]
+ set spacer ""
+ for { set i 0 } { $i < $level } { incr i } {
+ append spacer " "
+ }
+ if { [string equal $level 1] } {
+ append tree_view "${spacer}[lindex $element 1] "
+ } else {
+ append tree_view "${spacer}[lindex $element 1] "
+ }
+ foreach item $cat_obj_list {
+ if { [string equal [lindex $item 0] [lindex $element 0] ]} {
+ set course_id "[lindex $item 1]"
+ db_0or1row get_course_info { }
+ append tree_view "${spacer}   ($course_key) $course_name "
+ }
+ }
+}
+
+# Display courses without category
+set uncat_p 0
+db_multirow uncat get_courses_uncat { } {
+ set uncat_p 1
+}
\ No newline at end of file
Index: openacs-4/packages/courses/lib/tree-chunk.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/courses/lib/tree-chunk.xql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/courses/lib/tree-chunk.xql 12 Feb 2005 01:48:35 -0000 1.1
@@ -0,0 +1,26 @@
+
+
+
+
+
+ select cc.course_id, cc.course_key, cc.course_name
+ from course_catalog cc, cr_items ci
+ where cc.course_id = ci.live_revision and cc.course_id = :course_id
+
+
+
+
+
+
+ select cc.course_id, cc.course_key, cc.course_name
+ from course_catalog cc, cr_items ci
+ where cc.course_id = ci.live_revision and cc.course_id not in (
+ select object_id from category_object_map where category_id in (
+ select category_id from categories where tree_id =:tree_id
+ )
+ )
+
+
+
+
+
Index: openacs-4/packages/courses/tcl/apm-callback-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/courses/tcl/apm-callback-procs.tcl,v
diff -u -r1.4 -r1.5
--- openacs-4/packages/courses/tcl/apm-callback-procs.tcl 8 Feb 2005 23:07:52 -0000 1.4
+++ openacs-4/packages/courses/tcl/apm-callback-procs.tcl 12 Feb 2005 01:45:31 -0000 1.5
@@ -60,15 +60,33 @@
-sort_order 4 \
-column_spec "integer"
+ # To store the courses in the content repository
set folder_id [content::folder::new -name "Course Catalog" -label "Course Catalog"]
content::folder::register_content_type -folder_id $folder_id -content_type "course_catalog"
-
+
+ # To associate one course to dotlrn class
rel_types::new -role_one c_catalog_role -role_two dotlrn_class_role course_catalog_class_rel \
"Course Catalog Class" "Course Catalog Class" course_catalog 0 1 dotlrn_class_instance 0 1
+ # To associate one course to dotrln community
rel_types::new -role_one c_catalog_role -role_two dotlrn_com_role course_catalog_dotcom_rel \
"Course Catalog Community" "Course Catalog Community" course_catalog 0 1 dotlrn_club 0 1
}
+
+ad_proc -private courses::package_mount {
+ -package_id
+ -node_id
+} {
+ create the category tree for dotlrn catalog
+
+ @author Miguel Marin (miguelmarin@viaro.net) Viaro Networks (www.viaro.net)
+ @creation-date 11-02-2005
+} {
+ # To categorize courses
+ set tree_id [category_tree::add -name "dotlrn-course-catalog"]
+ category_tree::map -tree_id $tree_id -object_id $package_id -assign_single_p "t"
+}
+
ad_proc -private courses::package_uninstall {
} {
drops the CR type datamodel for the course catalog
Index: openacs-4/packages/courses/tcl/course-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/courses/tcl/course-procs.tcl,v
diff -u -r1.6 -r1.7
--- openacs-4/packages/courses/tcl/course-procs.tcl 9 Feb 2005 22:54:02 -0000 1.6
+++ openacs-4/packages/courses/tcl/course-procs.tcl 12 Feb 2005 01:45:31 -0000 1.7
@@ -228,4 +228,17 @@
course_catalog::delete_relation -rel_id $rel_id
}
content::item::delete -item_id $item_id
-}
\ No newline at end of file
+}
+
+ad_proc -private course_catalog::get_categories_from_tree {
+ -tree_id:required
+} {
+ Returns a list of all objects associated to one category under tree_id
+ @tree_id@ The tree_id that holds the objects
+} {
+ set return_list ""
+ db_foreach get_categories { } {
+ lappend return_list "[list "$category_id" "$object_id"]"
+ }
+ return $return_list
+}
Index: openacs-4/packages/courses/tcl/course-procs.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/courses/tcl/course-procs.xql,v
diff -u -r1.6 -r1.7
--- openacs-4/packages/courses/tcl/course-procs.xql 9 Feb 2005 22:54:02 -0000 1.6
+++ openacs-4/packages/courses/tcl/course-procs.xql 12 Feb 2005 01:45:31 -0000 1.7
@@ -133,4 +133,13 @@
+
+
+ select om.category_id, om.object_id from category_object_map om where
+ om.category_id in (select category_id from categories where tree_id =:tree_id)
+ and om.object_id in (select live_revision from cr_items where content_type = 'course_catalog')
+
+
+
+
Index: openacs-4/packages/courses/www/index.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/courses/www/index.adp,v
diff -u -r1.4 -r1.5
--- openacs-4/packages/courses/www/index.adp 9 Feb 2005 22:54:02 -0000 1.4
+++ openacs-4/packages/courses/www/index.adp 12 Feb 2005 01:45:31 -0000 1.5
@@ -5,7 +5,4 @@
-
- @course_list.course_key@ ---> @course_list.course_name@
-
-
\ No newline at end of file
+
Index: openacs-4/packages/courses/www/index.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/courses/www/index.tcl,v
diff -u -r1.5 -r1.6
--- openacs-4/packages/courses/www/index.tcl 9 Feb 2005 22:54:02 -0000 1.5
+++ openacs-4/packages/courses/www/index.tcl 12 Feb 2005 01:45:31 -0000 1.6
@@ -21,4 +21,9 @@
set create_p 0
}
-db_multirow course_list get_course_list { }
\ No newline at end of file
+set tree_id [db_string get_tree_id { } -default "-1"]
+
+
+
+
+
Index: openacs-4/packages/courses/www/index.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/courses/www/index.xql,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/courses/www/index.xql 9 Feb 2005 22:54:41 -0000 1.1
+++ openacs-4/packages/courses/www/index.xql 12 Feb 2005 01:45:31 -0000 1.2
@@ -1,12 +1,11 @@
-
+
- select cc.course_id, cc.course_key, cc.course_name, cc.course_info, cc.assessment_id, ci.item_id
- from course_catalog cc, cr_items ci
- where cc.course_id = ci.live_revision
+ select tree_id from category_tree_map where object_id = :cc_package_id
+
\ No newline at end of file
Fisheye: Tag 1.2 refers to a dead (removed) revision in file `openacs-4/packages/courses/www/cc-admin/add-edit-course.adp'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.8 refers to a dead (removed) revision in file `openacs-4/packages/courses/www/cc-admin/add-edit-course.tcl'.
Fisheye: No comparison available. Pass `N' to diff?
Fisheye: Tag 1.4 refers to a dead (removed) revision in file `openacs-4/packages/courses/www/cc-admin/add-edit-course.xql'.
Fisheye: No comparison available. Pass `N' to diff?
Index: openacs-4/packages/courses/www/cc-admin/course-add-edit.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/courses/www/cc-admin/course-add-edit.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/courses/www/cc-admin/course-add-edit.adp 12 Feb 2005 01:48:35 -0000 1.1
@@ -0,0 +1,5 @@
+
+@page_title@
+@context;noquote@
+
+
\ No newline at end of file
Index: openacs-4/packages/courses/www/cc-admin/course-add-edit.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/courses/www/cc-admin/course-add-edit.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/courses/www/cc-admin/course-add-edit.tcl 12 Feb 2005 01:48:35 -0000 1.1
@@ -0,0 +1,166 @@
+ad_page_contract {
+ Displays a form to add a course or add a new revision of a course (edit)
+
+ @author Miguel Marin (miguelmarin@viaro.net)
+ @author Viaro Networks www.viaro.net
+ @creation-date 27-01-2005
+
+} {
+ course_id:optional
+ mode:optional
+ { return_url "" }
+}
+
+if { [string equal $return_url ""]} {
+ set return_url "course-list"
+}
+
+set page_title ""
+set context ""
+
+set user_id [ad_conn user_id]
+
+if { [info exists mode] } {
+ # Check if users has admin permission to edit course_catalog
+ permission::require_permission -object_id $course_id -privilege "admin"
+ # To disable the element course_key
+ set mode display
+} else {
+ set mode edit
+}
+
+set cc_package_id [apm_package_id_from_key "courses"]
+
+# Get assessments
+set asm_package_id [apm_package_id_from_key assessment]
+set asm_list [list [list "[_ courses.not_associate]" "-1"]]
+db_foreach assessment { } {
+ if { [permission::permission_p -object_id $assessment_id -privilege "admin"] == 1 } {
+ lappend asm_list [list $title $assessment_id]
+ }
+}
+
+# Get a list of all the attributes asociated to course_catalog
+set attribute_list [package_object_attribute_list -start_with course_catalog course_catalog]
+set elements ""
+
+
+# Creates the elements to show with ad_form
+
+foreach attribute $attribute_list {
+ set element_mode ""
+ set aditional_type ""
+ set aditional_elements ""
+ switch [lindex $attribute 4] {
+ string {
+ if { [string equal [lindex $attribute 2] "assessment_id"]} {
+ set aditional_type "(select)"
+ set aditional_elements [list options $asm_list]
+ } else {
+ if { [string equal [lindex $attribute 2] "course_key"]} {
+ set element_mode [list mode edit]
+ }
+ }
+ }
+ text {
+ set aditional_type "(textarea)"
+ set aditional_elements "{html {rows 7 cols 35}}"
+ }
+ integer {
+ if { [string equal [lindex $attribute 2] "assessment_id"]} {
+ set aditional_type "(select)"
+ set aditional_elements [list options $asm_list]
+ }
+ }
+ }
+ set element [list [lindex $attribute 2]:text${aditional_type} [list label [lindex $attribute 3]] $aditional_elements $element_mode]
+
+ lappend elements $element
+
+}
+
+
+# Create the form
+ad_form -name add_course -export {return_url $return_url } -form {
+ course_id:key
+}
+
+
+ad_form -extend -name add_course -form $elements
+
+ad_form -extend -name add_course -form {
+ {category_ids:integer(category),multiple,optional
+ {label "[_ courses.categories]"}
+ {html {size 4}}
+ {value "-1"}
+ }
+}
+
+ad_form -extend -name add_course -validate {
+ { course_key
+ { [course_catalog::check_name -name $course_key] }
+ "[_ courses.name_already]"
+ }
+} -new_data {
+ # New item and revision in the CR
+ set folder_id [course_catalog::get_folder_id]
+ set attribute_list [package_object_attribute_list -start_with course_catalog course_catalog]
+ set form_attributes [list]
+ foreach attribute $attribute_list {
+ set attr_name [lindex $attribute 2]
+ lappend form_attributes [list $attr_name [set $attr_name]]
+ }
+
+ set item_id [content::item::new -name $course_key -parent_id $folder_id \
+ -content_type "course_catalog" -creation_user $user_id \
+ -attributes $form_attributes -is_live t]
+
+ # Grant admin privileges to the user over the item in the CR
+ permission::grant -party_id $user_id -object_id $item_id -privilege "admin"
+
+ set revision_id [db_string get_revision_id { } -default "-1"]
+ if { ![string equal $category_ids "-1"] } {
+ category::map_object -object_id $revision_id $category_ids
+ }
+} -edit_data {
+ # New revision in the CR
+ set folder_id [course_catalog::get_folder_id]
+ set item_id [course_catalog::get_item_id -revision_id $course_id]
+ set attribute_list [package_object_attribute_list -start_with course_catalog course_catalog]
+ set form_attributes [list]
+ foreach attribute $attribute_list {
+ 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 "course_catalog"]
+
+ # Set the new revision live
+ course_catalog::set_live -revision_id $course_id
+ if { ![string equal $category_ids "-1"] } {
+ category::map_object -object_id $course_id $category_ids
+ }
+} -new_request {
+ set context [list [list course-list "[_ courses.course_list]"] "[_ courses.new_course]"]
+ set page_title "[_ courses.new_course]"
+ set return_url "$return_url"
+
+} -edit_request {
+ set context [list [list course-list "[_ courses.course_list]"] "[_ courses.edit_course]"]
+ set page_title "[_ courses.edit_course]"
+ set return_url "$return_url"
+ db_1row get_course_info { }
+ db_string get_course_assessment { } -default "[_ courses.not_associated]"
+
+} -after_submit {
+ ad_returnredirect "$return_url"
+}
+
+
+
+
+
+
+
+
+
Index: openacs-4/packages/courses/www/cc-admin/course-add-edit.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/courses/www/cc-admin/course-add-edit.xql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/courses/www/cc-admin/course-add-edit.xql 12 Feb 2005 01:48:35 -0000 1.1
@@ -0,0 +1,36 @@
+
+
+
+
+
+ select cr.title ,ci.item_id as assessment_id from
+ cr_folders cf, cr_items ci, cr_revisions cr, as_assessments a
+ where cr.revision_id = ci.latest_revision and a.assessment_id = cr.revision_id and
+ ci.parent_id = cf.folder_id and cf.package_id = :asm_package_id order by cr.title
+
+
+
+
+
+ select * from course_catalog where course_id = :course_id
+
+
+
+
+
+ select cr.title from
+ cr_folders cf, cr_items ci, cr_revisions cr, as_assessments a
+ where cr.revision_id = ci.latest_revision and a.assessment_id = cr.revision_id and
+ ci.parent_id = cf.folder_id and cf.package_id = :asm_package_id and
+ ci.item_id = :assessment_id order by cr.title
+
+
+
+
+
+ select revision_id from cr_revisions where item_id = :item_id
+
+
+
+
+
Index: openacs-4/packages/courses/www/cc-admin/course-list.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/courses/www/cc-admin/course-list.adp,v
diff -u -r1.4 -r1.5
--- openacs-4/packages/courses/www/cc-admin/course-list.adp 10 Feb 2005 22:45:22 -0000 1.4
+++ openacs-4/packages/courses/www/cc-admin/course-list.adp 12 Feb 2005 01:45:31 -0000 1.5
@@ -1,10 +1,10 @@
@page_title@
@context;noquote@
- #courses.new_course#
+ #courses.new_course#
| #courses.grant_per#
-| Categories
+| #courses.admin_categories#
|