Index: openacs-4/packages/download/www/all-metadata.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/download/www/all-metadata.adp,v diff -u -r1.5 -r1.5.8.1 --- openacs-4/packages/download/www/all-metadata.adp 7 Nov 2003 22:11:36 -0000 1.5 +++ openacs-4/packages/download/www/all-metadata.adp 12 Sep 2013 09:57:37 -0000 1.5.8.1 @@ -1,6 +1,7 @@ All @pretty_name;noquote@ All Metadata -@table;noquote@ + + Index: openacs-4/packages/download/www/all-metadata.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/download/www/all-metadata.tcl,v diff -u -r1.4.2.1 -r1.4.2.2 --- openacs-4/packages/download/www/all-metadata.tcl 9 Sep 2013 17:34:16 -0000 1.4.2.1 +++ openacs-4/packages/download/www/all-metadata.tcl 12 Sep 2013 09:57:37 -0000 1.4.2.2 @@ -21,17 +21,19 @@ set answer_column [download_metadata_column $data_type] set metadata_select "metadata$metadata_id" -set table_def [list \ - [list $metadata_select $pretty_name {} \ - "\$$metadata_select"] \ - {version_count "[_ download._Versions]" - {version_count $order} - {$version_count}} \ - {archive_count "[_ download._Files]" - {archive_count $order} - {$archive_count}} \ -] +if {$orderby eq ""} { + set orderby $metadata_select +} +set elements [list \ + $metadata_select {label $pretty_name display_template {@metadata.$metadata_select@} orderby "$metadata_select"} \ + version_count { label "[_ download._Versions]" orderby version_count } \ + archive_count { label "[_ download._Files]" orderby archive_count}] + +template::list::create -name metadata_list \ + -multirow metadata \ + -html {width "100%"} \ + -elements $elements -filters {metadata_id {}} set sql_query " select $answer_column as $metadata_select, @@ -41,12 +43,10 @@ where drd.revision_id = dar.revision_id and drd.metadata_id = :metadata_id group by $answer_column - [ad_order_by_from_sort_spec $orderby $table_def]" + [template::list::orderby_clause -orderby -name metadata_list]" -set table [ad_table \ - -Torderby $orderby \ - -Ttable_extra_html { width=100% } \ - -bind [ad_tcl_vars_to_ns_set metadata_id] \ - all_metadata_list $sql_query $table_def ] +db_multirow -extend {url_one_metadata} metadata all_metadata_list $sql_query { + set url_one_metadata [export_vars -base one-mestada {metadata_id}] +} ad_return_template \ No newline at end of file Index: openacs-4/packages/download/www/archive-add.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/download/www/archive-add.adp,v diff -u -r1.5.2.1 -r1.5.2.2 --- openacs-4/packages/download/www/archive-add.adp 9 Sep 2013 17:56:22 -0000 1.5.2.1 +++ openacs-4/packages/download/www/archive-add.adp 12 Sep 2013 09:57:37 -0000 1.5.2.2 @@ -30,7 +30,7 @@ - @extra_form_elts@ + @extra_form_elts;noquote@ #download.lt_Version_Number_option# Index: openacs-4/packages/download/www/archive-version-add.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/download/www/archive-version-add.adp,v diff -u -r1.5.2.1 -r1.5.2.2 --- openacs-4/packages/download/www/archive-version-add.adp 9 Sep 2013 17:56:22 -0000 1.5.2.1 +++ openacs-4/packages/download/www/archive-version-add.adp 12 Sep 2013 09:57:38 -0000 1.5.2.2 @@ -13,7 +13,7 @@ - @extra_form_elts@ + @extra_form_elts;noquote@ #download.File# Index: openacs-4/packages/download/www/index-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/download/www/index-oracle.xql,v diff -u -r1.4 -r1.4.14.1 --- openacs-4/packages/download/www/index-oracle.xql 16 May 2001 09:41:05 -0000 1.4 +++ openacs-4/packages/download/www/index-oracle.xql 12 Sep 2013 09:57:38 -0000 1.4.14.1 @@ -45,7 +45,7 @@ acs_permission.permission_p(dar.revision_id, :user_id, 'read') = 't' $approval [ad_dimensional_sql $dimensional where] - [ad_order_by_from_sort_spec $orderby $table_def] + [template::list::orderby_clause -orderby -name download_list] Index: openacs-4/packages/download/www/index-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/download/www/index-postgresql.xql,v diff -u -r1.4 -r1.4.14.1 --- openacs-4/packages/download/www/index-postgresql.xql 16 May 2001 09:41:05 -0000 1.4 +++ openacs-4/packages/download/www/index-postgresql.xql 12 Sep 2013 09:57:38 -0000 1.4.14.1 @@ -45,7 +45,7 @@ acs_permission__permission_p(dar.revision_id, :user_id, 'read') = 't' $approval [ad_dimensional_sql $dimensional where] - [ad_order_by_from_sort_spec $orderby $table_def] + [template::list::orderby_clause -orderby -name download_list] Index: openacs-4/packages/download/www/index.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/download/www/index.adp,v diff -u -r1.9.2.1 -r1.9.2.2 --- openacs-4/packages/download/www/index.adp 9 Sep 2013 17:56:22 -0000 1.9.2.1 +++ openacs-4/packages/download/www/index.adp 12 Sep 2013 09:57:38 -0000 1.9.2.2 @@ -1,3 +1,4 @@ + @title;noquote@ @@ -8,17 +9,18 @@
#download.Help#
@description@ - +

