Index: openacs-4/packages/curriculum/curriculum.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/curriculum/curriculum.info,v diff -u -r1.3 -r1.4 --- openacs-4/packages/curriculum/curriculum.info 4 Jun 2003 16:41:49 -0000 1.3 +++ openacs-4/packages/curriculum/curriculum.info 10 Jun 2003 09:28:05 -0000 1.4 @@ -7,22 +7,24 @@ f f - + Ola Hansson Polyxena - + - - + + + + Index: openacs-4/packages/curriculum/lib/admin-curriculums.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/curriculum/lib/admin-curriculums.adp,v diff -u -r1.2 -r1.3 --- openacs-4/packages/curriculum/lib/admin-curriculums.adp 4 Jun 2003 16:43:42 -0000 1.2 +++ openacs-4/packages/curriculum/lib/admin-curriculums.adp 10 Jun 2003 09:28:29 -0000 1.3 @@ -4,6 +4,9 @@ @debug_output;noquote@ +

+ I'm done now, update the bar for everyone! (Use sparingly) +

[ Package parameters @@ -34,17 +37,22 @@ @curriculums.pretty_state@ - WF ACTIONS - | - delete + [WF Actions] + + + - - down - - up + + + + + + + + @@ -75,17 +83,22 @@ Enable - | - Delete + + + - - down - - up + + + + + + + + Index: openacs-4/packages/curriculum/lib/bar.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/curriculum/lib/bar.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/curriculum/lib/bar.tcl 3 Jun 2003 10:21:50 -0000 1.1 +++ openacs-4/packages/curriculum/lib/bar.tcl 10 Jun 2003 09:28:29 -0000 1.2 @@ -15,6 +15,7 @@ } set package_url [curriculum::conn package_url] +set package_id [curriculum::conn package_id] set logged_in_p [ad_conn user_id] @@ -24,4 +25,10 @@ # Upvar the "elements" multirow datasource for the curriculum bar. curriculum::get_bar -bar_p 1 -ad_return_template +# Top, bottom, left, right. +set position [parameter::get -package_id $package_id -parameter ExternalSiteBarPosition -default bottom] + +# Horizontal or vertical. +set direction [parameter::get -package_id $package_id -parameter BarDirection -default horizontal] + +ad_return_template /packages/curriculum/lib/bar-$direction Index: openacs-4/packages/curriculum/lib/user-curriculums.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/curriculum/lib/user-curriculums.adp,v diff -u -r1.4 -r1.5 --- openacs-4/packages/curriculum/lib/user-curriculums.adp 6 Jun 2003 13:58:04 -0000 1.4 +++ openacs-4/packages/curriculum/lib/user-curriculums.adp 10 Jun 2003 09:28:29 -0000 1.5 @@ -49,7 +49,7 @@ - Ongoing/Completed + CompletedOngoing Refresh @@ -74,13 +74,19 @@ Visited - Revisit + + + + Revisit Unvisited - Visit + + + + Visit Index: openacs-4/packages/curriculum/lib/user-curriculums.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/curriculum/lib/user-curriculums.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/curriculum/lib/user-curriculums.tcl 3 Jun 2003 10:21:50 -0000 1.1 +++ openacs-4/packages/curriculum/lib/user-curriculums.tcl 10 Jun 2003 09:28:29 -0000 1.2 @@ -18,4 +18,9 @@ # Upvar the "elements" multirow datasource for the curriculum bar. curriculum::get_bar -bar_p 0 +set package_id [curriculum::conn package_id] + +# Top, bottom, left, right. +set position [parameter::get -package_id $package_id -parameter ExternalSiteBarPosition -default bottom] + ad_return_template Index: openacs-4/packages/curriculum/sql/oracle/curriculum-curriculum-package-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/curriculum/sql/oracle/curriculum-curriculum-package-create.sql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/curriculum/sql/oracle/curriculum-curriculum-package-create.sql 3 Jun 2003 10:48:45 -0000 1.2 +++ openacs-4/packages/curriculum/sql/oracle/curriculum-curriculum-package-create.sql 10 Jun 2003 09:28:50 -0000 1.3 @@ -110,14 +110,14 @@ from cu_elements where curriculum_id = cu_curriculum.del.curriculum_id; begin + delete from acs_permissions + where object_id = cu_curriculum.del.curriculum_id; + -- Delete all elements in the curriculum. for v_element_val in c_element_cur loop cu_element.del(v_element_val.element_id); end loop; - delete from acs_permissions - where object_id = cu_curriculum.del.curriculum_id; - delete from cu_curriculums where curriculum_id = cu_curriculum.del.curriculum_id; Index: openacs-4/packages/curriculum/sql/oracle/curriculum-element-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/curriculum/sql/oracle/curriculum-element-create.sql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/curriculum/sql/oracle/curriculum-element-create.sql 3 Jun 2003 10:48:45 -0000 1.2 +++ openacs-4/packages/curriculum/sql/oracle/curriculum-element-create.sql 10 Jun 2003 09:28:50 -0000 1.3 @@ -25,6 +25,12 @@ url varchar(400) constraint cu_elements_url_nn not null, + external_p char(1) + default 'f' + constraint cu_elements_external_p_nn + not null + constraint cu_elements_external_p_ck + check (external_p in ('t','f')), enabled_p char(1) default 't' constraint cu_elements_enabled_p_nn Index: openacs-4/packages/curriculum/sql/oracle/curriculum-element-package-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/curriculum/sql/oracle/curriculum-element-package-create.sql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/curriculum/sql/oracle/curriculum-element-package-create.sql 26 May 2003 17:40:02 -0000 1.1 +++ openacs-4/packages/curriculum/sql/oracle/curriculum-element-package-create.sql 10 Jun 2003 09:28:50 -0000 1.2 @@ -19,6 +19,7 @@ description in varchar default null, desc_format in cu_elements.desc_format%TYPE, url in cu_elements.url%TYPE, + external_p in cu_elements.external_p%TYPE default 'f', enabled_p in cu_elements.enabled_p%TYPE default 't', sort_key in cu_elements.sort_key%TYPE default null, object_type in acs_objects.object_type%TYPE default 'cu_element', @@ -56,6 +57,7 @@ description in varchar default null, desc_format in cu_elements.desc_format%TYPE, url in cu_elements.url%TYPE, + external_p in cu_elements.external_p%TYPE default 'f', enabled_p in cu_elements.enabled_p%TYPE default 't', sort_key in cu_elements.sort_key%TYPE default null, object_type in acs_objects.object_type%TYPE default 'cu_element', @@ -87,9 +89,9 @@ end if; insert into cu_elements - (element_id, curriculum_id, name, description, desc_format, url, enabled_p, sort_key) + (element_id, curriculum_id, name, description, desc_format, url, external_p, enabled_p, sort_key) values - (v_element_id, curriculum_id, name, description, desc_format, url, enabled_p, v_sort_key); + (v_element_id, curriculum_id, name, description, desc_format, url, external_p, enabled_p, v_sort_key); return v_element_id; end new; Index: openacs-4/packages/curriculum/sql/postgresql/curriculum-curriculum-package-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/curriculum/sql/postgresql/curriculum-curriculum-package-create.sql,v diff -u -r1.3 -r1.4 --- openacs-4/packages/curriculum/sql/postgresql/curriculum-curriculum-package-create.sql 3 Jun 2003 18:51:49 -0000 1.3 +++ openacs-4/packages/curriculum/sql/postgresql/curriculum-curriculum-package-create.sql 10 Jun 2003 09:29:19 -0000 1.4 @@ -76,6 +76,9 @@ v_cur RECORD; v_return integer := 0; begin + delete from acs_permissions + where object_id = p_curriculum_id; + for v_cur in select element_id from cu_elements where curriculum_id = p_curriculum_id @@ -84,9 +87,6 @@ perform cu_element__del(v_cur.element_id); end loop; - delete from acs_permissions - where object_id = p_curriculum_id; - raise NOTICE ''Deleting curriculum - %'',p_curriculum_id; perform acs_object__delete(p_curriculum_id); Index: openacs-4/packages/curriculum/sql/postgresql/curriculum-element-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/curriculum/sql/postgresql/curriculum-element-create.sql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/curriculum/sql/postgresql/curriculum-element-create.sql 3 Jun 2003 10:45:44 -0000 1.2 +++ openacs-4/packages/curriculum/sql/postgresql/curriculum-element-create.sql 10 Jun 2003 09:29:19 -0000 1.3 @@ -26,6 +26,12 @@ url varchar(400) constraint cu_elements_url_nn not null, + external_p char(1) + default 'f' + constraint cu_elements_external_p_nn + not null + constraint cu_elements_external_p_ck + check (external_p in ('t','f')), enabled_p character(1) default 't' constraint cu_elements_enabled_p_nn Index: openacs-4/packages/curriculum/sql/postgresql/curriculum-element-package-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/curriculum/sql/postgresql/curriculum-element-package-create.sql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/curriculum/sql/postgresql/curriculum-element-package-create.sql 3 Jun 2003 18:51:49 -0000 1.2 +++ openacs-4/packages/curriculum/sql/postgresql/curriculum-element-package-create.sql 10 Jun 2003 09:29:19 -0000 1.3 @@ -4,7 +4,7 @@ -- @creation-date 2003-05-23 -- @cvs-id $Id$ -select define_function_args('cu_element__new','element_id,curriculum_id,name,description,desc_format,url,enabled_p,sort_key,object_type;cu_element,creation_date,creation_user,creation_ip,context_id'); +select define_function_args('cu_element__new','element_id,curriculum_id,name,description,desc_format,url,external_p,enabled_p,sort_key,object_type;cu_element,creation_date,creation_user,creation_ip,context_id'); create or replace function cu_element__new ( integer, -- element_id @@ -13,6 +13,7 @@ text, -- description varchar, -- desc_format varchar, -- url + char, -- external_p char, -- enabled_p integer, -- sort_key varchar, -- object_type @@ -28,13 +29,14 @@ p_description alias for $4; p_desc_format alias for $5; p_url alias for $6; - p_enabled_p alias for $7; -- default ''t'' - p_sort_key alias for $8; -- default null - p_object_type alias for $9; -- default ''cu_element'' - p_creation_date alias for $10; -- default current_timestamp - p_creation_user alias for $11; -- default null - p_creation_ip alias for $12; -- default null - p_context_id alias for $13; -- default null + p_external_p alias for $7; -- default ''f'' + p_enabled_p alias for $8; -- default ''t'' + p_sort_key alias for $9; -- default null + p_object_type alias for $10; -- default ''cu_element'' + p_creation_date alias for $11; -- default current_timestamp + p_creation_user alias for $12; -- default null + p_creation_ip alias for $13; -- default null + p_context_id alias for $14; -- default null v_element_id cu_elements.element_id%TYPE; v_sort_key cu_elements.sort_key%TYPE; begin @@ -57,9 +59,9 @@ end if; insert into cu_elements - (element_id, curriculum_id, name, description, desc_format, url, enabled_p, sort_key) + (element_id, curriculum_id, name, description, desc_format, url, external_p, enabled_p, sort_key) values - (v_element_id, p_curriculum_id, p_name, p_description, p_desc_format, p_url, p_enabled_p, v_sort_key); + (v_element_id, p_curriculum_id, p_name, p_description, p_desc_format, p_url, p_external_p, p_enabled_p, v_sort_key); raise NOTICE ''Adding element - %'',p_name; Index: openacs-4/packages/curriculum/tcl/apm-callback-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/curriculum/tcl/apm-callback-procs.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/curriculum/tcl/apm-callback-procs.tcl 3 Jun 2003 10:28:20 -0000 1.1 +++ openacs-4/packages/curriculum/tcl/apm-callback-procs.tcl 10 Jun 2003 09:29:49 -0000 1.2 @@ -55,32 +55,32 @@ # Create a curriculum. set curriculum_id [curriculum::new \ - -name "Demo Curriculum A" \ - -description Description \ + -name [set name "Demo Curriculum A"] \ + -description "$name description." \ -package_id $package_id] # Add some elements. foreach { url label } [list ${subsite_url}api-doc/ "API Documentation" ${subsite_url} "Home" ${subsite_url}doc/ "Package Documentation"] { curriculum::element::new \ -curriculum_id $curriculum_id \ -name $label \ - -description "Description of $label." \ + -description "Description of $label." \ -desc_format "text/html" \ -url $url } # Create a curriculum. set curriculum_id [curriculum::new \ - -name "Demo Curriculum B" \ - -description Description \ + -name [set name "Demo Curriculum B"] \ + -description "$name description." \ -package_id $package_id] # Add some elements. - foreach { url label } [list ${subsite_url}admin/ "Admin" ${subsite_url}acs-service-contract/ "Service Contracts" http://openacs.org "OpenACS Website"] { + foreach { url label } [list ${subsite_url}curriculum/ "Curriculum Home" ${subsite_url}admin/ "Admin" ${subsite_url}acs-service-contract/ "Service Contracts" http://openacs.org "OpenACS Website"] { curriculum::element::new \ -curriculum_id $curriculum_id \ -name $label \ - -description "Description of $label." \ + -description "Description of $label." \ -desc_format "text/fixed-width" \ -url $url } Index: openacs-4/packages/curriculum/tcl/element-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/curriculum/tcl/element-procs.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/curriculum/tcl/element-procs.tcl 3 Jun 2003 10:28:20 -0000 1.1 +++ openacs-4/packages/curriculum/tcl/element-procs.tcl 10 Jun 2003 09:29:49 -0000 1.2 @@ -37,10 +37,24 @@ @author Ola Hansson (ola@polyxena.net) } { + # Check for external URLs. + if { [string equal -length 7 "http://" $url] } { + set external_p t + } else { + # Try to determine if the URL belongs to another subsite. + array set node [site_node::get_from_url -url $url] + + # FIXME. This condition does not tell the whole truth ... + if { [string equal -length [string length $node(url)] $node(url) $url] } { + set external_p f + } else { + set external_p t + } + } # Prepare the variables for instantiation. set extra_vars [ns_set create] - oacs_util::vars_to_ns_set -ns_set $extra_vars -var_list {element_id curriculum_id name description desc_format url enabled_p sort_key} + oacs_util::vars_to_ns_set -ns_set $extra_vars -var_list {element_id curriculum_id name description desc_format url external_p enabled_p sort_key} # Instantiate the curriculum element. return [package_instantiate_object -extra_vars $extra_vars cu_element] Index: openacs-4/packages/curriculum/tcl/misc-procs-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/curriculum/tcl/misc-procs-oracle.xql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/curriculum/tcl/misc-procs-oracle.xql 6 Jun 2003 13:57:30 -0000 1.2 +++ openacs-4/packages/curriculum/tcl/misc-procs-oracle.xql 10 Jun 2003 09:29:49 -0000 1.3 @@ -26,6 +26,7 @@ cc.curriculum_id, cc.name as curriculum_name, cee.url, + cee.external_p, cee.name from (select curriculum_id from cu_curriculums @@ -56,17 +57,18 @@ select published.curriculum_id, published.name as curriculum_name, - dbms_lob.instr(published.description,1,:truncation_length) as curriculum_desc, + dbms_lob.substr(published.description,:truncation_length,1) as curriculum_desc, case when dbms_lob.getlength(published.description) > :truncation_length then 1 else 0 end as curr_desc_trunc_p, case when ucm.curriculum_id is null then 0 else 1 end as undesired_p, cee.element_id, cee.name as element_name, - dbms_lob.instr(cee.description,1,:truncation_length) as element_desc, + dbms_lob.substr(cee.description,:truncation_length,1) as element_desc, case when dbms_lob.getlength(cee.description) > :truncation_length then 1 else 0 end as elem_desc_trunc_p, - cee.url + cee.url, + cee.external_p from (select cc.* from cu_curriculums cc, workflow_cases cas, Index: openacs-4/packages/curriculum/tcl/misc-procs-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/curriculum/tcl/misc-procs-postgresql.xql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/curriculum/tcl/misc-procs-postgresql.xql 6 Jun 2003 13:57:30 -0000 1.2 +++ openacs-4/packages/curriculum/tcl/misc-procs-postgresql.xql 10 Jun 2003 09:29:49 -0000 1.3 @@ -21,46 +21,33 @@ --- --- Rewrite this query to look more like the Oracle version. --- - - (select cee.element_id, + select cee.element_id, cc.curriculum_id, cc.name as curriculum_name, cee.url, + cee.external_p, cee.name - from cu_curriculums cc left outer join - cu_elements_enabled cee using (curriculum_id), + from (select curriculum_id + from cu_curriculums + where package_id = :package_id + EXCEPT + select curriculum_id + from cu_user_curriculum_map + where user_id = :user_id + and package_id = :package_id) desired, workflow_cases cas, - workflow_case_fsm cfsm + workflow_case_fsm cfsm, + cu_curriculums cc, + cu_elements_enabled cee where cc.package_id = :package_id + and desired.curriculum_id = cc.curriculum_id + and cc.curriculum_id = cee.curriculum_id and cas.object_id = cc.curriculum_id and cfsm.case_id = cas.case_id and cfsm.current_state = :state_id order by cc.sort_key, - cee.sort_key) + cee.sort_key - EXCEPT - - (select cee.element_id, - cc.curriculum_id, - cc.name as curriculum_name, - cee.url, - cee.name - from (cu_user_curriculum_map ucm inner join - cu_curriculums cc using (curriculum_id)) left outer join - cu_elements_enabled cee using (curriculum_id), - workflow_cases cas, - workflow_case_fsm cfsm - where cc.package_id = :package_id - and cas.object_id = cc.curriculum_id - and cfsm.case_id = cas.case_id - and cfsm.current_state = :state_id - and ucm.user_id = :user_id - order by cc.sort_key, - cee.sort_key) - @@ -79,7 +66,8 @@ substring(cee.description from 1 for :truncation_length) as element_desc, case when length(cee.description) > :truncation_length then 1 else 0 end as elem_desc_trunc_p, - cee.url + cee.url, + cee.external_p from (select cc.* from cu_curriculums cc, workflow_cases cas, Index: openacs-4/packages/curriculum/tcl/misc-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/curriculum/tcl/misc-procs.tcl,v diff -u -r1.3 -r1.4 --- openacs-4/packages/curriculum/tcl/misc-procs.tcl 6 Jun 2003 13:57:30 -0000 1.3 +++ openacs-4/packages/curriculum/tcl/misc-procs.tcl 10 Jun 2003 09:29:49 -0000 1.4 @@ -184,7 +184,7 @@ ad_return_error "Could not get child package_id" \ "This could be because you have mounted more than one instance of the Curriculum package in a subsite. Curriculum was designed to only -mount one instance per acs-subsite. It could also be a bug in the code. +be mounted once per acs-subsite. Please visit the Site-Map and unmount the extra instance. However, it could also be a bug in the code.

