Index: openacs-4/packages/curriculum/www/TEST.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/curriculum/www/Attic/TEST.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/curriculum/www/TEST.tcl 3 Jun 2003 10:40:53 -0000 1.1 @@ -0,0 +1,20 @@ +#curriculum::elements_flush + +doc_return 200 text/plain " + +curriculum_ids: [curriculum::conn -nocache curriculum_ids] \n +package_id: [curriculum::conn package_id] \n +package_id (ad_conn): [ad_conn package_id] \n +subsite_id: [curriculum::conn subsite_id] \n +package_url: [curriculum::conn package_url] \n +package_url (ad_conn): [ad_conn package_url] \n +subsite_url: [curriculum::conn subsite_url] \n +curriculum_ids: [curriculum::conn curriculum_ids] \n +curriculum_names: [curriculum::conn curriculum_names] \n +curriculum_count: [curriculum::conn curriculum_count] \n + +enabled rows:\n +[join [curriculum::enabled_elements_memoized] \n] + +" + Index: openacs-4/packages/curriculum/www/TODO.TXT =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/curriculum/www/Attic/TODO.TXT,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/curriculum/www/TODO.TXT 3 Jun 2003 10:40:53 -0000 1.1 @@ -0,0 +1,54 @@ +TODO: + +- Let the public access the curriculum-ave and element-ave + widgets, but prohibit them from adding/editing content... + Also, remove the workflow action buttons! +- When you mount a new subsite that not yet have curriculum + mounted anywhere under it, URLs in that subsite crap out + because "enabled_elements" takes a package_id param, but + "conn" just returns {} without a curriculum instance mounted. + (We should probably change to scope by subsite_id which will + always be available!) +- I believe that the sort order is wrong in the "bar query" - + or am I being fooled by a caching issue? +- Think about flushing "enabled rows" after publishing. + (maybe via a WF "side effect") +- Assignees and notifications in workflow. +- Documentation. +- Optimize bar and admin page queries (compare with the + user page query!). +- Fix desc truncation and the "more" link on index page. +- Fix question mark in the curriculum bar. +- Host problem in ext.tcl and remove-from-bar.tcl + ("hostname" vs. "localhost"). +- Deleting the curriculum package when both curriculums + and elements are created work in PG, but not on Oracle. + + +QUESTIONS: + +Q: Does "cu_user_element_map" need a curriculum_id column, + completion_date, etc? +A: Yes, to be able to delete rows representing individual + curriculums. + +Q: Register filter or proc upon adding of a subsite-external + element to bring the current bar into the picture? +A: Maybe. + + +DONE: + +- Move workflow page under /admin. +- Make published curriculums alone be displayable as bars. +- Facilitate tracking of external elements. + (click-through page and ad_httpget) +- Enable the bar to be displayed on exernal pages + (ns_httpget for instance ...). +- Create user view (index page). +- create table "cu_user_curriculum_map" so that logged in + users get to choose which curriculums to participate in. +- Add an outer join with "cu_user_curriculum_map" to the + bar and index page queries to filter out the users desired + curriculums among the published ones. +- Add scripts to add/remove desired curriculums. Index: openacs-4/packages/curriculum/www/add-to-bar.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/curriculum/www/add-to-bar.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/curriculum/www/add-to-bar.tcl 3 Jun 2003 10:40:53 -0000 1.1 @@ -0,0 +1,38 @@ +ad_page_contract { + + Curriculum add-published-curriculums-to-bar page + + @author Ola Hansson (ola@polyxena.net) + @creation-date 2003-05-31 + @cvs-id $Id: add-to-bar.tcl,v 1.1 2003/06/03 10:40:53 olah Exp $ + +} { + curriculum_id:optional + {return_url "."} +} + +set package_id [curriculum::conn package_id] + +# Adding is actually obtained by deleting one or more rows from the table +# "cu_user_curriculum_map", which holds the row(s) the user DOESN'T want. + +if { [info exists curriculum_id] } { + # Just add one particular curriculum. + set extra_where_clause { and curriculum_id = :curriculum_id } +} else { + # Add all the curriculums there is. + set extra_where_clause {} +} + +if [set user_id [ad_conn user_id]] { + + db_transaction { + db_dml add_published_curriculums_to_bar {*SQL*} + + # Force the bat to update. + curriculum::elements_flush + } + +} + +ns_returnredirect $return_url Index: openacs-4/packages/curriculum/www/add-to-bar.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/curriculum/www/add-to-bar.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/curriculum/www/add-to-bar.xql 3 Jun 2003 10:40:53 -0000 1.1 @@ -0,0 +1,13 @@ + + + + + + delete from cu_user_curriculum_map + where user_id = :user_id + and package_id = :package_id + $extra_where_clause + + + + Index: openacs-4/packages/curriculum/www/element-ave.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/curriculum/www/element-ave.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/curriculum/www/element-ave.adp 3 Jun 2003 10:40:53 -0000 1.1 @@ -0,0 +1 @@ + Index: openacs-4/packages/curriculum/www/ext.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/curriculum/www/ext.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/curriculum/www/ext.adp 3 Jun 2003 10:40:53 -0000 1.1 @@ -0,0 +1,11 @@ + +External URL: @destination_url@ +
+Return to where you were: @return_url@ +
+ +
+ +@page;noquote@ + + \ No newline at end of file Index: openacs-4/packages/curriculum/www/ext.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/curriculum/www/ext.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/curriculum/www/ext.tcl 3 Jun 2003 10:40:53 -0000 1.1 @@ -0,0 +1,55 @@ +ad_page_contract { + + Clickthrough page + + @author Ola Hansson (ola@polyxena.net) + @creation-date 2003-05-28 + @cvs-id $Id: ext.tcl,v 1.1 2003/06/03 10:40:53 olah Exp $ + +} { + element_id:integer + curriculum_id:integer + return_url +} + +set package_id [curriculum::conn package_id] + +set destination_url [db_string get_destination_url {*SQL*}] + +#### +# +# Integration with the Clickthrough package. +# +#### + +# You may want to uncomment the below if you decide to install Clickthrough. + +# The URL should be guaranteed to be external already since we were sent +# to this script, but it doesn't hurt to check again ... +#if { [string equal -length 7 "http://" $destination_url] } { +# +# set destination_url [clickthrough_href $destination_url] +#} + +set input_cookie [ad_get_cookie [curriculum::get_cookie_name]] + +if { ![empty_string_p $input_cookie] && [lsearch $input_cookie $element_id] == -1} { + + set new_cookie_value [curriculum::curriculum_progress_cookie_value \ + -package_id $package_id $input_cookie $element_id] + + ad_set_cookie [curriculum::get_cookie_name] $new_cookie_value +} + +if { [set user_id [ad_conn user_id]] } { + # FIXME. Port this query to Oracle. + db_dml insert_into_map_table {*SQL*} +} + +#ad_returnredirect $destination_url + +array set external_page [ad_httpget -url $destination_url] + +set page $external_page(page) +set status $external_page(status) +set modified $external_page(modified) Index: openacs-4/packages/curriculum/www/ext.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/curriculum/www/ext.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/curriculum/www/ext.xql 3 Jun 2003 10:40:53 -0000 1.1 @@ -0,0 +1,28 @@ + + + + + + select url + from cu_elements + where element_id = :element_id + + + + + + insert into cu_user_element_map + (user_id, element_id, curriculum_id, package_id, completion_date) + select :user_id, + :element_id, + :curriculum_id, + :package_id, + current_timestamp + where not exists + (select 1 from cu_user_element_map + where user_id = :user_id + and element_id = :element_id) + + + + Index: openacs-4/packages/curriculum/www/index.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/curriculum/www/index.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/curriculum/www/index.adp 3 Jun 2003 10:40:53 -0000 1.1 @@ -0,0 +1,11 @@ + +@title@ +@context@ + + +

