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.4 -r1.1.2.5 --- openacs-4/packages/assessment/tcl/as-callback-procs.tcl 20 Jul 2005 15:58:42 -0000 1.1.2.4 +++ openacs-4/packages/assessment/tcl/as-callback-procs.tcl 10 Oct 2005 12:59:33 -0000 1.1.2.5 @@ -70,13 +70,87 @@ } { #se actualiza el parent_id del assessment en cr_items -db_dml update_as_cr_items {} +#get the new parent_id and package_id + db_1row get_new_parent_id {} + db_1row get_new_package_id {} + +#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 {} + 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 {} + db_dml update_as_as_acs_objects {} } + +ad_proc -public -callback datamanager::copy_assessment -impl datamanager { + -object_id:required + -selected_community:required +} { + Move an assessment to another class or community +} { +#get assessment data + db_1row get_assessment_data {} + db_1row get_assessment_package_id {} + +#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 {} + } +} + + + +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_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 {} +} 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.2 -r1.1.2.3 --- openacs-4/packages/assessment/tcl/as-callback-procs.xql 20 Jul 2005 15:58:42 -0000 1.1.2.2 +++ openacs-4/packages/assessment/tcl/as-callback-procs.xql 10 Oct 2005 12:59:34 -0000 1.1.2.3 @@ -96,76 +96,177 @@ 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 = (select folder_id - from cr_folders - where package_id= - (select package_id - from dotlrn_community_applets - where applet_id= - (select applet_id - from dotlrn_applets - where applet_key='dotlrn_assessment') - and community_id=:selected_community)) + 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 =(select folder_id - from cr_folders - where package_id= - (select package_id - from dotlrn_community_applets - where applet_id= - (select applet_id - from dotlrn_applets - where applet_key='dotlrn_assessment') - and community_id=:selected_community)) + 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 = (select package_id - from dotlrn_community_applets - where applet_id= - (select applet_id - from dotlrn_applets - where applet_key='dotlrn_assessment') - and community_id=:selected_community) + update acs_objects + set package_id = :new_package_id where object_id = (select context_id from acs_objects where object_id=:object_id) - - update acs_objects - set package_id =(select package_id - from dotlrn_community_applets - where applet_id= - (select applet_id - from dotlrn_applets - where applet_key='dotlrn_assessment') - and community_id=:selected_community) + update acs_objects + set package_id =:new_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 + + + + + + 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)) + + + + + Index: openacs-4/packages/datamanager/tcl/datamanager-callback-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/datamanager/tcl/datamanager-callback-procs.tcl,v diff -u -r1.1.2.2 -r1.1.2.3 --- openacs-4/packages/datamanager/tcl/datamanager-callback-procs.tcl 23 Sep 2005 14:35:44 -0000 1.1.2.2 +++ openacs-4/packages/datamanager/tcl/datamanager-callback-procs.tcl 10 Oct 2005 12:59:34 -0000 1.1.2.3 @@ -16,6 +16,12 @@ } { } +ad_proc -public -callback datamanager::delete_faq { + -object_id:required +} { +} + + ad_proc -public -callback datamanager::move_forum { -object_id:required -selected_community:required @@ -28,6 +34,12 @@ } { } +ad_proc -public -callback datamanager::delete_forum { + -object_id:required +} { +} + + ad_proc -public -callback datamanager::move_new { -object_id:required -selected_community:required @@ -40,7 +52,12 @@ } { } +ad_proc -public -callback datamanager::delete_new { + -object_id:required +} { +} + ad_proc -public -callback datamanager::move_static { -object_id:required -selected_community:required @@ -53,6 +70,12 @@ } { } +ad_proc -public -callback datamanager::delete_static { + -object_id:required +} { +} + + ad_proc -public -callback datamanager::move_assessment { -object_id:required -selected_community:required @@ -65,6 +88,12 @@ } { } +ad_proc -public -callback datamanager::delete_assessment { + -object_id:required +} { +} + + ad_proc -public -callback datamanager::move_folder { -object_id:required -selected_community:required @@ -76,3 +105,9 @@ -selected_community:required } { } + +ad_proc -public -callback datamanager::delete_folder { + -object_id:required +} { +} + Index: openacs-4/packages/datamanager/tcl/datamanager-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/datamanager/tcl/datamanager-procs.tcl,v diff -u -r1.1.2.3 -r1.1.2.4 --- openacs-4/packages/datamanager/tcl/datamanager-procs.tcl 23 Sep 2005 14:35:44 -0000 1.1.2.3 +++ openacs-4/packages/datamanager/tcl/datamanager-procs.tcl 10 Oct 2005 12:59:34 -0000 1.1.2.4 @@ -113,7 +113,17 @@ } set comm_id [dotlrn_community::get_community_id] + + set communities_list [db_list get_list_of_dest_communities {}] + set communities_list_p [list] + foreach community $communities_list { + if { [dotlrn::user_can_admin_community_p -community_id $community] } { + lappend communities_list_p $community + } + } + + db_multirow -extend { type } communities get_data_communities {} { if {$community_type == "dotlrn_club"} { set type "[_ datamanager.Community]" @@ -129,5 +139,25 @@ return available_communities } - + ad_proc -public get_trash_id { + } { + Get the trash identifier + } { + db_1row get_id {} + return $trash_id + } + + ad_proc -public get_trash_package_id { + {-community_id} + } { + Get the trash packageidentifier + } { + + if {[info exist community_id] == 0 } { + set community_id [dotlrn_community::get_community_id] + } + + db_1row get_package_id {} + return $trash_package_id + } } Index: openacs-4/packages/datamanager/tcl/datamanager-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/datamanager/tcl/datamanager-procs.xql,v diff -u -r1.1.2.3 -r1.1.2.4 --- openacs-4/packages/datamanager/tcl/datamanager-procs.xql 23 Sep 2005 14:35:44 -0000 1.1.2.3 +++ openacs-4/packages/datamanager/tcl/datamanager-procs.xql 10 Oct 2005 12:59:34 -0000 1.1.2.4 @@ -59,10 +59,9 @@ - - + - select community_id, community_type, pretty_name as name, parent_community_id + select community_id from dotlrn_communities_all where community_id <> :comm_id and (parent_community_id <> community_id or parent_community_id is null) and @@ -74,6 +73,14 @@ + + + select community_id, community_type, pretty_name as name, parent_community_id + from dotlrn_communities_all + where community_id in ([join $communities_list_p ","]) + + + select pretty_name @@ -82,4 +89,20 @@ + + + SELECT object_id as trash_id + FROM acs_objects + WHERE object_type='trash' and title IS NULL and context_id IS NULL and package_id IS NULL; + + + + + + SELECT b.object_id as trash_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='Datamanager'; + + + Index: openacs-4/packages/datamanager/www/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/datamanager/www/index.tcl,v diff -u -r1.1.2.1 -r1.1.2.2 --- openacs-4/packages/datamanager/www/index.tcl 20 Jul 2005 13:49:46 -0000 1.1.2.1 +++ openacs-4/packages/datamanager/www/index.tcl 10 Oct 2005 12:59:34 -0000 1.1.2.2 @@ -6,17 +6,26 @@ } -query { } -properties { } +set context [list] +set community_id [dotlrn_community::get_community_id] +#only administrator or professor must be allowed to enter this page +dotlrn::require_user_admin_community -community_id $community_id + + # prevent this page from being called when not in a community # (i.e. the main dotlrn instance -if {[empty_string_p [dotlrn_community::get_community_id]]} { +if {[empty_string_p $community_id]]} { ad_returnredirect "[dotlrn::get_url]" } -set context [list] -set community_id [dotlrn_community::get_community_id] db_1row datamanager::select_folder_package_id {} +set prueba_id [dotlrn_community::get_applet_package_id -community_id $community_id -applet_key 'dotlrn_fs'] + +nslog Notice "$package_id $prueba_id" + + set root_folder_id [fs::get_root_folder -package_id $package_id] template::list::create \ Index: openacs-4/packages/datamanager/www/one-object-copy.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/datamanager/www/one-object-copy.tcl,v diff -u -r1.1.2.2 -r1.1.2.3 --- openacs-4/packages/datamanager/www/one-object-copy.tcl 23 Sep 2005 14:15:38 -0000 1.1.2.2 +++ openacs-4/packages/datamanager/www/one-object-copy.tcl 10 Oct 2005 12:59:34 -0000 1.1.2.3 @@ -12,6 +12,9 @@ set context [list [_ datamanager.Object_Copy]] set title "[_ datamanager.Choose_Destination]" +#only administrator or professor must be allowed to enter this page +dotlrn::require_user_admin_community -community_id [dotlrn_community::get_community_id] + set object_type [datamanager::get_object_type -object_id $object_id] set object_data [datamanager::get_object_data -object_type $object_type -object_id $object_id] Index: openacs-4/packages/datamanager/www/one-object-delete.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/datamanager/www/Attic/one-object-delete.adp,v diff -u -r1.1.2.1 -r1.1.2.2 --- openacs-4/packages/datamanager/www/one-object-delete.adp 20 Jul 2005 13:49:46 -0000 1.1.2.1 +++ openacs-4/packages/datamanager/www/one-object-delete.adp 10 Oct 2005 12:59:34 -0000 1.1.2.2 @@ -3,3 +3,16 @@ <# Delete#> @context;noquote@
+ +

Do you really want to move to Trash @object_name@?

+ +
+ + + +
+ + + +
+
Index: openacs-4/packages/datamanager/www/one-object-delete.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/datamanager/www/Attic/one-object-delete.tcl,v diff -u -r1.1.2.1 -r1.1.2.2 --- openacs-4/packages/datamanager/www/one-object-delete.tcl 20 Jul 2005 13:49:46 -0000 1.1.2.1 +++ openacs-4/packages/datamanager/www/one-object-delete.tcl 10 Oct 2005 12:59:34 -0000 1.1.2.2 @@ -4,8 +4,23 @@ @creation_date 2005-07-05 } -query { + object_id:integer,notnull } -properties { } set context [list [_ datamanager.Object_Delete]] +set title "Delete confirmation" + +#only administrator must be allowed to enter this page +dotlrn::require_admin + +set object_type [datamanager::get_object_type -object_id $object_id] +set object_data [datamanager::get_object_data -object_type $object_type -object_id $object_id] + +set object_name [lindex $object_data 0] +set object_url [lindex $object_data 1] +set object_type [lindex $object_data 2] + +set action "delete_NOT_IMPLEMENTED_PROPERLY" + Index: openacs-4/packages/datamanager/www/one-object-move.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/datamanager/www/Attic/one-object-move.tcl,v diff -u -r1.1.2.2 -r1.1.2.3 --- openacs-4/packages/datamanager/www/one-object-move.tcl 23 Sep 2005 14:15:38 -0000 1.1.2.2 +++ openacs-4/packages/datamanager/www/one-object-move.tcl 10 Oct 2005 12:59:34 -0000 1.1.2.3 @@ -11,6 +11,9 @@ set context [list [_ datamanager.Object_Move]] set title "[_ datamanager.Choose_Destination]" +#only administrator or professor must be allowed to enter this page +dotlrn::require_user_admin_community -community_id [dotlrn_community::get_community_id] + set object_type [datamanager::get_object_type -object_id $object_id] set object_data [datamanager::get_object_data -object_type $object_type -object_id $object_id] Index: openacs-4/packages/datamanager/www/use-assessment.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/datamanager/www/Attic/use-assessment.tcl,v diff -u -r1.1.2.1 -r1.1.2.2 --- openacs-4/packages/datamanager/www/use-assessment.tcl 23 Sep 2005 14:30:37 -0000 1.1.2.1 +++ openacs-4/packages/datamanager/www/use-assessment.tcl 10 Oct 2005 12:59:34 -0000 1.1.2.2 @@ -5,22 +5,31 @@ } -query { object_id:integer,notnull - selected_community:integer,notnull + selected_community:integer,optional action:notnull } -properties { } +dotlrn::require_user_admin_community -community_id [dotlrn_community::get_community_id] set context [list []] set title "[_ datamanager.Confirmation]" switch $action { "move" { + + #only administrator or professor must be allowed to enter this page + dotlrn::require_user_admin_community -community_id $selected_community + callback -catch datamanager::move_assessment -object_id $object_id -selected_community $selected_community } "copy" { + #only administrator or professor must be allowed to enter this page + dotlrn::require_user_admin_community -community_id $selected_community + callback -catch datamanager::copy_assessment -object_id $object_id -selected_community $selected_community } "delete" { + callback -catch datamanager::delete_assessment -object_id $object_id } default { } Index: openacs-4/packages/datamanager/www/use-faq.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/datamanager/www/Attic/use-faq.tcl,v diff -u -r1.1.2.1 -r1.1.2.2 --- openacs-4/packages/datamanager/www/use-faq.tcl 23 Sep 2005 14:30:37 -0000 1.1.2.1 +++ openacs-4/packages/datamanager/www/use-faq.tcl 10 Oct 2005 12:59:34 -0000 1.1.2.2 @@ -6,21 +6,29 @@ } -query { object_id:integer,notnull action:notnull - selected_community:integer,notnull + selected_community:integer,optional } -properties { } +dotlrn::require_user_admin_community -community_id [dotlrn_community::get_community_id] set context [list []] set title "[_ datamanager.Confirmation]" switch $action { "move" { + #only administrator or professor must be allowed to enter this page + dotlrn::require_user_admin_community -community_id $selected_community + callback -catch datamanager::move_faq -object_id $object_id -selected_community $selected_community } "copy" { + #only administrator or professor must be allowed to enter this page + dotlrn::require_user_admin_community -community_id $selected_community + callback -catch datamanager::copy_faq -object_id $object_id -selected_community $selected_community } "delete" { + callback -catch datamanager::delete_faq -object_id $object_id } default { } Index: openacs-4/packages/datamanager/www/use-folder.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/datamanager/www/Attic/use-folder.tcl,v diff -u -r1.1.2.1 -r1.1.2.2 --- openacs-4/packages/datamanager/www/use-folder.tcl 23 Sep 2005 14:30:37 -0000 1.1.2.1 +++ openacs-4/packages/datamanager/www/use-folder.tcl 10 Oct 2005 12:59:34 -0000 1.1.2.2 @@ -6,21 +6,32 @@ } -query { object_id:integer,notnull action:notnull - selected_community:integer,notnull + selected_community:integer,optional } -properties { } + +dotlrn::require_user_admin_community -community_id [dotlrn_community::get_community_id] set context [list []] set title "[_ datamanager.Confirmation]" switch $action { "move" { + #only administrator or professor must be allowed to enter this page + + dotlrn::require_user_admin_community -community_id $selected_community + callback -catch datamanager::move_folder -object_id $object_id -selected_community $selected_community } "copy" { + #only administrator or professor must be allowed to enter this page + + dotlrn::require_user_admin_community -community_id $selected_community + callback -catch datamanager::copy_folder -object_id $object_id -selected_community $selected_community } "delete" { + callback -catch datamanager::delete_folder -object_id $object_id } default { } Index: openacs-4/packages/datamanager/www/use-forum.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/datamanager/www/Attic/use-forum.tcl,v diff -u -r1.1.2.1 -r1.1.2.2 --- openacs-4/packages/datamanager/www/use-forum.tcl 23 Sep 2005 14:30:37 -0000 1.1.2.1 +++ openacs-4/packages/datamanager/www/use-forum.tcl 10 Oct 2005 12:59:34 -0000 1.1.2.2 @@ -5,20 +5,30 @@ } -query { object_id:integer,notnull - selected_community:integer,notnull + selected_community:integer,optional action:notnull } -properties { } +dotlrn::require_user_admin_community -community_id [dotlrn_community::get_community_id] + set context [list []] set title "[_ datamanager.Confirmation]" switch $action { "move" { + #only administrator or professor must be allowed to enter this page + dotlrn::require_user_admin_community -community_id $selected_community + callback -catch datamanager::move_forum -object_id $object_id -selected_community $selected_community } "copy" { + #only administrator or professor must be allowed to enter this page + dotlrn::require_user_admin_community -community_id $selected_community + callback -catch datamanager::copy_forum -object_id $object_id -selected_community $selected_community } "delete" { + callback -catch datamanager::delete_forum -object_id $object_id + } default { } Index: openacs-4/packages/datamanager/www/use-news.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/datamanager/www/Attic/use-news.tcl,v diff -u -r1.1.2.1 -r1.1.2.2 --- openacs-4/packages/datamanager/www/use-news.tcl 23 Sep 2005 14:30:37 -0000 1.1.2.1 +++ openacs-4/packages/datamanager/www/use-news.tcl 10 Oct 2005 12:59:34 -0000 1.1.2.2 @@ -6,21 +6,32 @@ } -query { object_id:integer,notnull action:notnull - selected_community:integer,notnull + selected_community:integer,optional } -properties { } +dotlrn::require_user_admin_community -community_id [dotlrn_community::get_community_id] + set context [list []] set title "[_ datamanager.Confirmation]" switch $action { "move" { + #only administrator or professor must be allowed to enter this page + + dotlrn::require_user_admin_community -community_id $selected_community + callback -catch datamanager::move_new -object_id $object_id -selected_community $selected_community } "copy" { + #only administrator or professor must be allowed to enter this page + + dotlrn::require_user_admin_community -community_id $selected_community + callback -catch datamanager::copy_new -object_id $object_id -selected_community $selected_community } "delete" { + callback -catch datamanager::delete_new -object_id $object_id } default { } Index: openacs-4/packages/datamanager/www/use-static-portlet.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/datamanager/www/Attic/use-static-portlet.tcl,v diff -u -r1.1.2.1 -r1.1.2.2 --- openacs-4/packages/datamanager/www/use-static-portlet.tcl 23 Sep 2005 14:30:37 -0000 1.1.2.1 +++ openacs-4/packages/datamanager/www/use-static-portlet.tcl 10 Oct 2005 12:59:34 -0000 1.1.2.2 @@ -6,22 +6,33 @@ } -query { object_id:integer,notnull action:notnull - selected_community:integer,notnull + selected_community:integer,optional } -properties { } + +dotlrn::require_user_admin_community -community_id [dotlrn_community::get_community_id] set context [list []] set title "[_ datamanager.Confirmation]" switch $action { "move" { + #only administrator or professor must be allowed to enter this page + + dotlrn::require_user_admin_community -community_id $selected_community + callback -catch datamanager::move_static -object_id $object_id -selected_community $selected_community } "copy" { + #only administrator or professor must be allowed to enter this page + + dotlrn::require_user_admin_community -community_id $selected_community + callback -catch datamanager::copy_static -object_id $object_id -selected_community $selected_community } "delete" { + callback -catch datamanager::delete_static -object_id $object_id } default { } Index: openacs-4/packages/faq/tcl/faq-callback-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/faq/tcl/faq-callback-procs.tcl,v diff -u -r1.1.2.2 -r1.1.2.3 --- openacs-4/packages/faq/tcl/faq-callback-procs.tcl 23 Sep 2005 14:38:28 -0000 1.1.2.2 +++ openacs-4/packages/faq/tcl/faq-callback-procs.tcl 10 Oct 2005 12:59:34 -0000 1.1.2.3 @@ -11,9 +11,27 @@ Move a faq to another class or community } { +db_1row get_faqs_package {} + +db_dml update_faqs_q_and_a {} db_dml update_faqs {} } + +ad_proc -public -callback datamanager::delete_faq -impl datamanager { + -object_id:required + -selected_community:required +} { + Move a faq to the trash +} { +set trash_id [datamanager::get_trash_id] +set trash_package_id [datamanager::get_trash_package_id] + +db_dml del_update_faqs_q_and_a {} +db_dml del_update_faqs {} +} + + ad_proc -public -callback datamanager::copy_faq -impl datamanager { -object_id:required -selected_community:required Index: openacs-4/packages/faq/tcl/faq-callback-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/faq/tcl/Attic/faq-callback-procs.xql,v diff -u -r1.1.2.2 -r1.1.2.3 --- openacs-4/packages/faq/tcl/faq-callback-procs.xql 23 Sep 2005 14:38:28 -0000 1.1.2.2 +++ openacs-4/packages/faq/tcl/faq-callback-procs.xql 10 Oct 2005 12:59:34 -0000 1.1.2.3 @@ -3,17 +3,46 @@ - update acs_objects - set context_id = (select package_id - from dotlrn_community_applets - where community_id = :selected_community and applet_id = ( - select applet_id from dotlrn_applets where applet_key = 'dotlrn_faq' - )) - where object_id = :object_id + update acs_objects + set context_id = :new_package_id,package_id=:new_package_id + where object_id = :object_id + + + + + update acs_objects + set package_id = :new_package_id + where context_id = :object_id + + + +SELECT package_id as new_package_id +FROM dotlrn_community_applets +WHERE community_id = :selected_community and applet_id = (select applet_id from dotlrn_applets where applet_key = 'dotlrn_faq') + + + + + + + UPDATE acs_objects + SET context_id = :trash_package_id,package_id=:trash_package_id + WHERE object_id = :object_id + + + + + + UPDATE acs_objects + SET package_id = :trash_package_id + WHERE context_id = :object_id + + + SELECT b.object_id as package_id Index: openacs-4/packages/file-storage/tcl/file-storage-callback-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/tcl/file-storage-callback-procs.tcl,v diff -u -r1.1.2.6 -r1.1.2.7 --- openacs-4/packages/file-storage/tcl/file-storage-callback-procs.tcl 7 Oct 2005 08:55:08 -0000 1.1.2.6 +++ openacs-4/packages/file-storage/tcl/file-storage-callback-procs.tcl 10 Oct 2005 12:59:35 -0000 1.1.2.7 @@ -48,3 +48,32 @@ db_dml update_acs_objects {} } +ad_proc -public -callback datamanager::delete_folder -impl datamanager { + -object_id:required +} { + Move a folder to the trash +} { + +#get the trash_id +set trash_id [datamanager::get_trash_id] + + +#update forums_forums table +db_dml del_update_cr_items {} +db_dml del_update_acs_objects {} +} + + + +ad_proc -public -callback datamanager::copy_folder -impl datamanager { + -object_id:required + -selected_community:required +} { + Copy a folder to another class or community +} { +#get the destiny's root folder + set parent_id [dotlrn_fs::get_community_root_folder -community_id $selected_community] + + fs_folder_copy -old_folder_id $object_id -new_parent_id $parent_id + +} Index: openacs-4/packages/file-storage/tcl/file-storage-callback-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/tcl/Attic/file-storage-callback-procs.xql,v diff -u -r1.1.2.1 -r1.1.2.2 --- openacs-4/packages/file-storage/tcl/file-storage-callback-procs.xql 20 Jul 2005 15:49:30 -0000 1.1.2.1 +++ openacs-4/packages/file-storage/tcl/file-storage-callback-procs.xql 10 Oct 2005 12:59:35 -0000 1.1.2.2 @@ -26,4 +26,22 @@ + + + update cr_items + set parent_id=:trash_id + where item_id=:object_id + + + + + + + update acs_objects + set context_id =:trash_id + where object_id=:object_id + + + + Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/packages/file-storage/tcl/file-storage-copy-procs.tcl'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/packages/file-storage/tcl/file-storage-copy-procs.xql'. Fisheye: No comparison available. Pass `N' to diff? Index: openacs-4/packages/file-storage/www/file-copy-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/www/Attic/file-copy-2.tcl,v diff -u -r1.8 -r1.8.8.1 --- openacs-4/packages/file-storage/www/file-copy-2.tcl 5 Nov 2002 17:19:59 -0000 1.8 +++ openacs-4/packages/file-storage/www/file-copy-2.tcl 10 Oct 2005 12:59:35 -0000 1.8.8.1 @@ -33,6 +33,7 @@ # Question - do we copy revisions or not? # Current Answer - we copy the live revision only + db_transaction { db_exec_plsql file_copy " Index: openacs-4/packages/forums/tcl/forums-callback-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/tcl/forums-callback-procs.tcl,v diff -u -r1.1.2.3 -r1.1.2.4 --- openacs-4/packages/forums/tcl/forums-callback-procs.tcl 23 Sep 2005 14:45:28 -0000 1.1.2.3 +++ openacs-4/packages/forums/tcl/forums-callback-procs.tcl 10 Oct 2005 12:59:35 -0000 1.1.2.4 @@ -96,25 +96,45 @@ -object_id:required -selected_community:required } { - Move a faq to another class or community + Move a forum to another class or community } { +#get the new_package_id +set new_package_id [forum::get_forum_package -community_id $selected_community] + #update forums_forums table db_dml update_forums {} #update acs_objects table (because data redundancy) db_dml update_forums_acs_objects {} } +ad_proc -public -callback datamanager::delete_forum -impl datamanager { + -object_id:required +} { + Move a forum to the trash +} { + +#get trash_id +set trash_package_id [datamanager::get_trash_package_id] + + +#update forums_forums table +db_dml del_update_forums {} +#update acs_objects table (because data redundancy) +db_dml del_update_forums_acs_objects {} +} + + ad_proc -public -callback datamanager::copy_forum -impl datamanager { -object_id:required -selected_community:required } { - Move a faq to another class or community + Copy a forum to another class or community } { #get forum's data set forum_id [db_nextval acs_object_id_seq] - db_1row get_forum_package_id {} + set package_id [forum::get_forum_package -community_id $selected_community] db_1row get_forum_data {} #create the new forums Index: openacs-4/packages/forums/tcl/forums-callback-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/tcl/forums-callback-procs.xql,v diff -u -r1.1.2.3 -r1.1.2.4 --- openacs-4/packages/forums/tcl/forums-callback-procs.xql 23 Sep 2005 14:45:28 -0000 1.1.2.3 +++ openacs-4/packages/forums/tcl/forums-callback-procs.xql 10 Oct 2005 12:59:35 -0000 1.1.2.4 @@ -35,35 +35,41 @@ - update forums_forums - set package_id = (select package_id - from dotlrn_community_applets - where community_id = :selected_community and applet_id = ( - select applet_id from dotlrn_applets where applet_key = 'dotlrn_forums' - )) - where forum_id = :object_id + update forums_forums + set package_id = :new_package_id + where forum_id = :object_id + + + + + update forums_forums + set package_id = :trash_package_id + where forum_id = :object_id + + -update acs_objects - set package_id = (select package_id from dotlrn_community_applets where community_id = :selected_community and applet_id = (select applet_id from dotlrn_applets where applet_key = 'dotlrn_forums')),context_id = (select package_id from dotlrn_community_applets where community_id = :selected_community and applet_id = (select applet_id from dotlrn_applets where applet_key = 'dotlrn_forums')) + update acs_objects + set package_id = :new_package_id, + context_id = :new_package_id where object_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='Forums'; +update acs_objects +set package_id = :trash_package_id, + context_id = :trash_package_id +where object_id = :object_id - SELECT name,charter,presentation_type,posting_policy Index: openacs-4/packages/forums/tcl/forums-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/tcl/forums-procs.tcl,v diff -u -r1.17.2.4 -r1.17.2.5 --- openacs-4/packages/forums/tcl/forums-procs.tcl 26 Sep 2005 09:03:14 -0000 1.17.2.4 +++ openacs-4/packages/forums/tcl/forums-procs.tcl 10 Oct 2005 12:59:35 -0000 1.17.2.5 @@ -150,3 +150,15 @@ } { db_dml update_forum_disabled_p {} } + +ad_proc forum::get_forum_package { + {-community_id} +} { + if {[info exist community_id] == 0} { + set community_id [dotlrn_community::get_community_id] + } + + db_1row get_forum_package_id {} + + return $package_id +} Index: openacs-4/packages/forums/tcl/forums-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/forums/tcl/forums-procs.xql,v diff -u -r1.5.2.2 -r1.5.2.3 --- openacs-4/packages/forums/tcl/forums-procs.xql 19 Jul 2005 21:43:13 -0000 1.5.2.2 +++ openacs-4/packages/forums/tcl/forums-procs.xql 10 Oct 2005 12:59:35 -0000 1.5.2.3 @@ -56,4 +56,12 @@ + + + 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='Forums'; + + + Index: openacs-4/packages/news/tcl/news-callback-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/news/tcl/news-callback-procs.tcl,v diff -u -r1.1.2.4 -r1.1.2.5 --- openacs-4/packages/news/tcl/news-callback-procs.tcl 23 Sep 2005 14:50:47 -0000 1.1.2.4 +++ openacs-4/packages/news/tcl/news-callback-procs.tcl 10 Oct 2005 12:59:35 -0000 1.1.2.5 @@ -47,6 +47,8 @@ } { Move a new to another class or community } { + set new_package_id [news_get_package_id -community_id $selected_community] + db_dml update_news {} db_dml update_news_acs_objects_1 {} db_dml update_news_acs_objects_2 {} @@ -59,8 +61,8 @@ Copy a new to another class or community } { #get environment data - db_1row get_news_package_id {} - + set package_id [news_get_package_id -community_id $selected_community] + #get the revision's data set news_revisions_list [db_list_of_lists get_news_revisions_data {}] @@ -105,3 +107,16 @@ #does the new includes images? } + +ad_proc -public -callback datamanager::delete_new -impl datamanager { + -object_id:required +} { + Move a new to the trash +} { + set trash_package_id [datamanager::get_trash_package_id] + +db_dml del_update_news {} +db_dml del_update_news_acs_objects_1 {} +db_dml del_update_news_acs_objects_2 {} +} + Index: openacs-4/packages/news/tcl/news-callback-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/news/tcl/news-callback-procs.xql,v diff -u -r1.1.2.3 -r1.1.2.4 --- openacs-4/packages/news/tcl/news-callback-procs.xql 23 Sep 2005 14:50:47 -0000 1.1.2.3 +++ openacs-4/packages/news/tcl/news-callback-procs.xql 10 Oct 2005 12:59:35 -0000 1.1.2.4 @@ -18,10 +18,10 @@ - + update cr_news - set package_id = (select package_id from dotlrn_community_applets where community_id = :selected_community and applet_id = (select applet_id from dotlrn_applets where applet_key = 'dotlrn_news')) + set package_id = :new_package_id where news_id in (select revision_id from cr_revisions where item_id = (select item_id from cr_items where live_revision=:object_id)); @@ -31,31 +31,20 @@ update acs_objects - set package_id = (select package_id from dotlrn_community_applets where community_id = :selected_community and applet_id = (select applet_id from dotlrn_applets where applet_key = 'dotlrn_news')), - context_id = (select package_id from dotlrn_community_applets where community_id = :selected_community and applet_id = (select applet_id from dotlrn_applets where applet_key = 'dotlrn_news')) - + set package_id = :new_package_id, + context_id = :new_package_id where object_id=(select item_id from cr_revisions where revision_id=:object_id); update acs_objects - set package_id = (select package_id - from dotlrn_community_applets - where community_id = :selected_community and applet_id = ( - select applet_id from dotlrn_applets where applet_key = 'dotlrn_news')) + set package_id = :new_package_id where object_id in (select revision_id from cr_revisions where item_id = (select item_id from cr_revisions where revision_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='News'; - - @@ -155,4 +144,33 @@ + + + + update cr_news + set package_id = :trash_package_id + where news_id in (select revision_id from cr_revisions where item_id = (select item_id from cr_items where live_revision=:object_id)); + + + + + + + + update acs_objects + set package_id = :trash_package_id, + context_id = :trash_package_id + where object_id=(select item_id from cr_revisions where revision_id=:object_id); + + + + + + update acs_objects + set package_id = :trash_package_id + where object_id in (select revision_id from cr_revisions where item_id = (select item_id from cr_revisions where revision_id=:object_id)); + + + + Index: openacs-4/packages/news/tcl/news-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/news/tcl/news-procs.tcl,v diff -u -r1.20.2.5 -r1.20.2.6 --- openacs-4/packages/news/tcl/news-procs.tcl 26 Sep 2005 09:08:49 -0000 1.20.2.5 +++ openacs-4/packages/news/tcl/news-procs.tcl 10 Oct 2005 12:59:35 -0000 1.20.2.6 @@ -8,7 +8,25 @@ } # News specific db-API wrapper functions and interpreters +ad_proc news_get_package_id { + -community_id +} { + Get the news package in the selected community + @param community_id +} { + + if {[info exist community_id] == 0} { + set community_id [dotlrn_community::get_community_id] + } + + db_1row get_news_package_id {} + + return $package_id +} + + + ad_proc news_items_archive { id_list when } { immediately gives all news items in list id_list @@ -369,8 +387,10 @@ -impl_name "news" \ -owner "news"] rss_gen_report $subscr_id + } + # add news notification ad_proc -public news_notification_get_url { news_package_id @@ -402,3 +422,4 @@ -notif_text $new_content } + Index: openacs-4/packages/news/tcl/news-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/news/tcl/news-procs.xql,v diff -u -r1.8.2.3 -r1.8.2.4 --- openacs-4/packages/news/tcl/news-procs.xql 26 Sep 2005 09:08:49 -0000 1.8.2.3 +++ openacs-4/packages/news/tcl/news-procs.xql 10 Oct 2005 12:59:35 -0000 1.8.2.4 @@ -28,4 +28,12 @@ + + + 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='News'; + + + Index: openacs-4/packages/news/www/item-create-3.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/news/www/item-create-3.tcl,v diff -u -r1.9.2.1 -r1.9.2.2 --- openacs-4/packages/news/www/item-create-3.tcl 6 Sep 2005 06:11:34 -0000 1.9.2.1 +++ openacs-4/packages/news/www/item-create-3.tcl 10 Oct 2005 12:59:35 -0000 1.9.2.2 @@ -76,12 +76,11 @@ } else { set mime_type "text/plain" } - - # do insert: unfortunately the publish_body cannot be supplied through the PL/SQL function # we therefore have to do this in a second step set news_id [db_exec_plsql create_news_item {}] + # # RAL: For postgres, we need NOT store the data in a blob. The # news item body is stored in the prior news__new call. Index: openacs-4/packages/news/www/admin/revision-add-3.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/news/www/admin/revision-add-3.tcl,v diff -u -r1.6 -r1.6.2.1 --- openacs-4/packages/news/www/admin/revision-add-3.tcl 24 Feb 2005 18:03:05 -0000 1.6 +++ openacs-4/packages/news/www/admin/revision-add-3.tcl 10 Oct 2005 12:59:35 -0000 1.6.2.1 @@ -45,7 +45,6 @@ # make new revision the active revision set active_revision_p "t" - # Insert is 2-step process, same as in item-create-3.tcl if [catch { set revision_id [db_exec_plsql create_news_item_revision " Index: openacs-4/packages/static-portlet/www/element.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/static-portlet/www/element.tcl,v diff -u -r1.13.2.1 -r1.13.2.2 --- openacs-4/packages/static-portlet/www/element.tcl 26 Sep 2005 08:50:05 -0000 1.13.2.1 +++ openacs-4/packages/static-portlet/www/element.tcl 10 Oct 2005 12:59:35 -0000 1.13.2.2 @@ -74,8 +74,8 @@ set content [template::util::richtext::create $body $format] ad_set_form_values pretty_name } -new_data { - db_transaction { + set item_id [static_portal_content::new \ -package_id $package_id \ -content [template::util::richtext::get_property contents $content] \ @@ -86,9 +86,6 @@ -portal_id $portal_id \ -package_id $package_id \ -content_id $item_id] - - - } # support for templates & already created portals for users, @@ -126,7 +123,9 @@ -portal_id $target_portal_id \ -package_id $community_id \ -content_id $new_content_id] + + portal::set_element_param $new_element_id "package_id" $community_id portal::set_element_param $new_element_id "content_id" $new_content_id