Index: openacs-4/packages/download/www/admin/report-version-downloads.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/download/www/admin/report-version-downloads.tcl,v
diff -u -r1.5 -r1.6
--- openacs-4/packages/download/www/admin/report-version-downloads.tcl 10 Sep 2002 22:22:35 -0000 1.5
+++ openacs-4/packages/download/www/admin/report-version-downloads.tcl 16 Jan 2003 13:46:20 -0000 1.6
@@ -9,8 +9,18 @@
{orderby "last_name"}
{downloaded 1m}
{versions "current"}
+} -properties {
+ archive_name:onevalue
+ context:onevalue
+ user_id_list_export:onevalue
+ dimensional_html:onevalue
+ current_count:onevalue
+ total_count:onevalue
+ table:onevalue
}
+set repository_id [download_repository_id]
+
ad_require_permission $archive_id "admin"
set dimensional {
@@ -29,87 +39,37 @@
set table_def {
{user_name "User Name"
- {user_name $order}
- {
$user_name | }}
+ {user_name $order}
+ {$user_name | }}
{version_name "Version"
- {version_name $order}
- {$version_name | }}
+ {version_name $order}
+ {$version_name | }}
{download_date "Download Date"
- {download_date $order}
- {}}
+ {download_date $order}
+ {}}
{download_ip "From IP (hostname)"
- {download_ip $order}
- {$download_ip ($download_hostname) | }}
+ {download_ip $order}
+ {$download_ip ($download_hostname) | }}
{reason "Download Reason"
- {reason $order}
- {$reason | }}
+ {reason $order}
+ {$reason | }}
}
-db_1row name_select {
- select da.archive_name from download_archives_obj da where da.archive_id = :archive_id
-}
+db_1row name_select { *SQL* }
-if {$versions == "all" } {
- set version_str " in (
- select revision_id from download_arch_revisions_obj
- where archive_id = :archive_id )"
-} else {
- set version_str " = (
- select revision_id from download_arch_revisions_obj
- where archive_id = :archive_id
- and revision_id = content_item.get_live_revision(:archive_id))
- "
-}
+set current_count [db_string current_count { *SQL* }]
+set total_count [db_string total_count { *SQL* }]
-set count [db_string count_select "select count(*)
-from download_downloads d, download_arch_revisions_obj dar
-where dar.archive_id = :archive_id and
- d.revision_id = dar.revision_id
- [ad_dimensional_sql $dimensional where]
-"]
-
-#FIXME
-# what is temp_downloaded for?
-# why are count and total_count the same query?
-# do we need version_str above?
-
-set temp_downloaded $downloaded
-
-set total_count [db_string count_select "select count(*)
-from download_downloads d, download_arch_revisions_obj dar
-where dar.archive_id = :archive_id and
- d.revision_id = dar.revision_id
- [ad_dimensional_sql $dimensional where]
-"]
-set downloaded $temp_downloaded
-
-set sql_query "
- select u.last_name || ', ' || u.first_names as user_name,
- d.download_date,
- d.download_ip,
- nvl(d.download_hostname,'unavailable') as download_hostname,
- nvl(dar.version_name, 'unnamed') as version_name,
- dar.revision_id,
- u.user_id,
- u.email,
- nvl2(d.reason_id, d.reason, dr.reason) as reason
- from download_arch_revisions_obj dar, download_downloads d, download_reasons dr, cc_users u
- where d.user_id = u.user_id
- and dar.archive_id = $archive_id
- and dar.revision_id = d.revision_id
- and dr.download_reason_id(+) = d.reason_id
- [ad_dimensional_sql $dimensional where]
- [ad_order_by_from_sort_spec $orderby $table_def]
-"
-
-set export_sql_query [export_vars -url -sign {sql_query}]
-
set dimensional_html [ad_dimensional $dimensional]
set table [ad_table \
- -Ttable_extra_html { width= 90% align=center} \
+ -Ttable_extra_html { width="90%" align="center" } \
-bind [ad_tcl_vars_to_ns_set archive_id] \
- download_table $sql_query $table_def ]
+ download_table { *SQL* } $table_def ]
+# query users to spam
+set user_id_list [db_list users_to_spam { *SQL* }]
+set user_id_list_export [export_vars -form -sign user_id_list]
+
set context [list "$archive_name Download History"]
ad_return_template