Index: imagefield_assist.info
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/imagefield_assist/imagefield_assist.info,v
retrieving revision 1.1.2.2
diff -u -p -r1.1.2.2 imagefield_assist.info
--- imagefield_assist.info	4 Jul 2009 20:36:22 -0000	1.1.2.2
+++ imagefield_assist.info	27 Oct 2009 17:46:10 -0000
@@ -3,6 +3,7 @@ name = ImageField Assist
 description = This module allows users to upload and insert inline images into posts. It automatically generates an Add image link under the textarea fields of your choice, provides a tinyMCE plugin, using ImageField fields as resource.
 dependencies[] = imagefield
 dependencies[] = imagecache
+dependencies[] = views
 
 package = Image
 core = 6.x
Index: imagefield_assist.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/imagefield_assist/imagefield_assist.install,v
retrieving revision 1.1.2.5
diff -u -p -r1.1.2.5 imagefield_assist.install
--- imagefield_assist.install	22 Oct 2009 01:50:03 -0000	1.1.2.5
+++ imagefield_assist.install	27 Oct 2009 17:46:10 -0000
@@ -37,7 +37,6 @@ function imagefield_assist_uninstall() {
   variable_del('imagefield_assist_vocabs');
   variable_del('imagefield_assist_default_alignment');
   variable_del('imagefield_assist_all');
-  variable_del('imagefield_assist_count');
   variable_del('imagefield_assist_lightbox_preset');
   $presets = imagecache_presets();
   foreach($presets as $preset){
@@ -58,4 +57,3 @@ function imagefield_assist_update_6200()
   }
   return $ret;
 }
