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 -N -r1.31 -r1.32 --- openacs-4/packages/curriculum-central/catalog/curriculum-central.en_US.ISO-8859-1.xml 22 Jan 2006 08:43:15 -0000 1.31 +++ openacs-4/packages/curriculum-central/catalog/curriculum-central.en_US.ISO-8859-1.xml 23 Jan 2006 10:38:46 -0000 1.32 @@ -2,10 +2,11 @@ UoS + Stream Overview Enter a name for a school year. Eg Year 1. Select UoS to map to the %stream_name% degree stream. - Select the Semesters that this UoS is offered. Note: You can select multiple entries by holding down the CTRL key whilst selecting. - Select the Years that this UoS is offered. Note: You can select multiple entries by holding down the CTRL key whilst selecting. + Select the semesters that this UoS is offered. Note: You can select multiple entries by holding down the CTRL key whilst selecting. + Select the year that this UoS is offered. Select prerequisite UoS for the mapped UoS. Note: You can select multiple entries by holding down the CTRL key whilst selecting. Select assumed knowledge for the mapped UoS. Note: You can select multiple entries by holding down the CTRL key whilst selecting. Select co-requisites for the mapped UoS. Note: You can select multiple entries by holding down the CTRL key whilst selecting. Index: openacs-4/packages/curriculum-central/sql/postgresql/stream-uos-map-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/curriculum-central/sql/postgresql/stream-uos-map-create.sql,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/curriculum-central/sql/postgresql/stream-uos-map-create.sql 22 Jan 2006 08:43:15 -0000 1.1 +++ openacs-4/packages/curriculum-central/sql/postgresql/stream-uos-map-create.sql 23 Jan 2006 10:38:47 -0000 1.2 @@ -54,7 +54,7 @@ constraint cc_stream_uos_map_rev_rev_id_fk references cr_revisions(revision_id) on delete cascade, - year_ids varchar(256), + year_id integer, semester_ids varchar(256), prerequisite_ids varchar(256), assumed_knowledge_ids varchar(256), @@ -75,13 +75,13 @@ ); -select define_function_args('cc_stream_uos_map__new', 'map_id,stream_id,uos_id,year_ids,semester_ids,prerequisite_ids,assumed_knowledge_ids,corequisite_ids,prohibition_ids,no_longer_offered_ids,creation_user,creation_ip,context_id,item_subtype;cc_stream_uos_map,content_type;cc_stream_uos_map_rev,object_type,package_id'); +select define_function_args('cc_stream_uos_map__new', 'map_id,stream_id,uos_id,year_id,semester_ids,prerequisite_ids,assumed_knowledge_ids,corequisite_ids,prohibition_ids,no_longer_offered_ids,creation_user,creation_ip,context_id,item_subtype;cc_stream_uos_map,content_type;cc_stream_uos_map_rev,object_type,package_id'); create function cc_stream_uos_map__new( integer, -- map_id integer, -- stream_id integer, -- uos_id - varchar, -- year_ids + integer, -- year_id varchar, -- semester_ids varchar, -- prerequisite_ids varchar, -- assumed_knowledge_ids @@ -101,7 +101,7 @@ p_map_id alias for $1; p_stream_id alias for $2; p_uos_id alias for $3; - p_year_ids alias for $4; + p_year_id alias for $4; p_semester_ids alias for $5; p_prerequisite_ids alias for $6; p_assumed_knowledge_ids alias for $7; @@ -121,15 +121,21 @@ v_revision_id integer; v_name varchar; v_rel_id integer; + v_unique_val integer; begin -- get the content folder for this instance select folder_id into v_folder_id from cc_curriculum where curriculum_id = p_package_id; -- Create a unique name - v_name := ''map_uos_'' || p_uos_id || ''_to_stream_'' || p_stream_id; + select nextval + into v_unique_val + from acs_object_id_seq; + v_name := ''map_uos_'' || p_uos_id || ''_to_stream_'' + || p_stream_id || ''_'' || v_unique_val; + -- create the content item v_map_id := content_item__new ( v_name, -- name @@ -154,7 +160,7 @@ v_revision_id := cc_stream_uos_map_rev__new ( null, -- revision_id v_map_id, -- map_id - p_year_ids, -- year_ids + p_year_id, -- year_id p_semester_ids, -- semester_ids p_prerequisite_ids, -- requisite_ids p_assumed_knowledge_ids, -- assumed_knowledge_ids @@ -196,7 +202,7 @@ create or replace function cc_stream_uos_map_rev__new ( integer, -- revision_id integer, -- map_id - varchar, -- year_ids + integer, -- year_id varchar, -- semester_ids varchar, -- prerequisite_ids varchar, -- assumed_knowledge_ids @@ -211,7 +217,7 @@ declare p_revision_id alias for $1; p_map_id alias for $2; - p_year_ids alias for $3; + p_year_id alias for $3; p_semester_ids alias for $4; p_prerequisite_ids alias for $5; p_assumed_knowledge_ids alias for $6; @@ -243,7 +249,7 @@ -- Insert into the uos-specific revision table INSERT into cc_stream_uos_map_rev ( map_rev_id, - year_ids, + year_id, semester_ids, prerequisite_ids, assumed_knowledge_ids, @@ -252,7 +258,7 @@ no_longer_offered_ids ) VALUES ( v_revision_id, - p_year_ids, + p_year_id, p_semester_ids, p_prerequisite_ids, p_assumed_knowledge_ids, Index: openacs-4/packages/curriculum-central/tcl/stream-procs-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/curriculum-central/tcl/stream-procs-postgresql.xql,v diff -u -N -r1.3 -r1.4 --- openacs-4/packages/curriculum-central/tcl/stream-procs-postgresql.xql 22 Jan 2006 08:43:15 -0000 1.3 +++ openacs-4/packages/curriculum-central/tcl/stream-procs-postgresql.xql 23 Jan 2006 10:38:47 -0000 1.4 @@ -54,12 +54,11 @@ - + SELECT uos.uos_code || ' ' ||uos.uos_name AS name, uos.uos_id FROM cc_uos uos WHERE uos.package_id = :package_id - AND uos.uos_id NOT IN (SELECT uos_id FROM cc_stream_uos_map WHERE stream_id = :stream_id) Index: openacs-4/packages/curriculum-central/tcl/stream-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/curriculum-central/tcl/stream-procs.tcl,v diff -u -N -r1.3 -r1.4 --- openacs-4/packages/curriculum-central/tcl/stream-procs.tcl 22 Jan 2006 08:43:15 -0000 1.3 +++ openacs-4/packages/curriculum-central/tcl/stream-procs.tcl 23 Jan 2006 10:38:47 -0000 1.4 @@ -168,23 +168,21 @@ } -ad_proc curriculum_central::stream::non_mapped_uos { - {-stream_id:required} +ad_proc curriculum_central::stream::all_stream_uos { {-package_id ""} } { - Returns a two-column list of the names of all UoS and their - corresponding UoS ID that have not been mapped to the given - Stream ID. + Returns a two-column list of the names of all UoS and + corresponding UoS ID for the given Stream ID. @param stream_id Stream ID. @param package_id ID of the current package instance. - @return Returns a two-column list of all UoS that have not been mapped to + @return Returns a two-column list of all UoS that have been mapped to the given Stream ID. } { if { $package_id eq ""} { set package_id [ad_conn package_id] } - return [db_list_of_lists non_mapped_uos {}] + return [db_list_of_lists all_stream_uos {}] } Index: openacs-4/packages/curriculum-central/www/coordinate/stream-map-ae-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/curriculum-central/www/coordinate/stream-map-ae-postgresql.xql,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/curriculum-central/www/coordinate/stream-map-ae-postgresql.xql 22 Jan 2006 08:43:15 -0000 1.1 +++ openacs-4/packages/curriculum-central/www/coordinate/stream-map-ae-postgresql.xql 23 Jan 2006 10:38:47 -0000 1.2 @@ -11,21 +11,29 @@ - SELECT map.uos_id, rev.year_ids, rev.semester_ids, + SELECT map.uos_id, rev.year_id, rev.semester_ids, rev.prerequisite_ids, rev.assumed_knowledge_ids, rev.corequisite_ids, rev.prohibition_ids, rev.no_longer_offered_ids FROM cc_stream_uos_map map, cc_stream_uos_map_rev rev WHERE map.map_id = :map_id - AND rev.revision_id = map.latest_revision_id + AND rev.map_rev_id = map.latest_revision_id + + + SELECT latest_revision_id FROM cc_stream_uos_map + WHERE map_id = :map_id + + + + SELECT cc_stream_uos_map_rev__new ( NULL, :map_id, - :year_ids, + :year_id, :semester_ids, :prerequisite_ids, :assumed_knowledge_ids, @@ -41,7 +49,7 @@ - UPDATE cc_stream_uos_map SET live_revision_id = :new_revision_id + UPDATE cc_stream_uos_map SET live_revision_id = :latest_revision_id WHERE map_id = :map_id Index: openacs-4/packages/curriculum-central/www/coordinate/stream-map-ae.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/curriculum-central/www/coordinate/stream-map-ae.tcl,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/curriculum-central/www/coordinate/stream-map-ae.tcl 22 Jan 2006 08:43:15 -0000 1.1 +++ openacs-4/packages/curriculum-central/www/coordinate/stream-map-ae.tcl 23 Jan 2006 10:38:47 -0000 1.2 @@ -43,77 +43,79 @@ {label "[_ curriculum-central.uos]"} {value "[curriculum_central::uos::get_pretty_name -uos_id $uos_id]"} } - {year_ids:text(multiselect) + {year_id:text(select) {label "[_ curriculum-central.years]"} {options "[curriculum_central::stream::years_for_uos_get_options -stream_id $stream_id]"} - {html {size 5}} {help_text "[_ curriculum-central.help_select_years_that_uos_is_offered]"} } - {semester_ids:text(multiselect) + {semester_ids:text(multiselect),multiple {label "[_ curriculum-central.semesters]"} {options "[curriculum_central::stream::semesters_in_a_year_get_options -stream_id $stream_id]"} {html {size 5}} {help_text "[_ curriculum-central.help_select_semesters_that_uos_is_offered]"} } - {prerequisite_ids:text(multiselect) + {prerequisite_ids:text(multiselect),multiple {label "[_ curriculum-central.prerequisites]"} {options $requisite_uos_options} {html {size 5}} {help_text "[_ curriculum-central.help_select_prerequisites_for_uos]"} } - {assumed_knowledge_ids:text(multiselect) + {assumed_knowledge_ids:text(multiselect),multiple {label "[_ curriculum-central.assumed_knowledge]"} {options $requisite_uos_options} {html {size 5}} {help_text "[_ curriculum-central.help_select_assumed_knowledge_for_uos]"} } - {corequisite_ids:text(multiselect) + {corequisite_ids:text(multiselect),multiple {label "[_ curriculum-central.corequisites]"} {options $requisite_uos_options} {html {size 5}} {help_text "[_ curriculum-central.help_select_corequisites_for_uos]"} } - {prohibition_ids:text(multiselect) + {prohibition_ids:text(multiselect),multiple {label "[_ curriculum-central.prohibitions]"} {options $requisite_uos_options} {html {size 5}} {help_text "[_ curriculum-central.help_select_prohibitions_for_uos]"} } - {no_longer_offered_ids:text(multiselect) + {no_longer_offered_ids:text(multiselect),multiple {label "[_ curriculum-central.no_longer_offered]"} {options $requisite_uos_options} {html {size 5}} {help_text "[_ curriculum-central.help_select_uos_no_longer_offered]"} } - } -select_query_name { - form_info - } -new_data { + } -select_query_name {form_info} -new_data { # Create new CR object - package_instantiate_object \ + set map_id [package_instantiate_object \ -var_list [list \ [list package_id $package_id] \ [list stream_id $stream_id] \ [list uos_id $uos_id] \ - [list year_ids $year_ids] \ + [list year_id $year_id] \ [list semester_ids $semester_ids] \ [list prerequisite_ids $prerequisite_ids] \ [list assumed_knowledge_ids $assumed_knowledge_ids] \ [list corequisite_ids $corequisite_ids] \ [list prohibition_ids $prohibition_ids] \ [list no_longer_offered_ids $no_longer_offered_ids] \ [list object_type "cc_stream_uos_map"]] \ - "cc_stream_uos_map" + "cc_stream_uos_map"] + + # Set the latest revision as the live revision. + db_1row get_latest_revision {} + content::item::set_live_revision -revision_id $latest_revision_id + db_dml set_live_revision {} } -edit_data { set modifying_user [ad_conn user_id] set modifying_ip [ad_conn peeraddr] # Create new revision - set new_revision_id [db_exec_plsql new_revision {}] + set latest_revision_id [db_exec_plsql new_revision {}] # Make the new revision the live revision - content::item::set_live_revision -revision_id $new_revision_id + content::item::set_live_revision -revision_id $latest_revision_id db_dml set_live_revision {} } -after_submit { @@ -131,7 +133,7 @@ {return_url:text(hidden) {value $return_url}} {uos_id:integer(select) {label "[_ curriculum-central.uos]"} - {options "[curriculum_central::stream::non_mapped_uos -stream_id $stream_id]"} + {options "[curriculum_central::stream::all_stream_uos]"} {help_text "[_ curriculum-central.help_select_uos_to_map]"} {mode edit} } Index: openacs-4/packages/curriculum-central/www/coordinate/stream-view-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/curriculum-central/www/coordinate/stream-view-postgresql.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/curriculum-central/www/coordinate/stream-view-postgresql.xql 23 Jan 2006 10:38:47 -0000 1.1 @@ -0,0 +1,31 @@ + + + + postgresql7.4 + + + + SELECT map.map_id, uos.uos_code, uos.uos_name, uos.uos_id, + rev.year_id, y.name, rev.semester_ids + FROM cc_uos uos, cc_stream_uos_map map, cc_stream_uos_map_rev rev, + cc_year y + WHERE uos.uos_id = map.uos_id + AND map.stream_id = :stream_id + AND map.latest_revision_id = rev.map_rev_id + AND rev.year_id = y.year_id + + + + + + SELECT cc_stream__name(:stream_id) + + + + + + SELECT cc_semester__name(:semester_id) + + + + Index: openacs-4/packages/curriculum-central/www/coordinate/stream-view.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/curriculum-central/www/coordinate/stream-view.adp,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/curriculum-central/www/coordinate/stream-view.adp 23 Jan 2006 10:38:47 -0000 1.1 @@ -0,0 +1,13 @@ + +@page_title;noquote@ +@context;noquote@ + + +@stream.year_name@
+ +@stream.semester_name@
+ +@stream.uos_code@ @stream.uos_name@

+ + + \ No newline at end of file Index: openacs-4/packages/curriculum-central/www/coordinate/stream-view.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/curriculum-central/www/coordinate/stream-view.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/curriculum-central/www/coordinate/stream-view.tcl 23 Jan 2006 10:38:47 -0000 1.1 @@ -0,0 +1,55 @@ +ad_page_contract { + Displays a list of streams that the stream coordinator is responsible + for. + + @author Nick Carroll (nick.c@rroll.net) + @creation-date 2005-11-15 + @cvs-id $Id: stream-view.tcl,v 1.1 2006/01/23 10:38:47 ncarroll Exp $ +} { + stream_id:integer +} + +set stream_name [db_string stream_name {} -default ""] + +set page_title "[_ curriculum-central.stream_overview]: $stream_name" +set context [list [list . [_ curriculum-central.coordinate]] \ + [_ curriculum-central.stream_overview]] +set package_id [ad_conn package_id] +set user_id [ad_conn user_id] + +# Only stream coordinators can develop a stream. +if { ![curriculum_central::staff::stream_coordinator_p $user_id] } { + ad_returnredirect -message [_ curriculum-central.only_stream_coordinators_can_develop_a_stream] index +} + +# Get stream years. +# Get semesters in a year. +# Get mapped revisions + +set units_of_study [db_list_of_lists units_of_study {}] + +template::multirow create stream map_id year_id year_name \ + semester_id semester_name uos_id uos_code uos_name + +foreach uos $units_of_study { + set map_id [lindex $uos 0] + set uos_code [lindex $uos 1] + set uos_name [lindex $uos 2] + set uos_id [lindex $uos 3] + set year_id [lindex $uos 4] + set year_name [lindex $uos 5] + set semester_ids [lindex $uos 6] + + foreach semester_id $semester_ids { + # Get name for semester_id + set semester_name [db_string semester_name {} -default ""] + + template::multirow append stream $map_id $year_id $year_name \ + $semester_id $semester_name $uos_id $uos_code $uos_name + } +} + +# Sort stream info by increasing year and semester. +template::multirow sort stream -increasing year_id semester_id + +ad_return_template Index: openacs-4/packages/curriculum-central/www/coordinate/streams.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/curriculum-central/www/coordinate/streams.tcl,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/curriculum-central/www/coordinate/streams.tcl 22 Jan 2006 08:43:15 -0000 1.1 +++ openacs-4/packages/curriculum-central/www/coordinate/streams.tcl 23 Jan 2006 10:38:47 -0000 1.2 @@ -30,6 +30,7 @@ } stream_name { label "#curriculum-central.stream_name#" + link_url_eval {[export_vars -base stream-view { stream_id }]} } stream_code { label "#curriculum-central.stream_code#"