I see I can add a lots of property of the node's attached files but I can't display it's description. Could add this in the future?
Thank you

CommentFileSizeAuthor
#7 views_upload.inc_.patch1.95 KBbartezz

Comments

sun’s picture

Status: Active » Closed (won't fix)

Sorry, unfortunately this support request is way too specific. Please have a look at the issue queue - Views maintainers are buried already. You might want to try to get further support at http://drupal.org/support.

danyg’s picture

Version: 5.x-1.6 » 5.x-1.6-beta5
Status: Needs work » Closed (won't fix)

Hello,

I wrote a handler to solve this problem, it works under D5. I know this is a late post :) but I haven't search solution for this problem earlier.

function otnet_views_handler_file_description($fieldinfo, $fielddata, $value, $data) {
  return $data->description;
}

function otnet_views_query_handler_file_description($field, $fieldinfo, &$query) {
  $query->add_field('description', 'file_revisions');
  $query->add_field('filepath', 'files');
}

function otnet_views_handler_file_description_download($fieldinfo, $fielddata, $value, $data) {
  return l($data->description, check_url(file_create_url($data->filepath)));
}

function otnet_views_tables() {
  $table['file_description'] = array(
    'name' => 'file_revisions',
    'join' => array(
      'left' => array(
        'table' => 'files',
        'field' => 'fid',
      ),
      'right' => array(
        'field' => 'fid'
      ),
    ),
    'fields' => array(
      'description' => array(
        'field' => 'description',
        'name' => t('File: Description'),
        'notafield' => true,
        'query_handler' => 'otnet_views_query_handler_file_description',
        'handler' => array(
          'otnet_views_handler_file_description' => t('Plain'),
          'otnet_views_handler_file_description_download' => t('With download link'),
        ),
        'sortable' => false,
        'help' => t('Display file description'),
      ),
    ),
  );
  return $table;
}
danyg’s picture

Version: 5.x-1.6-beta5 » 5.x-1.6
Status: Closed (won't fix) » Needs review
dawehner’s picture

Status: Needs review » Needs work

Needs review, stands for, there is a patch.

So create a patch :)

danyg’s picture

Version: 5.x-1.6-beta5 » 5.x-1.6
Status: Closed (won't fix) » Needs work

I've just found a bug in my code, and repair the previous version (add $query->add_field('filepath', 'files'); and a join to tables() function), because the link wasn't correct, the latest version (in #2) is now working correctly. Early version is worked only if you added teh File:Name field selector also.

bartezz’s picture

Daniel,

Can you create a patch, or at least tell us where to use this code?

Cheers

bartezz’s picture

Category: feature » task
StatusFileSize
new1.95 KB

Hi,

Well I took a shot at it myself. I've managed to implement the code above and added File: description sorting capabilities as well.
When I have time I'll try to add description filter functionality as well but don't get your hopes up too much. Kinda busy now...

Cheers

bartezz’s picture

Category: task » feature
Status: Needs work » Needs review

Sorry changed wrong parameters :)

danyg’s picture

Sorry about not to create patch, my solution was a simple single module, with the function above (module called otnet).
Thanks to You, Bartezz to create the patch from the code.

bartezz’s picture

No sweat! I added the functionality to sort by description as well, you might want to check it out...

Cheers

esmerel’s picture

Status: Needs review » Closed (won't fix)

At this time, only security fixes will be made to the 5.x version of Views.

bartezz’s picture

At this time? The patch was posted in 2009!
If it was a feature request without a patch I could understand no one was willing to pick this one up.
But code was written, tested and a patch provided. Then 8 months later there's a "won't fix" because only security issues are handled.

I like open source software due to the fact people can improve, contribute and share.
But if this is the way contributions are handled then why would people go thru the trouble of improving and sharing code...

Just my 2 cents...

Cheers