Index: openacs-4/packages/edit-this-page/sql/postgresql/etp-create.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/edit-this-page/sql/postgresql/Attic/etp-create.sql,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/edit-this-page/sql/postgresql/etp-create.sql	24 Sep 2001 17:24:13 -0000	1.1
+++ openacs-4/packages/edit-this-page/sql/postgresql/etp-create.sql	29 Oct 2001 23:08:50 -0000	1.2
@@ -181,12 +181,24 @@
 declare
     p_package_id alias for $1;
     v_folder_id integer;
+    v_parent_id integer;
 begin
     select folder_id into v_folder_id
       from cr_folders
      where package_id = p_package_id;
     if not found then 
-        v_folder_id := content_item_globals.c_root_folder_id;
+        select parent_id into v_parent_id
+          from site_nodes
+         where object_id = p_package_id;
+        if found and v_parent_id is null then
+            v_folder_id := content_item_globals.c_root_folder_id;
+        else
+            -- This is probably an ETP app instance that
+            -- was created through the Site Map; by returning
+	    -- 0 we ensure the get_page_attributes query will
+	    -- fail and index.vuh will redirect to etp-setup-2.
+            v_folder_id := 0;
+        end if;
     end if;
 
     return v_folder_id;
