Index: openacs-4/packages/curriculum/curriculum.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/curriculum/curriculum.info,v diff -u -r1.10 -r1.11 --- openacs-4/packages/curriculum/curriculum.info 22 Feb 2004 22:01:52 -0000 1.10 +++ openacs-4/packages/curriculum/curriculum.info 5 Jul 2004 14:07:20 -0000 1.11 @@ -9,19 +9,22 @@ Ola Hansson + Create and track user page sequence "curriculum" Polyxena - Create and track user page sequence "curriculum" - Provides a UI for creating a sequence of links as a "curriculum" which can + Provides a UI for creating a sequence of links as a "curriculum" which can be presented as a linkbar in the page footer (or elsewhere) and is tracked per user. + 0 - - - + + + + - - + + + @@ -30,7 +33,6 @@ - Index: openacs-4/packages/curriculum/catalog/curriculum.en_US.ISO-8859-1.xml =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/curriculum/catalog/curriculum.en_US.ISO-8859-1.xml,v diff -u -r1.10 -r1.11 --- openacs-4/packages/curriculum/catalog/curriculum.en_US.ISO-8859-1.xml 10 Mar 2004 13:47:13 -0000 1.10 +++ openacs-4/packages/curriculum/catalog/curriculum.en_US.ISO-8859-1.xml 5 Jul 2004 14:07:20 -0000 1.11 @@ -1,5 +1,5 @@ - + Action Log Actions @@ -24,6 +24,7 @@ Curriculum Curriculum info Curriculum owner + Default assignees Delete Description Detailed information @@ -54,6 +55,7 @@ Back to where you came from Create a new curriculum Deactivate this element + Default assignees for this Curriculum instance Delete this curriculum and all of its data Delete this element and all of its data deleting curriculum %curriculum_id% in package_id %package_id% Index: openacs-4/packages/curriculum/lib/admin-curriculums-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/curriculum/lib/admin-curriculums-oracle.xql,v diff -u -r1.4 -r1.5 --- openacs-4/packages/curriculum/lib/admin-curriculums-oracle.xql 22 Feb 2004 22:01:54 -0000 1.4 +++ openacs-4/packages/curriculum/lib/admin-curriculums-oracle.xql 5 Jul 2004 14:07:20 -0000 1.5 @@ -16,41 +16,19 @@ dbms_lob.substr(ce.description,:truncation_length,1) as element_desc, case when dbms_lob.getlength(ce.description) > :truncation_length then 1 else 0 end as elem_desc_trunc_p, - ce.url as element_url, ce.enabled_p as element_enabled_p, ce.sort_key as element_sort_order, - author.first_names as author_first_names, - author.last_name as author_last_name, - author.email as author_email, - st.pretty_name as pretty_state, - st.short_name as state_short_name, - st.state_id, - st.hide_fields, - assignee.party_id as assignee_party_id, - assignee.email as assignee_email, - assignee.name as assignee_name + st.pretty_name as pretty_state from cu_curriculums cc, cu_elements ce, - cc_users author, - (select rpm.case_id, - p.party_id, - p.email, - acs_object.name(p.party_id) as name - from workflow_case_role_party_map rpm, - parties p - where rpm.role_id = :action_role - and p.party_id = rpm.party_id - ) assignee, workflow_cases cas, workflow_case_fsm cfsm, workflow_fsm_states st where cc.curriculum_id = ce.curriculum_id(+) and cc.package_id = :package_id and cfsm.case_id = cas.case_id and st.state_id = cfsm.current_state - and cas.workflow_id = :workflow_id and cas.object_id = cc.curriculum_id - and cas.case_id = assignee.case_id(+) $where_clauses order by cc.sort_key, ce.sort_key Index: openacs-4/packages/curriculum/lib/admin-curriculums-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/curriculum/lib/admin-curriculums-postgresql.xql,v diff -u -r1.4 -r1.5 --- openacs-4/packages/curriculum/lib/admin-curriculums-postgresql.xql 22 Feb 2004 22:01:54 -0000 1.4 +++ openacs-4/packages/curriculum/lib/admin-curriculums-postgresql.xql 5 Jul 2004 14:07:20 -0000 1.5 @@ -16,38 +16,17 @@ substring(ce.description from 1 for :truncation_length) as element_desc, case when length(ce.description) > :truncation_length then 1 else 0 end as elem_desc_trunc_p, - ce.url as element_url, ce.enabled_p as element_enabled_p, ce.sort_key as element_sort_order, - author.first_names as author_first_names, - author.last_name as author_last_name, - author.email as author_email, - st.pretty_name as pretty_state, - st.short_name as state_short_name, - st.state_id, - st.hide_fields, - assignee.party_id as assignee_party_id, - assignee.email as assignee_email, - assignee.name as assignee_name + st.pretty_name as pretty_state from cu_curriculums cc left outer join cu_elements ce using (curriculum_id), - cc_users author, - workflow_cases cas left outer join - (select rpm.case_id, - p.party_id, - p.email, - acs_object__name(p.party_id) as name - from workflow_case_role_party_map rpm, - parties p - where rpm.role_id = :action_role - and p.party_id = rpm.party_id - ) assignee using (case_id), + workflow_cases cas, workflow_case_fsm cfsm, workflow_fsm_states st where cc.package_id = :package_id and cfsm.case_id = cas.case_id and st.state_id = cfsm.current_state - and cas.workflow_id = :workflow_id and cas.object_id = cc.curriculum_id $where_clauses order by cc.sort_key, Index: openacs-4/packages/curriculum/lib/admin-curriculums.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/curriculum/lib/admin-curriculums.adp,v diff -u -r1.15 -r1.16 --- openacs-4/packages/curriculum/lib/admin-curriculums.adp 22 Feb 2004 22:01:54 -0000 1.15 +++ openacs-4/packages/curriculum/lib/admin-curriculums.adp 5 Jul 2004 14:07:20 -0000 1.16 @@ -2,6 +2,7 @@ #curriculum.Default_Assignees# #curriculum.Package_parameters# #curriculum.Package_permissions# + Site-Wide Categories #curriculum.Help#

