Create anchor to the file when component's type = 'file'

kovda - May 26, 2009 - 13:35
Project:webform report
Version:6.x-1.8
Component:User interface
Category:bug report
Priority:minor
Assigned:Unassigned
Status:active
Description

When the component's type is file, the report shows a serialized array of data about the file.
An anchor to the file would be useful.
I inserted some new lines into the 'webform_report.inc' file, to solve it.
The bold ones are the new lines.
From line 93:

// Don't leave the user field blank if no matching user is found.
if (empty($row->user)) {
$row->user = t('Anonymous');
}
// Create anchor to the file, if type is 'file'
if ($row->type == 'file') {
$file_data = unserialize($row->data);
$row->data = '<a href="' . $file_data['filepath'] . '">' . $file_data['filename'] . '</a>';
}

$values[$row->sid][-1] = array('data' => $row->user, 'field' => -1);
$values[$row->sid][-2] = array('data' => date('Y-m-d', $row->submitted), 'field' => -2);
$values[$row->sid][-3] = array('data' => date('H:s', $row->submitted), 'field' => -3);
$values[$row->sid][-4] = array('data' => $row->remote_addr, 'field' => -4);
$values[$row->sid][-5] = array('data' => '<a href="' . url('node/'. $row->nid . '/submission/' . $row->sid . '/edit') . '">' . t('edit') . '</a>', 'field' => -5);

 
 

Drupal is a registered trademark of Dries Buytaert.