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))
+
+
+
+
+