+ Administer Curriculum +

+
+ + Index: openacs-4/packages/curriculum/www/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/curriculum/www/index.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/curriculum/www/index.tcl 3 Jun 2003 10:40:53 -0000 1.1 @@ -0,0 +1,22 @@ +ad_page_contract { + + Curriculum index page. + + @author Ola Hansson (ola@polyxena.net) + @creation-date 2003-05-31 + @cvs-id $Id: index.tcl,v 1.1 2003/06/03 10:40:53 olah Exp $ + +} { +} -properties { + title:onevalue + context:onevalue + admin_p:onevalue +} + +set title "Curriculum" +set context {} + +# We let admins see the link to the admin page. +set admin_p [permission::permission_p -object_id [curriculum::conn package_id] -privilege admin] + +ad_return_template Index: openacs-4/packages/curriculum/www/remove-from-bar-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/curriculum/www/remove-from-bar-oracle.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/curriculum/www/remove-from-bar-oracle.xql 3 Jun 2003 10:40:53 -0000 1.1 @@ -0,0 +1,20 @@ + + + oracle8.1.6 + + + + insert into cu_user_curriculum_map + (user_id, curriculum_id, package_id) + select :user_id, + :curriculum_id, + :package_id + from dual + where not exists (select 1 + from cu_user_curriculum_map + where user_id = :user_id + and curriculum_id = :curriculum_id) + + + + Index: openacs-4/packages/curriculum/www/remove-from-bar-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/curriculum/www/remove-from-bar-postgresql.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/curriculum/www/remove-from-bar-postgresql.xql 3 Jun 2003 10:40:53 -0000 1.1 @@ -0,0 +1,19 @@ + + + postgresql7.1 + + + + insert into cu_user_curriculum_map + (user_id, curriculum_id, package_id) + select :user_id, + :curriculum_id, + :package_id + where not exists (select 1 + from cu_user_curriculum_map + where user_id = :user_id + and curriculum_id = :curriculum_id) + + + + Index: openacs-4/packages/curriculum/www/remove-from-bar.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/curriculum/www/remove-from-bar.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/curriculum/www/remove-from-bar.tcl 3 Jun 2003 10:40:53 -0000 1.1 @@ -0,0 +1,30 @@ +ad_page_contract { + + Curriculum remove-published-curriculums-from-bar page + + @author Ola Hansson (ola@polyxena.net) + @creation-date 2003-06-01 + @cvs-id $Id: remove-from-bar.tcl,v 1.1 2003/06/03 10:40:53 olah Exp $ + +} { + curriculum_id + {return_url "."} +} + +set package_id [curriculum::conn package_id] + +# Removing is actually obtained by inserting a row into the table +# "cu_user_curriculum_map", which holds the row(s) the user DOESN'T want. + +if [set user_id [ad_conn user_id]] { + + db_transaction { + db_dml user_curriculum_map_insert {*SQL*} + + # Force the bat to update. + curriculum::elements_flush + } + +} + +ns_returnredirect $return_url Index: openacs-4/packages/curriculum/www/start-over.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/curriculum/www/start-over.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/curriculum/www/start-over.tcl 3 Jun 2003 10:40:53 -0000 1.1 @@ -0,0 +1,35 @@ +ad_page_contract { + + Curriculum reset page + + @author Ola Hansson (ola@polyxena.net) + @creation-date 2003-06-03 + @cvs-id $Id: start-over.tcl,v 1.1 2003/06/03 10:40:53 olah Exp $ + +} { + curriculum_id:optional + {return_url "."} +} + +set package_id [curriculum::conn package_id] + +if { [info exists curriculum_id] } { + set new_cookie [curriculum::curriculum_progress_cookie_value \ + -package_id $package_id reset_one_curriculum $curriculum_id] + set extra_where_clause { and curriculum_id = :curriculum_id } +} else { + set new_cookie [curriculum::curriculum_progress_cookie_value \ + -package_id $package_id] + set extra_where_clause {} +} + +if [set user_id [ad_conn user_id]] { + db_dml start_over {*SQL*} +} + +# Write the new cookie. +ad_set_cookie -replace t \ + [curriculum::get_cookie_name] $new_cookie + + +ns_returnredirect $return_url Index: openacs-4/packages/curriculum/www/start-over.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/curriculum/www/start-over.xql,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/curriculum/www/start-over.xql 3 Jun 2003 10:40:53 -0000 1.1 @@ -0,0 +1,13 @@ + + + + + + delete from cu_user_element_map + where user_id = :user_id + and package_id = :package_id + $extra_where_clause + + + +