Index: openacs-4/packages/imsld/sql/postgresql/imsld-level-a-drop.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/sql/postgresql/imsld-level-a-drop.sql,v
diff -u -r1.3 -r1.4
--- openacs-4/packages/imsld/sql/postgresql/imsld-level-a-drop.sql 13 Jul 2006 13:11:43 -0000 1.3
+++ openacs-4/packages/imsld/sql/postgresql/imsld-level-a-drop.sql 19 Dec 2006 10:36:07 -0000 1.4
@@ -19,7 +19,7 @@
drop table imsld_roles cascade;
-drop table imsld_activity_descs;
+drop table imsld_activity_descs cascade;
drop table imsld_learning_activities cascade;
@@ -53,4 +53,11 @@
drop table imsld_classes cascade;
-drop table imsld_res_files_rel cascade;
\ No newline at end of file
+drop table imsld_as_la_rels cascade;
+drop table imsld_as_sa_rels cascade;
+drop table imsld_as_as_rels cascade;
+
+drop table imsld_res_files_rel cascade;
+
+drop table imsld_role_group_ext;
+drop table imsld_run_users_group_ext;
Index: openacs-4/packages/imsld/sql/postgresql/imsld-production-delivery-drop.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/sql/postgresql/imsld-production-delivery-drop.sql,v
diff -u -r1.2 -r1.3
--- openacs-4/packages/imsld/sql/postgresql/imsld-production-delivery-drop.sql 16 May 2006 09:24:35 -0000 1.2
+++ openacs-4/packages/imsld/sql/postgresql/imsld-production-delivery-drop.sql 19 Dec 2006 10:36:07 -0000 1.3
@@ -11,4 +11,6 @@
drop table imsld_property_instances cascade;
-drop table imsld_attribute_instances cascade;
\ No newline at end of file
+drop table imsld_attribute_instances cascade;
+
+drop table imsld_run_users_group_rels cascade;
Index: openacs-4/packages/imsld/tcl/apm-callback-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/tcl/apm-callback-procs.tcl,v
diff -u -r1.5 -r1.6
--- openacs-4/packages/imsld/tcl/apm-callback-procs.tcl 16 May 2006 09:24:35 -0000 1.5
+++ openacs-4/packages/imsld/tcl/apm-callback-procs.tcl 19 Dec 2006 10:36:07 -0000 1.6
@@ -29,14 +29,38 @@
return 1
}
+ad_proc -public imsld::apm_callback::before_uninstantiate {
+ -package_id:required
+} {
+ task that must be done before uninstance the imsld package
+} {
+ imsld::drop_imsld_package -object_id $package_id
+}
+
+ad_proc -public imsld::apm_callback::before_unmount {
+ -node_id:required
+ -package_id:required
+} {
+ task that must be done before unmount the imsld package
+} {
+
+
+}
+
ad_proc -public imsld::apm_callback::before_uninstall {
} {
Proc calls and tasks needed to be donde before the uninstallation of the imsld package.
} {
+
# clean rels
imsld::uninstall::delete_rels
imsld::uninstall::delete_ext_rels
+
+ #clean groups
+ imsld::uninstall::delete_group_types
+
+
# clean the cr
imsld::uninstall::empty_content_repository
Index: openacs-4/packages/imsld/tcl/imsld-install-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/tcl/imsld-install-procs.tcl,v
diff -u -r1.39 -r1.40
--- openacs-4/packages/imsld/tcl/imsld-install-procs.tcl 3 Nov 2006 14:39:02 -0000 1.39
+++ openacs-4/packages/imsld/tcl/imsld-install-procs.tcl 19 Dec 2006 10:36:07 -0000 1.40
@@ -650,7 +650,7 @@
ad_proc -public imsld::uninstall::delete_rels {
} {
Delete default rels between imsld items
-} {
+} {
imsld::rel_type_delete -rel_type imsld_lo_item_rel
imsld::rel_type_delete -rel_type imsld_res_files_rel
imsld::rel_type_delete -rel_type imsld_preq_item_rel
@@ -684,16 +684,30 @@
imsld::rel_type_delete -rel_type imsld_on_comp_notif_rel
imsld::rel_type_delete -rel_type imsld_notif_email_rel
imsld::rel_type_delete -rel_type imsld_send_mail_serv_data_rel
+ imsld::rel_type_delete -rel_type imsld_run_time_activities_rel
}
ad_proc -public imsld::uninstall::delete_ext_rels {
} {
Delete default rels between imsld and non IMS-LD objects
} {
imsld::rel_type_delete -rel_type imsld_role_group_rel
- imsld::rel_type_delete -rel_type imsld_res_files_rel
+ imsld::rel_type_delete -rel_type imsld_roleinstance_run_rel
+#TODO: drop attributes
+ imsld::rel_type_delete -rel_type imsld_run_users_group_rel
}
+
+ad_proc -public imsld::uninstall::delete_group_types {
+} {
+ Delete default group types
+} {
+
+ imsld::group_type_delete -group_type imsld_role_group
+#TODO: drop attributes
+ imsld::group_type_delete -group_type imsld_run_users_group
+}
+
ad_proc -public imsld::uninstall::empty_content_repository {
} {
Deletes content types and attributes
@@ -751,9 +765,6 @@
content::type::attribute::delete -content_type imsld_condition -attribute_name condition_xml
### IMS-LD Production and Delivery
- content::type::attribute::delete -content_type imsld_property_instance -attribute_name property_id
- content::type::attribute::delete -content_type imsld_property_instance -attribute_name party_id
- content::type::attribute::delete -content_type imsld_property_instance -attribute_name value
### IMS-LD level A
@@ -929,68 +940,60 @@
content::type::attribute::delete -content_type imsld_cp_dependency -attribute_name identifierref
# imsld cp files
- content::type::attribute::delete -content_type imsld_cp_file -attribute_name resource_id
content::type::attribute::delete -content_type imsld_cp_file -attribute_name path_to_file
content::type::attribute::delete -content_type imsld_cp_file -attribute_name file_name
content::type::attribute::delete -content_type imsld_cp_file -attribute_name href
### IMS-LD Production and Delivery
- # imsld runs attributes
- foreach attribute_list [package_object_attribute_list imsld_run] {
- set attribute_id [lindex $attribute_list 0]
- attribute::delete $attribute_id
- }
-
### Content Types
-
+ ### IMS-LD Production and Delivery
+ db_dml delete_table_ipi { drop table imsld_property_instances }
+ db_dml delete_table_isu { drop table imsld_status_user }
+ db_dml delete_table_iai { drop table imsld_attribute_instances }
+ db_dml delete_table_ir { drop table imsld_runs cascade}
### IMS-LD Level C
- content::type::delete -content_type imsld_notification -drop_table_p t
+ content::type::delete -content_type imsld_notification
### IMS-LD Level B
- content::type::delete -content_type imsld_property -drop_table_p t
- content::type::delete -content_type imsld_property_groups -drop_table_p t
- content::type::delete -content_type imsld_restriction -drop_table_p t
- content::type::delete -content_type imsld_monitor_service -drop_table_p t
- content::type::delete -content_type imsld_condition -drop_table_p t
- content::type::delete -content_type imsld_when_condition_true -drop_table_p t
+ content::type::delete -content_type imsld_property_groups
+ content::type::delete -content_type imsld_property
+ content::type::delete -content_type imsld_restriction
+ content::type::delete -content_type imsld_monitor_service
+ content::type::delete -content_type imsld_condition
+ content::type::delete -content_type imsld_when_condition_true
### IMS-LD Level A
- content::type::delete -content_type imsld_learning_object -drop_table_p t
- content::type::delete -content_type imsld_imsld -drop_table_p t
- content::type::delete -content_type imsld_learning_objective -drop_table_p t
- content::type::delete -content_type imsld_prerequisite -drop_table_p t
- content::type::delete -content_type imsld_item -drop_table_p t
- content::type::delete -content_type imsld_component -drop_table_p t
- content::type::delete -content_type imsld_role -drop_table_p t
- content::type::delete -content_type imsld_prerequisite -drop_table_p t
- content::type::delete -content_type imsld_activity_desc -drop_table_p t
- content::type::delete -content_type imsld_learning_activity -drop_table_p t
- content::type::delete -content_type imsld_support_activity -drop_table_p t
- content::type::delete -content_type imsld_activity_structure -drop_table_p t
- content::type::delete -content_type imsld_environment -drop_table_p t
- content::type::delete -content_type imsld_service -drop_table_p t
- content::type::delete -content_type imsld_send_mail_service -drop_table_p t
- content::type::delete -content_type imsld_send_mail_data -drop_table_p t
- content::type::delete -content_type imsld_conference_service -drop_table_p t
- content::type::delete -content_type imsld_method -drop_table_p t
- content::type::delete -content_type imsld_play -drop_table_p t
- content::type::delete -content_type imsld_act -drop_table_p t
- content::type::delete -content_type imsld_role_part -drop_table_p t
- content::type::delete -content_type imsld_complete_act -drop_table_p t
- content::type::delete -content_type imsld_on_completion -drop_table_p t
- content::type::delete -content_type imsld_class -drop_table_p t
+ content::type::delete -content_type imsld_learning_object
+ content::type::delete -content_type imsld_imsld
+ content::type::delete -content_type imsld_learning_objective
+ content::type::delete -content_type imsld_prerequisite
+ content::type::delete -content_type imsld_item
+ content::type::delete -content_type imsld_component
+ content::type::delete -content_type imsld_role
+ content::type::delete -content_type imsld_activity_desc
+ content::type::delete -content_type imsld_learning_activity
+ content::type::delete -content_type imsld_support_activity
+ content::type::delete -content_type imsld_activity_structure
+ content::type::delete -content_type imsld_environment
+ content::type::delete -content_type imsld_service
+ content::type::delete -content_type imsld_send_mail_service
+ content::type::delete -content_type imsld_send_mail_data
+ content::type::delete -content_type imsld_conference_service
+ content::type::delete -content_type imsld_method
+ content::type::delete -content_type imsld_play
+ content::type::delete -content_type imsld_act
+ content::type::delete -content_type imsld_role_part
+ content::type::delete -content_type imsld_complete_act
+ content::type::delete -content_type imsld_on_completion
+ content::type::delete -content_type imsld_class
### IMS-LD Content Packaging
- content::type::delete -content_type imsld_cp_manifest -drop_table_p t
- content::type::delete -content_type imsld_cp_organization -drop_table_p t
- content::type::delete -content_type imsld_cp_resource -drop_table_p t
- content::type::delete -content_type imsld_cp_dependency -drop_table_p t
- content::type::delete -content_type imsld_cp_file -drop_table_p t
+ content::type::delete -content_type imsld_cp_manifest
+ content::type::delete -content_type imsld_cp_organization
+ content::type::delete -content_type imsld_cp_resource
+ content::type::delete -content_type imsld_cp_dependency
+ content::type::delete -content_type imsld_cp_file
- ### IMS-LD Production and Delivery
-
- content::type::delete -content_type imsld_property_instance -drop_table_p t
-
}
Index: openacs-4/packages/imsld/tcl/imsld-procs-postgresql.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/tcl/imsld-procs-postgresql.xql,v
diff -u -r1.2 -r1.3
--- openacs-4/packages/imsld/tcl/imsld-procs-postgresql.xql 27 Sep 2005 11:05:10 -0000 1.2
+++ openacs-4/packages/imsld/tcl/imsld-procs-postgresql.xql 19 Dec 2006 10:36:07 -0000 1.3
@@ -9,4 +9,11 @@
+
+
+ select acs_object_type__drop_type(:group_type,'t');
+
+
+
+
Index: openacs-4/packages/imsld/tcl/imsld-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/imsld/tcl/imsld-procs.tcl,v
diff -u -r1.90 -r1.91
--- openacs-4/packages/imsld/tcl/imsld-procs.tcl 3 Nov 2006 14:39:02 -0000 1.90
+++ openacs-4/packages/imsld/tcl/imsld-procs.tcl 19 Dec 2006 10:36:07 -0000 1.91
@@ -537,7 +537,28 @@
-user_id $user_id
}
}
+ad_proc -public imsld::group_type_delete {
+ -group_type:required
+} {
+ Deletes a group type (since the group_types does not have a delete proc)
+} {
+#select all groups of this type
+set group_id_list [db_list select_groups {
+ select ao.object_id as group_id
+ from acs_objects ao
+ where ao.object_type= :group_type
+ }]
+#delete all groups and drop group_type
+ foreach group_id $group_id_list {
+ group::delete $group_id
+ }
+
+ db_dml delete_group_type {delete from group_types where group_type=:group_type}
+ db_exec_plsql drop_group_type {}
+
+
+}
ad_proc -public imsld::rel_type_delete {
-rel_type:required
} {
@@ -549,7 +570,6 @@
from acs_object_types t
where t.object_type = :rel_type
}
-
set rel_id_list [db_list select_rel_ids {
select r.rel_id
from acs_rels r
@@ -3613,6 +3633,112 @@
}
}
+ad_proc -public imsld::delete_run {
+ -run_id:required
+} {
+ Delete a run with all dependencies
+ @author Luis de la Fuente Valent�n (lfuente@it.uc3m.es)
+} {
+
+ db_dml delete_related_property_instances {
+ delete from imsld_property_instances where run_id=:run_id
+ }
+ db_dml delete_related_attribute_instances {
+ delete from imsld_attribute_instances where run_id=:run_id
+ }
+ db_dml delete_related_status_user {
+ delete from imsld_status_user where run_id=:run_id
+ }
+ db_dml delete_related_notification_history {
+ delete from imsld_notifications_history where run_id=:run_id
+ }
+
+ db_dml delete_run {delete from imsld_runs where run_id=:run_id}
+}
+
+ad_proc -public imsld::delete_cr_item {
+ -item_id:required
+ -only_revisions:boolean
+} {
+ Delete an item in cr_items if created by imsld
+ @author Luis de la Fuente Valent�n (lfuente@it.uc3m.es)
+} {
+#we must search for dependencies before aplying content::item::delete
+ set related_imsld_item_list [db_list_of_lists get_related_imsld_items {
+ select cri.content_type,
+ crr.revision_id,
+ aot.table_name,
+ aot.id_column
+ from cr_items cri,
+ cr_revisions crr,
+ acs_object_types aot
+ where cri.item_id=:item_id
+ and crr.item_id=cri.item_id
+ and aot.object_type=cri.content_type
+ }]
+
+ foreach related_item $related_imsld_item_list {
+ #delete all item_types
+ db_dml delete_imsld_type "delete
+ from [lindex $related_item 2]
+ where [lindex $related_item 3] = [lindex $related_item 1]"
+ content::revision::delete -revision_id [lindex $related_item 1]
+ }
+
+ set relations_list [db_list get_acs_relations {
+ select rel_id from acs_rels where object_id_one=:item_id or object_id_two=:item_id
+ }]
+ foreach relation $relations_list {
+ relation_remove $relation
+ }
+
+ if {!$only_revisions_p} {
+ content::item::delete -item_id $item_id
+ }
+
+
+
+}
+
+
+ad_proc -public imsld::drop_imsld_package {
+ -object_id:required
+} {
+ Drop an imsld package
+ @author Luis de la Fuente Valent�n (lfuente@it.uc3m.es)
+} {
+ #get related runs and drop them
+ set run_id_list [db_list get_run_id_list {
+ select ir.run_id
+ from acs_objects ao,
+ cr_items crr,
+ cr_revisions crev,
+ imsld_runs ir
+ where ao.context_id=:object_id
+ and crr.content_type='imsld_imsld'
+ and crr.item_id=ao.object_id
+ and crev.item_id=crr.item_id
+ and ir.imsld_id=crev.revision_id
+ } ]
+
+ foreach run_id $run_id_list {
+ imsld::delete_run -run_id $run_id
+ }
+
+ set related_objects_list [db_list get_related_objects {select object_id as related_object_id
+ from acs_objects
+ where context_id=:object_id
+ and object_type='content_item'
+ }]
+ foreach related_item $related_objects_list {
+ imsld::delete_cr_item -item_id $related_item -only_revisions
+ }
+ #to avoid conflicts, we first remove all revisions and then we remove the items themselves
+ foreach related_item $related_objects_list {
+ imsld::delete_cr_item -item_id $related_item
+ }
+}
+
ad_proc -public imsld::grant_permissions {
-resources_activities_list
-user_id