Closed (fixed)
Project:
FileField
Version:
6.x-3.2
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
14 May 2009 at 17:03 UTC
Updated:
8 May 2010 at 01:50 UTC
Jump to comment: Most recent file
Comments
Comment #1
quicksketchI haven't tried using diff with FileField, but it doesn't surprise me it doesn't work out-of-box. CCK currently is providing all the diff functionality for FileField, using the default comparison function. This comparison checks for a "value" property, but FileField doesn't actually have a value property, it uses a file "fid" as the primary value.
It looks like FileField can implement hook_content_diff_values() to solve this problem, I'm moving this to a feature request.
Comment #2
quicksketchComment #3
quicksketchThis patch adds basic Diff support, comparing the upload file paths. It doesn't take into consideration Alt, Title, or Description texts, I'm not sure if they'd be appropriate to include (Diff's upload.module support doesn't support descriptions either).
Comment #4
infodrupal commentedI've tried the patch and i think it works.
I've made some changes because i'm interested only in the filename. The code is as follows:
function filefield_content_diff_values($node, $field, $items) {
$return = array();
foreach ($items as $item) {
if (is_array($item) && !empty($item['filepath'])) {
$file = basename($item['filepath']);
$filename = explode(".",$file);
$return[] = $filename[0];
}
}
return $return;
}
I think this is a beginning because it would be fantastic if the module could show other differences like description, name or timestamp.
Comment #5
Encarte commentedsubscribing
Comment #6
agileware commentedPatch #3 works for me and would be a great addition to FileField.
Comment #7
quicksketchWell basic support is better than no support. Committed #3.