#download.You_must# register #download.lt_before_you_can_downlo#

- +
@dimensional_html;noquote@

-@table;noquote@ + +

#download.lt_Upload_a_New_Version_#

    Index: openacs-4/packages/download/www/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/download/www/index.tcl,v diff -u -r1.8.2.2 -r1.8.2.3 --- openacs-4/packages/download/www/index.tcl 9 Sep 2013 17:34:16 -0000 1.8.2.2 +++ openacs-4/packages/download/www/index.tcl 12 Sep 2013 09:57:38 -0000 1.8.2.3 @@ -67,16 +67,27 @@ set approval " and dar.approved_p = 't' " } +set element_list { + archive_name { + label "Software Name" + display_template { + + +  @downloads_multirow.archive_name@ @downloads_multirow.version_name@ +  (@downloads_multirow.file_size@k)
    @downloads_multirow.summary@ + } + orderby "archive_name" + } + archive_type { + label "Software Type" + orderby "archive_type" + } + downloads { + label "# Downloads" + orderby "downloads" + } +} -set table_def [list \ - [list archive_name "[_ download.Software_Name_1]"\ - {lower(archive_name) $order} \ - {  $archive_name $version_name  (${file_size}k)
    $summary} - ] \ - [list archive_type "[_ download.Software_Type]" "" ""] \ - [list downloads "[_ download._Downloads]" "" ""] \ - ] - #Setup the metadata set metadata_selects "" db_foreach metadata { @@ -95,67 +106,54 @@ append metadata_selects ", (select $answer_column from download_revision_data where revision_id = dar.revision_id and metadata_id = $metadata_id) as $metadata_select " if { $linked_p == "t" } { - set display "\$$metadata_select" + set display "@downloads_multirow.$metadata_select@" } else { set display "" } - lappend table_def [list $metadata_select $pretty_name {} $display] + lappend element_list $metadata_select [list label $pretty_name display_template $display] } ##Add on the metadata columns if { $admin_p } { - lappend table_def [list dar.approved_p "[_ download.Approval]" \ - {} \ - { \ - [ad_decode $approved_p \ - "t" "approved - \[ - reject\]" \ - "f" "rejected - \[ - approve\]" \ - "pending - \[ - approve | - reject\] - "] - }] + lappend element_list approved_p { + label "[_ download.Approval]" + display_template { + @downloads_multirow.approved_text@ + \[@downloads_multirow.approved_action@\] + } } +} -set sql_query " -select da.archive_id, - dat.pretty_name as archive_type, - da.archive_type_id, - da.archive_name, - da.summary, - dar.revision_id, - dar.file_name, - dar.version_name, - dbms_lob.getlength(dar.content) as file_size, - (select count(*) from download_downloads where revision_id = dar.revision_id) as downloads, - dar.approved_p - $metadata_selects -from download_archives_obj da, - download_archive_types dat, - download_arch_revisions_obj dar -where da.repository_id = :repository_id and - dat.archive_type_id = da.archive_type_id and - da.archive_id = dar.archive_id and - acs_permission.permission_p(dar.revision_id, :user_id, 'read') = 't' - $approval - [ad_dimensional_sql $dimensional where] - [ad_order_by_from_sort_spec $orderby $table_def]" +template::list::create -name download_list \ + -multirow downloads_multirow \ + -elements $element_list \ + -filters {archive_type_id {} query_string {} updated {}} -set dimensional_html [ad_dimensional $dimensional] -set table [ad_table \ - -Torderby $orderby \ - -Tband_colors {{} {\"\#cccccc\"}} \ - -bind [ad_tcl_vars_to_ns_set user_id repository_id] \ - -Ttable_extra_html { cellpadding=3 } \ - download_index_query $sql_query $table_def ] +set img_url "[ad_conn package_url]/graphics/download.gif" +db_multirow -extend {metadata_url download_img revision_url download_url approved_color approved_text approved_url approved_action reject_url} downloads_multirow download_index_query {*} { + set download_img $img_url + if {$approved_p} { + set approved_url [export_vars -base admin/approve-or-reject {{action reject} revision_id return_url}] + set approved_text "approved" + set approved_color green + set approved_action "reject" + } else { + set approved_url [export_vars -base admin/approve-or-reject {{action approve} revision_id return_url}] + set approved_text "rejected" + set approved_action approve + set approved_color red + } + set download_url "download/$file_name?revision_id=$revision_id" + set revision_url "one-revision?revision_id=$revision_id" + set metadata_url [export_vars -base one-metadata {metadata_id}] +} + + +set dimensional_html [ad_dimensional $dimensional] + db_multirow types types_select { select archive_type_id, pretty_name, description from download_archive_types where repository_id = :repository_id } @@ -177,4 +175,4 @@ -ad_return_template \ No newline at end of file +ad_return_template Index: openacs-4/packages/download/www/one-revision.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/download/www/one-revision.adp,v diff -u -r1.7.2.1 -r1.7.2.2 --- openacs-4/packages/download/www/one-revision.adp 9 Sep 2013 17:56:22 -0000 1.7.2.1 +++ openacs-4/packages/download/www/one-revision.adp 12 Sep 2013 09:57:38 -0000 1.7.2.2 @@ -13,7 +13,7 @@ [#download.Download_Now#] - [>#download.See_All_Versions#]
      + [#download.See_All_Versions#]
     

    #download.Summary# @summary@ Index: openacs-4/packages/download/www/admin/report-by-ip.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/download/www/admin/report-by-ip.adp,v diff -u -r1.9 -r1.9.2.1 --- openacs-4/packages/download/www/admin/report-by-ip.adp 13 Jan 2005 13:57:52 -0000 1.9 +++ openacs-4/packages/download/www/admin/report-by-ip.adp 12 Sep 2013 09:57:38 -0000 1.9.2.1 @@ -10,4 +10,5 @@

    @dimensional_html;noquote@ -@table;noquote@ + + \ No newline at end of file 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.7.8.1 -r1.7.8.2 --- openacs-4/packages/download/www/admin/report-by-ip.tcl 9 Sep 2013 17:34:16 -0000 1.7.8.1 +++ openacs-4/packages/download/www/admin/report-by-ip.tcl 12 Sep 2013 09:57:38 -0000 1.7.8.2 @@ -24,20 +24,28 @@ {all "all" {}}}} } -set table_def { - {download_ip "From IP" - {no_sort} - {$download_ip}} - {download_hostname "Hostname" {} {}} - {num_downloads "# Downloads" {no_sort} {}} -} +template::list::create -name ips_list \ + -multirow ips \ + -html {width "90%" align center} \ + -elements { + download_ip { + label "From IP" + link_url_col one_ip_url + } + download_hostname { + label "Hostname" + } + num_downloads { + label "# Downloads" + } + } 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* } $table_def ] +db_multirow -extend {one_ip_url} ips download_table { *SQL* } { + set one_ip_url [export_vars -base report-one-ip {download_ip downloaded}] +} + # 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] Index: openacs-4/packages/download/www/admin/report-by-user.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/download/www/admin/report-by-user.adp,v diff -u -r1.8 -r1.8.2.1 --- openacs-4/packages/download/www/admin/report-by-user.adp 13 Jan 2005 13:57:52 -0000 1.8 +++ openacs-4/packages/download/www/admin/report-by-user.adp 12 Sep 2013 09:57:39 -0000 1.8.2.1 @@ -10,4 +10,4 @@

    @dimensional_html;noquote@ -@table;noquote@ + 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.7.8.1 -r1.7.8.2 --- openacs-4/packages/download/www/admin/report-by-user.tcl 9 Sep 2013 17:34:16 -0000 1.7.8.1 +++ openacs-4/packages/download/www/admin/report-by-user.tcl 12 Sep 2013 09:57:39 -0000 1.7.8.2 @@ -24,19 +24,28 @@ {all "all" {}}}} } -set table_def { - {user_name "User Name (Last name, first name)" - {no_sort} - {$user_name ($email)}} - {num_downloads "# Downloads" {no_sort} {}} -} - 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* } $table_def ] +template::list::create -name users_list \ + -multirow users \ + -html { width "90%" align center} \ + -elements { + user_name { + label "User Name (Last name, first name)" + display_template { + @users.user_name@ + (@users.email@) + } + } + num_downloads { + label "# Downloads" + } + } + +db_multirow -extend {report_one_url} users download_table { *SQL* } { + set report_one_url "[export_vars -base report-one-user {user_id downloaded}]" +} + # 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] Index: openacs-4/packages/download/www/admin/report-one-ip-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/download/www/admin/report-one-ip-oracle.xql,v diff -u -r1.3 -r1.3.8.1 --- openacs-4/packages/download/www/admin/report-one-ip-oracle.xql 16 Jan 2003 13:46:20 -0000 1.3 +++ openacs-4/packages/download/www/admin/report-one-ip-oracle.xql 12 Sep 2013 09:57:39 -0000 1.3.8.1 @@ -22,7 +22,7 @@ and dr.download_reason_id(+) = d.reason_id and u.user_id = d.user_id [ad_dimensional_sql $dimensional where] - [ad_order_by_from_sort_spec $orderby $table_def] + [template::list::orderby_clause -orderby -name history_list] Index: openacs-4/packages/download/www/admin/report-one-ip-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/download/www/admin/report-one-ip-postgresql.xql,v diff -u -r1.2 -r1.2.8.1 --- openacs-4/packages/download/www/admin/report-one-ip-postgresql.xql 16 Jan 2003 13:46:20 -0000 1.2 +++ openacs-4/packages/download/www/admin/report-one-ip-postgresql.xql 12 Sep 2013 09:57:39 -0000 1.2.8.1 @@ -27,7 +27,7 @@ and d.download_ip = :download_ip and u.user_id = d.user_id [ad_dimensional_sql $dimensional where] - [ad_order_by_from_sort_spec $orderby $table_def] + [template::list::orderby_clause -orderby -name history_list] Index: openacs-4/packages/download/www/admin/report-one-ip.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/download/www/admin/report-one-ip.adp,v diff -u -r1.8 -r1.8.2.1 --- openacs-4/packages/download/www/admin/report-one-ip.adp 13 Jan 2005 13:57:52 -0000 1.8 +++ openacs-4/packages/download/www/admin/report-one-ip.adp 12 Sep 2013 09:57:39 -0000 1.8.2.1 @@ -10,4 +10,5 @@

    @dimensional_html;noquote@ -@table;noquote@ + + \ No newline at end of file Index: openacs-4/packages/download/www/admin/report-one-ip.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/download/www/admin/report-one-ip.tcl,v diff -u -r1.6.8.1 -r1.6.8.2 --- openacs-4/packages/download/www/admin/report-one-ip.tcl 9 Sep 2013 17:34:16 -0000 1.6.8.1 +++ openacs-4/packages/download/www/admin/report-one-ip.tcl 12 Sep 2013 09:57:39 -0000 1.6.8.2 @@ -28,31 +28,42 @@ } } +template::list::create -name history_list \ + -multirow history \ + -html {width "90%" align center} \ + -elements { + archive_name { + label "Archive" + link_url_col url_archive + orderby archive_name + } + version_name { + label "Version" + link_url_col url_archive + orderby version_name + } + user_name { + label "User Name" + link_url_col url_one_user + orderby user_name + } + download_date { + label "Download Date" + orderby download_date + } + reason { + label "Download Reason" + orderby reason + } + } -filters {download_ip {} downloaded {}} -set table_def { - {archive_name "Archive" - {archive_name $order} - {$archive_name}} - {version_name "Version" - {version_name $order} - {$version_name}} - {user_name "User Name" - {user_name} - {$user_name}} - {download_date "Download Date" - {download_date} - {}} - {reason "Download Reason" - {reason} - {}} -} - 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 download_ip] \ - download_table { *SQL* } $table_def ] +db_multirow -extend {url_one_user url_archive} history download_table { *SQL* } { + set url_archive [export_vars -base "../one-revision" {archive_id}] + set url_one_user [export_vars -base "report-one-user" {user_id downloaded}] +} + # 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] Index: openacs-4/packages/download/www/admin/report-one-user-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/download/www/admin/report-one-user-oracle.xql,v diff -u -r1.3 -r1.3.8.1 --- openacs-4/packages/download/www/admin/report-one-user-oracle.xql 16 Jan 2003 13:46:20 -0000 1.3 +++ openacs-4/packages/download/www/admin/report-one-user-oracle.xql 12 Sep 2013 09:57:39 -0000 1.3.8.1 @@ -20,7 +20,7 @@ and d.user_id = :user_id and dr.download_reason_id(+) = d.reason_id [ad_dimensional_sql $dimensional where] - [ad_order_by_from_sort_spec $orderby $table_def] + [template::list::orderby_clause -orderby -name history_list] Index: openacs-4/packages/download/www/admin/report-one-user-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/download/www/admin/report-one-user-postgresql.xql,v diff -u -r1.2 -r1.2.8.1 --- openacs-4/packages/download/www/admin/report-one-user-postgresql.xql 16 Jan 2003 13:46:20 -0000 1.2 +++ openacs-4/packages/download/www/admin/report-one-user-postgresql.xql 12 Sep 2013 09:57:39 -0000 1.2.8.1 @@ -24,7 +24,7 @@ and d.revision_id = dar.revision_id and d.user_id = :user_id [ad_dimensional_sql $dimensional where] - [ad_order_by_from_sort_spec $orderby $table_def] + [template::list::orderby_clause -orderby -name history_list] Index: openacs-4/packages/download/www/admin/report-one-user.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/download/www/admin/report-one-user.adp,v diff -u -r1.7 -r1.7.2.1 --- openacs-4/packages/download/www/admin/report-one-user.adp 13 Jan 2005 13:57:52 -0000 1.7 +++ openacs-4/packages/download/www/admin/report-one-user.adp 12 Sep 2013 09:57:39 -0000 1.7.2.1 @@ -3,4 +3,5 @@ @context;noquote@ @dimensional_html;noquote@ -@table;noquote@ + + Index: openacs-4/packages/download/www/admin/report-one-user.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/download/www/admin/report-one-user.tcl,v diff -u -r1.6.8.1 -r1.6.8.2 --- openacs-4/packages/download/www/admin/report-one-user.tcl 9 Sep 2013 17:34:17 -0000 1.6.8.1 +++ openacs-4/packages/download/www/admin/report-one-user.tcl 12 Sep 2013 09:57:39 -0000 1.6.8.2 @@ -27,31 +27,46 @@ } -set table_def { - {archive_name "Archive" - {archive_name $order} - {$archive_name}} - {version_name "Version" - {version_name $order} - {$version_name}} - {download_date "Download Date" - {download_date} - {}} - {download_ip "From IP" - {download_ip} - {$download_ip ($download_hostname)}} - {reason "Download Reason" - {reason} - {}} -} +template::list::create -name history_list \ + -multirow history \ + -html { width "90%" align "center"} \ + -elements { + archive_name { + label "Archive" + link_url_col url_archive_id + orderby archive_name + } + version_name { + label "Version" + link_url_col url_archive_id + orderby version_name + } + download_date { + label "Download Date" + orderby download_date + } + download_ip { + label "From IP" + display_template { + @history.download_ip@ (@history.download_hostname@) + } + orderby download_ip + } + reason { + label "Download Reason" + orderby reason + } + } -filters {user_id {} downloaded {}} db_1row name_select { *SQL* } 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 user_id] \ - download_table { *SQL* } $table_def ] +db_multirow -extend {url_one_ip url_archive_id} history download_table { *SQL* } { + set url_archive_id [export_vars -base "../one-revision" {revision_id}] + set url_one_ip [export_vars -base "report-one-ip" {download_ip downloaded}] +} + + set context [list [list "report-by-user" "Downloads by User"] "$first_names $last_name"] ad_return_template Index: openacs-4/packages/download/www/admin/report-version-downloads-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/download/www/admin/report-version-downloads-oracle.xql,v diff -u -r1.3 -r1.3.8.1 --- openacs-4/packages/download/www/admin/report-version-downloads-oracle.xql 16 Jan 2003 13:46:20 -0000 1.3 +++ openacs-4/packages/download/www/admin/report-version-downloads-oracle.xql 12 Sep 2013 09:57:40 -0000 1.3.8.1 @@ -21,7 +21,7 @@ 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] + [template::list::orderby_clause -orderby -name download_list] Index: openacs-4/packages/download/www/admin/report-version-downloads-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/download/www/admin/report-version-downloads-postgresql.xql,v diff -u -r1.3 -r1.3.8.1 --- openacs-4/packages/download/www/admin/report-version-downloads-postgresql.xql 16 Jan 2003 13:46:20 -0000 1.3 +++ openacs-4/packages/download/www/admin/report-version-downloads-postgresql.xql 12 Sep 2013 09:57:40 -0000 1.3.8.1 @@ -23,7 +23,7 @@ and dar.archive_id = :archive_id and dar.revision_id = d.revision_id [ad_dimensional_sql $dimensional where] - [ad_order_by_from_sort_spec $orderby $table_def] + [template::list::orderby_clause -orderby -name download_list] Index: openacs-4/packages/download/www/admin/report-version-downloads.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/download/www/admin/report-version-downloads.adp,v diff -u -r1.8 -r1.8.2.1 --- openacs-4/packages/download/www/admin/report-version-downloads.adp 13 Jan 2005 13:57:52 -0000 1.8 +++ openacs-4/packages/download/www/admin/report-version-downloads.adp 12 Sep 2013 09:57:40 -0000 1.8.2.1 @@ -12,4 +12,4 @@ @dimensional_html;noquote@
    #download.lt_Total_downloads_liste#
    -@table;noquote@ + 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.6.8.2 -r1.6.8.3 --- openacs-4/packages/download/www/admin/report-version-downloads.tcl 9 Sep 2013 17:34:17 -0000 1.6.8.2 +++ openacs-4/packages/download/www/admin/report-version-downloads.tcl 12 Sep 2013 09:57:40 -0000 1.6.8.3 @@ -6,7 +6,7 @@ @cvs-id $Id$ } { {archive_id:integer,notnull} - {orderby "last_name"} + {orderby "user_name"} {downloaded 1m} {versions "current"} } -properties { @@ -37,35 +37,52 @@ }} } -set table_def { - {user_name "User Name" - {user_name $order} - {$user_name}} - {version_name "Version" - {version_name $order} - {$version_name}} - {download_date "Download Date" - {download_date $order} - {}} - {download_ip "From IP (hostname)" - {download_ip $order} - {$download_ip ($download_hostname)}} - {reason "Download Reason" - {reason $order} - {$reason}} -} +template::list::create -name download_list \ + -multirow downloads \ + -html {width "90%" align center} \ + -elements { + user_name { + label "User Name" + orderby user_name + link_url_col url_one_user + } + version_name { + label "Version" + orderby version_name + link_url_col url_one_revision + + } + download_date { + label "Download Date" + orderby download_date + } + download_ip { + label "From IP (hostname)" + orderby download_ip + display_template { + @downloads.download_ip@ (@downloads.download_hostname@) + } + } + reason { + label "Download Reason" + orderby reason + } + } -filters {archive_id {} downloaded {} versions {}} db_1row name_select { *SQL* } set current_count [db_string current_count { *SQL* }] set total_count [db_string total_count { *SQL* }] set dimensional_html [ad_dimensional $dimensional] -set table [ad_table \ - -Ttable_extra_html { width="90%" align="center" } \ - -bind [ad_tcl_vars_to_ns_set archive_id] \ - download_table { *SQL* } $table_def ] +set pkg_url [ad_conn package_url] +db_multirow -extend {url_one_ip url_one_revision url_one_user} downloads download_table { *SQL* } { + set url_one_user [export_vars -base report-one-user {user_id}] + set url_one_revision [export_vars -base "${pkg_url}one-revision" {revision_id downloaded}] + set url_one_ip [export_vars -base report-one-ip {download_ip downloaded}] +} + # 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] Index: openacs-4/packages/download/www/admin/repository-metadata-edit.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/download/www/admin/repository-metadata-edit.xql,v diff -u -r1.2 -r1.2.14.1 --- openacs-4/packages/download/www/admin/repository-metadata-edit.xql 22 May 2001 04:17:45 -0000 1.2 +++ openacs-4/packages/download/www/admin/repository-metadata-edit.xql 12 Sep 2013 09:57:40 -0000 1.2.14.1 @@ -17,7 +17,7 @@ dam.mainpage_p, dam.computed_p from download_archive_metadata dam left join download_archive_types dat - using archive_type_id + using (archive_type_id) where dam.repository_id = :repository_id and dam.metadata_id = :metadata_id order by archive_type_id Index: openacs-4/packages/download/www/download/index.vuh =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/download/www/download/index.vuh,v diff -u -r1.1.1.1 -r1.1.1.1.14.1 --- openacs-4/packages/download/www/download/index.vuh 20 Apr 2001 20:51:10 -0000 1.1.1.1 +++ openacs-4/packages/download/www/download/index.vuh 12 Sep 2013 09:57:40 -0000 1.1.1.1.14.1 @@ -1 +1,80 @@ -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_conn 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 {$revision_id eq ""} { + 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 {$revision_id eq ""} { + ad_returnredirect [ad_conn package_url] + ad_script_abort +} + +permission::require_permission -object_id $revision_id -privilege "read" + +cr_write_content -revision_id $revision_id + +##Record the download for all time!! +if {$download_id eq ""} { + set download_id [db_nextval acs_object_id_seq] +} +set double_click_p [db_string download_count "select count(*) from download_downloads where download_id = :download_id"] +#ns_log notice "DAVEB: double_click_p is $double_click_p" +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" + } +} + + +