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.32 -r1.33 --- openacs-4/packages/curriculum-central/catalog/curriculum-central.en_US.ISO-8859-1.xml 23 Jan 2006 10:38:46 -0000 1.32 +++ openacs-4/packages/curriculum-central/catalog/curriculum-central.en_US.ISO-8859-1.xml 24 Jan 2006 06:31:14 -0000 1.33 @@ -2,6 +2,10 @@ UoS + Status: Modified + Status: Published + Publish + Stream overview has been published. Stream Overview Enter a name for a school year. Eg Year 1. Select UoS to map to the %stream_name% degree stream. 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 -r1.2 -r1.3 --- openacs-4/packages/curriculum-central/www/coordinate/stream-map-ae-postgresql.xql 23 Jan 2006 10:38:47 -0000 1.2 +++ openacs-4/packages/curriculum-central/www/coordinate/stream-map-ae-postgresql.xql 24 Jan 2006 06:31:14 -0000 1.3 @@ -20,14 +20,6 @@ - - - SELECT latest_revision_id FROM cc_stream_uos_map - WHERE map_id = :map_id - - - - SELECT cc_stream_uos_map_rev__new ( @@ -47,11 +39,4 @@ - - - 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 -r1.2 -r1.3 --- openacs-4/packages/curriculum-central/www/coordinate/stream-map-ae.tcl 23 Jan 2006 10:38:47 -0000 1.2 +++ openacs-4/packages/curriculum-central/www/coordinate/stream-map-ae.tcl 24 Jan 2006 06:31:14 -0000 1.3 @@ -100,24 +100,15 @@ [list no_longer_offered_ids $no_longer_offered_ids] \ [list object_type "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 latest_revision_id [db_exec_plsql new_revision {}] - - # Make the new revision the live revision - content::item::set_live_revision -revision_id $latest_revision_id - db_dml set_live_revision {} - + db_exec_plsql new_revision {} + } -after_submit { ad_returnredirect $return_url ad_script_abort Index: openacs-4/packages/curriculum-central/www/coordinate/stream-publish-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/curriculum-central/www/coordinate/stream-publish-postgresql.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/curriculum-central/www/coordinate/stream-publish-postgresql.xql 24 Jan 2006 06:31:14 -0000 1.1 @@ -0,0 +1,17 @@ + + + + postgresql7.4 + + + + UPDATE cc_stream_uos_map + SET live_revision_id = (SELECT latest_revision_id + FROM cc_stream_uos_map + WHERE map_id = :map_id AND stream_id = :stream_id) + WHERE map_id = :map_id + AND stream_id = :stream_id + + + + Index: openacs-4/packages/curriculum-central/www/coordinate/stream-publish.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/curriculum-central/www/coordinate/stream-publish.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/curriculum-central/www/coordinate/stream-publish.tcl 24 Jan 2006 06:31:14 -0000 1.1 @@ -0,0 +1,26 @@ +ad_page_contract { + This page takes a list of modified stream-to-uos maps, identified + by the corresponding map_ids. Each mapping instance is updated + so that the latest revision becomes the live revision. + + @author Nick Carroll (nick.c@rroll.net) + @creation-date 2005-11-15 + @cvs-id $Id: stream-publish.tcl,v 1.1 2006/01/24 06:31:14 ncarroll Exp $ +} { + stream_id:integer + modified_list +} + +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 +} + +foreach map_id $modified_list { + db_dml publish {} +} + +ad_returnredirect -message [_ curriculum-central.stream_overview_has_been_published] [export_vars -base stream-view {stream_id}] 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 -r1.1 -r1.2 --- openacs-4/packages/curriculum-central/www/coordinate/stream-view-postgresql.xql 23 Jan 2006 10:38:47 -0000 1.1 +++ openacs-4/packages/curriculum-central/www/coordinate/stream-view-postgresql.xql 24 Jan 2006 06:31:14 -0000 1.2 @@ -6,7 +6,8 @@ SELECT map.map_id, uos.uos_code, uos.uos_name, uos.uos_id, - rev.year_id, y.name, rev.semester_ids + rev.year_id, y.name, rev.semester_ids, map.live_revision_id, + map.latest_revision_id 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 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 -r1.2 -r1.3 --- openacs-4/packages/curriculum-central/www/coordinate/stream-view.adp 23 Jan 2006 12:36:17 -0000 1.2 +++ openacs-4/packages/curriculum-central/www/coordinate/stream-view.adp 24 Jan 2006 06:31:14 -0000 1.3 @@ -5,8 +5,15 @@ +
+ +#curriculum-central.status_modified# | #curriculum-central.publish# + + +#curriculum-central.status_published# + +
-
    @@ -16,7 +23,7 @@
  • @stream.semester_name@
  • 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 -r1.2 -r1.3 --- openacs-4/packages/curriculum-central/www/coordinate/stream-view.tcl 23 Jan 2006 12:36:17 -0000 1.2 +++ openacs-4/packages/curriculum-central/www/coordinate/stream-view.tcl 24 Jan 2006 06:31:14 -0000 1.3 @@ -31,6 +31,12 @@ template::multirow create stream map_id year_id year_name \ semester_id semester_name uos_id uos_code uos_name group edit_url +# Set the modified state to 0 by default. This means the stream +# overview has been published. The state will be toggled below when +# we find a UoS mapping that has been modified. +set modified_p 0 +set modified_list [list] + foreach uos $units_of_study { set map_id [lindex $uos 0] set uos_code [lindex $uos 1] @@ -39,7 +45,17 @@ set year_id [lindex $uos 4] set year_name [lindex $uos 5] set semester_ids [lindex $uos 6] + set live_revision_id [lindex $uos 7] + set latest_revision_id [lindex $uos 8] + # If there is no live revision or that the live revision and + # latest revision IDs are different, then set modified flag to 1. + if { $live_revision_id eq "" || \ + $live_revision_id ne $latest_revision_id } { + set modified_p "1" + lappend modified_list $map_id + } + foreach semester_id $semester_ids { # Get name for semester_id set semester_name [db_string semester_name {} -default ""] @@ -60,6 +76,8 @@ } } +set publish_url [export_vars -base stream-publish {stream_id modified_list}] + # Sort stream info by increasing year and semester. template::multirow sort stream -increasing year_id semester_id