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 -N -r1.25.2.9 -r1.25.2.10 --- openacs-4/packages/file-storage/tcl/file-storage-procs.tcl 15 Nov 2003 18:47:25 -0000 1.25.2.9 +++ openacs-4/packages/file-storage/tcl/file-storage-procs.tcl 16 Nov 2003 02:05:00 -0000 1.25.2.10 @@ -620,14 +620,11 @@ 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] switch [cr_registered_type_for_mime_type $mime_type] { image { set content_type "image" @@ -646,25 +643,63 @@ } } - 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] + + set revision_id [fs::add_version \ + -name $name \ + -parent_id $parent_id \ + -tmp_filename $tmp_filename \ + -package_id $package_id \ + -item_id $item_id \ + -creation_user $creation_user \ + -creation_ip $creation_ip \ + -title $title \ + -description $description + ] + } + return $revision_id +} + +ad_proc fs::add_version { + -name + -parent_id + -tmp_filename + -package_id + {-item_id ""} + {-creation_user ""} + {-creation_ip ""} + {-title ""} + {-description ""} + +} { + Create a new version of a file storage item + @returns revision_id +} { + + if {[ad_parameter "StoreFilesInDatabaseP" -package_id $package_id]} { + set storage_type "lob" + } else { + set storage_type "file" + } + + set mime_type [cr_filename_to_mime_type -create $name] + set tmp_size [file size $tmp_filename] + + 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 "" - } on_error { - error $errmsg - } return $revision_id -} \ No newline at end of file +}