Index: openacs-4/packages/oacs-dav/tcl/oacs-dav-procs-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/oacs-dav/tcl/oacs-dav-procs-postgresql.xql,v diff -u -r1.4 -r1.5 --- openacs-4/packages/oacs-dav/tcl/oacs-dav-procs-postgresql.xql 1 Jun 2004 22:54:19 -0000 1.4 +++ openacs-4/packages/oacs-dav/tcl/oacs-dav-procs-postgresql.xql 8 Aug 2006 21:27:07 -0000 1.5 @@ -25,29 +25,59 @@ - select coalesce (cr.content_length,0) as content_length, - coalesce(cr.mime_type,'*/*') as mime_type, - to_char(timezone('GMT',o.creation_date) :: timestamptz ,'YYYY-MM-DD"T"HH:MM:SS.MS"Z"') as creation_date, - to_char(timezone('GMT',o.last_modified) :: timestamptz ,'Dy, DD Mon YYYY HH:MM:SS TZ') as last_modified, - ci1.item_id, - case when ci1.item_id=ci2.item_id then '' else ci1.name end as name, - content_item__get_path(ci1.item_id,:folder_id) as item_uri, - case when o.object_type='content_folder' then 1 else 0 end - as collection_p - from cr_items ci1 left join cr_revisions cr on ci1.live_revision = cr.revision_id, - cr_items ci2, - acs_objects o - where ci1.tree_sortkey between ci2.tree_sortkey and - tree_right(ci2.tree_sortkey) - and ci2.item_id=:folder_id - and ci1.item_id = o.object_id - and (tree_level(ci1.tree_sortkey) - tree_level(ci2.tree_sortkey)) - <= :depth :: integer - and exists (select 1 + select + coalesce (cr.content_length,0) as content_length, + coalesce(cr.mime_type,'*/*') as mime_type, + to_char(timezone('GMT',o.creation_date) :: timestamptz ,'YYYY-MM-DD"T"HH:MM:SS.MS"Z"') as creation_date, + to_char(timezone('GMT',o.last_modified) :: timestamptz ,'Dy, DD Mon YYYY HH:MM:SS TZ') as last_modified, + ci1.item_id, + case when ci1.item_id=ci2.item_id then '' else ci1.name end as name, + content_item__get_path(ci1.item_id,:folder_id) as item_uri, + case when o.object_type='content_folder' then 1 else 0 end + as collection_p + from + cr_items ci1, + cr_revisions cr, + cr_items ci2, + acs_objects o + where + ci1.live_revision = cr.revision_id and + ci1.tree_sortkey between ci2.tree_sortkey and tree_right(ci2.tree_sortkey) and + ci2.item_id=:folder_id and + ci1.item_id = o.object_id and + (tree_level(ci1.tree_sortkey) - tree_level(ci2.tree_sortkey)) <= :depth :: integer and + exists (select 1 from acs_object_party_privilege_map m where m.object_id = ci1.item_id and m.party_id = :user_id and m.privilege = 'read') + union + select 0 as content_length, + '*/*' as mime_type, + to_char(timezone('GMT',o.creation_date) :: timestamptz ,'YYYY-MM-DD"T"HH:MM:SS.MS"Z"') as creation_date, + to_char(timezone('GMT',o.last_modified) :: timestamptz ,'Dy, DD Mon YYYY HH:MM:SS TZ') as last_modified, + ci1.item_id, + case when ci1.item_id=ci2.item_id then '' else ci1.name end as name, + content_item__get_path(ci1.item_id,:folder_id) as item_uri, + case when o.object_type='content_folder' then 1 else 0 end + as collection_p + from + cr_items ci1, + cr_items ci2, + acs_objects o + where + ci1.tree_sortkey between ci2.tree_sortkey and tree_right(ci2.tree_sortkey) and + ci2.item_id=:folder_id and + ci1.item_id = o.object_id and + (tree_level(ci1.tree_sortkey) - tree_level(ci2.tree_sortkey)) <= :depth :: integer and + exists (select 1 + from acs_object_party_privilege_map m + where m.object_id = ci1.item_id + and m.party_id = :user_id + and m.privilege = 'read') and + not exists (select 1 + from cr_revisions cr + where cr.revision_id = ci1.live_revision)