-
Index: imagefield_assist.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/imagefield_assist/imagefield_assist.module,v
retrieving revision 1.1.2.9
diff -u -p -r1.1.2.9 imagefield_assist.module
--- imagefield_assist.module	22 Oct 2009 13:01:21 -0000	1.1.2.9
+++ imagefield_assist.module	27 Oct 2009 17:46:11 -0000
@@ -11,6 +11,16 @@
  */
 
 /**
+ * Implementation of hook_views_api().
+ */
+function imagefield_assist_views_api() {
+  return array(
+    'api' => 2,
+    'path' => drupal_get_path('module', 'imagefield_assist') .'/includes',
+  );
+}
+
+/**
  * Implementation of hook_help().
  */
 function imagefield_assist_help($path, $arg) {
@@ -843,40 +853,14 @@ function imagefield_assist_load_imagefie
  *
  */
 function imagefield_assist_thumbs() {
-  global $user;
-    
-  $output = '';
-  $count = variable_get('imagefield_assist_count',4);
-  $images = imagefield_assist_load_imagefields(array('count' => $count));
-  
-  if (!empty($images)) {
-  
-    $output .="<table><tbody><tr>";
-    
-    foreach ($images as $n => $img) {
-      $output .=
-        '<td>'.
-        l(
-          theme('imagecache', 'ifa_thumbnail', file_create_path($img->path)),
-          'imagefield_assist/properties/'. $img->fid,
-          array('html' => TRUE)
-        )
-        .'</td>';
-    
-      // Line break
-      if ( ($n+1) % 4 == 0 ) $output .= '</tr><tr>';
-    }
-    $output .="</tr></tbody></table>";
-  
-  }
-  else {
+
+  $view = views_get_view('imagefield_assist_browser');
+  $output = $view->preview();
+  if (empty($output)) {
     $output = t('No Images added yet. Click the upload button above to start.');
   }
   
   echo theme('imagefield_assist_page', $output, array('id' => 'imagefield_assist_thumbs', 'onload' => 'parent.initThumbs();', 'class' => 'imagefield_assist'));
-  if ($count > 0) {
-    echo theme('pager', variable_get('imagefield_assist_count',0));
-  }
   exit;
 }
 
@@ -1574,6 +1558,9 @@ function imagefield_assist_map_delete($n
  */
 function imagefield_assist_map_load($nid) {
   $imagemap = array();
+  if (!db_table_exists('image')) {
+    return $imagemap;
+  }
   $result = db_query('SELECT * FROM {image} i INNER JOIN {imagefield_assist_map} iam ON i.nid = iam.iid WHERE i.nid = %d', $nid);
   while ($data = db_fetch_object($result)) {
     $imagemap[] = $data->nid;
Index: includes/imagefield_assist.views_default.inc
===================================================================
RCS file: includes/imagefield_assist.views_default.inc
diff -N includes/imagefield_assist.views_default.inc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ includes/imagefield_assist.views_default.inc	27 Oct 2009 17:46:11 -0000
@@ -0,0 +1,159 @@
+<?php
+function imagefield_assist_views_default_views() {
+ 
+  // Find all fields and their content types
+  // that use imagefields.
+  $types = content_types();
+  $fields = array();
+  $node_types = array();
+  foreach ($types as $type_name => $type) {
+    foreach ($type['fields'] as $field_name => $field) {
+      if (substr($field['widget']['module'], 0, 10) == 'imagefield' ||
+	  strstr($field['widget']['type'], 'imagefield')) {
+        $node_types[] = $field['type_name'];
+        $fields[$field_name] = $field;
+      }
+    }
+  }
+  
+  $views = array();
+  
+$view = new view;
+$view->name = 'imagefield_assist_browser';
+$view->description = 'The browser screen for images in imagefield assist module.';
+$view->tag = '';
+$view->view_php = '';
+$view->base_table = 'node';
+$view->is_cacheable = FALSE;
+$view->api_version = 2;
+$view->disabled = FALSE; /* Edit this to true to make a default view disabled initially */
+$handler = $view->new_display('default', 'Defaults', 'default');
+
+$relationships = array();
+foreach ($fields as $field_name => $field) {
+  $relationships[$field_name .'_fid'] = array(
+    'label' => 'Image',
+    'required' => 0,
+    'delta' => -1,
+    'id' => $field_name .'_fid',
+    'table' => 'node_data_'. $field_name,
+    'field' => $field_name .'_fid',
+    'relationship' => 'none',
+  );
+}
+$handler->override_option('relationships', $relationships);
+
+$count = 0;
+$viewfields = array();
+foreach ($fields as $field_name => $field) {
+  $append = $count > 0 ? '_'. $count : '';
+  $viewfields['fid'. $append] = array(
+    'label' => '',
+    'alter' => array(
+      'alter_text' => 0,
+      'text' => '',
+      'make_link' => 0,
+      'path' => '',
+      'link_class' => '',
+      'alt' => '',
+      'prefix' => '',
+      'suffix' => '',
+      'help' => '',
+      'trim' => 0,
+      'max_length' => '',
+      'word_boundary' => 1,
+      'ellipsis' => 1,
+      'strip_tags' => 0,
+      'html' => 0,
+    ),
+    'link_to_file' => 0,
+    'exclude' => 1,
+    'id' => 'fid'. $append,
+    'table' => 'files',
+    'field' => 'fid',
+    'relationship' => $field_name .'_fid',  
+  );
+  $viewfields[$field_name .'_fid'] = array(
+    'label' => '',
+    'alter' => array(
+      'alter_text' => 0,
+      'text' => '',
+      'make_link' => 1,
+      'path' => 'imagefield_assist/properties/[fid]',
+      'link_class' => '',
+      'alt' => '',
+      'prefix' => '',
+      'suffix' => '',
+      'help' => '',
+      'trim' => 0,
+      'max_length' => '',
+      'word_boundary' => 1,
+      'ellipsis' => 1,
+      'strip_tags' => 0,
+      'html' => 0,
+    ),
+    'link_to_node' => 0,
+    'label_type' => 'none',
+    'format' => 'ifa_thumbnail_default',
+    'multiple' => array(
+      'group' => TRUE,
+      'multiple_number' => '',
+      'multiple_from' => '',
+      'multiple_reversed' => FALSE,
+    ),
+    'exclude' => 0,
+    'id' => $field_name .'_fid',
+    'table' => 'node_data_'. $field_name,
+    'field' => $field_name .'_fid',
+    'relationship' => 'none',  
+  );
+  $count++;
+}
+$handler->override_option('fields', $viewfields);
+
+$handler->override_option('filters', array(
+  'type' => array(
+    'operator' => 'in',
+    'value' => drupal_map_assoc($node_types),
+    'group' => '0',
+    'exposed' => FALSE,
+    'expose' => array(
+      'operator' => FALSE,
+      'label' => '',
+    ),
+    'id' => 'type',
+    'table' => 'node',
+    'field' => 'type',
+    'relationship' => 'none',
+  ),
+));
+
+$handler->override_option('sorts', array(
+  'created' => array(
+    'order' => 'DESC',
+    'granularity' => 'second',
+    'id' => 'created',
+    'table' => 'node',
+    'field' => 'created',
+    'relationship' => 'none',
+  ),
+));
+$handler->override_option('access', array(
+  'type' => 'none',
+));
+$handler->override_option('cache', array(
+  'type' => 'none',
+));
+$handler->override_option('use_ajax', TRUE);
+$handler->override_option('items_per_page', 8);
+$handler->override_option('use_pager', '1');
+$handler->override_option('style_plugin', 'grid');
+$handler->override_option('style_options', array(
+  'grouping' => '',
+  'columns' => '4',
+  'alignment' => 'horizontal',
+));
+
+$views[$view->name] = $view;
+return $views;
+}
