diff -upr ./tmp/date/date/date_admin.inc ./date/date/date_admin.inc --- ./tmp/date/date/date_admin.inc 2009-02-27 09:05:21.000000000 -0800 +++ ./date/date/date_admin.inc 2009-03-23 13:58:21.000000000 -0700 @@ -245,7 +245,8 @@ 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': @@ -311,6 +312,9 @@ function date_columns($field) { $db_columns['offset'] = array('type' => 'int', 'not null' => FALSE, 'sortable' => TRUE, 'views' => FALSE); if (!empty($field['todate'])) $db_columns['offset2'] = array('type' => 'int', 'not null' => FALSE, 'sortable' => TRUE, 'views' => FALSE); } + 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, 'views' => FALSE); } @@ -329,6 +333,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)) { @@ -365,7 +370,6 @@ function date_field_settings_form($field '#options' => $format_types, '#description' => t('Select a default format type to be used for the date display. Visit the Date and time date format page to add and edit format types.', array('@date-time-page' => base_path() .'admin/settings/date-time/formats')), ); - $description = t('Select the timezone handling method to be used for this date field.'); $description .= date_data_loss_warning('Time zone handling'); $form['tz_handling'] = array( @@ -375,6 +379,13 @@ 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( @@ -707,4 +718,4 @@ function _date_formatter_settings($form_ ); } return $form; -} \ No newline at end of file +} Only in ./date/date: date_all_day.js diff -upr ./tmp/date/date/date_elements.inc ./date/date/date_elements.inc --- ./tmp/date/date/date_elements.inc 2009-02-27 07:47:39.000000000 -0800 +++ ./date/date/date_elements.inc 2009-03-23 13:57:01.000000000 -0700 @@ -60,9 +60,17 @@ function _date_field_update($op, &$node, continue; } + 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']); @@ -170,6 +178,19 @@ 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.'), + '#attributes' => array('onclick' => 'dateAllDayToggle(this.checked, \''. str_replace('_', '-', $field['field_name']) .'\', \''. $field['required'] .'\')'), + ); + drupal_add_js(drupal_get_path('module', 'date') .'/date_all_day.js'); + } + return $element; } diff -upr ./tmp/date/theme/theme.inc ./date/theme/theme.inc --- ./tmp/date/theme/theme.inc 2009-02-17 09:04:31.000000000 -0800 +++ ./date/theme/theme.inc 2009-03-23 13:52:47.000000000 -0700 @@ -159,6 +159,9 @@ function template_preprocess_date_vcalen $events[$uid]['timezone'] = ''; } $date_format = ($row->calendar_all_day == TRUE) ? DATE_FORMAT_ICAL_DATE : DATE_FORMAT_ICAL; + if ($event['end'] && $row->calendar_all_day == TRUE){ + $event['end']->modify("+1 day"); + } $events[$uid]['start'] = date_format($event['start'], $date_format); if ($event['start'] && $event['end']) { $events[$uid]['end'] = date_format($event['end'], $date_format); @@ -325,4 +328,4 @@ function theme_date_part_label_ampm($par } function theme_date_part_label_timezone($part_type, $element) { return t('Timezone'); -} \ No newline at end of file +}