Index: openacs.org-dev/packages/download/www/index.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs.org-dev/packages/download/www/index.tcl,v
diff -u -r1.3 -r1.4
--- openacs.org-dev/packages/download/www/index.tcl 28 Jan 2003 17:17:36 -0000 1.3
+++ openacs.org-dev/packages/download/www/index.tcl 30 Jun 2003 02:11:00 -0000 1.4
@@ -6,7 +6,7 @@
@cvs-id $Id$
} {
{archive_type_id ""}
- {orderby "archive_name"}
+ {orderby "archive_name*"}
{query_string ""}
{updated ""}
} -properties {
@@ -77,7 +77,7 @@
set table_def {
{archive_name "Software Name"
{lower(archive_name) $order}
- {
$archive_name $version_name (${file_size}k) $summary | }}
+ { $archive_name $version_name (${file_size}k) $summary | }}
{archive_type "Software Type" {} {}}
{downloads "# Downloads" {} {}}
}
Index: openacs.org-dev/packages/download/www/download/index.vuh
===================================================================
RCS file: /usr/local/cvsroot/openacs.org-dev/packages/download/www/download/index.vuh,v
diff -u -r1.1 -r1.2
--- openacs.org-dev/packages/download/www/download/index.vuh 9 Jul 2002 17:35:04 -0000 1.1
+++ openacs.org-dev/packages/download/www/download/index.vuh 30 Jun 2003 02:11:02 -0000 1.2
@@ -1 +1,76 @@
-download_file_downloader
\ No newline at end of file
+ad_page_contract {
+
+} {
+ { revision_id:naturalnum,notnull "" }
+ { download_id:naturalnum,notnull "" }
+ { reason_id "" }
+ { reason_other ""}
+}
+
+ns_log Notice "download_file_downloader: $revision_id"
+
+set user_id [ad_verify_and_get_user_id]
+set download_ip [ad_conn peeraddr]
+if [catch {
+ set download_hostname [ns_hostbyaddr $download_ip]
+}] {
+ set download_hostname [db_null]
+}
+set user_agent [ns_set iget [ad_conn headers] user-agent]
+
+regexp "[ad_conn package_url]download/(.*)" [ad_conn url] match path
+
+# let's try to get the user_id from the filename, just grab the
+# latest revision --DaveB
+
+if {[empty_string_p $revision_id]} {
+ set file_name [ad_conn path_info]
+ set revision_id [db_string get_revision_id {select revision_id from download_arch_revisions_obj where file_name=:file_name and approved_p = 't'} -default ""]
+}
+
+if [empty_string_p $revision_id] {
+ ad_returnredirect [ad_conn package_url]
+ ad_script_abort
+}
+
+ad_require_permission $revision_id "read"
+
+cr_write_content -revision_id $revision_id
+
+##Record the download for all time!!
+set double_click_p [db_string download_count "select count(*) from download_downloads where download_id = :download_id"]
+if { $double_click_p == 0 } {
+ if [catch {
+ # JCD: Huge ugly kludge map user 0 to evil@xarg.net
+ if {! $user_id } {
+ set user_id 56228
+ }
+ db_dml download_insert {
+insert into download_downloads (
+ download_id,
+ user_id,
+ revision_id,
+ download_date,
+ download_ip,
+ download_hostname,
+ user_agent,
+ reason_id,
+ reason)
+values (
+ :download_id,
+ :user_id,
+ :revision_id,
+ current_timestamp,
+ :download_ip,
+ :download_hostname,
+ :user_agent,
+ :reason_id,
+ :reason_other)
+ }
+ } errmsg] {
+ ns_log Error "Download: Unable to log download of $path $revision_id due to an error: $errmsg"
+ }
+}
+
+
+