diff -rup calendar_original/includes/calendar.inc calendar/includes/calendar.inc --- calendar_original/includes/calendar.inc 2009-05-11 15:24:27.000000000 -0700 +++ calendar/includes/calendar.inc 2009-12-19 23:46:53.000000000 -0800 @@ -391,12 +391,17 @@ function calendar_build_nodes(&$view, &$ // For now, use the date fields's timezone for the day splitting. $display_timezone_name = $to_zone; $values_display = array(); - + + // check to see if the end of the day is to be altered in anyway + $day_end = $view->date_info->calendar_day_end; + // Start date $date = date_make_date($values[0], $db_tz, $field['sql_type']); if ($db_tz != $to_zone) { date_timezone_set($date, timezone_open($to_zone)); } + if($day_end) + date_modify($date, "-{$day_end} hours"); $values[0] = date_format($date, DATE_FORMAT_DATETIME); if ($display_timezone_name != $to_zone) { @@ -412,6 +417,8 @@ function calendar_build_nodes(&$view, &$ if ($db_tz != $to_zone) { date_timezone_set($date, timezone_open($to_zone)); } + if($day_end) + date_modify($date, "-{$day_end} hours"); $values[1] = date_format($date, DATE_FORMAT_DATETIME); if ($display_timezone_name != $to_zone) { date_timezone_set($date, $display_timezone); diff -rup calendar_original/includes/calendar.views_default.inc calendar/includes/calendar.views_default.inc --- calendar_original/includes/calendar.views_default.inc 2009-02-21 08:33:15.000000000 -0800 +++ calendar/includes/calendar.views_default.inc 2009-12-19 22:14:18.000000000 -0800 @@ -334,6 +334,7 @@ $handler->override_option('calendar_colo $handler->override_option('calendar_colors_taxonomy', array()); $handler->override_option('calendar_popup', 0); $handler->override_option('calendar_date_link', $date_link_type); +$handler->override_option('calendar_day_end', 0); // Calendar block. $handler = $view->new_display('calendar_block', 'Calendar block', 'calendar_block_1'); $handler->override_option('style_options', array()); diff -rup calendar_original/includes/calendar_plugin_display_attachment.inc calendar/includes/calendar_plugin_display_attachment.inc --- calendar_original/includes/calendar_plugin_display_attachment.inc 2009-03-17 11:03:36.000000000 -0700 +++ calendar/includes/calendar_plugin_display_attachment.inc 2009-12-19 22:14:18.000000000 -0800 @@ -134,6 +134,7 @@ class calendar_plugin_display_attachment $this->view->date_info->calendar_colors = $this->view->display[$display_id]->handler->options['calendar_colors']; $this->view->date_info->calendar_colors_taxonomy = $this->view->display[$display_id]->handler->options['calendar_colors_taxonomy']; $this->view->date_info->calendar_popup = $this->view->display[$display_id]->handler->options['calendar_popup']; + $this->view->date_info->calendar_day_end = $this->view->display[$display_id]->handler->options['calendar_day_end']; $this->view->date_info->calendar_date_link = $this->view->display[$display_id]->handler->options['calendar_date_link']; } parent::attach_to($display_id); diff -rup calendar_original/includes/calendar_plugin_display_page.inc calendar/includes/calendar_plugin_display_page.inc --- calendar_original/includes/calendar_plugin_display_page.inc 2009-07-24 12:44:09.000000000 -0700 +++ calendar/includes/calendar_plugin_display_page.inc 2009-12-19 23:45:16.000000000 -0800 @@ -61,6 +61,7 @@ class calendar_plugin_display_page exten $options['calendar_colors_vocabulary'] = array('default' => array()); $options['calendar_colors_taxonomy'] = array('default' => array()); $options['calendar_popup'] = array('default' => 0); + $options['calendar_day_end'] = array('default' => 0); $options['calendar_date_link'] = array('default' => ''); $options['style_plugin'] = array('default' => 'calendar_nav'); return $options; @@ -110,11 +111,26 @@ class calendar_plugin_display_page exten 'value' => !empty($default) ? check_plain(node_get_types('name', $default)) : '', ); + $day_end_options = $this->day_end_options(); + $default = $this->get_option('calendar_day_end'); + $options['calendar_day_end'] = array( + 'category' => 'calendar_settings', + 'title' => t('Day End'), + 'value' => isset($default) ? $day_end_options[$default] : $day_end_options[0], + ); } function popup_options() { return array(0 => t('No'), 1 => t('Yes')); } + + function day_end_options() { + $return_array = array(); + for($i = 0; $i < 24; $i++) { + $return_array[$i] = $i ? $i.":00" : 'midnight'; + } + return $return_array; + } function options_form(&$form, &$form_state) { // It is very important to call the parent function here: @@ -219,6 +235,17 @@ class calendar_plugin_display_page exten } $form['calendar_colors_taxonomy']['color']['#suffix'] = ''; break; + + case 'calendar_day_end': + $day_end_options = $this->day_end_options(); + $form['#title'] .= t('Day End'); + $form['calendar_day_end'] = array( + '#type' => 'select', + '#default_value' => $this->get_option('calendar_day_end'), + '#options' => $day_end_options, + '#description' => t('Days typically end at midnight (by default). Extend the time a typical day ends by choosing the appropriate time. Be aware that any event starting before this time will appear on the previous day.'), + ); + break; } } @@ -244,6 +271,9 @@ class calendar_plugin_display_page exten $this->set_option($form_state['section'], ($form_state['values'][$form_state['section']])); variable_set('calendar_date_link_'. $form_state['values']['calendar_date_link'], $this->display->handler->get_option('path')); break; + case 'calendar_day_end': + $this->set_option($form_state['section'], $form_state['values'][$form_state['section']]); + break; } }