Index: openacs-4/packages/download/www/admin/report-by-user.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/download/www/admin/report-by-user.tcl,v diff -u -r1.6 -r1.6.2.1 --- openacs-4/packages/download/www/admin/report-by-user.tcl 10 Sep 2002 22:22:35 -0000 1.6 +++ openacs-4/packages/download/www/admin/report-by-user.tcl 6 Dec 2002 11:31:28 -0000 1.6.2.1 @@ -1,6 +1,6 @@ -# /packages/download/www/admin/all-user-downloads.tcl +# /packages/download/www/admin/report-by-user.tcl ad_page_contract { - + Show list of users who have downloaded a specified archive. @author jbank@arsdigita.com [jbank@arsdigita.com] @creation-date Wed Dec 13 13:39:29 2000 @cvs-id $Id$ @@ -11,28 +11,25 @@ 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-user.date_clause_1]"}} - {1w "last week" {where "[db_map dbqd.download.www.admin.report-by-user.date_clause_7]"}} - {1m "last month" {where "[db_map dbqd.download.www.admin.report-by-user.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 { {user_name "User Name (Last name, first name)" {no_sort} - {$user_name ($email)}} + {$user_name ($email)}} {num_downloads "# Downloads" {no_sort} {}} } set sql_query " - select min(u.last_name || ', ' || u.first_names) as user_name, + select d.user_id, + min(u.last_name || ', ' || u.first_names) as user_name, min(u.email) as email, - d.user_id, count(*) as num_downloads, min('$downloaded') as downloaded from download_downloads_repository d, cc_users u @@ -43,13 +40,19 @@ 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} \ + -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 User"] ad_return_template \ No newline at end of file