Index: openacs-4/packages/curriculum/lib/admin-curriculums.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/curriculum/lib/admin-curriculums.tcl,v diff -u -r1.6 -r1.7 --- openacs-4/packages/curriculum/lib/admin-curriculums.tcl 5 Sep 2003 09:32:14 -0000 1.6 +++ openacs-4/packages/curriculum/lib/admin-curriculums.tcl 5 Jul 2004 14:07:20 -0000 1.7 @@ -19,11 +19,6 @@ permission::require_permission -object_id $package_id -privilege admin -# We might need this if we want to present statistics, see bug-tracker (we need it for this page, too). -set initial_state_id [workflow::fsm::get_initial_state -workflow_id $workflow_id] - -set action_role [db_string select_resolve_role {*SQL*}] - #### # Filters. #### @@ -60,4 +55,9 @@ set export_vars [export_vars -url { package_id return_url }] +# Categories. +set category_map_url [export_vars -base \ + "[site_node::get_package_url -package_key categories]cadmin/one-object" \ + { { object_id $package_id } }] + ad_return_template Fisheye: Tag 1.2 refers to a dead (removed) revision in file `openacs-4/packages/curriculum/lib/admin-curriculums.xql'. Fisheye: No comparison available. Pass `N' to diff? Index: openacs-4/packages/curriculum/lib/curriculum-ave.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/curriculum/lib/curriculum-ave.tcl,v diff -u -r1.12 -r1.13 --- openacs-4/packages/curriculum/lib/curriculum-ave.tcl 22 Feb 2004 22:01:54 -0000 1.12 +++ openacs-4/packages/curriculum/lib/curriculum-ave.tcl 5 Jul 2004 14:07:20 -0000 1.13 @@ -228,6 +228,13 @@ } -edit_data { + # Esti: the roles where not assigned because they were not included in the curriculum_array + foreach role_id [workflow::get_roles -workflow_id [workflow::case::get_element -case_id $case_id -element workflow_id]] { + workflow::role::get -role_id $role_id -array role + set element "role_$role(short_name)" + set curriculum_array($element) [set $element] + } + curriculum::edit \ -curriculum_id $curriculum_id \ -name $name \ Index: openacs-4/packages/curriculum/lib/element-ave.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/curriculum/lib/element-ave.tcl,v diff -u -r1.9 -r1.10 --- openacs-4/packages/curriculum/lib/element-ave.tcl 11 Dec 2003 21:40:01 -0000 1.9 +++ openacs-4/packages/curriculum/lib/element-ave.tcl 5 Jul 2004 14:07:20 -0000 1.10 @@ -60,22 +60,49 @@ -mode $form_mode \ -has_edit [expr !$write_p] \ -form { - element_id:key - {name:text - {label "[_ curriculum.Name]"} - {html {size 50}} + element_id:key + {name:text + {label "[_ curriculum.Name]"} + {html {size 50}} + } + {description:richtext,optional + {label "[_ curriculum.Description]"} + {help_text "[_ curriculum.lt_This_text_should_desc_1]"} + {html {rows 10 cols 50 wrap soft}} + } + {url:text(text),optional,nospell + {label "[_ curriculum.URL]"} + {help_text "[_ curriculum.lt_A_leading_http_indica]"} + {html {size 50}} + } } - {description:richtext,optional - {label "[_ curriculum.Description]"} - {help_text "[_ curriculum.lt_This_text_should_desc_1]"} - {html {rows 10 cols 50 wrap soft}} - } - {url:text(text),optional,nospell - {label "[_ curriculum.URL]"} - {help_text "[_ curriculum.lt_A_leading_http_indica]"} - {html {size 50}} - } -} -on_request { + +#if { [exists_and_not_null element_id] } { +# if { ![empty_string_p [category_tree::get_mapped_trees $package_id]] } { +# ad_form -extend -name element -form { +# {category_ids:integer(category),multiple {label "E Categories"} +# {html {size 7}} {value {$element_id $package_id}} +# } +# } +# } +#} else { +# if { ![empty_string_p [category_tree::get_mapped_trees $package_id]] } { +# ad_form -extend -name element -form { +# {category_ids:integer(category),multiple,optional {label "A Categories"} +# {html {size 7}} {value {}} +# } +# } +# } +#} + +# SWC (Site-wide categories): +category::ad_form::add_widgets \ + -container_object_id $package_id \ + -categorized_object_id [value_if_exists entry_id] \ + -form_name element \ + -help_text "Help text here!" + +ad_form -extend -name element -on_request { # Nothing, really } -edit_request { @@ -96,6 +123,12 @@ "[_ curriculum.lt_URL_may_not_be_more_t]" } +} -on_submit { + + # SWC Collect categories from all the category widgets + set category_ids [category::ad_form::get_categories \ + -container_object_id $package_id] + } -new_data { curriculum::element::new \ @@ -107,6 +140,9 @@ -url [ad_decode $url "" "[curriculum::conn package_url]element-ave?curriculum_id=$curriculum_id&element_id=$element_id" $url] \ -enabled_p t + # SWC + category::map_object -remove_old -object_id $element_id $category_ids + } -edit_data { curriculum::element::edit \ @@ -115,7 +151,10 @@ -description [template::util::richtext::get_property contents $description] \ -desc_format [template::util::richtext::get_property format $description] \ -url [ad_decode $url "" "[curriculum::conn package_url]element-ave?curriculum_id=$curriculum_id&element_id=$element_id" $url] - + + # SWC + category::map_object -remove_old -object_id $element_id $category_ids + } -after_submit { # Force the curriculum bar to update. Index: openacs-4/packages/curriculum/tcl/apm-callback-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/curriculum/tcl/apm-callback-procs.tcl,v diff -u -r1.5 -r1.6 --- openacs-4/packages/curriculum/tcl/apm-callback-procs.tcl 22 Feb 2004 22:01:56 -0000 1.5 +++ openacs-4/packages/curriculum/tcl/apm-callback-procs.tcl 5 Jul 2004 14:07:21 -0000 1.6 @@ -67,6 +67,17 @@ } +ad_proc -private curriculum::apm::after_mount { + {-package_id:required} + {-node_id:required} +} { + Package mount callback proc. +} { + # Register the filter that makes tracking in the curriculum bar work. + curriculum::register_filter -package_id $package_id +} + + ##### # # Service contract implementations. Index: openacs-4/packages/curriculum/tcl/curriculum-init.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/curriculum/tcl/curriculum-init.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/curriculum/tcl/curriculum-init.tcl 5 Sep 2003 09:32:15 -0000 1.2 +++ openacs-4/packages/curriculum/tcl/curriculum-init.tcl 5 Jul 2004 14:07:21 -0000 1.3 @@ -8,23 +8,10 @@ } -# FIXME. Most likely we should only get the package_ids that have -# curriculums which are published. -set package_ids [db_list get_all_curriculum_package_ids {*SQL*}] +set package_key [curriculum::package_key] -foreach package_id $package_ids { +db_foreach get_all_curriculum_package_ids {*SQL*} { # Register the filter that keeps track of which elements the user has seen. - # If no "UrlPatternsToFilter" parameter is detected we register - # this filter for all urls in this curriculum instance. - - set url_patterns [parameter::get -package_id $package_id \ - -parameter UrlPatternsToFilter \ - -default *] - - foreach url_pattern [split [string trim $url_patterns]] { - ns_log Notice "[_ curriculum.lt_Installing_curriculum]" - ad_register_filter postauth GET $url_pattern curriculum::curriculum_filter - } - + curriculum::register_filter -package_id $package_id } Index: openacs-4/packages/curriculum/tcl/curriculum-init.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/curriculum/tcl/curriculum-init.xql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/curriculum/tcl/curriculum-init.xql 3 Jun 2003 10:28:20 -0000 1.1 +++ openacs-4/packages/curriculum/tcl/curriculum-init.xql 5 Jul 2004 14:07:21 -0000 1.2 @@ -3,8 +3,10 @@ - select distinct package_id - from cu_curriculums + select package_id + from apm_packages + where package_key = :package_key + order by package_id Index: openacs-4/packages/curriculum/tcl/curriculum-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/curriculum/tcl/curriculum-procs.tcl,v diff -u -r1.15 -r1.16 --- openacs-4/packages/curriculum/tcl/curriculum-procs.tcl 22 Feb 2004 22:01:57 -0000 1.15 +++ openacs-4/packages/curriculum/tcl/curriculum-procs.tcl 5 Jul 2004 14:07:21 -0000 1.16 @@ -103,9 +103,11 @@ array set assignments [list] set role_prefix "role_" - foreach name [array names row "${role_prefix}*"] { - set assignments([string range $name [string length $role_prefix] end]) $row($name) - unset row($name) + + # Esti : name -> role_name (otherwise mixes with the name of the curriculum) + foreach role_name [array names row "${role_prefix}*"] { + set assignments([string range $role_name [string length $role_prefix] end]) $row($role_name) + unset row($role_name) } db_transaction { @@ -550,7 +552,8 @@ entry_id } { # Force the curriculum bar to update. - curriculum::elements_flush + curriculum::elements_flush -thorough + ns_log Notice "OLA -- case_id: $case_id, object_id: $object_id, action_id: $action_id, entry_id: $entry_id" } @@ -665,3 +668,21 @@ " ad_script_abort } + + +ad_proc -private curriculum::register_filter { + -package_id:required +} { + set curriculum_url [site_node::get_url_from_object_id -object_id $package_id] + + set curriculum_subsite_id [site_node::closest_ancestor_package -include_self \ + -url $curriculum_url \ + -package_key { acs-subsite dotlrn } \ + -element package_id] + + set url_pattern "[site_node::get_url_from_object_id -object_id $curriculum_subsite_id]*" + + ns_log Notice "[_ curriculum.lt_Installing_curriculum]" + + ad_register_filter -debug f postauth GET $url_pattern curriculum::curriculum_filter $package_id +} Index: openacs-4/packages/curriculum/tcl/misc-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/curriculum/tcl/misc-procs.tcl,v diff -u -r1.13 -r1.14 --- openacs-4/packages/curriculum/tcl/misc-procs.tcl 22 Feb 2004 22:01:57 -0000 1.13 +++ openacs-4/packages/curriculum/tcl/misc-procs.tcl 5 Jul 2004 14:07:21 -0000 1.14 @@ -59,8 +59,9 @@ # instances of "acs-subsite" but instances of "dotlrn", and we need to be able # to scope our cache based on those instances too ... - # May need to be cached if it is possible ... - return [site_node_closest_ancestor_package { acs-subsite dotlrn }] + # Still using this proc despite the fact that it is deprecated. The new proc + # (site_node::closest_ancestor_package), which supersedes this one, is a lot slower. + return [site_node_closest_ancestor_package -url [ad_conn url] { acs-subsite dotlrn }] } package_id - package_url - @@ -141,73 +142,39 @@ set subsite_id [conn subsite_id] } - set subsite_node_id [site_node::get_node_id_from_object_id -object_id $subsite_id] + set package_key [package_key] - set info(subsite_url) [site_node::get_url -node_id $subsite_node_id] - - # Note! Returns a list of curriculum package_ids. + set info(subsite_url) [site_node::get_url_from_object_id -object_id $subsite_id] + + # Note! Returns a list of curriculum package_ids mounted directly under the given + # node. Of course, only one curriculum instance is allowed under a "curriculum subsite" + # (acs-subsite or dotlrn instance) so it should never return more than one element. + set subsite_node_id [site_node::get_node_id -url $info(subsite_url)] set info(package_id) [site_node::get_children \ - -package_key [package_key] \ + -package_key $package_key \ -element package_id \ -node_id $subsite_node_id] - - + if { [llength $info(package_id)] > 1 } { - + # Get the latest curriculum instance that was mounted. - set package_id [db_string max_curriculum_id {*SQL*}] - set node_id [site_node::get_node_id_from_object_id -object_id $package_id] + set latest_package_id [db_string max_curriculum_package_id {*SQL*}] + set node_id [site_node::get_node_id_from_object_id -object_id $latest_package_id] set export_vars [export_vars -url { node_id { confirm_p 1 } }] - + set delete_url "/admin/applications/application-delete?$export_vars" - + ad_return_error "[_ curriculum.lt_More_than_one_instanc]" "[_ curriculum.lt_Please_delete_the_ext]" - + ad_script_abort } - - set package_node_id [site_node::get_node_id_from_object_id -object_id $info(package_id)] - - set info(package_url) [site_node::get_url -node_id $package_node_id] - + + set info(package_url) [site_node::get_url_from_object_id -object_id $info(package_id)] + return [array get info] } -# FIXME. It would be awesome if this could go! -ad_proc -private curriculum::get_package_id_from_subsite_id { - -subsite_id:required -} { - # This call is what prevents us from mounting several curriculum instances - # per subsite ... Maybe that could be amended? - - set package_key [package_key] - - if { [catch { - set package_id [site_node_apm_integration::get_child_package_id \ - -package_id $subsite_id -package_key $package_key] - } errmsg] } { - - # Get the latest curriculum instance that was mounted. - set package_id [db_string max_curriculum_id {*SQL*}] - - set node_id [site_node::get_node_id_from_object_id -object_id $package_id] - - ad_return_error "[_ curriculum.lt_Could_not_get_child_p]" \ - "[_ curriculum.lt_This_could_be_because] -

