oacs_dav::impl::content_revision::put (private)
oacs_dav::impl::content_revision::put
Defined in packages/oacs-dav/tcl/oacs-dav-procs.tcl
PUT DAV method for generic content revision
- Author:
- Dave Bauer
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- oacs_dav_put
Source code: set user_id [oacs_dav::conn user_id] set item_id [oacs_dav::conn item_id] set root_folder_id [oacs_dav::conn folder_id] set uri [oacs_dav::conn uri] if {"unlocked" ne [tdav::check_lock $uri] } { return [list 423] } set tmp_filename [oacs_dav::conn tmpfile] set tmp_size [file size $tmp_filename] # authenticate that user has write privilege # we need to calculate parent_id from the URI # it might not be the root DAV folder for the package # check for folder or not set urlv [split [oacs_dav::conn uri] "/"] set name [oacs_dav::conn item_name] set parent_id [oacs_dav::item_parent_folder_id $uri] if {$parent_id eq ""} { set response [list 409] return $response } # create new item if necessary db_transaction { set mime_type [cr_filename_to_mime_type $name] if {$item_id eq ""} { # this won't really work very nicely if we support # abstract url type names... maybe chop off the extension # when we name the object? set revision_id [cr_import_content -storage_type file $parent_id $tmp_filename $tmp_size $mime_type $name] if {[file exists [tdav::get_lock_file $uri]]} { # if there is a null lock use 204 set response [list 204] } else { set response [list 201] } } else { set revision_id [cr_import_content -item_id $item_id -storage_type file $parent_id $tmp_filename $tmp_size $mime_type $name] set response [list 204] } db_dml set_live_revision "" } on_error { set response [list 500] ns_log error "oacs_dav::impl::content_revision::put: $errmsg" } file delete -- $tmp_filename # at least we need to return the http_status return $responseGeneric XQL file: <fullquery name="oacs_dav::impl::content_revision::put.set_live_revision"> <querytext> update cr_items set live_revision=:revision_id where item_id=(select item_id from cr_revisions where revision_id=:revision_id) </querytext> </fullquery>packages/oacs-dav/tcl/oacs-dav-procs.xql
PostgreSQL XQL file: packages/oacs-dav/tcl/oacs-dav-procs-postgresql.xql
Oracle XQL file: packages/oacs-dav/tcl/oacs-dav-procs-oracle.xql