We upgraded to 6.x-3.x-dev from 6.x-2.1 to overcome the problem with node attributes being assigned to the wrong node (the body, title, etc. of some nodes were displayed in the bubble of the wrong node).
After the upgrade the timeline page loads but the timeline is blank (http://jewishmuseum.ca/timeline), except for what appears to be the horizontal rules at the top and in the middle of the timeline.
We undertook the following actions in order to resolve the problem:
1) reconfigured the views and created new test views exactly according to the module documentation - no effect
2) downloaded and installed the latest simile js and ajax libraries and confirmed they were installed correctly - no effect
3) cleared the caches - no effect
4) Looked for javascript errors in firebug - found two seemingly unrelated errors and encountered a jQuery is undefined error in the rendered timeline page on the line that includes "jQuery.extend(Drupal.settings, { "basePath": "/", "fivestar": { "titleUser": "Your rating: ", "titleAverage": "Average: ", "feedbackSavingVote":... (This is odd since fivestar is disabled for this content type).
5) set the timeline to debug mode (see attached capture) - observed that the content is successfully returning from the query
6) confirmed that timeline.js, timeline-bundle.js and timeline-api.js are loading successfully (they are actually loaded twice for some reason)
7) switched the view style from Timeline to HTML list - the correct list of nodes appear as a list.
Any help would be greatly appreciated.
| Comment | File | Size | Author |
|---|---|---|---|
| Timeline Debug Data.txt | 94.66 KB | stevenaburton |
Comments
Comment #1
stevenaburton commentedComment #2
stevenaburton commentedI found that the timeline actually works if the node post date is selected instead of the CCK Date field (a custom field that indicates the date of the historical event).
When the CCK Date Field is configured, the query returned by the view is returning the correct value (such as 1845-01-01T00:00:00) . However, the timeline logic returns the following:
array (
'events' =>
array (
'events' =>
array (
0 =>
array (
'title' => 'First BC Person',
'link' => false,
'start' => NULL,
...
Notice the NULL start date, which is obviously preventing the node data from being placed on the timeline, resulting in an empty timeline.
Running an SQL query directly shows that the node created date is returning as in unix timestamp (such as 1309891445) while the CCK Date is formatted as yyyy-mm-dd'T'hh:MM:ss. It seems that the timeline code can't handle the variation in date formats?
On the other hand, creating a CCK timestamp field and configuring the timeline to use this field still results in a 'start' => NULL.
Any help would be greatly appreciated, I have been working on this for weeks with no luck.
Thanks
Comment #3
stevenaburton commentedThe problem is in the timeline_date_source_date_field_conversion function in sites/all/modules/timeline/plugins/date_sourcesdate_field.inc
The first line, $input_format = $options['field']['date format'];, returns NULL when a CCK Date field is used. This causes the date conversion logic to fail, resulting in a null start date.
I managed to get it working by adding a default switch condition that catches CCK dates but I am aware it is a hack since non-CCK Date fields would probably throw errors.
For what it's worth, here is my code... I added the last two lines and the timeline now appears correctly.
function timeline_date_source_date_field_conversion($date, $output_format, $options = array()) {
$input_format = $options['field']['date format'];
switch ($input_format) {
case 'date':
switch ($output_format) {
case 'iso8601':
return date_convert(date_convert($date, DATE_ISO, DATE_UNIX), DATE_UNIX, DATE_ISO, date_get_timezone('date')) . 'Z';
case 'gregorian':
if (module_exists('date_api') && variable_get('date_api_version', 0) >= 5.2) {
return format_date(date_convert($date, DATE_ISO, DATE_UNIX) + timeline_get_timezone(), 'custom', 'M d Y G:i:s', '0', 'en');
}
else {
return format_date(strtotime($date) + timeline_get_timezone(), 'custom', 'M d Y G:i:s', '0', 'en');
}
case 'timestamp':
return date_convert($date, DATE_ISO, DATE_UNIX) + timeline_get_timezone();
}
case 'datetime':
switch ($output_format) {
case 'iso8601':
return date_convert(date_convert($date, DATE_DATETIME, DATE_UNIX), DATE_UNIX, DATE_ISO, date_get_timezone('date')) . 'Z';
case 'gregorian':
return format_date(date_convert($date, DATE_DATETIME, DATE_UNIX) + timeline_get_timezone(), 'custom', 'M d Y G:i:s', '0', 'en');
case 'timestamp':
return date_convert($date, DATE_DATETIME, DATE_UNIX) + timeline_get_timezone();
}
case 'datestamp':
switch ($output_format) {
case 'iso8601':
if (module_exists('date_api') && variable_get('date_api_version', 0) >= 5.2) {
return date_convert($date, DATE_UNIX, DATE_ISO, date_get_timezone('date')) . 'Z';
}
else {
return format_date($date + timeline_get_timezone(), 'custom', 'Y-m-d\TH:i:s\Z', '0', 'en');
}
case 'gregorian':
return format_date($date + timeline_get_timezone(), 'custom', 'M d Y G:i:s', '0', 'en');
case 'timestamp':
return $date + timeline_get_timezone();
}
default:
return date_convert(date_convert($date, DATE_ISO, DATE_UNIX), DATE_UNIX, DATE_ISO, date_get_timezone('date')) . 'Z';
}
}
Comment #4
Anonymous (not verified) commentedI noticed that line 28 in sites/all/modules/timeline/plugins/date_sources/date_field.inc seems to be missing an underscore when retrieving the date format from the $options array.
Changing
$input_format = $options['field']['date format']
to
$input_format = $options['field']['date_format'];
cleared up the NULL start and end times in my timeline.
Comment #5
amstercadThanks to this last comment, my timeline issue is now resolved. If you search for "Simile Timeline Libraries not found" my site is way, way up there in the listings. Hopefully this will change very soon now.
BTW, this was a secondary issue that stemmed from upgrading past 6.2.x which fails because of how javascript files are written by that version.
Comment #6
xamanu commentedThank you bags. I committed it to the module.