First of all, this module rocks and I am starting to use it on alot of my sites ...

Second, I was hoping that there would be an Admin Views form field to alter the width of the time line intervals... not just the height. After I looked at the code, I realized the value I needed to alter was in the actual timeline.js file... and I couldn't find a point to interject a change in that value: intervalPixels: 50 Also, when I looked at the online documentation from the
simile-widgets project page ( http://code.google.com/p/simile-widgets/wiki/Timeline_CreatingNewThemes ) I realized that alot of functionality was possible if only I could alter the timeline.js per theme.

So I came up with this solution, at the end of this function:

/**
 * Inlude all js and css files that needs the timeline.
 * Depending on the timeline views settings the external SIMILE server is used.
 * Or otherwise a local installation.
 *
 * @return: TRUE if everything could be included properly
 *          FALSE if Simile Exhibit Libraries aren't found
 */
function _timeline_include($timeline_theme) {
  $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;
  }

  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_theme . '/timeline.js');
  } else {
	 drupal_add_js($timeline_mod_path . '/js/timeline.js');
  }  
  return TRUE;
}

By including the timeline.js file in with each theme, you can expose those options to different themes.

Also, I felt very "dirty" by augmenting / adding a theme folder within a module. Is there a way to do this in for of a drupally way? I understand exposing all the options with FAPI is aton of work ...

What do you think about this?

johnvsc

Comments

xamanu’s picture

Title: Give themes the ability to have their own timeline.js file » timeline intervals settings for the views plugin
Version: 6.x-2.0 » 6.x-2.x-dev
Status: Needs review » Needs work

I don't really agree with the way you solved this problem, but I think you are right that intervals should be customizable.
IMHO I'd provide another settings field on the views settings page for the timeline. This is pretty straight forward and could be done easily.

With the feature #602956: Implement supported fields as plugins I'm going to use ctools' plugin api as well for the theme inclusion.
Thanks.

johnvsc’s picture

hey ... yeah i don't agree with it too ... but rather than just saying so, i thought that i would at least try to offer up a solution ...

anyone else ?

xamanu’s picture

Status: Needs work » Fixed

This has been implemented.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.