? .DS_Store
Index: imagefield.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/imagefield/imagefield.install,v
retrieving revision 1.31
diff -u -p -r1.31 imagefield.install
--- imagefield.install	15 Apr 2009 20:15:03 -0000	1.31
+++ imagefield.install	11 Jun 2009 21:26:26 -0000
@@ -327,3 +327,66 @@ function imagefield_update_6005() {
 
   return $ret;
 }
+
+/**
+ * Update all file fields that are displayed as image fields that are set to be listed
+ */
+function imagefield_update_6006() {
+  if(variable_get('imagecache_list_updated', FALSE)) { 
+      variable_del('imagecache_list_updated');
+      return array();
+  }
+  $file_fields = array();
+$content_types = content_types();
+  // Loop through each field on each content type to find all filefields and determine whether each field is displayed as an image
+  foreach ($content_types as $content_type_name => $type) {
+   foreach ($type['fields'] as $field_name => $field) {
+     if ($field['type'] == 'filefield') {
+       if(isset($file_fields[$field_name]['update']) && !$file_fields[$field_name]['update']) {
+         $file_fields[$field_name]['update'] = 0;
+       }
+       $file_fields[$field_name]['content_type'] = $content_type_name;
+       if ($field['display_settings']['teaser']['format'] != 'default' || $field['display_settings']['full']['format'] != 'default') {
+         $file_fields[$field_name]['update'] = 1;
+       }
+     }
+   }
+  }
+  // Loop through each field on each view to determine whether the field is displayed as an image
+  foreach (views_get_all_views() as $view) {
+    foreach ($view->display as $display) {
+      if (isset($display->display_options['fields'])) {
+        foreach ($display->display_options['fields'] as $field_name => $field) {
+          // check to see if this is a cck field
+          if (substr($field_name, 0, 6) == 'field_') {
+            // remove the _fid suffix
+            $field_name = substr($field_name, 0, -4);
+            $field_info = content_fields($field_name);
+            if (isset($field_info['type']) && $field_info['type'] == 'filefield') {
+              if ($field['format'] != 'default') {
+                $file_fields[$field_name]['update'] = 1;
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+  $items = array();
+  // loop through our file fields and if they were found to be displayed 
+  // as images update them setting list to 1 for all of their files
+  foreach ($file_fields as $field_name => $file_field) {
+    if ($file_field['update'] == 1) {
+      if ($content_types[$file_field['content_type']]['fields'][$field_name]['db_storage']) {
+        $table = 'content_type_'. $file_field['content_type'];
+      }
+      else {
+        $table = 'content_'. $field_name;
+      }
+      $items[] = update_sql("UPDATE ". $table ." SET ". $field_name ."_list = 1");
+    }
+  }
+  cache_clear_all();
+  variable_set('imagefield_list_updated', TRUE);
+  return $items;
+}
Index: imagefield_formatter.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/imagefield/imagefield_formatter.inc,v
retrieving revision 1.12
diff -u -p -r1.12 imagefield_formatter.inc
--- imagefield_formatter.inc	21 Mar 2009 03:26:57 -0000	1.12
+++ imagefield_formatter.inc	11 Jun 2009 21:26:26 -0000
@@ -7,13 +7,15 @@
  */
 
 function theme_imagefield_formatter_image_plain($element) {
-  // Inside a view $element may contain null data. In that case, just return.
-  if (empty($element['#item']['fid'])) {
-    return '';
-  }
-
+  
   $field = content_fields($element['#field_name']);
   $item = $element['#item'];
+  module_load_include('inc', 'filefield', 'filefield_formatter');
+  
+  // Inside a view $element may contain null data or file may not be listed. In that case, just return.
+  if (empty($element['#item']['fid']) || !filefield_file_listed($item, $field)) {
+    return '';
+  }
 
   $item['data']['alt'] = isset($item['data']['alt']) ? $item['data']['alt'] : '';
   $item['data']['title'] = isset($item['data']['title']) ? $item['data']['title'] : NULL;
