? includes/views_handler_sort_by_download_counter.inc Index: download_count.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/download_count/download_count.module,v retrieving revision 1.20 diff -u -p -r1.20 download_count.module --- download_count.module 3 Jun 2010 14:04:45 -0000 1.20 +++ download_count.module 13 Sep 2010 15:19:36 -0000 @@ -181,7 +181,6 @@ function download_count_file_download($f db_query("INSERT INTO {download_count} (fid, nid, uid, vid, timestamp) VALUES (%d, %d, %d, %d, %d)", $fid, $nid, $user->uid, $vid, time()); watchdog('download', '%file was downloaded', array('%file' => $filename), WATCHDOG_NOTICE); - } /** Index: includes/download_count.views.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/download_count/includes/download_count.views.inc,v retrieving revision 1.1 diff -u -p -r1.1 download_count.views.inc --- includes/download_count.views.inc 2 Jun 2010 14:40:26 -0000 1.1 +++ includes/download_count.views.inc 13 Sep 2010 15:19:36 -0000 @@ -35,10 +35,19 @@ function download_count_views_data() { ), ); - //fields + + $data['files']['download_count'] = array( + 'title' => t('Download count'), + 'help' => t('Number of times the file was download.'), + 'sort' => array( + 'handler' => 'views_handler_sort_by_download_counter', + ), + ); + + //norlmal fields $data['download_count']['timestamp'] = array( 'title' => t('Timestamp'), - 'help' => t('The date & time the file was downloaded.'), + 'help' => t('The date & time the file was downloaded, adding this to your "File" views will display the same file multiple times.'), 'field' => array( 'handler' => 'views_handler_field_date', 'click sortable' => TRUE, @@ -55,8 +64,8 @@ function download_count_views_data() { ); $data['download_count']['dcid'] = array( - 'title' => t('Download count id'), - 'help' => t('The unique id of the download.'), + 'title' => t('Download id (dcid)'), + 'help' => t('The unique id of the download, adding this to your "File" views will display the same file multiple times.'), 'field' => array( 'handler' => 'views_handler_field', 'click sortable' => TRUE, @@ -118,4 +127,22 @@ function download_count_views_data() { ); return $data; +} + + +/** + * Implementation of hook_views_handlers() + */ +function download_count_views_handlers() { + return array( + 'info' => array( + 'path' => drupal_get_path('module', 'download_count') . '/includes' + ), + 'handlers' => array( + 'views_handler_sort_by_download_counter' => array( + 'parent' => 'views_handler_sort', + 'file' => 'views_handler_sort_by_download_counter.inc', + ), + ), + ); } \ No newline at end of file