Index: openacs-4/packages/curriculum/www/admin/curriculum-ave.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/curriculum/www/admin/curriculum-ave.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/curriculum/www/admin/curriculum-ave.adp 3 Jun 2003 10:32:38 -0000 1.1 @@ -0,0 +1 @@ + Index: openacs-4/packages/curriculum/www/admin/curriculum-delete.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/curriculum/www/admin/curriculum-delete.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/curriculum/www/admin/curriculum-delete.tcl 3 Jun 2003 10:32:38 -0000 1.1 @@ -0,0 +1,20 @@ +ad_page_contract { + + Delete a curriculum. + + @author Ola Hansson (ola@polyxena.net) + @creation-date 2003-06-03 + @cvs-id $Id: curriculum-delete.tcl,v 1.1 2003/06/03 10:32:38 olah Exp $ + +} { + curriculum_id:integer,notnull +} + +curriculum::delete -curriculum_id $curriculum_id + +# Force the curriculum bar to reflect the reality. +# Not needed since we do this when we disable a curriculum, +# which we always do before we delete it. +#curriculum::elements_flush + +ad_returnredirect "." Index: openacs-4/packages/curriculum/www/admin/curriculum-swap.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/curriculum/www/admin/curriculum-swap.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/curriculum/www/admin/curriculum-swap.tcl 3 Jun 2003 10:32:38 -0000 1.1 @@ -0,0 +1,38 @@ +ad_page_contract { + + Swaps two sort keys for two curriculums, sort_order and new_sort_order. + + @creation-date 2003-06-03 + @author Ola Hansson (ola@polyxena.net) + @cvs-id $Id: curriculum-swap.tcl,v 1.1 2003/06/03 10:32:38 olah Exp $ + +} { + sort_order:integer,notnull + direction:notnull +} + +set package_id [curriculum::conn package_id] + +permission::require_permission -object_id $package_id \ + -privilege write + +db_transaction { + + if { [string equal "up" $direction] } { + set new_sort_order [db_string prior_sort_order {*SQL*}] + } else { + # Assume the direction is "down". + set new_sort_order [db_string next_sort_order {*SQL*}] + } + + # For some reason the PG driver couldn't handle bind vars for all the + # vars in "curriculum-swap.xql". I therefore left a couple of $s in there. + + db_dml swap_sort_orders {*SQL*} + + # Force the curriculum bar to reflect the reality. + curriculum::elements_flush + +} + +ad_returnredirect "." Index: openacs-4/packages/curriculum/www/admin/curriculum-swap.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/curriculum/www/admin/curriculum-swap.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/curriculum/www/admin/curriculum-swap.xql 3 Jun 2003 10:32:38 -0000 1.1 @@ -0,0 +1,41 @@ + + + + + + + + select max(sort_key) + from cu_curriculums + where package_id = :package_id + and sort_key < :sort_order + + + + + + + + select min(sort_key) + from cu_curriculums + where package_id = :package_id + and sort_key > :sort_order + + + + + + + + update cu_curriculums + set sort_key = case when sort_key = :sort_order + then $new_sort_order + when sort_key = :new_sort_order + then $sort_order end + where package_id = :package_id + and sort_key in (:sort_order, :new_sort_order) + + + + + Index: openacs-4/packages/curriculum/www/admin/element-ave.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/curriculum/www/admin/element-ave.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/curriculum/www/admin/element-ave.adp 3 Jun 2003 10:32:38 -0000 1.1 @@ -0,0 +1 @@ + Index: openacs-4/packages/curriculum/www/admin/element-delete.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/curriculum/www/admin/element-delete.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/curriculum/www/admin/element-delete.tcl 3 Jun 2003 10:32:38 -0000 1.1 @@ -0,0 +1,19 @@ +ad_page_contract { + + delete (archive) curriculum element + + @author Ola Hansson (ola@polyxena.net) + @creation-date 2003-06-03 + @cvs-id $Id: element-delete.tcl,v 1.1 2003/06/03 10:32:38 olah Exp $ + +} { + element_id:integer,notnull +} + +curriculum::element::delete -element_id $element_id + +# Force the curriculum bar to reflect the reality. +# Not needed because we do this when we disable an element. +#curriculum::elements_flush + +ad_returnredirect "." Index: openacs-4/packages/curriculum/www/admin/element-disable.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/curriculum/www/admin/element-disable.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/curriculum/www/admin/element-disable.tcl 3 Jun 2003 10:32:38 -0000 1.1 @@ -0,0 +1,18 @@ +ad_page_contract { + + disable (archive) curriculum element + + @author Ola Hansson (ola@polyxena.net) + @creation-date 2003-06-03 + @cvs-id $Id: element-disable.tcl,v 1.1 2003/06/03 10:32:38 olah Exp $ + +} { + element_id:integer,notnull +} + +curriculum::element::disable -element_id $element_id + +# Force the curriculum bar to reflect the reality. +curriculum::elements_flush + +ad_returnredirect "." Index: openacs-4/packages/curriculum/www/admin/element-enable.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/curriculum/www/admin/element-enable.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/curriculum/www/admin/element-enable.tcl 3 Jun 2003 10:32:38 -0000 1.1 @@ -0,0 +1,18 @@ +ad_page_contract { + + enable (activate) curriculum element + + @author Ola Hansson (ola@polyxena.net) + @creation-date 2003-06-03 + @cvs-id $Id: element-enable.tcl,v 1.1 2003/06/03 10:32:38 olah Exp $ + +} { + element_id:integer,notnull +} + +curriculum::element::enable -element_id $element_id + +# Force the curriculum bar to reflect the reality. +curriculum::elements_flush + +ad_returnredirect "." Index: openacs-4/packages/curriculum/www/admin/element-swap.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/curriculum/www/admin/element-swap.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/curriculum/www/admin/element-swap.tcl 3 Jun 2003 10:32:38 -0000 1.1 @@ -0,0 +1,37 @@ +ad_page_contract { + + Swaps two sort keys for two elements, sort_order and new_sort_order. + + @creation-date 2003-06-03 + @author Ola Hansson (ola@polyxena.net) + @cvs-id $Id: element-swap.tcl,v 1.1 2003/06/03 10:32:38 olah Exp $ + +} { + curriculum_id:integer,notnull + sort_order:integer,notnull + direction:notnull +} + +permission::require_permission -object_id $curriculum_id \ + -privilege write + +db_transaction { + + if { [string equal "up" $direction] } { + set new_sort_order [db_string prior_sort_order {*SQL*}] + } else { + # Assume the direction is "down". + set new_sort_order [db_string next_sort_order {*SQL*}] + } + + # For some reason the PG driver couldn't handle bind vars for all the + # vars in "element-swap.xql". I therefore left a couple of $s in there. + + db_dml swap_sort_orders {*SQL*} + + # Force the curriculum bar to reflect the reality. + curriculum::elements_flush + +} + +ad_returnredirect "." Index: openacs-4/packages/curriculum/www/admin/element-swap.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/curriculum/www/admin/element-swap.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/curriculum/www/admin/element-swap.xql 3 Jun 2003 10:32:38 -0000 1.1 @@ -0,0 +1,41 @@ + + + + + + + + select max(sort_key) + from cu_elements + where curriculum_id = :curriculum_id + and sort_key < :sort_order + + + + + + + + select min(sort_key) + from cu_elements + where curriculum_id = :curriculum_id + and sort_key > :sort_order + + + + + + + + update cu_elements + set sort_key = case when sort_key = :sort_order + then $new_sort_order + when sort_key = :new_sort_order + then $sort_order end + where curriculum_id = :curriculum_id + and sort_key in (:sort_order, :new_sort_order) + + + + + Index: openacs-4/packages/curriculum/www/admin/index.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/curriculum/www/admin/index.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/curriculum/www/admin/index.adp 3 Jun 2003 10:32:38 -0000 1.1 @@ -0,0 +1,7 @@ + +@title@ +@context@ + + + + Index: openacs-4/packages/curriculum/www/admin/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/curriculum/www/admin/index.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/curriculum/www/admin/index.tcl 3 Jun 2003 10:32:38 -0000 1.1 @@ -0,0 +1,33 @@ +ad_page_contract { + + Curriculum admin index page. + + @author Ola Hansson (ola@polyxena.net) + @creation-date 2003-05-28 + @cvs-id $Id: index.tcl,v 1.1 2003/06/03 10:32:38 olah Exp $ + +} { +} -properties { + title:onevalue + context:onevalue +} + +set title "Curriculum" +set context {} + +# Create the tab strip that filters curriculums by workflow state. +set url [ad_conn url] + +template::tabstrip create states -base_url $url + +set workflow_id [curriculum::get_instance_workflow_id] +array set state_data [workflow::state::fsm::get_all_info -workflow_id $workflow_id] + +foreach state_id $state_data(state_ids) { + array set state $state_data($state_id) + template::tabstrip add_tab states $state(state_id) $state(pretty_name) $state(short_name) +} + +template::tabstrip add_tab states any "Any" any + +ad_return_template