Index: date_api.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/date/date_api.module,v retrieving revision 1.64.2.5.2.63 diff -u -p -r1.64.2.5.2.63 date_api.module --- date_api.module 11 Feb 2009 22:41:24 -0000 1.64.2.5.2.63 +++ date_api.module 12 Feb 2009 16:03:32 -0000 @@ -29,6 +29,7 @@ define('DATE_FORMAT_ISO', "Y-m-d\TH:i:s" define('DATE_FORMAT_UNIX', "U"); define('DATE_FORMAT_DATETIME', "Y-m-d H:i:s"); define('DATE_FORMAT_ICAL', "Ymd\THis"); +define('DATE_FORMAT_ICAL_DATE', "Ymd"); define('DATE_FORMAT_DATE', 'Y-m-d'); define('DATE_REGEX_ISO', '/(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):?(\d{2})?/'); Index: date/date_admin.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/date/date/date_admin.inc,v retrieving revision 1.40.2.3.2.30 diff -u -p -r1.40.2.3.2.30 date_admin.inc --- date/date_admin.inc 25 Jan 2009 13:03:13 -0000 1.40.2.3.2.30 +++ date/date_admin.inc 12 Feb 2009 16:03:32 -0000 @@ -245,7 +245,7 @@ function _date_field_settings($op, $fiel case 'save': - $options = array('granularity', 'timezone_db', 'tz_handling', 'todate', 'repeat', 'repeat_collapsed', 'default_format'); + $options = array('granularity', 'timezone_db', 'tz_handling', 'todate', 'repeat', 'repeat_collapsed', 'default_format', 'all_day'); return $options; case 'database columns': @@ -298,6 +298,9 @@ function date_columns($field) { $db_columns['offset'] = array('type' => 'int', 'not null' => FALSE, 'sortable' => TRUE); if (!empty($field['todate'])) $db_columns['offset2'] = array('type' => 'int', 'not null' => FALSE, 'sortable' => TRUE); } + if (isset($field['all_day']) && $field['all_day'] == TRUE) { + $db_columns['all_day'] = array('type' => 'int', 'length' => 1, 'not null' => FALSE, 'sortable' => FALSE); + } if (isset($field['repeat']) && $field['repeat'] == 1) { $db_columns['rrule'] = array('type' => 'text', 'not null' => FALSE, 'sortable' => FALSE); } @@ -316,6 +319,7 @@ function date_field_settings_form($field $granularity = array('year', 'month', 'day', 'hour', 'minute'); } $tz_handling = isset($field['tz_handling']) ? $field['tz_handling'] : (date_has_time($granularity) ? 'site' : 'none'); + $all_day = isset($field['all_day']) ? $field['all_day'] : FALSE; // If adding a repeat, override the Content module's handling of the multiple values option. if (module_exists('date_repeat') && date_is_repeat_field($field)) { @@ -362,6 +366,12 @@ function date_field_settings_form($field '#options' => date_timezone_handling_options(), '#description' => $description, ); + $form['all_day'] = array( + '#type' => 'checkbox', + '#title' => t('All-day checkbox'), + '#default_value' => $all_day, + '#description' => t('If turned on, all-day property of the dates can be handled.'), + ); // Force this value to hidden because we don't want to allow it to be changed right now, // but allow it to be a variable if needed. $form['timezone_db'] = array( Index: date/date_elements.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/date/date/date_elements.inc,v retrieving revision 1.46.2.2.2.44 diff -u -p -r1.46.2.2.2.44 date_elements.inc --- date/date_elements.inc 13 Jan 2009 13:49:05 -0000 1.46.2.2.2.44 +++ date/date_elements.inc 12 Feb 2009 16:03:32 -0000 @@ -72,9 +72,16 @@ function _date_field_update($op, &$node, } } } + + if ($item['all_day'] == TRUE) { + $items[$delta]['value'] = date(DATE_FORMAT_DATE, strtotime($items[$delta]['value'])); + if ($field['todate']) { + $items[$delta]['value2'] = date(DATE_FORMAT_DATE, strtotime($items[$delta]['value2'])); + } + } // Special case for ISO dates which may have been given artificial values for // some date parts to make them into valid dates. - if ($field['type'] == DATE_ISO) { + elseif ($field['type'] == DATE_ISO) { $items[$delta]['value'] = date_limit_value($items[$delta]['value'], date_granularity($field), $field['type']); if ($field['todate']) { $items[$delta]['value2'] = date_limit_value($items[$delta]['value2'], date_granularity($field), $field['type']); @@ -182,6 +189,15 @@ function _date_widget(&$form, &$form_sta _date_repeat_widget($element, $field, $items, $delta); $element['rrule']['#weight'] = $field['widget']['weight'] + .4; } + if ($field['all_day'] == TRUE) { + $element['all_day'] = array( + '#title' => t('All-day'), + '#type' => 'checkbox', + '#delta' => $delta, + '#default_value' => $items[$delta]['all_day'], + '#description' => t('Turn on if the date is all-day.') + ); + } return $element; } Index: theme/theme.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/date/theme/Attic/theme.inc,v retrieving revision 1.1.4.29 diff -u -p -r1.1.4.29 theme.inc --- theme/theme.inc 3 Dec 2008 15:44:27 -0000 1.1.4.29 +++ theme/theme.inc 12 Feb 2009 16:03:33 -0000 @@ -144,7 +144,9 @@ function template_preprocess_date_vcalen // Format the event results as iCal expects. $events_in = $vars['events']; $events = array(); + $rows = $vars['rows']; foreach ($events_in as $uid => $event) { + $row = array_shift($rows); // Omit any items with empty dates. if (!empty($event['start'])) { $events[$uid] = $event; @@ -155,9 +157,10 @@ function template_preprocess_date_vcalen else { $events[$uid]['timezone'] = ''; } - $events[$uid]['start'] = date_format($event['start'], DATE_FORMAT_ICAL); + $date_format = ($row->calendar_all_day == TRUE) ? DATE_FORMAT_ICAL_DATE : DATE_FORMAT_ICAL; + $events[$uid]['start'] = date_format($event['start'], $date_format); if ($event['start'] && $event['end']) { - $events[$uid]['end'] = date_format($event['end'], DATE_FORMAT_ICAL); + $events[$uid]['end'] = date_format($event['end'], $date_format); } else { $events[$uid]['end'] = $events[$uid]['start'];