Here is what the database said:

@@ -376,6 +376,7 @@ ad_proc -public curriculum::elements_flush { + {-thorough:boolean 0} {-package_id ""} {-user_id ""} } { @@ -386,6 +387,12 @@ set package_id [conn package_id] } + if { $thorough_p } { + # Flush the cache for all users (including non-logged in) in this package_id. + util_memoize_flush_regexp [list curriculum::enabled_elements -package_id $package_id] + return + } + if { [empty_string_p $user_id] } { set user_id [ad_conn user_id] } @@ -485,7 +492,7 @@ set this_curriculum $info(curriculum_id) foreach element_id $element_ids { - lappend manipulated_rows [concat $info_row($element_id) checked_p $checked_p($element_id) external_p $external_p($element_id) completed_p $completed_p] + lappend manipulated_rows [concat $info_row($element_id) checked_p $checked_p($element_id) completed_p $completed_p] } # Empty the list. @@ -506,19 +513,11 @@ set completed_p 0 } - # FIXME. Should be performed by the db! - # Check for external URLs. - if { [string equal -length 7 "http://" $info(url)] } { - set external_p(${info(element_id)}) 1 - } else { - set external_p(${info(element_id)}) 0 - } - } # Play the recording for the last curriculum. foreach element_id $element_ids { - lappend manipulated_rows [concat $info_row($element_id) checked_p $checked_p($element_id) external_p $external_p($element_id) completed_p $completed_p] + lappend manipulated_rows [concat $info_row($element_id) checked_p $checked_p($element_id) completed_p $completed_p] } # Let's turn this list into a multirow datasource in the @@ -667,7 +666,7 @@ This will run after a registered url has been served. } { # FIXME. Remove the row below and uncomment the catch statement when the package is published. - curriculum_filter_internal $args $why + curriculum_filter_internal $args $why # we don't want an error in the script to interrupt page service # if [catch { curriculum_filter_internal $args $why } errmsg] { @@ -727,33 +726,6 @@ } -ad_proc -public curriculum::element_filter { - conn - package_id - why -} { - get_bar -bar_p 1 -package_id $package_id - - set package_url [conn package_url] - set return_url_export [export_vars -url [set return_url [ad_conn url]]] - set logged_in_p [ad_conn user_id] - - set code [template::adp_compile -file [acs_package_root_dir curriculum]/lib/bar.adp] - - # Return the HTML chunk. - ns_write [template::adp_eval code] - -#template::adp_append_code "append __adp_output \[$command\]" -# set command "template::adp_parse" -# append command " \[template::util::url_to_file \"$src\" \"\$__adp_stub\"\]" -# append command " \[list" - - - - return "filter_ok" -} - - ##### # # Util procs (that perhaps should go back to the community) Index: openacs-4/packages/curriculum/www/TODO.TXT =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/curriculum/www/Attic/TODO.TXT,v diff -u -r1.2 -r1.3 --- openacs-4/packages/curriculum/www/TODO.TXT 4 Jun 2003 16:45:30 -0000 1.2 +++ openacs-4/packages/curriculum/www/TODO.TXT 10 Jun 2003 09:30:07 -0000 1.3 @@ -8,9 +8,9 @@ - Assignees and notifications in workflow. - Documentation. - Optimize bar and admin page queries (compare with the - user page query!). + user page query!). - Fix desc truncation and the "more" link on index page. -- Fix question mark in the curriculum bar. + (dbms_lob.instr() doesn't return the substr on Oracle ...) - Host problem in ext.tcl and remove-from-bar.tcl ("hostname" vs. "localhost"). - Deleting the curriculum package when both curriculums @@ -50,3 +50,9 @@ "conn" just returns {} without a curriculum instance mounted. - I believe that the sort order is wrong in the "bar query" - or am I being fooled by a caching issue? +- Fix question mark in the curriculum bar. +- Normally, flushing of the cache should be done globally - + not per user and instance! + ("util_memoize_flush_regexp" is pretty expensive considering + that each user has one cache per instance, so we provided + a link instead, that the admin should hit when done admin'ing.) \ No newline at end of file Index: openacs-4/packages/curriculum/www/ext.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/curriculum/www/ext.adp,v diff -u -r1.1 -r1.2 --- openacs-4/packages/curriculum/www/ext.adp 3 Jun 2003 10:40:53 -0000 1.1 +++ openacs-4/packages/curriculum/www/ext.adp 10 Jun 2003 09:30:07 -0000 1.2 @@ -1,11 +1,34 @@ - -External URL: @destination_url@ -
-Return to where you were: @return_url@ -
- -


- -@page;noquote@ - - \ No newline at end of file + + + + External Element + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Index: openacs-4/packages/curriculum/www/ext.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/curriculum/www/ext.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/curriculum/www/ext.tcl 3 Jun 2003 10:40:53 -0000 1.1 +++ openacs-4/packages/curriculum/www/ext.tcl 10 Jun 2003 09:30:07 -0000 1.2 @@ -9,8 +9,14 @@ } { element_id:integer curriculum_id:integer - return_url + {return_url "."} + {position "bottom"} } +# The positions are: +# "top" (horizontal) +# "bottom" (horizontal) +# "left" (vertical). +# "right" (vertical). set package_id [curriculum::conn package_id] @@ -46,10 +52,4 @@ 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) +ad_return_template \ No newline at end of file Index: openacs-4/packages/curriculum/www/ext.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/curriculum/www/ext.xql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/curriculum/www/ext.xql 3 Jun 2003 10:40:53 -0000 1.1 +++ openacs-4/packages/curriculum/www/ext.xql 10 Jun 2003 09:30:07 -0000 1.2 @@ -9,20 +9,4 @@ - - - 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/remove-from-bar-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/curriculum/www/remove-from-bar-oracle.xql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/curriculum/www/remove-from-bar-oracle.xql 3 Jun 2003 10:40:53 -0000 1.1 +++ openacs-4/packages/curriculum/www/remove-from-bar-oracle.xql 10 Jun 2003 09:30:07 -0000 1.2 @@ -17,4 +17,17 @@ + + + select curriculum_id + from cu_curriculums + where package_id = :package_id + MINUS + select curriculum_id + from cu_user_curriculum_map + where user_id = :user_id + and package_id = :package_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 -r1.1 -r1.2 --- openacs-4/packages/curriculum/www/remove-from-bar-postgresql.xql 3 Jun 2003 10:40:53 -0000 1.1 +++ openacs-4/packages/curriculum/www/remove-from-bar-postgresql.xql 10 Jun 2003 09:30:07 -0000 1.2 @@ -16,4 +16,17 @@ + + + select curriculum_id + from cu_curriculums + where package_id = :package_id + EXCEPT + select curriculum_id + from cu_user_curriculum_map + where user_id = :user_id + and package_id = :package_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 -r1.1 -r1.2 --- openacs-4/packages/curriculum/www/remove-from-bar.tcl 3 Jun 2003 10:40:53 -0000 1.1 +++ openacs-4/packages/curriculum/www/remove-from-bar.tcl 10 Jun 2003 09:30:07 -0000 1.2 @@ -7,7 +7,7 @@ @cvs-id $Id$ } { - curriculum_id + curriculum_id:integer,optional {return_url "."} } @@ -17,14 +17,25 @@ # "cu_user_curriculum_map", which holds the row(s) the user DOESN'T want. if [set user_id [ad_conn user_id]] { + + if { [info exists curriculum_id] } { - db_transaction { + # Just remove the this one curriculum. db_dml user_curriculum_map_insert {*SQL*} - # Force the bat to update. - curriculum::elements_flush + } else { + + db_foreach desired_curriculums {*SQL*} { + db_dml user_curriculum_map_insert {*SQL*} + } if_no_rows { + # Don't do a thing! + } + } + # Force the bar to update. + curriculum::elements_flush + } ns_returnredirect $return_url