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.8 -r1.9 --- openacs-4/packages/dotlrn-catalog/catalog/dotlrn-catalog.en_US.ISO-8859-1.xml 19 Feb 2005 03:43:11 -0000 1.8 +++ openacs-4/packages/dotlrn-catalog/catalog/dotlrn-catalog.en_US.ISO-8859-1.xml 3 Mar 2005 22:32:16 -0000 1.9 @@ -1,6 +1,7 @@ <?xml version="1.0" encoding="ISO-8859-1"?> <message_catalog package_key="dotlrn-catalog" package_version="0.1a4" locale="en_US" charset="ISO-8859-1"> + <msg key="Actions">Actions</msg> <msg key="add_course_to">Add this course to one category.</msg> <msg key="admin">Admin</msg> <msg key="admin_categories">Manage Category Tree</msg> 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.3 -r1.4 --- openacs-4/packages/dotlrn-catalog/tcl/dotlrn-catalog-procs.tcl 22 Feb 2005 14:54:40 -0000 1.3 +++ openacs-4/packages/dotlrn-catalog/tcl/dotlrn-catalog-procs.tcl 3 Mar 2005 22:33:36 -0000 1.4 @@ -240,3 +240,36 @@ } return $return_list } + +ad_proc -private dotlrn_catalog::get_categories_widget { +} { + Returns a list of all objects associated to one category under the dotlrn catalog tree_id + @tree_id@ The tree_id that holds the objects +} { + set return_list "" + set name "" + set cc_package_id [apm_package_id_from_key "dotlrn-catalog"] + + # The tree id from categories + set tree_list [category_tree::get_mapped_trees $cc_package_id] + if { [string equal [lindex [lindex $tree_list 0] 1] "dotlrn-course-catalog"] } { + set tree_id [lindex [lindex $tree_list 0] 0] + } else { + set tree_id "" + } + + + set categories [category_tree::get_tree $tree_id] + + foreach cat $categories { + set name "" + set j [lindex $cat 3] + for { set i 0} { $i < $j } {incr i} { + append name "." + } + append name " [lindex $cat 1]" + lappend return_list [list $name [lindex $cat 0]] + } + + return $return_list +} 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.6 -r1.7 --- openacs-4/packages/dotlrn-catalog/www/dt-admin/course-add-edit.tcl 22 Feb 2005 14:54:40 -0000 1.6 +++ openacs-4/packages/dotlrn-catalog/www/dt-admin/course-add-edit.tcl 3 Mar 2005 22:32:16 -0000 1.7 @@ -24,6 +24,7 @@ set user_id [ad_conn user_id] set cc_package_id [apm_package_id_from_key "dotlrn-catalog"] + # Check for create permissions over dotlrn-catalog package permission::require_permission -party_id $user_id -object_id $cc_package_id -privilege "create" @@ -90,9 +91,10 @@ ad_form -extend -name add_course -form $elements ad_form -extend -name add_course -form { - {category_ids:integer(category),multiple,optional + {category_ids:integer(multiselect),multiple,optional {label "[_ dotlrn-catalog.categories]"} {html {size 4}} + {options [dotlrn_catalog::get_categories_widget]} {value "-1"} } } @@ -140,6 +142,13 @@ 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 { + set return_url "$return_url?course_id=$course_id&course_name=$course_name&course_key=$course_key&index=$index" + } + } -new_request { set context [list [list course-list "[_ dotlrn-catalog.course_list]"] "[_ dotlrn-catalog.new_course]"] set page_title "[_ dotlrn-catalog.new_course]" @@ -149,7 +158,7 @@ set page_title "[_ dotlrn-catalog.edit_course]" db_1row get_course_info { } db_string get_course_assessment { } -default "[_ dotlrn-catalog.not_associated]" - set return_url "$return_url?course_id=$course_id&course_name=$course_name&course_key=$course_key&index=$index" + set category_ids [category::get_mapped_categories $course_id] } -after_submit { ad_returnredirect "$return_url" } Index: openacs-4/packages/dotlrn-catalog/www/dt-admin/course-list.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-catalog/www/dt-admin/course-list.adp,v diff -u -r1.6 -r1.7 --- openacs-4/packages/dotlrn-catalog/www/dt-admin/course-list.adp 23 Feb 2005 20:35:47 -0000 1.6 +++ openacs-4/packages/dotlrn-catalog/www/dt-admin/course-list.adp 3 Mar 2005 22:32:16 -0000 1.7 @@ -10,10 +10,8 @@ } </STYLE> -<a href="course-add-edit?return_url=@return_url@">#dotlrn-catalog.new_course#</a> -<if @admin_p@ eq 1> <if @tree_id@ not eq ""> - | <a href="/categories/cadmin/tree-view?tree_id=@tree_id@">#dotlrn-catalog.admin_categories#</a> + <a href="/categories/cadmin/tree-view?tree_id=@tree_id@">#dotlrn-catalog.admin_categories#</a> </if> | <a href="../admin/grant-list?return_url=@return_url@">#dotlrn-catalog.grant_per#</a> </if> @@ -27,6 +25,10 @@ </form> <br> <listtemplate name=course_list></listtemplate> - </center> +<br> +<a class=button href="course-add-edit?return_url=@return_url@">#dotlrn-catalog.new_course#</a> +<if @admin_p@ eq 1> + + 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.7 -r1.8 --- openacs-4/packages/dotlrn-catalog/www/dt-admin/course-list.tcl 23 Feb 2005 20:35:47 -0000 1.7 +++ openacs-4/packages/dotlrn-catalog/www/dt-admin/course-list.tcl 3 Mar 2005 22:32:16 -0000 1.8 @@ -67,9 +67,6 @@ label "[_ dotlrn-catalog.course_key]" display_template { <div align=left> - <a href=course-add-edit?course_id=@course_list.course_id@&return_url=$return_url&mode=1 \ - title="[_ dotlrn-catalog.new_ver]">\ - <img border=0 src=/resources/Edit16.gif></a> <a href="revision-list?course_key=@course_list.course_key@&return_url=$return_url&course_id=@course_list.course_id@" title="[_ dotlrn-catalog.see_all_rev]">@course_list.course_key@</a> </div> } @@ -118,11 +115,25 @@ <a href="grant-user-list?object_id=@course_list.item_id@&creation_user=@course_list.creation_user@&course_key=@course_list.course_key@">\#dotlrn-catalog.manage_per\#</a> } } - delete { + view { + label "[_ dotlrn-catalog.versions]" + display_template { - <a href="course-delete?object_id=@course_list.item_id@&creation_user=@course_list.creation_user@&course_key=@course_list.course_key@" title="\#dotlrn-catalog.delete\#"><img border=0 src=/resources/Delete16.gif></a> + <a href="revision-list?course_key=@course_list.course_key@&return_url=$return_url&course_id=@course_list.course_id@" title="[_ dotlrn-catalog.see_all_rev]">[_ dotlrn-catalog.versions]</a> } + } + actions { + + label "[_ dotlrn-catalog.admin] [_ dotlrn-catalog.Actions]" + display_template { + <div align=center> + <a href=course-add-edit?course_id=@course_list.course_id@&mode=1 + title="[_ dotlrn-catalog.new_ver]"><img border=0 src=/resources/Edit16.gif></a> + <a href="course-delete?object_id=@course_list.item_id@&creation_user=@course_list.creation_user@&course_key=@course_list.course_key@" title="\#dotlrn-catalog.delete\#"><img border=0 src=/resources/Delete16.gif></a> + </div> + } + } } db_multirow -extend { asm_name rel item_id creation_user category_name } course_list $query {} { Index: openacs-4/packages/dotlrn-catalog/www/dt-admin/revision-list.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-catalog/www/dt-admin/revision-list.adp,v diff -u -r1.3 -r1.4 --- openacs-4/packages/dotlrn-catalog/www/dt-admin/revision-list.adp 21 Feb 2005 19:22:13 -0000 1.3 +++ openacs-4/packages/dotlrn-catalog/www/dt-admin/revision-list.adp 3 Mar 2005 22:32:16 -0000 1.4 @@ -2,7 +2,13 @@ <property name=title>@page_title@</property> <property name="context">@context;noquote@</property> +<multiple name="live_course"> + <include src="/packages/dotlrn-catalog/lib/course-chunk" course_id=@live_course.course_id@ course_key=@live_course.course_key@ name=@live_course.course_name@ info=@live_course.course_info@ asm=@live_course.asm_name@ rel=@live_course.rel@ return_url=@return_url@ edit=no live_revision=@live_course.live_revision@ revision=yes> +<br> +<hr> +</multiple> + <multiple name="course_list"> <include src="/packages/dotlrn-catalog/lib/course-chunk" course_id=@course_list.course_id@ course_key=@course_list.course_key@ name=@course_list.course_name@ info=@course_list.course_info@ asm=@course_list.asm_name@ rel=@course_list.rel@ return_url=@return_url@ edit=no live_revision=@course_list.live_revision@ revision=yes> <br> 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.2 -r1.3 --- openacs-4/packages/dotlrn-catalog/www/dt-admin/revision-list.tcl 22 Feb 2005 14:54:40 -0000 1.2 +++ openacs-4/packages/dotlrn-catalog/www/dt-admin/revision-list.tcl 3 Mar 2005 22:32:16 -0000 1.3 @@ -35,4 +35,8 @@ set asm_name [db_string get_asm_name { } -default "[_ dotlrn-catalog.not_associated]"] set rel [dotlrn_catalog::has_relation -course_id $course_id] } +db_multirow -extend { asm_name rel } live_course get_live_course { } { + set asm_name [db_string get_asm_name { } -default "[_ dotlrn-catalog.not_associated]"] + set rel [dotlrn_catalog::has_relation -course_id $course_id] +} Index: openacs-4/packages/dotlrn-catalog/www/dt-admin/revision-list.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dotlrn-catalog/www/dt-admin/revision-list.xql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/dotlrn-catalog/www/dt-admin/revision-list.xql 22 Feb 2005 14:54:40 -0000 1.2 +++ openacs-4/packages/dotlrn-catalog/www/dt-admin/revision-list.xql 3 Mar 2005 22:32:16 -0000 1.3 @@ -6,10 +6,23 @@ select dc.course_id, dc.course_key, dc.course_name, dc.course_info, dc.assessment_id, ci.live_revision from dotlrn_catalog dc, cr_items ci where ci.item_id = :item_id and - dc.course_id in (select revision_id from cr_revisions where item_id = :item_id ) + dc.course_id in (select revision_id from cr_revisions where item_id = :item_id ) + and ci.live_revision <> dc.course_id order by dc.course_id asc </querytext> </fullquery> + +<fullquery name="get_live_course"> + <querytext> + select dc.course_id, dc.course_key, dc.course_name, dc.course_info, dc.assessment_id, ci.live_revision + from dotlrn_catalog dc, cr_items ci + where ci.item_id = :item_id and + dc.course_id in (select revision_id from cr_revisions where item_id = :item_id ) + and ci.live_revision=dc.course_id + </querytext> +</fullquery> + + <fullquery name="get_asm_name"> <querytext> select cr.title from