-[_ curriculum.lt_Here_is_what_the_data] -

-$errmsg" - ad_script_abort - - } else { - - return $package_id - } -} - - ##### # # Cached curriculum info procs @@ -635,27 +602,25 @@ ad_proc -public curriculum::curriculum_filter { conn - args + package_id why } { - We run this filter on registered urls in conjunction with - "curriculum_bar" which gets called from the default-master. + We run this filter on registered url patterns for GETs in conjunction + with "curriculum_bar" which gets called from the default-master. This will run after a registered url has been served. } { # We don't want an error in the script to interrupt page service - if { [catch { curriculum_filter_internal $args $why } errmsg] } { - ns_log Error "curriculum::curriculum_filter_internal coughed up $errmsg" + if { [catch { curriculum_filter_internal -package_id $package_id } errmsg] } { + ns_log Error "\"curriculum::curriculum_filter_internal -package_id $package_id\" coughed up: $errmsg" } - + return "filter_ok" } ad_proc -private curriculum::curriculum_filter_internal { - args - why + -package_id:required } { - set package_id [conn package_id] set cookie_name [get_cookie_name -package_id $package_id] set cookie [ad_get_cookie $cookie_name] @@ -674,7 +639,6 @@ # to curriculums to consider adding to cookie. set list_of_lists [curriculum::enabled_elements_memoized -package_id $package_id] set current_url [ad_conn url] - # Check for query vars. URL decode the vars here if they exist, and do the same # when we compare current_url to the element URLs to ensure consistency ... if { ![empty_string_p [set query_vars [ad_conn query]]] } { Index: openacs-4/packages/curriculum/tcl/misc-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/curriculum/tcl/misc-procs.xql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/curriculum/tcl/misc-procs.xql 17 Oct 2003 13:43:30 -0000 1.2 +++ openacs-4/packages/curriculum/tcl/misc-procs.xql 5 Jul 2004 14:07:21 -0000 1.3 @@ -28,7 +28,7 @@ - + select max(package_id) from apm_packages Index: openacs-4/packages/curriculum/www/doc/admin.html =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/curriculum/www/doc/admin.html,v diff -u -r1.3 -r1.4 --- openacs-4/packages/curriculum/www/doc/admin.html 11 Dec 2003 21:40:01 -0000 1.3 +++ openacs-4/packages/curriculum/www/doc/admin.html 5 Jul 2004 14:07:21 -0000 1.4 @@ -88,7 +88,12 @@ >

# Curriculum bar
-set curriculum_bar_p [llength [site_node::get_children -all -filters { package_key "curriculum" } -node_id $subsite_node_id]]