Index: openacs-4/packages/download/www/admin/report-by-ip.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/download/www/admin/report-by-ip.tcl,v diff -u -r1.6 -r1.6.2.1 --- openacs-4/packages/download/www/admin/report-by-ip.tcl 10 Sep 2002 22:22:35 -0000 1.6 +++ openacs-4/packages/download/www/admin/report-by-ip.tcl 6 Dec 2002 11:31:28 -0000 1.6.2.1 @@ -1,5 +1,6 @@ -# /packages/download/www/admin/all-user-downloads.tcl +# /packages/download/www/admin/report-by-ip.tcl ad_page_contract { + List of IP addresses that have downloaded a specific archive @author jbank@arsdigita.com [jbank@arsdigita.com] @creation-date Wed Dec 13 13:39:29 2000 @@ -11,29 +12,26 @@ set repository_id [download_repository_id] ##TODO: Add support for other -# vinodk: put in the full query name so that when I -# pass this var to spam-users, it can find -# the right query set dimensional { {downloaded "Download Period" 1m { - {1d "last 24hrs" {where "[db_map dbqd.download.www.admin.report-by-ip.date_clause_1]"}} - {1w "last week" {where "[db_map dbqd.download.www.admin.report-by-ip.date_clause_7]"}} - {1m "last month" {where "[db_map dbqd.download.www.admin.report-by-ip.date_clause_30]"}} + {1d "last 24hrs" {where "[db_map date_clause_1]"}} + {1w "last week" {where "[db_map date_clause_7]"}} + {1m "last month" {where "[db_map date_clause_30]"}} {all "all" {}}}} } set table_def { {download_ip "From IP" {no_sort} - {$download_ip}} + {$download_ip}} {download_hostname "Hostname" {} {}} {num_downloads "# Downloads" {no_sort} {}} } set sql_query " - select min(u.last_name || ', ' || u.first_names) as user_name, + select min(d.user_id) as user_id, + min(u.last_name || ', ' || u.first_names) as user_name, min(u.email) as email, - min(d.user_id) as user_id, d.download_ip, nvl(min(d.download_hostname),'unavailable') as download_hostname, count(*) as num_downloads, @@ -46,14 +44,20 @@ order by 2 desc " -set export_sql_query [export_vars -url -sign {downloaded repository_id dimensional}] - set dimensional_html [ad_dimensional $dimensional] set table [ad_table \ -Ttable_extra_html { width= 90% align=center} \ -bind [ad_tcl_vars_to_ns_set repository_id downloaded] \ download_table $sql_query $table_def ] +# vinodk: the download_table query gets the list of users (plus other data) +# we reuse the same query to get the list of user_id's to spam. +# Since we're using db_list, it's important that the first column +# of the query is the user_id. + +set user_id_list [db_list download_table { *SQL* }] +set user_id_list_export [export_vars -url -sign user_id_list] + set context [list "Downloads by IP"] ad_return_template \ No newline at end of file