Index: openacs-4/packages/file-storage/sql/postgresql/upgrade/upgrade-4.6.1-4.6.2.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/sql/postgresql/upgrade/upgrade-4.6.1-4.6.2.sql,v
diff -u -r1.1.2.4 -r1.1.2.4.2.1
--- openacs-4/packages/file-storage/sql/postgresql/upgrade/upgrade-4.6.1-4.6.2.sql	28 Mar 2003 08:56:23 -0000	1.1.2.4
+++ openacs-4/packages/file-storage/sql/postgresql/upgrade/upgrade-4.6.1-4.6.2.sql	14 Oct 2003 18:41:09 -0000	1.1.2.4.2.1
@@ -67,6 +67,8 @@
   drop function inline_0();
   drop view fs_objects;
   drop view fs_urls_full;
+  drop view fs_folders;
+
   drop table fs_urls;
   drop table fs_simple_objects;
 end;
@@ -121,6 +123,26 @@
       left join cr_revisions on (cr_items.live_revision = cr_revisions.revision_id)
       join acs_objects on (cr_items.item_id = acs_objects.object_id);
 
+
+
+
+create view fs_folders
+as
+    select cr_folders.folder_id,
+           cr_folders.label as name,
+           acs_objects.last_modified, -- JCD needs to walk tree as oracle ver
+           (select count(*) -- DRB: needs to walk tree and won't scale worth shit
+            from cr_items ci2
+	    where ci2.content_type <> 'content_folder'
+              and ci2.tree_sortkey between ci.tree_sortkey and tree_right(ci.tree_sortkey)) as content_size,
+           ci.parent_id,
+           ci.name as key
+    from cr_folders,
+         cr_items ci,
+         acs_objects
+    where cr_folders.folder_id = ci.item_id
+    and cr_folders.folder_id = acs_objects.object_id;
+
 -- JS: BEFORE DELETE TRIGGER to clean up CR entries (except root folder)
 drop function fs_package_items_delete_trig ();
 create function fs_package_items_delete_trig () returns opaque as '
