Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/packages/file-storage/tcl/file-storage-dav-install-procs.tcl'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `openacs-4/packages/file-storage/tcl/file-storage-dav-procs.tcl'. Fisheye: No comparison available. Pass `N' to diff? Index: openacs-4/packages/file-storage/tcl/file-storage-procs-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/tcl/file-storage-procs-postgresql.xql,v diff -u -r1.29.2.5 -r1.29.2.6 --- openacs-4/packages/file-storage/tcl/file-storage-procs-postgresql.xql 9 Nov 2003 03:36:56 -0000 1.29.2.5 +++ openacs-4/packages/file-storage/tcl/file-storage-procs-postgresql.xql 9 Nov 2003 20:56:45 -0000 1.29.2.6 @@ -143,4 +143,30 @@ + + + + select file_storage__new_file ( + :name, + :parent_id, + :creation_user, + :creation_ip, + :indbp, + :item_id + ) + + + + + + begin + perform acs_object__update_last_modified + (:parent_id,:creation_user,:creation_ip); + perform + acs_object__update_last_modified(:item_id,:creation_user,:creation_ip); + return null; + end; + + + Index: openacs-4/packages/file-storage/tcl/file-storage-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/tcl/file-storage-procs.tcl,v diff -u -r1.25.2.6 -r1.25.2.7 --- openacs-4/packages/file-storage/tcl/file-storage-procs.tcl 9 Nov 2003 03:36:56 -0000 1.25.2.6 +++ openacs-4/packages/file-storage/tcl/file-storage-procs.tcl 9 Nov 2003 20:56:45 -0000 1.25.2.7 @@ -599,3 +599,61 @@ } return [db_exec_plsql get_item_id ""] } + +ad_proc -public fs::add_file { + -name + -parent_id + -tmp_filename + -package_id + {-item_id ""} + {-creation_user ""} + {-creation_ip ""} + {-title ""} + {-description ""} +} { + Create a new file storage item or add a new revision if + an item with the same name and parent folder already exists + + @returns revision_id +} { + + if {[ad_parameter "StoreFilesInDatabaseP" -package_id $package_id]} { + set indbp "t" + set storage_type "lob" + } else { + set indpb "f" + set storage_type "file" + } + + set mime_type [cr_filename_to_mime_type -create $name] + set tmp_size [file size $tmp_filename] + db_transaction { + if {[empty_string_p $item_id] || ![db_string item_exists ""]} { + set item_id [db_exec_plsql create_item ""] + } + + set revision_id [cr_import_content \ + -item_id $item_id \ + -storage_type $storage_type \ + -creation_user $creation_user \ + -creation_ip $creation_ip \ + -other_type "file_storage_object" \ + -title $title \ + -description $description \ + $parent_id \ + $tmp_filename \ + $tmp_size \ + $mime_type \ + $name] + + db_dml set_live_revision "" + db_exec_plsql update_last_modified "" + + if {![empty_string_p $creation_user]} { + permission::grant -party_id $creation_user -object_id $item_id -privilege admin + } + } on_error { + error $errmsg + } + return $revision_id +} \ No newline at end of file Index: openacs-4/packages/file-storage/tcl/file-storage-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/tcl/file-storage-procs.xql,v diff -u -r1.10.2.4 -r1.10.2.5 --- openacs-4/packages/file-storage/tcl/file-storage-procs.xql 20 Mar 2003 22:13:59 -0000 1.10.2.4 +++ openacs-4/packages/file-storage/tcl/file-storage-procs.xql 9 Nov 2003 20:56:45 -0000 1.10.2.5 @@ -117,4 +117,19 @@ + + + select count(*) from cr_items + where name=:name + and parent_id=:parent_id + + + + + + update cr_items set live_revision=:revision_id + where item_id=:item_id + + +