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.7 -r1.8 --- openacs-4/packages/file-storage/tcl/file-storage-procs.tcl 21 Feb 2002 20:06:27 -0000 1.7 +++ openacs-4/packages/file-storage/tcl/file-storage-procs.tcl 22 Feb 2002 19:06:28 -0000 1.8 @@ -209,14 +209,17 @@ #set pretty_mime_type ??? - if { [db_string mime_type_exists " - select count(*) from cr_mime_types - where mime_type = :mime_type"] == 0 } { - db_dml new_mime_type " - insert into cr_mime_types - (mime_type, file_extension) - values - (:mime_type, :extension)" + if { [db_string mime_type_exists { + select count(*) + from cr_mime_types + where mime_type = :mime_type + }] == 0 } { + db_dml new_mime_type { + insert into cr_mime_types + (mime_type, file_extension) + values + (:mime_type, :extension) + } } return $mime_type @@ -229,7 +232,7 @@ {-pretty_name ""} {-description ""} } { - Create a root folder for a package instance + Create a root folder for a package instance. @param package_id Package instance associated with this root folder @@ -241,7 +244,7 @@ ad_proc -public get_root_folder { {-package_id:required} } { - Get the root folder of a package instance + Get the root folder of a package instance. @param package_id Package instance of the root folder to retrieve @@ -257,7 +260,7 @@ {-creation_user ""} {-creation_ip ""} } { - Create a new folder + Create a new folder. @param name Internal name of the folder, must be unique under a given parent_id @@ -283,7 +286,7 @@ {-name:required} {-parent_id:required} } { - Retrieve the folder_id of a folder given it's name and parent folder + Retrieve the folder_id of a folder given it's name and parent folder. @param name Internal name of the folder, must be unique under a given parent_id @@ -295,4 +298,26 @@ return [db_string get_folder {} -default ""] } + ad_proc -public get_folder_contents { + {-folder_id:required} + {-user_id ""} + } { + Retrieve the contents of the specified folder in the form of a list + of ns_sets, one for each row returned. The keys for each row are as + follows: + + file_id, name, live_revision, type, + last_modified, content_size, sort_key + + @param folder_id The folder for which to retrieve contents + @param user_id The viewer of the contents (to make sure they have + permission) + } { + if {[empty_string_p $user_id]} { + set user_id [acs_magic_object "the_public"] + } + + return [db_list_of_ns_sets get_folder_contents {}] + } + }