+ |
+
Show files modified in the past days as new.
Index: openacs-4/packages/file-storage/www/index.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/www/index.tcl,v
diff -u -r1.13 -r1.14
--- openacs-4/packages/file-storage/www/index.tcl 2 May 2002 20:38:46 -0000 1.13
+++ openacs-4/packages/file-storage/www/index.tcl 22 May 2002 16:42:31 -0000 1.14
@@ -36,7 +36,12 @@
# set templating datasources
set folder_name [fs_get_folder_name $folder_id]
-set context_bar [fs_context_bar_list $folder_id]
+set ext [fs::get_archive_extension]
+set download_name $folder_name
+if {![empty_string_p $ext]} {
+ append download_name ".${ext}"
+}
+set download_name [ns_urlencode $download_name]
set user_id [ad_conn user_id]
set write_p [ad_permission_p $folder_id write]
@@ -78,4 +83,6 @@
form get_values n_past_days_form n_past_days folder_id
}
+set context_bar [fs_context_bar_list $folder_id]
+
ad_return_template
Index: openacs-4/packages/file-storage/www/download-archive/index.vuh
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/file-storage/www/download-archive/index.vuh,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/file-storage/www/download-archive/index.vuh 22 May 2002 16:42:31 -0000 1.1
@@ -0,0 +1,61 @@
+# file-storage/www/download-archive/index.vuh
+
+ad_page_contract {
+
+ @author yon@openforce.net
+ @creation-date 2002-05-21
+ @version $Id: index.vuh,v 1.1 2002/05/22 16:42:31 yon Exp $
+
+} -query {
+ {object_id:integer,optional}
+}
+
+if {[exists_and_not_null object_id]} {
+ set download_name [fs::get_object_name -object_id $object_id]
+ set ext [fs::get_archive_extension]
+ if {![empty_string_p $ext]} {
+ append download_name ".${ext}"
+ }
+
+ ad_returnredirect "${object_id}/${download_name}"
+ ad_script_abort
+}
+
+# convenient way to get the values out of a list
+foreach {object_id download_name} [split [ad_conn path_info] /] {break}
+
+set user_id [ad_conn user_id]
+if {$user_id == 0} {
+ set user_id ""
+}
+
+# publish the object to the file system
+set in_path [ns_tmpnam]
+file mkdir $in_path
+
+set file [fs::publish_object_to_file_system -object_id $object_id -path $in_path -user_id $user_id]
+set file_name [file tail $file]
+
+# create a temp dir to put the archive in
+set out_path [ns_tmpnam]
+file mkdir $out_path
+
+set out_file "${out_path}/${download_name}"
+
+# get the archive command
+set cmd [fs::get_archive_command -in_file $file_name -out_file $out_file]
+
+# create the archive
+with_catch errmsg {
+ exec /bin/sh -c "cd $in_path; $cmd; cd -"
+} {
+ # some day we'll do something useful here
+ error $errmsg
+}
+
+# return the archive to the connection.
+ns_returnfile 200 application/octet-stream $out_file
+
+# clean everything up
+file delete -force $in_path
+file delete -force $out_path
|