Index: openacs-4/packages/edit-this-page/www/etp-trash.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/edit-this-page/www/etp-trash.tcl,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/edit-this-page/www/etp-trash.tcl 24 Sep 2001 17:24:13 -0000 1.1
+++ openacs-4/packages/edit-this-page/www/etp-trash.tcl 9 Nov 2001 03:00:50 -0000 1.2
@@ -16,12 +16,21 @@
set package_id [ad_conn package_id]
-if {[db_0or1row get_node_id ""]} {
- site_map_unmount_application -delete_p "t" $node_id
-}
+db_transaction {
-db_dml trash_item ""
+ if {[db_0or1row get_node_id ""]} {
+ site_map_unmount_application -delete_p "t" $node_id
+ }
+ # If an item with the same name is already in the trash,
+ # rename this item to "Copy of foo".
+ while {[db_string matching_name ""] > 0} {
+ db_dml update_name ""
+ }
+
+ db_dml trash_item ""
+
+}
ad_returnredirect "etp"
ad_script_abort
Index: openacs-4/packages/edit-this-page/www/etp-trash.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/edit-this-page/www/etp-trash.xql,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/edit-this-page/www/etp-trash.xql 24 Sep 2001 17:24:13 -0000 1.1
+++ openacs-4/packages/edit-this-page/www/etp-trash.xql 9 Nov 2001 03:00:50 -0000 1.2
@@ -10,7 +10,23 @@
+
+
+ select count(1)
+ from cr_items
+ where parent_id = -400
+ and name = (select name from cr_items where item_id = :item_id)
+
+
+
+
+ update cr_items
+ set name = 'Copy of ' || name
+ where item_id = :item_id
+
+
+
update cr_items