Index: openacs-4/packages/file-storage/tcl/file-storage-procs-oracle.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/tcl/file-storage-procs-oracle.xql,v
diff -u -r1.25.2.6 -r1.25.2.7
--- openacs-4/packages/file-storage/tcl/file-storage-procs-oracle.xql 26 Jul 2004 23:57:01 -0000 1.25.2.6
+++ openacs-4/packages/file-storage/tcl/file-storage-procs-oracle.xql 9 Aug 2004 21:48:37 -0000 1.25.2.7
@@ -204,7 +204,7 @@
-
+
begin
@@ -214,8 +214,17 @@
end;
-
+
+
+
+ file_storage.delete_folder (
+ :folder_id,
+ :cascade_p
+ )
+
+
+
begin
Index: openacs-4/packages/file-storage/tcl/file-storage-procs-postgresql.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/tcl/file-storage-procs-postgresql.xql,v
diff -u -r1.38.2.3 -r1.38.2.4
--- openacs-4/packages/file-storage/tcl/file-storage-procs-postgresql.xql 26 Jul 2004 23:57:01 -0000 1.38.2.3
+++ openacs-4/packages/file-storage/tcl/file-storage-procs-postgresql.xql 9 Aug 2004 21:48:37 -0000 1.38.2.4
@@ -192,6 +192,15 @@
+
+
+ select file_storage__delete_folder (
+ :folder_id,
+ :cascade_p
+ )
+
+
+
begin
Index: openacs-4/packages/file-storage/tcl/file-storage-procs.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/tcl/file-storage-procs.tcl,v
diff -u -r1.42.2.12 -r1.42.2.13
--- openacs-4/packages/file-storage/tcl/file-storage-procs.tcl 2 Aug 2004 20:26:18 -0000 1.42.2.12
+++ openacs-4/packages/file-storage/tcl/file-storage-procs.tcl 9 Aug 2004 21:48:37 -0000 1.42.2.13
@@ -775,6 +775,24 @@
fs::do_notifications -folder_id $parent_id -filename $version_name -item_id $item_id -action "delete_file"
}
+ad_proc fs::delete_folder {
+ -folder_id
+ {-cascade_p "t"}
+ {-parent_id ""}
+} {
+ Deletes a folder and all contents
+} {
+ set version_name [get_object_name -object_id $folder_id]
+ db_exec_plsql delete_folder ""
+
+ if {[empty_string_p $parent_id]} {
+ set parent_id [get_parent -item_id $folder_id]
+ }
+
+ fs::do_notifications -folder_id $parent_id -filename $version_name -item_id $folder_id -action "delete_folder"
+
+}
+
ad_proc fs::delete_version {
-item_id
-version_id
@@ -846,6 +864,7 @@
Note that not all possible operations are implemented, e.g. move, copy etc. See documentation.
@param action The kind of operation. One of: new_file, new_version, new_url, delete_file, delete_url
+ delete_folder
} {
if {[string equal "" $package_id]} {
set package_id [ad_conn package_id]
@@ -862,6 +881,8 @@
set action_type {File deleted}
} elseif {[string equal $action "delete_url"]} {
set action_type {URL deleted}
+ } elseif {[string equal $action "delete_folder"]} {
+ set action_type {Folder deleted}
} else {
error "Unknown file-storage notification action: $action"
}
@@ -874,6 +895,8 @@
if {[string equal $action "new_version"]} {
set sql "select description as description from cr_revisions
where cr_revisions.revision_id = :item_id"
+ } elseif {[string match "*folder" $action]} {
+ set sql "select description from cr_folders where folder_id=:item_id"
} else {
set sql "select description as description from cr_revisions
where cr_revisions.item_id = :item_id"
Index: openacs-4/packages/file-storage/www/delete-postgresql.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/www/Attic/delete-postgresql.xql,v
diff -u -r1.1.2.3 -r1.1.2.4
--- openacs-4/packages/file-storage/www/delete-postgresql.xql 5 Aug 2004 01:21:15 -0000 1.1.2.3
+++ openacs-4/packages/file-storage/www/delete-postgresql.xql 9 Aug 2004 21:48:36 -0000 1.1.2.4
@@ -15,7 +15,7 @@
- select fs.object_id as fs_object_id, fs.name, fs.parent_id,
+ select fs.object_id as fs_object_id, fs.type, fs.name, fs.parent_id,
acs_permission__permission_p(fs.object_id, :user_id, 'write') as delete_p
from fs_objects fs
where fs.object_id in ('$object_id_list')
Index: openacs-4/packages/file-storage/www/delete.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/www/delete.tcl,v
diff -u -r1.1.2.5 -r1.1.2.6
--- openacs-4/packages/file-storage/www/delete.tcl 5 Aug 2004 01:38:13 -0000 1.1.2.5
+++ openacs-4/packages/file-storage/www/delete.tcl 9 Aug 2004 21:48:36 -0000 1.1.2.6
@@ -65,7 +65,19 @@
db_transaction {
template::multirow foreach delete_list {
if {$delete_p} {
- fs::delete_file -item_id $fs_object_id -parent_id $parent_id
+ switch $type {
+ folder {
+ fs::delete_folder \
+ -folder_id $fs_object_id \
+ -parent_id $parent_id
+ }
+ default {
+ fs::delete_file \
+ -item_id $fs_object_id \
+ -parent_id $parent_id
+ }
+ }
+
}
}
}