Index: openacs-4/packages/curriculum-central/catalog/curriculum-central.en_US.ISO-8859-1.xml =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/curriculum-central/catalog/curriculum-central.en_US.ISO-8859-1.xml,v diff -u -r1.44 -r1.45 --- openacs-4/packages/curriculum-central/catalog/curriculum-central.en_US.ISO-8859-1.xml 20 Feb 2006 09:40:38 -0000 1.44 +++ openacs-4/packages/curriculum-central/catalog/curriculum-central.en_US.ISO-8859-1.xml 22 Feb 2006 06:28:37 -0000 1.45 @@ -2,6 +2,7 @@ UoS + Notification Requisites View Key The varying colours convey the different requisites for the selected Unit of Study. A white Unit of Study box indicates that the Unit of Study does not affect the selected Unit of Study. Index: openacs-4/packages/curriculum-central/tcl/curriculum-central-procs-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/curriculum-central/tcl/curriculum-central-procs-postgresql.xql,v diff -u -r1.3 -r1.4 --- openacs-4/packages/curriculum-central/tcl/curriculum-central-procs-postgresql.xql 12 Jan 2006 07:15:23 -0000 1.3 +++ openacs-4/packages/curriculum-central/tcl/curriculum-central-procs-postgresql.xql 22 Feb 2006 06:28:38 -0000 1.4 @@ -70,4 +70,24 @@ + + + SELECT name FROM cc_session + WHERE session_id = :session_id + AND package_id = :package_id + + + + + + SELECT gan.name + FROM cc_uos_gradattr_name gan, cc_uos_gradattr_map gam, + cc_uos_gradattr ga, cc_uos_gradattr_set gas + WHERE gas.parent_uos_id = :uos_id + AND gas.latest_revision_id = gam.revision_id + AND gam.gradattr_id = ga.gradattr_id + AND ga.name_id = gan.name_id + + + Index: openacs-4/packages/curriculum-central/tcl/curriculum-central-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/curriculum-central/tcl/curriculum-central-procs.tcl,v diff -u -r1.13 -r1.14 --- openacs-4/packages/curriculum-central/tcl/curriculum-central-procs.tcl 22 Jan 2006 08:43:15 -0000 1.13 +++ openacs-4/packages/curriculum-central/tcl/curriculum-central-procs.tcl 22 Feb 2006 06:28:38 -0000 1.14 @@ -214,3 +214,71 @@ return [concat $export_vars $extra_vars] } + + +ad_proc curriculum_central::join_sessions { + {-session_ids:required} + {-separator ", "} +} { + Retrieve the names that match each session ID, and join the names + using the given separator. + + @param session_ids A list of session IDs. + @param separator Specify a separator that will be used to join the + session names together. Uses a comma by default. +} { + set package_id [ad_conn package_id] + set session_names [list] + + foreach session_id $session_ids { + lappend session_names [db_string session_name {} -default ""] + } + + return [join $session_names $separator] +} + + +ad_proc curriculum_central::join_staff { + {-staff_ids:required} + {-separator ", "} +} { + Retrieve the names that match each staff ID, and join the names + using the given separator. + + @param staff_ids A list of staff IDs. + @param separator Specify a separator that will be used to join the + staff names together. Uses a comma by default. +} { + set package_id [ad_conn package_id] + set staff_names [list] + + foreach staff_id $staff_ids { + lappend staff_names \ + [curriculum_central::staff::pretty_name $staff_id] + } + + return [join $staff_names $separator] +} + + +ad_proc curriculum_central::join_graduate_attributes { + {-uos_id:required} + {-separator ", "} +} { + Retrieve the graduate attribute names for the given UoS ID, and join + the names using the given separator. + + @param uos_id UoS ID to retrieve graduate attributes for. + @param separator Specify a separator that will be used to join the + graduate_attribute names together. Uses a comma by default. +} { + set package_id [ad_conn package_id] + set ga_names [list] + + db_foreach ga_name {} { + lappend ga_names $name + + } + + return [join $ga_names $separator] +} Index: openacs-4/packages/curriculum-central/tcl/uos-procs-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/curriculum-central/tcl/uos-procs-postgresql.xql,v diff -u -r1.21 -r1.22 --- openacs-4/packages/curriculum-central/tcl/uos-procs-postgresql.xql 9 Feb 2006 11:41:37 -0000 1.21 +++ openacs-4/packages/curriculum-central/tcl/uos-procs-postgresql.xql 22 Feb 2006 06:28:38 -0000 1.22 @@ -231,6 +231,7 @@ SELECT DISTINCT coordinator_id FROM cc_stream WHERE package_id = :package_id + AND department_id = :department_id @@ -682,4 +683,20 @@ + + + SELECT uosr.credit_value, uosr.session_ids, dept.department_name, + dr.lecturer_ids, dr.tutor_ids, dr.objectives, + dr.learning_outcomes, dr.syllabus, dr.relevance, + dr.online_course_content, dr.note + FROM cc_uos_revisions uosr, cr_items cr, cc_department dept, + cc_uos_detail d, cc_uos_detail_revisions dr + WHERE cr.item_id = :object_id + AND uosr.uos_revision_id = cr.latest_revision + AND dept.department_id = uosr.department_id + AND d.parent_uos_id = :object_id + AND d.latest_revision_id = dr.detail_revision_id + + + Index: openacs-4/packages/curriculum-central/tcl/uos-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/curriculum-central/tcl/uos-procs.tcl,v diff -u -r1.28 -r1.29 --- openacs-4/packages/curriculum-central/tcl/uos-procs.tcl 9 Feb 2006 11:41:37 -0000 1.28 +++ openacs-4/packages/curriculum-central/tcl/uos-procs.tcl 22 Feb 2006 06:28:38 -0000 1.29 @@ -367,12 +367,51 @@ -no_longer_offered_ids $no_longer_offered_ids \ -activity_log $activity_log ] - array set assign_array [list unit_coordinator $unit_coordinator_id] + # Get a list of stream coordinator IDs. + # All stream coordinators for the given department_id + # are assigned to the workflow case. + set stream_coordinator_ids [db_list get_stream_coordinator_ids {}] + set notify_user_ids [list] + lappend notify_user_ids $stream_coordinator_ids + # Add the unit coordinator for notifications, if they + # are not a stream coordinator for the given department. + if { [lsearch -exact $notify_user_ids $unit_coordinator_id] == -1 } { + lappend notify_user_ids $unit_coordinator_id + } + + # Initiate notifications + set type_id [notification::type::get_type_id \ + -short_name "workflow_case"] + + set request_id [notification::request::get_request_id \ + -type_id $type_id \ + -object_id $uos_id \ + -user_id $user_id] + + set delivery_method_id \ + [notification::get_delivery_method_id -name "email"] + + set interval_id \ + [notification::interval::get_id_from_name -name "instant"] + + foreach notify_user_id $notify_user_ids { + notification::request::new \ + -request_id $request_id \ + -type_id $type_id \ + -user_id $notify_user_id \ + -object_id $uos_id \ + -interval_id $interval_id \ + -delivery_method_id $delivery_method_id + } + + # Initiate the workflow case. set workflow_id [workflow::get_id \ -object_id $package_id \ -short_name [workflow_short_name]] + array set assign_array [list unit_coordinator $unit_coordinator_id] + # Create a new workflow case for the given UoS. set case_id [workflow::case::new \ -workflow_id $workflow_id \ @@ -384,17 +423,14 @@ # Get the role_id for the stream coordinator role. - set role_id [workflow::role::get_id -workflow_id $workflow_id \ - -short_name stream_coordinator] - - # Get a list of stream coordinator IDs. - # All stream coordinators are assigned the role of stream coordinator - # for all Units of Study. - set stream_coordinator_ids [db_list get_stream_coordinator_ids {}] + set stream_coordinator_role_id [workflow::role::get_id \ + -workflow_id $workflow_id \ + -short_name stream_coordinator] # Assign the stream coordinators workflow::case::role::assignee_insert -case_id $case_id \ - -role_id $role_id -party_ids $stream_coordinator_ids -replace + -role_id $stream_coordinator_role_id \ + -party_ids $stream_coordinator_ids -replace return $uos_id } @@ -1469,23 +1505,64 @@ return "[_ curriculum-central.uos_info]" } -# TODO: Finish off this proc properly. + ad_proc -private curriculum_central::uos::notification_info::get_notification_info { case_id object_id } { - # TODO: Fix URL - # set url "[ad_url][apm_package_url_from_id $bug(project_id)]bug? - # [export_vars { { bug_number $bug(bug_number) } }]" - set url "[ad_url]" - set one_line "UoS" + set package_id [ad_conn package_id] + set url "[ad_url][apm_package_url_from_id $package_id]coordinate/uos-edit?[export_vars { {uos_id $object_id} }]" + set one_line [curriculum_central::uos::get_pretty_name -uos_id $object_id] + set details_list [list] - lappend details_list "label" "value" + + if { [db_0or1row uos_details {}] } { + lappend details_list [_ curriculum-central.credit_value] $credit_value + lappend details_list [_ curriculum-central.department] $department_name + lappend details_list [_ curriculum-central.sessions] \ + [curriculum_central::join_sessions -session_ids $session_ids] - set notification_subject_tag "Notification Subject Tag" + lappend details_list [_ curriculum-central.lecturers] \ + [curriculum_central::join_staff -staff_ids $lecturer_ids] + lappend details_list [_ curriculum-central.tutors] \ + [curriculum_central::join_staff -staff_ids $tutor_ids] + + lappend details_list [_ curriculum-central.aims_and_objectives] \ + [template::util::richtext::get_property text $objectives] + + lappend details_list [_ curriculum-central.learning_outcomes] \ + [template::util::richtext::get_property text $learning_outcomes] + + lappend details_list [_ curriculum-central.syllabus] \ + [template::util::richtext::get_property text $syllabus] + + lappend details_list [_ curriculum-central.relevance] \ + [template::util::richtext::get_property text $relevance] + + lappend details_list [_ curriculum-central.online_course_content] \ + $online_course_content + + lappend details_list [_ curriculum-central.graduate_attributes] \ + [curriculum_central::join_graduate_attributes \ + -uos_id $object_id] + + lappend details_list [_ curriculum-central.note] \ + [template::util::richtext::get_property text $note] + } + + + # Learning Outcomes + # Syllabus + # Relevance + # Online Course Content + # Graduate attributes + # Note + + set notification_subject_tag [_ curriculum-central.notification] + return [list $url $one_line $details_list $notification_subject_tag] }