? timeline.module.cck-multi
? timeline.module.cvs
Index: timeline.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/timeline/timeline.module,v
retrieving revision 1.3.2.7.2.7
diff -u -p -r1.3.2.7.2.7 timeline.module
--- timeline.module	16 Mar 2008 23:50:53 -0000	1.3.2.7.2.7
+++ timeline.module	9 Apr 2008 11:00:27 -0000
@@ -496,13 +496,24 @@ function timeline_data($view, $view_args
   $events = array();
   foreach ($items->items as $item) {
     $node = node_load(array('nid' => $item->nid));
-
+    
     $start_value = !empty($start_field) && !empty($item->$start_field) ? $item->$start_field : $node->created;
     $end_value = !empty($end_field) && !empty($item->$end_field) ? $item->$end_field : NULL;
     $title_value = !empty($title_field) && !empty($item->$title_field) ? $item->$title_field : $node->title;
     $body_value = !empty($body_field) && !empty($item->$body_field) ? $item->$body_field : $node->teaser;
     $body_format = !empty($format_field) && !empty($item->$format_field) ? $item->$format_field : $node->format;
-
+    // Try to get CCK field names
+    unset($image_path);
+    $result = db_query_range("SELECT n.field_name FROM {node_field_instance} n WHERE type_name = '%s'", $node->type, 0, 100);
+    while (($field_name = db_fetch_object($result)->field_name) && is_null($image_path)) { // only first image to show
+      // Only get path if it is an image type field
+      if (db_fetch_object(db_query("SELECT n.type FROM {node_field} n WHERE field_name = '%s'", $field_name))->type == 'image') {
+        if (!empty($node->$field_name)) {
+          $image_path = $node->{$field_name}['0']['filepath'];
+        }
+      }
+    }
+    
     $event = array(
       'title'       => $title_value,
       'link'        => url('node/' . $node->nid),
@@ -510,8 +521,11 @@ function timeline_data($view, $view_args
       'end'         => $end_value ? timeline_format_iso8601_date($end_value) : NULL,
       //'isDuration'  => $end_value ? 'true' : 'false', // NOTE: broken with JSON when explicit
       'description' => check_markup($body_value, $body_format, FALSE),
+      'image'       => url($image_path),
+      'icon'        => theme('timeline_icon', $node),
     );
     if (is_null($event['end']) || $event['start'] == $event['end']) unset($event['end']);
+    if (is_null($image_path)) unset($event['image']);
     $events[] = $event;
   }
   return $events;
