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.2 -r1.3
--- openacs-4/packages/edit-this-page/www/etp-trash.tcl	9 Nov 2001 03:00:50 -0000	1.2
+++ openacs-4/packages/edit-this-page/www/etp-trash.tcl	9 Nov 2001 03:38:17 -0000	1.3
@@ -16,9 +16,28 @@
 
 set package_id [ad_conn package_id]
 
+if {![db_0or1row get_node_id ""]} {
+    set node_id ""
+} else {
+
+    # You can't delete a site node if it has any children 
+    if {[db_string site_node_children ""] > 0} {
+	ad_return_warning "Unable to delete content section" "
+	Sorry, this subtopic contains other subtopics.
+	You should remove them first; then you'll be able to
+	remove this one.  If Edit This Page isn't showing any
+	subtopics, you
+	may need to use the <a href=\"/admin/site-map/\">Site Map</a>.
+	"
+	ad_script_abort
+    }
+}
+    
+
+
 db_transaction {
 
-    if {[db_0or1row get_node_id ""]} {
+    if {![empty_string_p $node_id]} {
 	site_map_unmount_application -delete_p "t" $node_id    
     }
 
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.2 -r1.3
--- openacs-4/packages/edit-this-page/www/etp-trash.xql	9 Nov 2001 03:00:50 -0000	1.2
+++ openacs-4/packages/edit-this-page/www/etp-trash.xql	9 Nov 2001 03:38:17 -0000	1.3
@@ -1,6 +1,14 @@
 <?xml version="1.0"?>
 <queryset>
 
+<fullquery name="site_node_children">
+<querytext>
+  select count(1)
+    from site_nodes
+   where parent_id = :node_id
+</querytext>
+</fullquery>
+
 <fullquery name="get_node_id">
 <querytext>
   select node_id