Dopry's hacking away at HEAD on filefield and imagefield. I'm trying to do some running QA on it to spot issues.
A few variations I'm trying to make sure I test:
- Single, Multi, Unlimited value fields
- All the formatters
Issues:
- Uploads are lost if form fails validation (both imagefield and filefield) after clicking an "Upload" button.
--only if upload button is the selected button... preview and save don't lose new upload on validation
errors. dopry
the upload buttons still seem pretty broken. i've got a node with two single value filefields on it, i fill in the required text fields and select two files click the upload button and it submits the files correctly but discards the node's title. --drewish - The list checkbox doesn't work.
- The 'suitability callback' function imagefield_handles_file() isn't defined. Not critical but needs to either be added or removed from the data returned by the hook_formatter_info() implementations.
- If widget is allowed "unlimited" entries then warnings are thrown:
warning: Cannot use a scalar value as an array in /var/www/html/drupal/drupal-6.3/sites/all/modules/cck/content.module on line 807.
. - Broken thumbs for progressive jpegs. Need to add "image/pjpeg" to the list for imagefield_file_is_image($file)
Things to consider:
- Default field formatter for "image" widgets should probably be "Image linked to file" rather then "Generic Files" IMO.
- Imagecache and other modules that provide formatters for cck images currently seem to key off the cck "image" *type* rather then a "image" widget. As a result they will not show up as formatters for cck type: file widget: image.
E_ALL notices...
(lets keep these out of the way of the functional bugs... also I would prefer to see them fixed with proper
initialization rather than isset and empty checks... only checkboxes should 'require' empty checks...)
- notice: Undefined index: description in filefield/filefield_widget.inc on line 23. Here's a fix:
--- filefield_widget.inc 15 Jul 2008 02:07:46 -0000 1.6
+++ filefield_widget.inc 15 Jul 2008 17:07:16 -0000
@@ -20,7 +20,7 @@ function filefield_widget_value($element
$file = field_file_load($edit['fid']);
$item = array(
'fid' => $edit['fid'],
- 'description' => $edit['description'],
+ 'description' => empty($edit['description']) ? '' : $edit['description'],
'list' => empty($edit['list']),
'data' => '',
); -
# notice: Undefined index: alt in imagefield/imagefield.module on line 231.
# notice: Undefined index: title in imagefield/imagefield.module on line 232.
--- imagefield.module 15 Jul 2008 01:06:16 -0000 1.56
+++ imagefield.module 15 Jul 2008 17:37:42 -0000
@@ -228,8 +228,8 @@ function theme_imagefield_image($file, $
$image_attributes = array();
if (!$getsize || (list($width, $height, $type, $image_attributes) = @getimagesize($file['filepath']))) {
$attributes = drupal_attributes($attributes);
- $alt = empty($alt) ? $file['alt'] : $alt;
- $title = empty($title) ? $file['title'] : $title;
+ $alt = empty($alt) && isset($file['alt']) ? $file['alt'] : $alt;
+ $title = empty($title) && isset($file['title']) ? $file['title'] : $title;
$url = file_create_url($file['filepath']);
return '<img src="'. check_url($url) .'" alt="'.
check_plain($alt) .'" title="'. check_plain($title) .'" '. $image_attributes . $attributes .' />'; -
# notice: Undefined index: alt in imagefield/imagefield_formatter.inc on line 61.
# notice: Undefined index: title in imagefield/imagefield_formatter.inc on line 61.
--- imagefield_formatter.inc 14 Jul 2008 06:17:11 -0000 1.2
+++ imagefield_formatter.inc 15 Jul 2008 17:37:42 -0000
@@ -56,7 +56,10 @@ function theme_imagefield_formatter_imag
if (empty($item['fid']) && $field['use_default_image']) $item = $field['default_image'];
if (empty($item['filepath'])) $item = array_merge($item, field_file_load($item['fid']));
-
+
+ if (!isset($item['alt'])) $item['alt'] = '';
+ if (!isset($item['title'])) $item['title'] = '';
+
$class = 'imagefield imagefield-'. $field['field_name'];
return theme('imagefield_image', $item, $item['alt'], $item['title'], array('class' => $class));
}