Index: openacs-4/packages/assessment/tcl/as-assessment-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-assessment-procs.tcl,v diff -u -r1.26.2.9 -r1.26.2.10 --- openacs-4/packages/assessment/tcl/as-assessment-procs.tcl 3 Mar 2006 11:48:37 -0000 1.26.2.9 +++ openacs-4/packages/assessment/tcl/as-assessment-procs.tcl 3 Mar 2006 13:52:09 -0000 1.26.2.10 @@ -588,15 +588,4 @@ } -ad_proc -private as::assessment::get_package_id { - -community_id -} { - lfuente@it.uc3m.es - Get assessment package id from an specific community -} { - if {[info exist community_id]==0} {set community_id [ad_conn community_id]} - ns_log Notice "community_id: $community_id" - db_1row get_assessment_package_id {} - return $package_id -} Index: openacs-4/packages/assessment/tcl/as-assessment-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-assessment-procs.xql,v diff -u -r1.9.2.1 -r1.9.2.2 --- openacs-4/packages/assessment/tcl/as-assessment-procs.xql 21 Nov 2005 15:10:25 -0000 1.9.2.1 +++ openacs-4/packages/assessment/tcl/as-assessment-procs.xql 3 Mar 2006 13:52:09 -0000 1.9.2.2 @@ -133,13 +133,5 @@ - - - - SELECT b.object_id as package_id - FROM acs_objects as a,acs_objects as b - WHERE a.context_id=:community_id and a.object_type='apm_package' and a.object_id=b.context_id and b.title='Assessment' - - - + Index: openacs-4/packages/assessment/tcl/as-callback-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-callback-procs.tcl,v diff -u -r1.1.2.11 -r1.1.2.12 --- openacs-4/packages/assessment/tcl/as-callback-procs.tcl 21 Feb 2006 18:09:33 -0000 1.1.2.11 +++ openacs-4/packages/assessment/tcl/as-callback-procs.tcl 3 Mar 2006 13:52:09 -0000 1.1.2.12 @@ -73,111 +73,7 @@ } -ad_proc -public -callback datamanager::move_assessment -impl datamanager { - -object_id:required - -selected_community:required -} { - Move an assessment to another class or community -} { -#se actualiza el parent_id del assessment en cr_items - -#get the new parent_id and package_id - db_1row get_new_parent_id {} - db_1row get_new_package_id {} - - - db_transaction { -#update table - db_dml update_as_cr_items {} - -#se actualiza el context_id y el package_id del assessment en acs_objects - db_dml update_as_it_acs_objects1 {} - db_dml update_as_it_acs_objects2 {} - -#se actualiza el package_id del assessment en acs_objects - db_dml update_as_as_acs_objects {} - } on_error { - ad_return_error "Error:" "The error was: $errmsg" - } -} - - -ad_proc -public -callback datamanager::copy_assessment -impl datamanager { - -object_id:required - -selected_community:required -} { - Copy an assessment to another class or community -} { -#get assessment data - db_1row get_assessment_data {} - set package_id [as::assessment::get_package_id -community_id $selected_community ] - -#create the assessment - set new_assessment_id [as::assessment::new -title $title \ - -creator_id $creator_id \ - -description $description \ - -instructions $instructions \ - -run_mode $run_mode \ - -anonymous_p $anonymous_p \ - -secure_access_p $secure_access_p \ - -reuse_responses_p $reuse_responses_p \ - -show_item_name_p $show_item_name_p \ - -random_p $random_p \ - -entry_page $entry_page \ - -exit_page $exit_page \ - -consent_page $consent_page \ - -return_url $return_url \ - -start_time $start_time \ - -end_time $end_time \ - -number_tries $number_tries \ - -wait_between_tries $wait_between_tries \ - -time_for_response $time_for_response \ - -ip_mask $ip_mask \ - -password $password \ - -show_feedback $show_feedback \ - -section_navigation $section_navigation \ - -survey_p $survey_p \ - -package_id $package_id \ - -type $type ] - - -#get sections data - set sections_id_list [db_list get_sections_id_list {}] -#asociate section with assessment - for {set i 0} {$i < [llength $sections_id_list]} {incr i} { - set section_id [lindex $sections_id_list $i] - - db_1row get_section_data {} - db_dml map_ass_sections {} - } - return $new_assessment_id -} - - - -ad_proc -public -callback datamanager::delete_assessment -impl datamanager { - -object_id:required -} { - Delete an assessment. That is, move it to the trash -} { -#get the trash id - set trash_id [datamanager::get_trash_id] - set community_id [dotlrn_community::get_community_id] - set trash_package_id [datamanager::get_trash_package_id -community_id $community_id] - -#update tables - db_transaction { - db_dml del_update_as_cr_items {} - db_dml del_update_as_it_acs_objects {} -# db_dml del_update_as_it_acs_objects2 {} - db_dml del_update_as_as_acs_objects {} - } on_error { - ad_return_error "Database error" "A database error occured:
$errmsg
" - } - -} - ad_proc -public -callback imsld::finish_object { -object_id } { Index: openacs-4/packages/assessment/tcl/as-callback-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/assessment/tcl/as-callback-procs.xql,v diff -u -r1.1.2.4 -r1.1.2.5 --- openacs-4/packages/assessment/tcl/as-callback-procs.xql 3 Nov 2005 09:29:04 -0000 1.1.2.4 +++ openacs-4/packages/assessment/tcl/as-callback-procs.xql 3 Mar 2006 13:52:09 -0000 1.1.2.5 @@ -96,177 +96,5 @@ where staff_id = :from_user_id - - - - SELECT crf.folder_id as new_parent_id - FROM dotlrn_applets as da, - dotlrn_community_applets as dca, - cr_folders as crf - WHERE da.applet_key='dotlrn_assessment' - and dca.applet_id=da.applet_id - and dca.community_id=:selected_community - and crf.package_id=dca.package_id; - - - - - - update cr_items - set parent_id = :new_parent_id - where item_id=(select context_id from acs_objects where object_id=:object_id); - - - - - update acs_objects - set context_id = :new_parent_id - where object_id = (select context_id from acs_objects where object_id=:object_id) - - - - - - SELECT dca.package_id - FROM dotlrn_community_applets as dca, - dotlrn_applets as da - WHERE da.applet_key='dotlrn_assessment' - and dca.applet_id=da.applet_id - and dca.community_id=:selected_community - - - - - - update acs_objects - set package_id = :package_id - where object_id = (select context_id from acs_objects where object_id=:object_id) - - - - - - update acs_objects - set package_id =:package_id - where object_id in (select object_id - from acs_objects - where context_id= - (select context_id - from acs_objects - where object_id=:object_id)) - - - - - - SELECT cri.name, - ao.title, - ao.creation_user as creator_id, - crr.description, - ass.instructions, - ass.run_mode, - ass.anonymous_p, - ass.secure_access_p, - ass.reuse_responses_p, - ass.show_item_name_p, - ass.random_p, - ass.entry_page, - ass.exit_page, - ass.consent_page, - ass.return_url, - ass.start_time, - ass.end_time, - ass.number_tries, - ass.wait_between_tries, - ass.time_for_response, - ass.ip_mask, - ass.password, - ass.show_feedback, - ass.section_navigation, - ass.survey_p, - ass.type - FROM acs_objects as ao, - cr_items as cri, - cr_revisions as crr, - as_assessments as ass - WHERE ao.object_id=ass.assessment_id - and crr.revision_id=ass.assessment_id - and cri.item_id=crr.item_id - and ass.assessment_id=:object_id - - - - - - - SELECT b.object_id as package_id - FROM acs_objects as a,acs_objects as b - WHERE a.context_id=:selected_community and a.object_type='apm_package' and a.object_id=b.context_id and b.title='Assessment'; - - - - - - SELECT section_id - FROM as_assessment_section_map - WHERE assessment_id=:object_id - - - - - - SELECT max_time_to_complete, - sort_order, - points - FROM as_assessment_section_map - WHERE section_id=:section_id and assessment_id=:object_id - - - - - - INSERT INTO as_assessment_section_map(assessment_id, section_id, max_time_to_complete, sort_order, points) - VALUES (:new_assessment_id,:section_id,:max_time_to_complete,:sort_order,:points) - - - - - - - - update cr_items - set parent_id = :trash_id - where item_id=(select context_id from acs_objects where object_id=:object_id); - - - - - - update acs_objects - set context_id = :trash_id, package_id = :trash_package_id - where object_id = (select context_id from acs_objects where object_id=:object_id) - - - - - - - - - update acs_objects - set package_id =:trash_package_id - where object_id in (select object_id from acs_objects where context_id=(select context_id from acs_objects where object_id=:object_id)) - - - - - + \ No newline at end of file