oacs_dav::impl::content_folder::propfind (private)
oacs_dav::impl::content_folder::propfind
Defined in packages/oacs-dav/tcl/oacs-dav-procs.tcl
PROPFIND DAV method for generic content folder
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
Source code: set user_id [oacs_dav::conn user_id] set depth [oacs_dav::conn depth] set encoded_uri [list] foreach fragment [split [ad_conn url] "/"] { lappend encoded_uri [ns_urlencode $fragment] } set folder_uri "[ad_conn location][join $encoded_uri "/"]" # this is wacky, but MS Web Folders usually (but not always) # requests a collection without a trailing slash # if you return a propfind with the href for the collection # with a trailing slash, sometimes (but not always) it will # get confused and show the collection as a member of itself regsub {/$} $folder_uri {} folder_uri if {$depth eq ""} { set depth 0 } set prop_req [oacs_dav::conn prop_req] set folder_id [oacs_dav::conn item_id] # append the properties into response set all_properties [list] # hack to get the OS timezone to tack on the end of oracle timestamps # until we stop supporting oracle 8i set os_time_zone [clock format [clock seconds] -format %Z] db_foreach get_properties "" { set name $name set etag "1f9a-400-3948d0f5" set properties [list] # is "D" the namespace?? lappend properties [list "D" "getcontentlength"] $content_length # ns_log debug "\nDAVEB item_id $item_id folder_id $folder_id $item_uri" if {$item_id == $folder_id} { set item_uri "/" } else { set encoded_uri [list] foreach fragment [split $item_uri "/"] { lappend encoded_uri [ns_urlencode $fragment] # ns_log debug "\npropfind: fragment \"$fragment\" encoded_uri \"$encoded_uri\" " } set item_uri "/[join $encoded_uri "/"]" } lappend properties [list "D" "getcontenttype"] $mime_type # where do we get an etag from? lappend properties [list "D" "getetag"] $etag lappend properties [list "D" "getlastmodified"] $last_modified lappend properties [list "D" "creationdate"] $creation_date if {$collection_p} { lappend properties [list "D" "resourcetype"] "D:collection" } else { lappend properties [list "D" "resourcetype"] "" } # according to Todd's example # resourcetype for a folder(collection) is <D:collection/> # and getcontenttype is */* foreach i [tdav::get_user_props ${folder_uri}${item_uri} $depth $prop_req] { lappend properties $i } lappend all_properties [list ${folder_uri}${item_uri} $collection_p $properties] } set response [list 207 $all_properties] return $responseGeneric XQL file: packages/oacs-dav/tcl/oacs-dav-procs.xql
PostgreSQL XQL file: <fullquery name="oacs_dav::impl::content_folder::propfind.get_properties"> <querytext> 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 acs_permission__permission_p(ci1.item_id, :user_id, '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 acs_permission__permission_p(ci1.item_id, :user_id, 'read') and not exists (select 1 from cr_revisions cr where cr.revision_id = ci1.live_revision) </querytext> </fullquery>packages/oacs-dav/tcl/oacs-dav-procs-postgresql.xql
Oracle XQL file: <fullquery name="oacs_dav::impl::content_folder::propfind.get_properties"> <querytext> select nvl (cr.content_length,0) as content_length, nvl (cr.mime_type,'*/*') as mime_type, to_char(o.creation_date, 'YYYY-MM-DD"T"HH:MI:SS."000"') as creation_date, to_char(o.last_modified, 'Dy, Dd Mon YYYY HH:MI:SS "${os_time_zone}"') as last_modified, ci1.item_id, case when ci1.item_id=:folder_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 ( select * from cr_items where (parent_id=:folder_id or item_id=:folder_id) and level <= :depth + 1 connect by prior item_id=parent_id start with item_id=:folder_id ) ci1, cr_revisions cr, acs_objects o where ci1.item_id=o.object_id and ci1.live_revision = cr.revision_id(+) 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') </querytext> </fullquery>packages/oacs-dav/tcl/oacs-dav-procs-oracle.xql