--- event.module 2009-03-16 05:12:20.000000000 +1100 +++ event.module 2009-04-02 10:47:40.000000000 +1100 @@ -378,6 +378,20 @@ '#default_value' => variable_get('event_type_control', 'all'), '#options' => array('all' => t('Show content type filter control on calendar views'), 'request' => t('Only show content type filter control when content type filter view is requested'), 'never' => t('Never show content type filter control'))); + $form['event_display_nodetype'] = array( + '#type' => 'radios', + '#title' => t('Display node types'), + '#default_value' => variable_get('event_display_nodetype', 0), + '#options' => array(0 => t('Do not display the node type with the date in event listings.'), 1 => t('Display the node type with the date in event listings.'))); + + $form['event_date_format'] = array( + '#type' => 'textfield', + '#title' => t('Format for the time left until an event.'), + '#default_value' => variable_get('event_date_format', ''), + '#maxlength' => 16, + '#size' => 8, + '#description' => t('The format string that determines how the time until an event is displayed. A blank field will display the default number of hours, days, weeks or months remaining. You can also specify a valid !link format string.', array('!link' => l(t('PHP date'), 'http://php.net/date')))); + return system_settings_form($form); } @@ -2057,22 +2071,32 @@ } if ($node->status) { + + // First determine how we will display the time left value. + // Just default to no format, for X days type display. + $date_format = variable_get('event_date_format', ''); + if (event_is_later($node->event_start, $time, 'string')) { - $days_left = $node->days_left; - if ($days_left > 0) { - $timeleft = format_plural($days_left, '1 day', '@count days'); - } - else { - $time_left = explode(':', $node->time_left); - if ($time_left[0] > 23) { - $timeleft = format_plural(floor($time_left[0] / 24), '1 day', '@count days'); - } - else if ($time_left[0] >= 1) { - $timeleft = format_plural((int) $time_left[0], '1 hour', '@count hours'); + if(!$date_format) { + $days_left = $node->days_left; + if ($days_left > 0) { + $timeleft = format_plural($days_left, '1 day', '@count days'); } else { - $timeleft = format_plural((int) $time_left[1], '1 minute', '@count minutes'); + $time_left = explode(':', $node->time_left); + if ($time_left[0] > 23) { + $timeleft = format_plural(floor($time_left[0] / 24), '1 day', '@count days'); + } + else if ($time_left[0] >= 1) { + $timeleft = format_plural((int) $time_left[0], '1 hour', '@count hours'); + } + else { + $timeleft = format_plural((int) $time_left[1], '1 minute', '@count minutes'); + } } + } + else { + $timeleft = date($date_format, strtotime( $node->event_start ) ); } } else { --- event.theme 2008-12-26 03:19:17.000000000 +1100 +++ event.theme 2009-04-02 10:21:31.000000000 +1100 @@ -465,8 +465,9 @@ * TODO: decorate with hcalendar */ function theme_event_upcoming_item($node, $types = array()) { + $display_nodetype = variable_get('event_display_nodetype', 0); $output = l($node->title, "node/$node->nid", array('attributes' => array('title' => $node->title))); - if (count($types) > 1) { + if ($display_nodetype && count($types) > 1) { $output .= '('. $node->event['node_type'] .')'; } $output .= '('. $node->event['timeleft'] .')';