? timeline-708942-2.patch
? timeline-708942.patch
Index: timeline.theme.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/timeline/timeline.theme.inc,v
retrieving revision 1.13.2.1.2.13
diff -u -p -r1.13.2.1.2.13 timeline.theme.inc
--- timeline.theme.inc	19 Oct 2009 13:30:30 -0000	1.13.2.1.2.13
+++ timeline.theme.inc	15 Feb 2010 11:23:22 -0000
@@ -16,8 +16,8 @@ function template_preprocess_views_view_
   if (_timeline_include($vars['options']['timeline']['theme'])) {
 
     // preprocess css information for the template
-    $vars['id'] = $vars['view']->name;
-    $vars['class'] = $vars['view']->name;
+    $vars['id'] = $vars['options']['timeline']['class'];
+    $vars['class'] = $vars['options']['timeline']['class'];
     $vars['height'] = $vars['options']['timeline']['height'];
     $vars['width'] = $vars['options']['timeline']['width'];
     $vars['controls'] = $vars['options']['misc']['controls'];
@@ -80,30 +80,33 @@ function theme_timeline_debug($debug_arr
  *          FALSE if Simile Exhibit Libraries aren't found
  */
 function _timeline_include($timeline_theme) {
+  static $loaded = FALSE;
   $timeline_mod_path = drupal_get_path('module', 'timeline');
 
-  // Use SIMILE Server
-  if (variable_get('timeline_library_source', 'hosted') == 'hosted') {
-    $timeline_api = 'http://static.simile.mit.edu/timeline/api-2.3.0/timeline-api.js?bundle=true';
-    drupal_set_html_head('<script type="text/javascript" src="'. $timeline_api .'"></script>'); //  We have to wait to D7 to get rid of this: #91250 - fd
-  }
-  elseif (variable_get('timeline_library_source', 'hosted') == 'local' && $message = timeline_validate_library()) {
-    $timeline_lib_path = libraries_get_path('simile_timeline');
-    drupal_add_js(file_directory_path() . '/timeline/local_variables.js');
-    drupal_add_js($timeline_lib_path . '/timeline_js/timeline-api.js');
-  }
-  else {
-    drupal_set_message(t('Simile Timeline Libraries not found'), 'error');
-    return FALSE;
+  if (!$loaded) {
+    // Use SIMILE Server
+    if (variable_get('timeline_library_source', 'hosted') == 'hosted') {
+      $timeline_api = 'http://static.simile.mit.edu/timeline/api-2.3.0/timeline-api.js?bundle=true';
+      drupal_set_html_head('<script type="text/javascript" src="'. $timeline_api .'"></script>'); //  We have to wait to D7 to get rid of this: #91250 - fd
+    }
+    elseif (variable_get('timeline_library_source', 'hosted') == 'local' && $message = timeline_validate_library()) {
+      $timeline_lib_path = libraries_get_path('simile_timeline');
+      drupal_add_js(file_directory_path() . '/timeline/local_variables.js');
+      drupal_add_js($timeline_lib_path . '/timeline_js/timeline-api.js');
+    }
+    else {
+      drupal_set_message(t('Simile Timeline Libraries not found'), 'error');
+      return FALSE;
+    }
+    drupal_add_css($timeline_mod_path . '/css/timeline.css');
+    drupal_add_js($timeline_mod_path . '/js/timeline.js');
+    $loaded = TRUE;
   }
 
-  drupal_add_css($timeline_mod_path . '/css/timeline.css');
-
   // include custom theme files (if activated)
   if ($timeline_theme != $timeline_mod_path . '/themes/ClassicTheme' && $timeline_theme != FALSE) {
     drupal_add_js($timeline_theme . '/theme.js');
     drupal_add_css($timeline_theme . '/theme.css');
   }
-  drupal_add_js($timeline_mod_path . '/js/timeline.js');
   return TRUE;
 }
Index: views_views_plugin_style_timeline.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/timeline/views_views_plugin_style_timeline.inc,v
retrieving revision 1.1.2.12
diff -u -p -r1.1.2.12 views_views_plugin_style_timeline.inc
--- views_views_plugin_style_timeline.inc	8 Oct 2009 12:20:57 -0000	1.1.2.12
+++ views_views_plugin_style_timeline.inc	15 Feb 2010 11:23:22 -0000
@@ -314,6 +314,8 @@ class views_views_plugin_style_timeline 
    * Data for the simile timeline is getting collected within the view
    */
   function render() {
+    static $delta = 0;
+
     // Load only when neccessary
     module_load_include('inc', 'timeline', 'classes/Timeline.class');
     module_load_include('inc', 'timeline', 'classes/TimelineEvent.class');
@@ -328,7 +330,9 @@ class views_views_plugin_style_timeline 
     drupal_alter('timeline_data', $timeline->data);
 
     // Convert data to json and push them to drupal's js behaviors
-    $timeline->timeline_to_json();
+    $data = array();
+    $data['timeline'][$delta] = array($timeline->data['id'] .'_' .$delta => $timeline->data);
+    drupal_add_js($data, 'setting');
 
     // Print warning if no data is available
     if (count($timeline->data['events']['events']) == 0) {
@@ -340,13 +344,14 @@ class views_views_plugin_style_timeline 
     }
     // options that are used for template preprocessor
     $this->options['timeline'] = array(
-      'class' => $this->view->name,
+      'class' => $this->view->name .'_'. $delta,
       'width' => _timeline_to_dim($this->view->style_options['display']['width']),
       'height' => _timeline_to_dim($this->view->style_options['display']['height']),
       'align' => '',
       'controls' => FALSE, // $this->view->style_options['misc']['controls'],
       'theme' => $this->options['display']['appearance']['theme'],
     );
+    $delta++;
     return theme($this->theme_functions(), $this->view, $this->options);
   }
 }
Index: js/timeline.js
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/timeline/js/timeline.js,v
retrieving revision 1.1.2.4
diff -u -p -r1.1.2.4 timeline.js
--- js/timeline.js	7 Oct 2009 17:35:28 -0000	1.1.2.4
+++ js/timeline.js	15 Feb 2010 11:23:22 -0000
@@ -201,9 +201,12 @@ Drupal.timeline.controls = {
 Drupal.behaviors.timeline = function(context) {
   if(Timeline && Drupal.settings.timeline) {
     $.each(Drupal.settings.timeline, function(i, v) {
-      $('.' + i + '-wrapper:not(.timeline-processed)', context).each(function() {
-        $(this).addClass('timeline-processed');
-        Drupal.timeline.createWidget(v);
+      $.each(v, function(i, v) {
+    	v.id = i;
+	    $('.' + i + '-wrapper:not(.timeline-processed)', context).each(function() {
+	      $(this).addClass('timeline-processed');
+	      Drupal.timeline.createWidget(v);
+	    });
       });
     });
   } 
