Index: openacs-4/packages/file-storage/tcl/file-storage-callback-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/tcl/file-storage-callback-procs.tcl,v diff -u -r1.5 -r1.6 --- openacs-4/packages/file-storage/tcl/file-storage-callback-procs.tcl 14 Nov 2006 16:07:53 -0000 1.5 +++ openacs-4/packages/file-storage/tcl/file-storage-callback-procs.tcl 23 Nov 2006 12:39:03 -0000 1.6 @@ -1,4 +1,4 @@ -# packages/file-storage/tcl/file-storage-callback-procs.tcl +## packages/file-storage/tcl/file-storage-callback-procs.tcl ad_library { @@ -49,8 +49,16 @@ {-package_id:required} {-file_id:required} {-parent_id:required} + {-creation_user ""} + {-creation_ip ""} } { -} + Callback executed when a new file revision is created + @package_id Package_id of the file storage package + @file_id New file_id for the revision + @parent_id Usually the folder the file was uploaded to. + @creation_user User_id of the user creating the revision + @creation_ip IP Of the creation +} - # Our callback implementations 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.55 -r1.56 --- openacs-4/packages/file-storage/tcl/file-storage-procs.tcl 15 Nov 2006 15:57:55 -0000 1.55 +++ openacs-4/packages/file-storage/tcl/file-storage-procs.tcl 23 Nov 2006 12:39:03 -0000 1.56 @@ -271,6 +271,7 @@ {-creation_user ""} {-creation_ip ""} {-description ""} + {-package_id ""} -no_callback:boolean } { Create a new folder. @@ -282,6 +283,7 @@ @param creation_user Who created this folder @param creation_ip What is the ip address of the creation_user @param description of the folder. Not used in the current FS UI but might be used elsewhere. + @param package_id Package_id of the package for which to create the new folder. Preferably a file storage package_id @param no_callback defines if the callback should be called. Defaults to yes @return folder_id of the newly created folder } { @@ -293,14 +295,17 @@ set creation_ip [ns_conn peeraddr] } - set folder_id [content::folder::new -name $name -label $pretty_name -parent_id $parent_id -creation_user $creation_user -creation_ip $creation_ip -description $description] + if {$package_id eq ""} { + set package_id [acs_object::package_id -object_id $parent_id] + } + + set folder_id [content::folder::new -name $name -label $pretty_name -parent_id $parent_id -creation_user $creation_user -creation_ip $creation_ip -description $description -package_id $package_id] permission::grant -party_id $creation_user -object_id $folder_id -privilege "admin" if {!$no_callback_p} { - if {![catch {ad_conn package_id} package_id]} { - callback fs::folder_new -package_id $package_id -folder_id $folder_id - } + callback fs::folder_new -package_id $package_id -folder_id $folder_id } + return $folder_id }