Improving intial date settings logic
ndm - September 22, 2009 - 00:42
| Project: | Timeline |
| Version: | 6.x-2.x-dev |
| Component: | Code |
| Category: | feature request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Description
Hello,
I have added two start points : median and middle.
The code is :
Change the line 252 in views_views_plugin_style_timeline.inc
'#options' => array('today' => t('The current date'), 'first' => t('First event in timeline'), 'last' => t('Last event in timeline'), 'middle' => t('Middle Event'), 'median' => t('Median Event'), 'custom' => t('Custom')),Add the following lines after the line 137 :
case 'median':
foreach($this->data['events']['events'] as $date){
$t[]=timeline_date_conversion($date['start'], 'iso8601', 'timestamp');
}
sort($t);
return timeline_date_conversion($t[round(count($t)/2)], 'timestamp', 'gregorian');I have found one bug in use Last Event and i must change the line 132 by this :
return timeline_date_conversion($this->data['events']['events'][count($this->data['events']['events']) - 1]['start'], 'iso8601', 'gregorian');Regards,
Nicolas

#1
Thanks for your work on that. I'd appreciate if you could make a patch. This would be a lot easier to handle. Check out ttp://drupal.org/patch for information on how to create patches. Please use the DRUPAL-6--2 cvs branch.
Thanks!
#2
The patch with the modifications explain before.
#3
Thank you for the patch. I applied it to the 6.x-2.0-dev version. The whole logic would need some more love. I'd like to track these improvements within this post. There was a related ticket to that (#566734: Initial time placement when first loaded syntax error).
Everybody who wants is invited to write a patch and help with that.
#4
Information on how this initial date logic is not good enough: #607338: Initial Date Focus not Working
#5
And another one who found this bug: #610006: Band - Interval Settings Not Working for Initial Date Focus