summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaren Stevenson2011-01-18 00:37:35 (GMT)
committer Karen Stevenson2011-01-18 00:37:35 (GMT)
commit41e4d4ae792ff43b868df204b57651abc81718ae (patch)
tree93fb50cbf06234bf744d7f6cae0bb1c1821478a9
parentb3f73da791dbdc7c7c5c0bbebafcf289ae9ba4d7 (diff)
Clean up whitespace.
-rw-r--r--INSTALL.txt5
-rw-r--r--README.txt4
-rw-r--r--date.devel_generate.inc22
-rw-r--r--date.field.inc20
-rw-r--r--date.install5
-rw-r--r--date.module30
-rw-r--r--date.theme21
-rw-r--r--date_admin.inc40
-rw-r--r--date_api/date_api.module75
-rw-r--r--date_api/date_api_elements.inc29
-rw-r--r--date_api/date_api_ical.inc5
-rw-r--r--date_api/date_api_sql.inc40
-rw-r--r--date_api/theme/theme.inc4
-rw-r--r--date_elements.inc57
-rw-r--r--date_popup/README.txt1
-rw-r--r--date_popup/date_popup.module29
-rw-r--r--date_popup/themes/datepicker.1.7.css1
-rw-r--r--date_popup/translations/date_popup.de.po1
-rw-r--r--date_popup/translations/date_popup.es.po1
-rw-r--r--date_popup/translations/date_popup.fr.po1
-rw-r--r--date_popup/translations/date_popup.tr.po1
-rw-r--r--date_popup/translations/es.po1
-rw-r--r--date_repeat.inc11
-rw-r--r--date_repeat/date_repeat.module6
-rw-r--r--date_repeat/date_repeat_calc.inc48
-rw-r--r--date_repeat/date_repeat_form.inc18
-rw-r--r--date_repeat/tests/date_repeat.test5
-rw-r--r--date_repeat/translations/date_repeat.de.po1
-rw-r--r--date_repeat/translations/date_repeat.es.po1
-rw-r--r--date_repeat/translations/date_repeat.fr.po1
-rw-r--r--date_token.inc4
-rw-r--r--date_tools/date_tools.change_type.inc22
-rw-r--r--date_tools/date_tools.module4
-rw-r--r--date_tools/date_tools.wizard.inc52
-rw-r--r--date_tools/tests/date_tools.test4
-rw-r--r--date_tools/translations/date_tools.de.po1
-rw-r--r--date_tools/translations/date_tools.es.po1
-rw-r--r--date_tools/translations/date_tools.fr.po1
-rw-r--r--date_views/date_views.module10
-rw-r--r--date_views/includes/date_handler_field_multiple.inc24
-rw-r--r--date_views/includes/date_navigation_plugin_style.inc12
-rw-r--r--date_views/includes/date_views.views.inc10
-rw-r--r--date_views/includes/date_views.views_default.inc3
-rw-r--r--date_views/includes/date_views_argument_handler.inc48
-rw-r--r--date_views/includes/date_views_fields.inc38
-rw-r--r--date_views/includes/date_views_filter_handler.inc65
-rw-r--r--date_views/theme/theme.inc16
-rw-r--r--help/date-argument.html10
-rw-r--r--help/date-filter.html1
-rw-r--r--help/date-views-dates.html2
-rw-r--r--help/form-elements.html2
-rw-r--r--help/overview.html3
-rw-r--r--tests/README.txt3
-rw-r--r--tests/date.test2
-rw-r--r--tests/date_api.test40
-rw-r--r--tests/date_field.test15
-rw-r--r--tests/date_validation.test9
-rw-r--r--translations/date_api.da.po1
-rw-r--r--translations/date_api.de.po1
-rw-r--r--translations/date_api.es.po1
-rw-r--r--translations/date_api.fr.po1
-rw-r--r--translations/date_api.he.po2
-rw-r--r--translations/date_api.it.po1
-rw-r--r--translations/date_api.nl.po1
-rw-r--r--translations/date_api.pt-br.po1
-rw-r--r--translations/date_api.tr.po1
-rw-r--r--translations/general.de.po1
-rw-r--r--translations/general.es.po1
-rw-r--r--translations/general.fr.po1
-rw-r--r--translations/general.he.po2
-rw-r--r--translations/general.it.po1
-rw-r--r--translations/general.nl.po1
-rw-r--r--translations/general.pt-br.po1
-rw-r--r--translations/includes.de.po1
-rw-r--r--translations/includes.es.po1
-rw-r--r--translations/includes.fr.po1
-rw-r--r--translations/includes.he.po2
-rw-r--r--translations/includes.it.po1
-rw-r--r--translations/includes.nl.po1
-rw-r--r--translations/theme.de.po1
-rw-r--r--translations/theme.es.po1
-rw-r--r--translations/theme.fr.po1
-rw-r--r--translations/theme.he.po2
-rw-r--r--translations/theme.it.po1
-rw-r--r--translations/theme.nl.po1
-rw-r--r--translations/theme.pt-br.po1
86 files changed, 420 insertions, 499 deletions
diff --git a/INSTALL.txt b/INSTALL.txt
index 898a499..1e5d2ea 100644
--- a/INSTALL.txt
+++ b/INSTALL.txt
@@ -28,7 +28,6 @@ You should end up with a structure like:
/drupal/sites/all/modules/date/date_copy/date_copy.module
...
-
==================================================================================
Install CCK Date Fields:
==================================================================================
@@ -44,9 +43,7 @@ Install CCK Date Fields:
5) While viewing a content type, select the option to add a new field from the tabs at
the top of the page. Several options for date fields should be visible.
-
+
==================================================================================
More documentation is available at http://drupal.org/node/92460.
==================================================================================
-
-
diff --git a/README.txt b/README.txt
index b2f18bd..7f7d1db 100644
--- a/README.txt
+++ b/README.txt
@@ -195,7 +195,6 @@ calculation function that will parse the RRULE and return an array of dates
that match those rules. The API is implemented in the Date module as a
new date widget if the Date Repeat API is installed.
-
============================================================================
Install file for dependent modules
============================================================================
@@ -262,6 +261,3 @@ function calendar_update_5000() {
$ret[] = update_sql("UPDATE {system} SET weight = 1 WHERE name = 'calendar'");
return $ret;
}
-
-
-
diff --git a/date.devel_generate.inc b/date.devel_generate.inc
index 0280911..2ffc6c6 100644
--- a/date.devel_generate.inc
+++ b/date.devel_generate.inc
@@ -30,7 +30,7 @@ function date_devel_generate($node, $field, $instance, $bundle) {
date_modify($start, "+$seconds seconds");
$increment = $instance['widget']['settings']['increment'];
date_increment_round($start, $increment);
-
+
// Modify To date by 1 hour to 3 days, shorter for repeating dates
// longer for others.
$start2 = clone($start);
@@ -38,7 +38,7 @@ function date_devel_generate($node, $field, $instance, $bundle) {
$max = 240;
date_modify($start2, '+' . mt_rand(60, $max) . ' minutes');
date_increment_round($start2, $increment);
-
+
if ($field['settings']['tz_handling'] == 'date') {
// Choose a random timezone.
// Not all keys exist, so we have to check.
@@ -54,7 +54,7 @@ function date_devel_generate($node, $field, $instance, $bundle) {
else {
$timezone = date_get_timezone($field['settings']['tz_handling']);
}
-
+
switch ($field['type']) {
case 'date':
$format = DATE_FORMAT_ISO;
@@ -75,16 +75,16 @@ function date_devel_generate($node, $field, $instance, $bundle) {
$node_field['offset'] = date_offset_get($start);
date_timezone_set($start2, timezone_open($timezone));
$node_field['offset2'] = date_offset_get($start2);
-
+
if (!empty($field['settings']['repeat'])) {
module_load_include('inc', 'date_repeat', 'date_repeat_calc');
module_load_include('inc', 'date', 'date_repeat');
module_load_include('inc', 'date_api', 'date_api_ical');
-
+
// Create a repeating date.
$duration = $start->difference($start2);
$form_values = array();
-
+
// Create the default case more frequently than case 1 or 2.
$which = mt_rand(0, 10);
$max_items = 10;
@@ -127,9 +127,9 @@ function date_devel_generate($node, $field, $instance, $bundle) {
$form_values['BYDAY'] = array($dow);
break;
}
-
+
$form_values['INTERVAL'] = $interval;
-
+
switch ($freq) {
case 'YEARLY':
$period = 'year';
@@ -143,17 +143,17 @@ function date_devel_generate($node, $field, $instance, $bundle) {
default:
$period = 'day';
break;
-
+
}
date_modify($start2, '+' . max(1, $forward) . ' years');
date_increment_round($start2, $increment);
$until = date_format($start2, 'Y-m-d H:i:s');
$form_values['UNTIL'] = array('datetime' => $until, 'tz' => 'UTC');
$form_values['COUNT'] = $max_items;
-
+
$rrule = date_api_ical_build_rrule($form_values);
$values = date_repeat_build_dates($rrule, $form_values, $field, $node_field);
-
+
$start = $node_field;
$node_field = array(0 => $start);
$node_field[0]['rrule'] = $rrule;
diff --git a/date.field.inc b/date.field.inc
index c6f8f12..f3bab8c 100644
--- a/date.field.inc
+++ b/date.field.inc
@@ -53,7 +53,7 @@ function date_field_formatter_settings_form($field, $instance, $view_mode, $form
return date_default_formatter_settings_form($field, $instance, $view_mode, $form, $form_state);
}
}
-
+
/**
* Implements hook_field_formatter_settings_summary().
*/
@@ -107,7 +107,7 @@ function date_field_formatter_view($entity_type, $entity, $field, $instance, $la
'display' => $display,
'dates' => array(),
);
-
+
// See if we are only supposed to display a selected
// item from multiple value date fields.
$selected_deltas = array();
@@ -119,7 +119,7 @@ function date_field_formatter_view($entity_type, $entity, $field, $instance, $la
}
}
}
-
+
switch ($display['type']) {
case 'format_interval':
foreach ($items as $delta => $item) {
@@ -234,7 +234,7 @@ function date_field_widget_info() {
'default value' => FIELD_BEHAVIOR_CUSTOM,
),
);
-
+
// Repeating dates have custom handling
// for multiple values.
$repeat_settings = $settings;
@@ -301,7 +301,7 @@ function date_field_load($entity_type, $entities, $field, $instances, $langcode,
function date_field_validate($entity_type, $entity, $field, $instance, $langcode, $items, &$errors) {
$field_name = $field['field_name'];
$flexible = 0;
-
+
// Don't try to validate if there were any errors before this point
// since the element won't have been munged back into a date.
if (!form_get_errors()) {
@@ -317,7 +317,7 @@ function date_field_validate($entity_type, $entity, $field, $instance, $langcode
}
$valid1 = $date1->validGranularity($field['settings']['granularity'], $flexible);
$valid2 = $date2->validGranularity($field['settings']['granularity'], $flexible);
-
+
foreach ($process as $processed) {
if ($processed == 'value' && $field['settings']['todate'] && !$valid1 && $valid2) {
$errors[$field['field_name']][$langcode][$delta][] = array(
@@ -420,7 +420,7 @@ function date_field_settings_form($field, $instance, $has_data) {
* see what widget type was originally used.
*/
function date_content_migrate_field_alter(&$field_value) {
-
+
switch ($field_value['module']) {
case 'date':
@@ -442,9 +442,9 @@ function date_content_migrate_field_alter(&$field_value) {
function date_content_migrate_instance_alter(&$instance_value) {
switch ($instance_value['module']) {
case 'date':
-
+
$field_value = content_migrate_get_field_values($instance_value['field_name']);
-
+
// Some settings have been moved from field to instance.
$default_format = $field_value['settings']['default_format'];
unset($field_value['settings']['default_format']);
@@ -461,7 +461,7 @@ function date_content_migrate_instance_alter(&$instance_value) {
$instance_value['settings']['default_value_code2'] = $instance_value['widget']['settings']['default_value_code2'];
unset($instance_value['widget']['settings']['default_value_code2']);
break;
-
+
// We need to retrieve formatter settings from the variables and store them in the instance.
// Some formatter names changed, and system date type names changed.
$new_type = array(
diff --git a/date.install b/date.install
index 8b8e5ae..66592b4 100644
--- a/date.install
+++ b/date.install
@@ -39,7 +39,7 @@ function date_field_schema($field) {
// If a second date is needed for 'To date', just make a copy of the first one.
if (!empty($field['settings']['todate'])) {
$db_columns['value2'] = $db_columns['value'];
-
+
// We don't want CCK to create additional columns, just the first.
// We modify them our own way in views data.
$db_columns['value2']['views'] = FALSE;
@@ -71,8 +71,7 @@ function date_field_schema($field) {
}
return array('columns' => $db_columns);
}
-
-
+
function date_update_last_removed() {
return 6005;
}
diff --git a/date.module b/date.module
index 20c812b..722d0c0 100644
--- a/date.module
+++ b/date.module
@@ -5,7 +5,7 @@
* @file
* Defines date/time field types for the Content Construction Kit (CCK).
*/
-
+
module_load_include('theme', 'date', 'date');
module_load_include('inc', 'date', '/date.field');
module_load_include('inc', 'date', '/date_elements');
@@ -276,7 +276,7 @@ function date_formatter_process($formatter, $entity_type, $entity, $field, $inst
if (empty($timezone)) {
return $dates;
}
-
+
$granularity = date_granularity($field);
$settings = $display['settings'];
$field_name = $field['field_name'];
@@ -298,7 +298,7 @@ function date_formatter_process($formatter, $entity_type, $entity, $field, $inst
}
$date = new DateObject($value, $timezone_db);
$date->limitGranularity($field['settings']['granularity']);
-
+
$dates[$processed] = array();
$dates[$processed]['db']['object'] = $date;
$dates[$processed]['db']['datetime'] = date_format($date, DATE_FORMAT_DATETIME);
@@ -308,7 +308,7 @@ function date_formatter_process($formatter, $entity_type, $entity, $field, $inst
$dates[$processed]['local']['datetime'] = date_format($date, DATE_FORMAT_DATETIME);
$dates[$processed]['local']['timezone'] = $timezone;
$dates[$processed]['local']['offset'] = date_offset_get($date);
-
+
//format the date, special casing the 'interval' format which doesn't need to be processed
$dates[$processed]['formatted'] = '';
if (is_object($date)) {
@@ -338,7 +338,7 @@ function date_formatter_process($formatter, $entity_type, $entity, $field, $inst
}
$date1 = $dates['value']['local']['object'];
$date2 = $dates['value2']['local']['object'];
-
+
$all_day = '';
$all_day2 = '';
if ($format != 'format_interval') {
@@ -429,7 +429,7 @@ function date_field_widget_error($element, $error, $form, &$form_state) {
function date_formatter_format($formatter, $settings, $granularity = NULL, $langcode = NULL) {
$default = variable_get('date_format_medium', 'D, m/d/Y - H:i');
$format_type = !empty($settings['format_type']) ? $settings['format_type'] : 'format_interval';
-
+
switch ($formatter) {
case 'format_interval':
return 'format_interval';
@@ -448,7 +448,7 @@ function date_formatter_format($formatter, $settings, $granularity = NULL, $lang
}
break;
}
-
+
// A selected format might include timezone information.
array_push($granularity, 'timezone');
return date_limit_format($format, $granularity);
@@ -464,13 +464,13 @@ function date_prepare_entity($formatter, $entity_type, $entity, $field, $instanc
$field_name = $field['field_name'];
$options = $display['settings'];
$max_count = $options['multiple_number'];
-
+
// If no results should be shown, empty the values and return.
if (is_numeric($max_count) && $max_count == 0) {
$entity->{$field_name} = array();
return $entity;
}
-
+
// Otherwise removed values that should not be displayed.
if (!empty($options['multiple_from']) || !empty($options['multiple_to']) || !empty($max_count)) {
$format = date_type_format($field['type']);
@@ -508,7 +508,7 @@ function date_prepare_entity($formatter, $entity_type, $entity, $field, $instanc
}
}
}
-
+
return $entity;
}
@@ -525,13 +525,13 @@ function date_prepare_entity($formatter, $entity_type, $entity, $field, $instanc
*/
function date_field_get_sql_handler($field, $compare_tz = NULL) {
module_load_include('inc', 'date_api', 'date_api_sql');
-
+
$db_info = date_api_database_info($field);
-
+
// Create a DateAPI SQL handler class for this field type.
$handler = new date_sql_handler();
$handler->construct($field['type']);
-
+
// If this date field stores a timezone in the DB, tell the handler about it.
if ($field['settings']['tz_handling'] == 'date') {
$handler->db_timezone_field = $db_info['columns']['timezone']['column'];
@@ -539,7 +539,7 @@ function date_prepare_entity($formatter, $entity_type, $entity, $field, $instanc
else {
$handler->db_timezone = date_get_timezone_db($field['settings']['tz_handling']);
}
-
+
if (empty($compare_tz)) {
$compare_tz = date_get_timezone($field['settings']['tz_handling']);
}
@@ -645,7 +645,7 @@ function date_field_all_day($field, $instance, $date1, $date2 = NULL) {
if (empty($date2)) {
$date2 = $date1;
}
-
+
$granularity = $field['settings']['granularity'];
$granularity = array_pop($granularity);
$increment = isset($instance['widget']['increment']) ? $instance['widget']['increment'] : 1;
diff --git a/date.theme b/date.theme
index b8b9c17..6106f95 100644
--- a/date.theme
+++ b/date.theme
@@ -69,7 +69,7 @@ function theme_date_display_combination($vars) {
}
}
}
-
+
// Check the formatter settings to see if the repeat rule should be
// displayed. Show it only with the first multiple value date.
list($id) = entity_extract_ids($entity_type, $entity);
@@ -85,8 +85,7 @@ function theme_date_display_combination($vars) {
$output .= theme('date_repeat_display', $repeat_vars);
$repeating_ids[] = $id;
}
-
-
+
// If this is a full node or a pseudo node created by grouping
// multiple values, see exactly which values are supposed to be visible.
if (isset($entity->$field_name)) {
@@ -98,7 +97,7 @@ function theme_date_display_combination($vars) {
// Adjust the $element values to match the changes.
$element['#entity'] = $entity;
}
-
+
switch ($options['fromto']) {
case 'value':
$date1 = $dates['value']['formatted'];
@@ -113,7 +112,7 @@ function theme_date_display_combination($vars) {
$date2 = $dates['value2']['formatted'];
break;
}
-
+
// Pull the timezone, if any, out of the formatted result and tack it
// back on at the end, if it is in the current formatted date.
$timezone = $dates['value']['formatted_timezone'];
@@ -122,7 +121,7 @@ function theme_date_display_combination($vars) {
}
$date1 = str_replace($timezone, '', $date1);
$date2 = str_replace($timezone, '', $date2);
-
+
// No date values, display nothing.
if (empty($date1) && empty($date2)) {
$output .= '';
@@ -151,7 +150,7 @@ function theme_date_display_combination($vars) {
else {
$output .= theme('date_display_range', array('date1' => $date1, 'date2' => $date2, 'timezone' => $timezone));
}
-
+
return $output;
}
@@ -194,7 +193,7 @@ function theme_date_display_interval($vars) {
$options = $display['settings'];
$dates = $vars['dates'];
$formatter = $display['type'];
-
+
// Get the formatter settings, either the default settings for this node
// type or the View settings stored in $entity->date_info.
if (!empty($entity->date_info) && !empty($entity->date_info->formatter_settings)) {
@@ -256,12 +255,12 @@ function theme_date_all_day($vars) {
if (empty($date2)) {
$date2 = $date1;
}
-
+
if (!date_has_time($field['settings']['granularity'])) {
$format = date_limit_format($format, array('year', 'month', 'day'));
return date_format_date($$which, 'custom', $format);
}
-
+
if ($all_day = date_field_all_day($field, $instance, $date1, $date2)) {
$format = date_limit_format($format, array('year', 'month', 'day'));
return trim(date_format_date($$which, 'custom', $format) .' '. theme('date_all_day_label'));
@@ -269,7 +268,7 @@ function theme_date_all_day($vars) {
else {
return date_format_date($$which, 'custom', $format);
}
-
+
}
/**
diff --git a/date_admin.inc b/date_admin.inc
index f54d6ef..621db5d 100644
--- a/date_admin.inc
+++ b/date_admin.inc
@@ -13,7 +13,7 @@ function date_default_formatter_settings_form($field, $instance, $view_mode, $fo
$settings = $display['settings'];
$formatter = $display['type'];
$form = array();
-
+
$form['format_type'] = array(
'#title' => t('Format:'),
'#type' => 'select',
@@ -21,7 +21,7 @@ function date_default_formatter_settings_form($field, $instance, $view_mode, $fo
'#default_value' => $settings['format_type'],
'#weight' => 0,
);
-
+
$form['fromto'] = array(
'#title' => t('Display:'),
'#type' => 'select',
@@ -49,7 +49,7 @@ function date_default_formatter_settings_form($field, $instance, $view_mode, $fo
'#access' => $field['cardinality'] == FIELD_CARDINALITY_UNLIMITED ? 1 : $field['cardinality'],
'#description' => t('Identify a specific number of values to display, or leave blank to show all values.'),
);
-
+
list($prefix, $suffix) = explode('@isodate', t('starting from @isodate'));
$form['multiple_from'] = array(
'#type' => 'textfield',
@@ -72,7 +72,7 @@ function date_default_formatter_settings_form($field, $instance, $view_mode, $fo
'#access' => $field['cardinality'] == FIELD_CARDINALITY_UNLIMITED ? 1 : $field['cardinality'],
'#description' => t('Identify specific start and/or end dates in the format YYYY-MM-DDTHH:MM:SS, or leave blank for all available dates.'),
);
-
+
$form['show_repeat_rule'] = array(
'#title' => t('Repeat rule:'),
'#type' => 'select',
@@ -104,7 +104,7 @@ function date_interval_formatter_settings_form($field, $instance, $view_mode, $f
);
return $form;
}
-
+
/**
* Settings summary for the default formatter.
*/
@@ -114,16 +114,16 @@ function date_default_formatter_settings_summary($field, $instance, $view_mode)
$formatter = $display['type'];
$format_types = date_format_type_options();
$summary = array();
-
+
$summary[] = t('Use the @format format type.', array('@format' => $format_types[$settings['format_type']]));
-
+
$options = array(
'both' => t('Display both From and To dates'),
'value' => t('Display From date only'),
'value2' => t('Display To date only'),
);
$summary[] = $options[$settings['fromto']];
-
+
if (!empty($field['cardinality'])) {
$summary[] = t('Show @count value(s) starting with @date1, ending with @date2', array(
'@count' => !empty($settings['multiple_number']) ? $settings['multiple_number'] : t('all'),
@@ -131,7 +131,7 @@ function date_default_formatter_settings_summary($field, $instance, $view_mode)
'@date2' => !empty($settings['multiple_to']) ? $settings['multiple_to'] : t('latest'),
));
}
-
+
if (!empty($field['repeat'])) {
if (!empty($settings['show_repeat_rule'])) {
$summary[] = t('Show repeat rule');
@@ -156,7 +156,7 @@ function date_interval_formatter_settings_summary($field, $instance, $view_mode)
return t('Display time ago, showing @interval units.', array('@interval' => $settings['interval']));
}
-
+
function _date_field_instance_settings_form($field, $instance) {
$widget = $instance['widget'];
$settings = $instance['settings'];
@@ -196,12 +196,12 @@ function _date_field_instance_settings_form($field, $instance) {
'#default_value' => $settings['default_value_code2'],
);
}
-
+
$format_types = array();
foreach (_system_date_format_types_build() as $name => $info) {
$format_types[$name] = $info['title'];
}
-
+
$form['default_format'] = array(
'#type' => 'select',
'#title' => t('Default Display'),
@@ -229,7 +229,7 @@ function date_field_instance_settings_form_validate(&$form, &$form_state) {
$settings = array_merge($settings, $settings['default']);
unset($settings['default']);
form_set_value(array('#parents' => array('instance', 'settings')), $settings, $form_state);
-
+
if ($settings['default_value'] == 'strtotime') {
$is_strtotime = @strtotime($settings['default_value_code']);
if (!$is_strtotime) {
@@ -247,7 +247,7 @@ function date_field_instance_settings_form_validate(&$form, &$form_state) {
function _date_field_widget_settings_form($field, $instance) {
$widget = $instance['widget'];
$settings = $widget['settings'];
-
+
$form = array(
'#element_validate' => array('date_field_widget_settings_form_validate'),
);
@@ -271,9 +271,9 @@ function _date_field_widget_settings_form($field, $instance) {
'#options' => $options,
'#description' => t('Set the order and format for the date parts in the input form. The format will be adapted to remove values not in the granularity for this field.'),
'#weight' => 4,
-
+
);
-
+
// Only a limited set of formats is available for the Date Popup module
if ($widget['type'] != 'date_popup') {
$form['format'] = array(
@@ -375,7 +375,7 @@ function date_field_widget_settings_form_validate(&$form, &$form_state) {
$settings = array_merge($settings, $settings['format'], $settings['advanced']);
unset($settings['format'], $settings['advanced']);
form_set_value(array('#parents' => array('instance', 'widget', 'settings')), $settings, $form_state);
-
+
$widget = $form_state['values']['instance']['widget'];
// Munge the table display for text parts back into an array of text parts.
if (is_array($widget['settings']['text_parts'])) {
@@ -388,7 +388,7 @@ function date_field_widget_settings_form_validate(&$form, &$form_state) {
function _date_field_settings_form($field, $instance, $has_data) {
$settings = $field['settings'];
-
+
$form = array(
'#element_validate' => array('date_field_settings_validate'),
);
@@ -397,7 +397,7 @@ function _date_field_settings_form($field, $instance, $has_data) {
$granularity = array_filter($settings['granularity']);
}
$tz_handling = $settings['tz_handling'];
-
+
// 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, $instance)) {
$form['repeat'] = array('#type' => 'hidden', '#value' => 1);
@@ -440,7 +440,6 @@ function _date_field_settings_form($field, $instance, $has_data) {
'#type' => 'hidden',
'#value' => date_get_timezone_db($tz_handling),
);
-
return $form;
}
@@ -496,4 +495,3 @@ function date_example_date() {
}
return $now;
}
-
diff --git a/date_api/date_api.module b/date_api/date_api.module
index 53fe61f..aa63dc4 100644
--- a/date_api/date_api.module
+++ b/date_api/date_api.module
@@ -81,7 +81,7 @@ class DateObject extends DateTime {
public function __toString() {
return $this->format(DATE_FORMAT_DATETIME) . ' '. $this->getTimeZone()->getName();
}
-
+
/**
* Overridden constructor.
*
@@ -95,15 +95,15 @@ class DateObject extends DateTime {
* $format is recommended in order to use negative or large years, which php's parser fails on.
*/
public function __construct($time = 'now', $tz = NULL, $format = NULL) {
-
+
$this->timeOnly = FALSE;
$this->dateOnly = FALSE;
-
+
// Allow string timezones
if (!empty($tz) && !is_object($tz)) {
$tz = new DateTimeZone($tz);
}
-
+
// Default to the site timezone when not explicitly provided.
elseif (empty($tz)) {
$tz = date_default_timezone_object();
@@ -138,7 +138,7 @@ class DateObject extends DateTime {
// We checked for errors already, skip the step of parsing the input values.
$format = NULL;
}
-
+
// The parse function will also set errors on the date parts.
if (!empty($format)) {
$arg = self::$allgranularity;
@@ -278,7 +278,7 @@ class DateObject extends DateTime {
}
return in_array($g, $this->granularity);
}
-
+
// whether a date is valid for a given $granularity array, depending on if it's allowed to be flexible.
public function validGranularity($granularity = NULL, $flexible = FALSE) {
return $this->hasGranularity() && (!$granularity || $flexible || $this->hasGranularity($granularity));
@@ -299,7 +299,7 @@ class DateObject extends DateTime {
public function completeDate() {
return $this->completeDate;
}
-
+
/**
* In common usage we should not unset timezone through this.
*/
@@ -334,7 +334,7 @@ class DateObject extends DateTime {
$this->addGranularity('timezone');
}
}
-
+
protected function parse($date, $tz, $format) {
$array = date_format_patterns();
foreach ($array as $key => $value) {
@@ -437,17 +437,17 @@ class DateObject extends DateTime {
elseif (isset($ampm) && $ampm == 'am' && $final_date['hour'] == 12) {
$final_date['hour'] -= 12;
}
-
+
// Blank becomes current time, given TZ.
parent::__construct('', $tz ? $tz : new DateTimeZone("UTC"));
if ($tz) {
$this->addGranularity('timezone');
}
-
+
// SetDate expects an integer value for the year, results can
// be unexpected if we feed it something like '0100' or '0000';
$final_date['year'] = intval($final_date['year']);
-
+
$this->errors += $this->arrayErrors($final_date);
// If the input value is '0000-00-00', PHP's date class will later incorrectly convert
@@ -462,18 +462,17 @@ class DateObject extends DateTime {
elseif (empty($this->errors)) {
$this->setDate($final_date['year'], $final_date['month'], $final_date['day']);
}
-
+
if (!isset($final_date['hour']) && !isset($final_date['minute']) && !isset($final_date['second'])) {
$this->dateOnly = TRUE;
}
elseif (empty($this->errors)) {
$this->setTime($final_date['hour'], $final_date['minute'], $final_date['second']);
}
-
+
return $this;
}
-
/**
* Helper to return all standard date parts in an array.
* Will return '' for parts in which it lacks granularity.
@@ -489,7 +488,7 @@ class DateObject extends DateTime {
'timezone' => $this->format('e', $force),
);
}
-
+
/**
* Create an ISO date from an array of values.
*/
@@ -518,7 +517,7 @@ class DateObject extends DateTime {
}
return $datetime;
}
-
+
/**
* Force an incomplete date to be valid, for instance to add
* a valid year, month, and day if only the time has been defined.
@@ -542,7 +541,7 @@ class DateObject extends DateTime {
$this->setDate($arr['year'], $arr['month'], $arr['day']);
$this->setTime($arr['hour'], $arr['minute'], $arr['second']);
}
-
+
/**
* Convert a date part into something that will produce a valid date.
*/
@@ -576,7 +575,7 @@ class DateObject extends DateTime {
break;
}
}
-
+
// Find possible errors in an array of date part values.
// The forceValid() function will change an invalid value to a valid one,
// so we just need to see if the value got altered.
@@ -612,7 +611,7 @@ class DateObject extends DateTime {
}
return $errors;
}
-
+
/**
* Compute difference between two days using a given measure.
*
@@ -1115,7 +1114,7 @@ function date_timezone_names($required = FALSE, $refresh = FALSE) {
$zonenames[$zone] = $zone;
}
}
-
+
if (!empty($zonenames)) {
cache_set('date_timezone_identifiers_list', $zonenames);
}
@@ -1443,19 +1442,19 @@ function date_week_range($week, $year) {
* Start and end dates for an ISO week.
*/
function date_iso_week_range($week, $year) {
-
+
// Get to the last ISO week of the previous year.
$min_date = new DateObject(($year - 1) .'-12-28 00:00:00');
date_timezone_set($min_date, date_default_timezone_object());
-
+
// Find the first day of the first ISO week in the year.
date_modify($min_date, '+1 Monday');
-
+
// Jump ahead to the desired week for the beginning of the week range.
if ($week > 1) {
date_modify($min_date, '+ '. ($week - 1) .' weeks');
}
-
+
// move forwards to the last day of the week
$max_date = clone($min_date);
date_modify($max_date, '+7 days');
@@ -1489,7 +1488,7 @@ function date_week($date) {
$parts = explode('-', $date);
$date = new DateObject($date . ' 12:00:00', 'UTC');
-
+
// If we are using ISO weeks, this is easy.
if (variable_get('date_api_use_iso8601', FALSE)) {
return intval($date->format('W'));
@@ -1522,7 +1521,7 @@ function date_week($date) {
return $week;
}
-
+
/**
* Helper function to left pad date parts with zeros.
* Provided because this is needed so often with dates.
@@ -1581,14 +1580,14 @@ function date_limit_format($format, $granularity) {
'\,' => ',',
);
$format = strtr($format, $replace);
-
+
// Get the 'T' out of ISO date formats that don't have
// both date and time.
if (!date_has_time($granularity) || !date_has_date($granularity)) {
$format = str_replace('\T', ' ', $format);
$format = str_replace('T', ' ', $format);
}
-
+
$regex = array();
if (!date_has_time($granularity)) {
$regex[] = '((?<!\\\\)[a|A])';
@@ -1618,7 +1617,7 @@ function date_limit_format($format, $granularity) {
case 'timezone':
$regex[] = '([\-/\.,:]?\s?(?<!\\\\)[TOZPe])';
break;
-
+
}
}
// Remove empty parentheses, brackets, pipes.
@@ -1633,10 +1632,10 @@ function date_limit_format($format, $granularity) {
// Remove orphaned punctuation at the end of the string.
$format = preg_replace('([\-/\.,:\']$)', '', $format);
$format = preg_replace('(\\$)', '', $format);
-
+
// Trim any whitespace from the result.
$format = trim($format);
-
+
// After removing the non-desired parts of the format, test if the only
// things left are escaped, non-date, characters. If so, return nothing.
if (!$test = trim(preg_replace('(\\\\\w{1})', '', $format))) {
@@ -1838,7 +1837,7 @@ function date_range_valid($string) {
function date_range_years($string, $date = NULL) {
$this_year = date_format(date_now(), 'Y');
list($min_year, $max_year) = explode(':', $string);
-
+
// Valid patterns would be -5:+5, 0:+1, 2008:2010.
$plus_pattern = '@[\+|\-][0-9]{1,4}@';
$year_pattern = '@[0-9]{4}@';
@@ -1960,7 +1959,7 @@ function date_is_all_day($string1, $string2, $granularity = 'second', $increment
elseif (!in_array($granularity, array('hour', 'minute', 'second'))) {
return FALSE;
}
-
+
preg_match('/([0-9]{4}-[0-9]{2}-[0-9]{2}) (([0-9]{2}):([0-9]{2}):([0-9]{2}))/', $string1, $matches);
$count = count($matches);
$date1 = $count > 1 ? $matches[1] : '';
@@ -1975,19 +1974,19 @@ function date_is_all_day($string1, $string2, $granularity = 'second', $increment
$hour2 = $count > 3 ? intval($matches[3]) : 0;
$min2 = $count > 4 ? intval($matches[4]) : 0;
$sec2 = $count > 5 ? intval($matches[5]) : 0;
-
+
if (empty($date1) || empty($date2) || $date1 != $date2) {
return FALSE;
}
if (empty($time1) || empty($time2)) {
return FALSE;
}
-
+
$tmp = date_seconds('s', TRUE, $increment);
$max_seconds = intval(array_pop($tmp));
$tmp = date_minutes('i', TRUE, $increment);
$max_minutes = intval(array_pop($tmp));
-
+
switch ($granularity) {
case 'second':
$min_match = $time1 == '00:00:00' || ($hour1 == 0 && $min1 == 0 && $sec1 == 0);
@@ -2005,11 +2004,11 @@ function date_is_all_day($string1, $string2, $granularity = 'second', $increment
$min_match = TRUE;
$max_match = FALSE;
}
-
+
if ($min_match && $max_match) {
return TRUE;
}
-
+
return FALSE;
}
diff --git a/date_api/date_api_elements.inc b/date_api/date_api_elements.inc
index 8e95f09..6fd8717 100644
--- a/date_api/date_api_elements.inc
+++ b/date_api/date_api_elements.inc
@@ -212,7 +212,7 @@ function date_text_element_value_callback($element, $input = FALSE, &$form_state
*
*/
function date_text_element_process($element, $form_state, $form) {
-
+
$element['#tree'] = TRUE;
$element['#theme_wrappers'] = array('date_text');
$element['date']['#value'] = $element['#value']['date'];
@@ -220,7 +220,7 @@ function date_text_element_process($element, $form_state, $form) {
$element['date']['#weight'] = !empty($element['date']['#weight']) ? $element['date']['#weight'] : $element['#weight'];
$element['date']['#attributes'] = array('class' => isset($element['#attributes']['class']) ? $element['#attributes']['class'] += array('date-date') : array('date-date'));
$element['date']['#description'] = ' ' . t('Format: @date', array('@date' => date_now()->format($element['#date_format'])));
-
+
// Keep the system from creating an error message for the sub-element.
// We'll set our own message on the parent element.
//$element['date']['#required'] = $element['#required'];
@@ -329,7 +329,7 @@ function date_select_element_process($element, $form_state, $form) {
$input_exists = NULL;
$input = drupal_array_get_nested_value($form_state['input'], $element['#parents'], $input_exists);
-
+
if (is_array($element['#default_value'])) {
$date = date_select_input_date($element, $element['#default_value']);
}
@@ -339,9 +339,9 @@ function date_select_element_process($element, $form_state, $form) {
$element['#tree'] = TRUE;
$element['#theme_wrappers'] = array('date_select');
-
+
$element += (array) date_parts_element($element, $date, $element['#date_format']);
-
+
// Store a hidden value for all date parts not in the current display.
$granularity = date_format_order($element['#date_format']);
$formats = array('year' => 'Y', 'month' => 'n', 'day' => 'j', 'hour' => 'H', 'minute' => 'i', 'second' => 's');
@@ -403,7 +403,7 @@ function date_parts_element($element, $date, $format) {
$range = date_range_years($element['#date_year_range'], $date);
$min_year = $range[0];
$max_year = $range[1];
-
+
$sub_element[$field]['#default_value'] = is_object($date) ? $date->format('Y') : '';
if ($part_type == 'select') {
$sub_element[$field]['#options'] = drupal_map_assoc(date_years($min_year, $max_year, $part_required));
@@ -443,7 +443,7 @@ function date_parts_element($element, $date, $format) {
$sub_element[$field]['#prefix'] = theme('date_part_minsec_prefix', $element);
break;
}
-
+
// Add handling for the date part label.
$label = theme('date_part_label_' . $field, array('part_type' => $part_type, 'element' => $element));
if (in_array($field, $element['#date_text_parts'])) {
@@ -475,7 +475,7 @@ function date_parts_element($element, $date, $format) {
}
}
}
-
+
// Views exposed filters are treated as submitted even if not,
// so force the #default value in that case. Make sure we set
// a default that is in the option list.
@@ -484,7 +484,7 @@ function date_parts_element($element, $date, $format) {
$default = !empty($sub_element[$field]['#default_value']) ? $sub_element[$field]['#default_value'] : array_shift($options);
$sub_element[$field]['#value'] = $default;
}
-
+
if (($hours_format == 'g' || $hours_format == 'h') && date_has_time($granularity)) {
$sub_element['ampm'] = array(
'#type' => 'select',
@@ -515,19 +515,19 @@ function date_select_validate($element, &$form_state) {
if (is_string($element['#value'])) {
return;
}
-
+
$input_exists = NULL;
$input = drupal_array_get_nested_value($form_state['input'], $element['#parents'], $input_exists);
-
+
// Strip field labels out of the results.
foreach ($element['#value'] as $field => $field_value) {
if (substr($field_value, 0, 1) == '-') {
$input[$field] = '';
}
}
-
+
$label = !empty($element['#date_title']) ? $element['#date_title'] : (!empty($element['#title']) ? $element['#title'] : '');
-
+
if (isset($element['#value']['ampm'])) {
if ($input['ampm'] == 'pm' && $input['hour'] < 12) {
$input['hour'] += 12;
@@ -538,7 +538,7 @@ function date_select_validate($element, &$form_state) {
}
unset($input['ampm']);
$date = date_select_input_date($element, $input);
-
+
if (empty($date) && $element['#required']) {
form_error($element, t('A valid value is required.'));
}
@@ -568,4 +568,3 @@ function date_select_input_date($element, $input) {
}
return NULL;
}
-
diff --git a/date_api/date_api_ical.inc b/date_api/date_api_ical.inc
index 70017f4..0ed7342 100644
--- a/date_api/date_api_ical.inc
+++ b/date_api/date_api_ical.inc
@@ -128,14 +128,13 @@ function date_ical_import($filename) {
*/
function date_ical_parse($icaldatafolded = array()) {
$items = array();
-
+
// Verify this is iCal data
if (trim($icaldatafolded[0]) != 'BEGIN:VCALENDAR') {
watchdog('date ical', 'Invalid calendar file.');
return FALSE;
}
-
// "unfold" wrapped lines
$icaldata = array();
foreach ($icaldatafolded as $line) {
@@ -277,7 +276,7 @@ function date_ical_parse($icaldatafolded = array()) {
$parse_result = array('DATA' => $data);
}
break;
-
+
case 'DURATION':
// Can't be sure whether DTSTART is before or after DURATION in
// the VEVENT, so store the data and parse it at the end.
diff --git a/date_api/date_api_sql.inc b/date_api/date_api_sql.inc
index 3e45353..cbc8ba3 100644
--- a/date_api/date_api_sql.inc
+++ b/date_api/date_api_sql.inc
@@ -9,7 +9,7 @@
* Add experimental support for sqllite (http://www.sqlite.org/lang_datefunc.html) and
* Oracle (http://psoug.org/reference/date_func.html and http://psoug.org/reference/datatypes.html) date/time functions.
*/
-
+
/**
* A helper function to do cross-database concatation of date parts
*
@@ -69,7 +69,7 @@ class date_sql_handler {
var $db_timezone_field = NULL; // Use if the db timezone is stored in a field.
var $local_timezone_field = NULL; // Use if the local timezone is stored in a field.
var $offset_field = NULL; // Use if the offset is stored in a field.
-
+
function construct($date_type = DATE_DATETIME, $local_timezone = NULL) {
$this->db_type = $this->get_db_type();
$this->date_type = $date_type;
@@ -86,7 +86,7 @@ class date_sql_handler {
function get_db_type() {
return $GLOBALS['databases']['default']['default']['driver'];
}
-
+
/**
* See if the db has timezone name support.
*/
@@ -114,7 +114,7 @@ class date_sql_handler {
}
return $has_support;
}
-
+
/**
* Set the database timzone offset.
*
@@ -144,7 +144,7 @@ class date_sql_handler {
$already_set = TRUE;
}
}
-
+
/**
* Return timezone offset for the date being processed.
*/
@@ -158,7 +158,7 @@ class date_sql_handler {
}
return 0;
}
-
+
/**
* Helper function to create cross-database SQL dates.
*
@@ -223,7 +223,7 @@ class date_sql_handler {
}
return $field;
}
-
+
/**
* Adjust a field value by time interval.
*
@@ -248,7 +248,7 @@ class date_sql_handler {
case 'SUB':
return "DATE_SUB($field, INTERVAL $count $granularity)";
}
-
+
case 'pgsql':
$granularity .= 'S';
switch ($direction) {
@@ -260,7 +260,7 @@ class date_sql_handler {
}
return $field;
}
-
+
/**
* Select a date value from the database, adjusting the value
* for the timezone.
@@ -279,7 +279,7 @@ class date_sql_handler {
// if they are field names they do not.
$db_zone = $this->db_timezone_field ? $this->db_timezone_field : "'{$this->db_timezone}'";
$localzone = $this->local_timezone_field ? $this->local_timezone_field : "'{$this->local_timezone}'";
-
+
// If a fixed offset is required, use it.
if ($offset !== NULL) {
return $this->sql_offset($field, $offset);
@@ -311,7 +311,7 @@ class date_sql_handler {
}
}
}
-
+
/**
* Helper function to create cross-database SQL date formatting.
*
@@ -410,7 +410,7 @@ class date_sql_handler {
}
}
}
-
+
/**
* Create a where clause to compare a complete date field to a complete date value.
*
@@ -457,7 +457,7 @@ class date_sql_handler {
}
return "$field $operator $value";
}
-
+
/**
* Create a where clause to compare an extracted part of a field to an integer value.
*
@@ -481,7 +481,7 @@ class date_sql_handler {
}
return $this->sql_extract($part, $field) . " $operator $value";
}
-
+
/**
* Create a where clause to compare a formated field to a formated value.
*
@@ -606,7 +606,7 @@ class date_sql_handler {
return;
}
}
-
+
$compare = array_merge($this->part_info('empty_' . $type), $selected);
// If this is a max date, make sure the last day of
// the month is the right one for this date.
@@ -658,7 +658,7 @@ class date_sql_handler {
}
return TRUE;
}
-
+
function views_formats($granularity, $type = 'sql') {
$formats = array('display', 'sql');
// Start with the site long date format and add seconds to it
@@ -695,7 +695,7 @@ class date_sql_handler {
}
return $formats[$type];
}
-
+
function granularity_form($granularity) {
$form = array(
'#title' => t('Granularity'),
@@ -780,7 +780,7 @@ class date_sql_handler {
$direction = $results[1];
$count = $results[2];
$item = $results[3];
-
+
$replace = array(
'now' => '@',
'+' => 'P',
@@ -805,7 +805,7 @@ class date_sql_handler {
$prefix = in_array($item, array('hours', 'hour', 'minutes', 'minute', 'seconds', 'second')) ? 'T' : '';
return $prefix . strtr($direction, $replace) . $count . strtr($item, $replace);
}
-
+
/**
* Use the parsed values from the ISO argument to determine the
* granularity of this period.
@@ -827,7 +827,7 @@ class date_sql_handler {
function arg_range($arg) {
// Parse the argument to get its parts
$parts = $this->arg_parts($arg);
-
+
// Build a range from a period-only argument (assumes the min date is now.)
if (empty($parts[0]['date']) && !empty($parts[0]['period']) && (empty($parts[1]))) {
$min_date = date_now();
diff --git a/date_api/theme/theme.inc b/date_api/theme/theme.inc
index 829ce26..a832d5f 100644
--- a/date_api/theme/theme.inc
+++ b/date_api/theme/theme.inc
@@ -171,7 +171,7 @@ function theme_date_time_ago($vars) {
$start_date = $vars['start_date'];
$end_date = $vars['end_date'];
$interval = !empty($vars['interval']) ? $vars['interval'] : 2;
-
+
// If no date is sent, then return nothing
if (empty($start_date) || empty($end_date)) {
return NULL;
@@ -181,7 +181,7 @@ function theme_date_time_ago($vars) {
$now = date_format(date_now(), DATE_FORMAT_DATETIME);
$start = date_format($start_date, DATE_FORMAT_DATETIME);
$end = date_format($end_date, DATE_FORMAT_DATETIME);
-
+
// 1) The date is entirely in the future
if ($now < $start) {
return t('!time from now', array('!time' => date_format_interval($start_date, $interval)));
diff --git a/date_elements.inc b/date_elements.inc
index 1816221..abe2257 100644
--- a/date_elements.inc
+++ b/date_elements.inc
@@ -50,7 +50,7 @@ function date_field_widget_form(&$form, &$form_state, $field, $instance, $langco
module_load_include('inc', 'date_api', 'date_api_elements');
$timezone = date_get_timezone($field['settings']['tz_handling'], isset($items[0]['timezone']) ? $items[0]['timezone'] : date_default_timezone());
-
+
// TODO see if there's a way to keep the timezone element from ever being
// nested as array('timezone' => 'timezone' => value)). After struggling
// with this a while, I can find no way to get it displayed in the form
@@ -59,7 +59,7 @@ function date_field_widget_form(&$form, &$form_state, $field, $instance, $langco
if (is_array($timezone)) {
$timezone = $timezone['timezone'];
}
-
+
// Convert UTC dates to their local values in DATETIME format,
// and adjust the default values as specified in the field settings.
@@ -77,7 +77,7 @@ function date_field_widget_form(&$form, &$form_state, $field, $instance, $langco
$date = date_local_date($form, $form_state, $delta, $items[$delta], $timezone, $field, $instance, $processed);
$items[$delta][$processed] = is_object($date) ? date_format($date, DATE_FORMAT_DATETIME) : '';
}
-
+
$element += array(
'#type' => 'date_combo',
'#theme_wrappers' => array('date_combo'),
@@ -95,14 +95,14 @@ function date_field_widget_form(&$form, &$form_state, $field, $instance, $langco
'#weight' => $instance['widget']['weight'] + .2,
);
}
-
+
// Add a date repeat form element, if needed.
if (module_exists('date_repeat') && $field['settings']['repeat'] == 1) {
module_load_include('inc', 'date', 'date_repeat');
_date_repeat_widget($element, $field, $instance, $items, $delta);
$element['rrule']['#weight'] = $instance['widget']['weight'] + .4;
}
-
+
return $element;
}
@@ -156,7 +156,7 @@ function date_local_date($form, $form_state, $delta, $item, $timezone, $field, $
}
else {
$value = $item[$part];
-
+
// @TODO Figure out how to replace date_fuzzy_datetime() function.
// Special case for ISO dates to create a valid date object for formatting.
// Is this still needed?
@@ -169,7 +169,7 @@ function date_local_date($form, $form_state, $delta, $item, $timezone, $field, $
$value = date_convert($value, $field['type'], DATE_DATETIME, $db_timezone);
}
*/
-
+
$date = new DateObject($value, date_get_timezone_db($field['settings']['tz_handling']));
$date->limitGranularity($field['settings']['granularity']);
if (empty($date)) {
@@ -190,7 +190,7 @@ function date_combo_element_process($element, &$form_state, $form) {
if (isset($element['#access']) && empty($element['#access'])) {
return;
}
-
+
$field_name = $element['#field_name'];
$delta = $element['#delta'];
$bundle = $element['#bundle'];
@@ -229,9 +229,9 @@ function date_combo_element_process($element, &$form_state, $form) {
'#date_year_range' => $instance['widget']['settings']['year_range'],
'#date_label_position' => $instance['widget']['settings']['label_position'],
);
-
+
$description = !empty($instance['description']) ? t($instance['description']) : '';
-
+
// Give this element the right type, using a Date API
// or a Date Popup element type.
@@ -256,7 +256,7 @@ function date_combo_element_process($element, &$form_state, $form) {
$element[$from_field]['#theme_wrappers'] = array('date_text');
break;
}
-
+
// If this field uses the 'To', add matching element
// for the 'To' date, and adapt titles to make it clear which
// is the 'From' and which is the 'To' .
@@ -277,7 +277,7 @@ function date_combo_element_process($element, &$form_state, $form) {
else {
$element[$from_field]['#description'] = $description;
}
-
+
// Create label for error messages that make sense in multiple values
// and when the title field is left blank.
if (!empty($field['cardinality']) && empty($field['settings']['repeat'])) {
@@ -293,7 +293,7 @@ function date_combo_element_process($element, &$form_state, $form) {
else {
$element[$from_field]['#date_title'] = $instance['label'];
}
-
+
// Make sure field info will be available to the validator which
// does not get the values in $form.
$form_state['#field_info'][$field['field_name']] = $field;
@@ -318,22 +318,22 @@ function date_element_empty($element, &$form_state) {
* Don't try this if there were errors before reaching this point.
*/
function date_combo_validate($element, &$form_state) {
-
+
$form_values = $form_state['values'];
$field_name = $element['#field_name'];
$delta = $element['#delta'];
$langcode = $element['#language'];
-
+
// If the whole field is empty and that's OK, stop now.
if (empty($form_state['input'][$field_name]) && !$element['#required']) {
return;
}
-
+
// Repeating dates have a different form structure, so get the
// right item values.
$item = isset($form_values[$field_name][$langcode]['rrule']) ? $form_values[$field_name][$langcode] : $form_values[$field_name][$langcode][$delta];
$posted = isset($form_values[$field_name][$langcode]['rrule']) ? $form_state['input'][$field_name][$langcode] : $form_state['input'][$field_name][$langcode][$delta];
-
+
$field = field_widget_field($element, $form_state);
$instance = field_widget_instance($element, $form_state);
@@ -342,7 +342,7 @@ function date_combo_validate($element, &$form_state) {
$tz_field = 'timezone';
$offset_field = 'offset';
$offset_field2 = 'offset2';
-
+
// Unfortunately, due to the fact that much of the processing is already
// done by the time we get here, it is not possible highlight the field
// with an error, we just try to explain which element is creating the
@@ -367,7 +367,7 @@ function date_combo_validate($element, &$form_state) {
}
}
}
-
+
// A 'To' date without a 'From' date is a validation error.
if ($empty && !empty($item[$to_field])) {
if (!is_array($item[$to_field])) {
@@ -384,7 +384,7 @@ function date_combo_validate($element, &$form_state) {
}
}
}
-
+
if ($empty) {
$item = date_element_empty($element, $form_state);
if (!$element['#required']) {
@@ -395,7 +395,7 @@ function date_combo_validate($element, &$form_state) {
// because otherwise we'll show errors on the nested elements
// more than once.
elseif (!form_get_errors()) {
-
+
// Check todate input for blank values and substitute in fromdate
// values where needed, then re-compute the todate with those values.
if ($field['settings']['todate']) {
@@ -411,7 +411,7 @@ function date_combo_validate($element, &$form_state) {
$merged_date['hour'] -= 12;
}
}
-
+
// If all date values were empty and a date is required, throw
// an error on the first element. We don't want to create
// duplicate messages on every date part, so the error will
@@ -421,7 +421,7 @@ function date_combo_validate($element, &$form_state) {
}
$element[$to_field]['#value'] = $merged_date;
-
+
// Call the right function to turn this altered user input into
// a new value for the todate.
$item[$to_field] = $merged_date;
@@ -429,9 +429,9 @@ function date_combo_validate($element, &$form_state) {
else {
$item[$to_field] = $item[$from_field];
}
-
+
$from_date = date_input_date($field, $instance, $element[$from_field], $posted[$from_field]);
-
+
if (!empty($field['settings']['todate'])) {
$to_date = date_input_date($field, $instance, $element[$to_field], $merged_date);
}
@@ -439,7 +439,6 @@ function date_combo_validate($element, &$form_state) {
$to_date = $from_date;
}
-
// Neither the from date nor the to date should be empty at this point
// unless they held values that couldn't be evaluated.
if (!$instance['required'] && (empty($from_date) || empty($to_date))) {
@@ -458,10 +457,10 @@ function date_combo_validate($element, &$form_state) {
$item[$tz_field] = $timezone;
$item[$offset_field] = date_offset_get($from_date);
-
+
$test_from = date_format($from_date, 'r');
$test_to = date_format($to_date, 'r');
-
+
$item[$offset_field2] = date_offset_get($to_date);
date_timezone_set($from_date, timezone_open($timezone_db));
date_timezone_set($to_date, timezone_open($timezone_db));
@@ -470,7 +469,7 @@ function date_combo_validate($element, &$form_state) {
if (isset($form_values[$field_name]['rrule'])) {
$item['rrule'] = $form_values[$field['field_name']]['rrule'];
}
-
+
// Test a roundtrip back to the original timezone to catch
// invalid dates, like 2AM on the day that spring daylight savings
// time begins in the US.
diff --git a/date_popup/README.txt b/date_popup/README.txt
index 57a3c04..b60c39b 100644
--- a/date_popup/README.txt
+++ b/date_popup/README.txt
@@ -52,7 +52,6 @@ are:
The default format uses the short site default format.
-
#date_year_range
the number of years to go backwards and forwards from current year
in year selector, in the format -{years back}:+{years forward},
diff --git a/date_popup/date_popup.module b/date_popup/date_popup.module
index e9e4102..7577f15 100644
--- a/date_popup/date_popup.module
+++ b/date_popup/date_popup.module
@@ -51,7 +51,7 @@ function date_popup_library() {
);
return $libraries;
}
-
+
/**
* Implement hook_init().
*/
@@ -187,7 +187,6 @@ function date_popup_time_format($element) {
return date_popup_format_to_popup_time(date_limit_format($element['#date_format'], date_popup_time_granularity($element)));
}
-
/**
* Element value callback for date_popup element.
*/
@@ -217,13 +216,13 @@ function date_popup_element_value_callback($element, $input = FALSE, &$form_stat
function date_popup_element_process($element, $form_state, $form) {
date_popup_add();
module_load_include('inc', 'date_api', 'date_api_elements');
-
+
$element['#tree'] = TRUE;
$element['#theme_wrappers'] = array('date_popup');
-
+
$element['date'] = date_popup_process_date($element);
$element['time'] = date_popup_process_time($element);
-
+
if (isset($element['#element_validate'])) {
array_push($element['#element_validate'], 'date_popup_validate');
}
@@ -240,7 +239,7 @@ function date_popup_process_date(&$element) {
$granularity = date_format_order($element['#date_format']);
$date_granularity = date_popup_date_granularity($element);
if (empty($date_granularity)) return array();
-
+
// The datepicker can't handle zero or negative values like 0:+1
// even though the Date API can handle them, so rework the value
// we pass to the datepicker to use defaults it can accept (such as +0:+1)
@@ -274,10 +273,10 @@ function date_popup_process_date(&$element) {
// Custom setting, will be expanded in Drupal.behaviors.date_popup()
'fromTo' => isset($fromto),
);
-
+
// Create a unique id for each set of custom settings.
$id = date_popup_js_settings_id($element['#id'], 'datepicker', $settings);
-
+
$sub_element = array(
'#type' => 'textfield',
'#default_value' => $element['#value']['date'],
@@ -338,19 +337,19 @@ function date_popup_validate($element, &$form_state) {
module_load_include('inc', 'date_api', 'date_api_elements');
date_popup_add();
-
+
$granularity = date_format_order($element['#date_format']);
$date_granularity = date_popup_date_granularity($element);
$time_granularity = date_popup_time_granularity($element);
$has_time = date_has_time($granularity);
-
+
$label = !empty($element['#date_title']) ? $element['#date_title'] : (!empty($element['#title']) ? $element['#title'] : '');
$label = t($label);
$input_exists = NULL;
$input = drupal_array_get_nested_value($form_state['input'], $element['#parents'], $input_exists);
$date = date_popup_input_date($element, $input);
-
+
// If the field is empty and not required, set it to empty and return.
// If the field is empty and required, set error message and return.
$error_field = implode('][', $element['#parents']);
@@ -369,7 +368,7 @@ function date_popup_validate($element, &$form_state) {
}
form_set_value($element, NULL, $form_state);
}
-
+
// If the created date is valid, set it.
if (!empty($date)) {
if (!empty($date->errors)) {
@@ -408,7 +407,7 @@ function date_popup_input_date($element, $input, $auto_complete = FALSE) {
$granularity = date_format_order($element['#date_format']);
$has_time = date_has_time($granularity);
$flexible = !empty($element['#date_flexible']) ? $element['#date_flexible'] : 0;
-
+
$format = date_popup_date_format($element);
$format .= $has_time ? ' ' . date_popup_time_format($element) : '';
$datetime = $input['date'];
@@ -561,7 +560,7 @@ function date_popup_menu() {
*/
function date_popup_settings() {
$form['#prefix'] = t('<p>The Date Popup module uses a jQuery timepicker module. There is no "official" jQuery UI timepicker, and not everyone likes the one that is included here. If you do not want to use the timepicker, you can turn it off below and users will get a regular textfield instead.</p>');
-
+
$form['date_popup_timepicker'] = array(
'#type' => 'select',
'#options' => array('default' => t('Use default jQuery timepicker'), 'none' => t('Manual time entry, no jQuery timepicker')),
@@ -569,7 +568,7 @@ function date_popup_settings() {
'#default_value' => variable_get('date_popup_timepicker', 'default'),
'#description' => t("Choose the jQuery timepicker to user."),
);
-
+
$css = <<<EOM
/* ___________ IE6 IFRAME FIX ________ */
.ui-datepicker-cover {
diff --git a/date_popup/themes/datepicker.1.7.css b/date_popup/themes/datepicker.1.7.css
index 1ad1cc5..2ca10c0 100644
--- a/date_popup/themes/datepicker.1.7.css
+++ b/date_popup/themes/datepicker.1.7.css
@@ -7,7 +7,6 @@ border-bottom:2px #666 solid;
z-index: 9999;
}
-
/* Datepicker
----------------------------------*/
.ui-datepicker { width: 17em; padding: .2em .2em 0; }
diff --git a/date_popup/translations/date_popup.de.po b/date_popup/translations/date_popup.de.po
index a012d43..3e6ea28 100644
--- a/date_popup/translations/date_popup.de.po
+++ b/date_popup/translations/date_popup.de.po
@@ -66,4 +66,3 @@ msgstr "Datumspopup"
#: date_popup/date_popup.info:0
msgid "Enables jquery popup calendars and time entry widgets for selecting dates and times."
msgstr "Aktiviert jQuery-Popup-Kalender und Zeit-Steuerelemente für die Auswahl von Terminen und Zeiten."
-
diff --git a/date_popup/translations/date_popup.es.po b/date_popup/translations/date_popup.es.po
index 53869b2..b020366 100644
--- a/date_popup/translations/date_popup.es.po
+++ b/date_popup/translations/date_popup.es.po
@@ -90,4 +90,3 @@ msgstr "Habilita calendarios emergentes y widgets de ingreso y selección de fec
#: date_popup.info:0
msgid "Date/Time"
msgstr "Fecha/Hora"
-
diff --git a/date_popup/translations/date_popup.fr.po b/date_popup/translations/date_popup.fr.po
index 0243c83..b3aefa5 100644
--- a/date_popup/translations/date_popup.fr.po
+++ b/date_popup/translations/date_popup.fr.po
@@ -98,4 +98,3 @@ msgstr "Date Popup"
#: date_popup/date_popup.info:0
msgid "Enables jquery popup calendars and time entry widgets for selecting dates and times."
msgstr "Active les popups calendrier jquery et des widgets de saisir de temps pour la sélection de dates et heures."
-
diff --git a/date_popup/translations/date_popup.tr.po b/date_popup/translations/date_popup.tr.po
index ef72346..1046dbd 100644
--- a/date_popup/translations/date_popup.tr.po
+++ b/date_popup/translations/date_popup.tr.po
@@ -68,4 +68,3 @@ msgstr "Tarih ve saat seçmek için jquery takvim ve saat giriş araçlarını e
#: date_popup.info:0
msgid "Date/Time"
msgstr "Tarih/Saat"
-
diff --git a/date_popup/translations/es.po b/date_popup/translations/es.po
index 53869b2..b020366 100644
--- a/date_popup/translations/es.po
+++ b/date_popup/translations/es.po
@@ -90,4 +90,3 @@ msgstr "Habilita calendarios emergentes y widgets de ingreso y selección de fec
#: date_popup.info:0
msgid "Date/Time"
msgstr "Fecha/Hora"
-
diff --git a/date_repeat.inc b/date_repeat.inc
index 7caf0bc..576ea96 100644
--- a/date_repeat.inc
+++ b/date_repeat.inc
@@ -67,7 +67,7 @@ function _date_repeat_widget_validate($element, &$form_state) {
$input = $input[$key];
}
$rrule_values = date_repeat_merge($input['rrule'], $element['rrule']);
-
+
// If no start date was set, clean up the form and return.
// If no repeats are set, clean up the form and return.
if (empty($item['value']) || $rrule_values['FREQ'] == 'NONE') {
@@ -129,14 +129,14 @@ function _date_repeat_widget_validate($element, &$form_state) {
function date_repeat_build_dates($rrule = NULL, $rrule_values = NULL, $field, $item) {
include_once(DRUPAL_ROOT . '/' . drupal_get_path('module', 'date_api') . '/date_api_ical.inc');
$field_name = $field['field_name'];
-
+
if (empty($rrule)) {
$rrule = date_api_ical_build_rrule($rrule_values);
}
elseif (empty($rrule_values)) {
$rrule_values = date_ical_parse($rrule);
}
-
+
// By the time we get here, the start and end dates have been
// adjusted back to UTC, but we want localtime dates to do
// things like '+1 Tuesday', so adjust back to localtime.
@@ -157,7 +157,7 @@ function date_repeat_build_dates($rrule = NULL, $rrule_values = NULL, $field, $i
}
$duration = $start->difference($end);
$start_datetime = date_format($start, DATE_FORMAT_DATETIME);
-
+
if (!empty($rrule_values['UNTIL']['datetime'])) {
$end = date_ical_date($rrule_values['UNTIL'], $timezone);
}
@@ -177,10 +177,9 @@ function date_repeat_build_dates($rrule = NULL, $rrule_values = NULL, $field, $i
foreach ($parsed_rdates as $rdate) {
$additions[] = date_ical_date($rdate, $timezone);
}
-
+
$dates = date_repeat_calc($rrule, $start_datetime, $end_datetime, $exceptions, $timezone, $additions);
-
$value = array();
foreach ($dates as $delta => $date) {
// date_repeat_calc always returns DATE_DATETIME dates, which is
diff --git a/date_repeat/date_repeat.module b/date_repeat/date_repeat.module
index 89a20de..ef49893 100644
--- a/date_repeat/date_repeat.module
+++ b/date_repeat/date_repeat.module
@@ -161,10 +161,10 @@ function date_repeat_rrule_description($rrule, $format = 'D M d Y') {
if (empty($rrule) || !strstr($rrule, 'RRULE')) {
return;
}
-
+
module_load_include('inc', 'date_api', 'date_api_ical');
module_load_include('inc', 'date_repeat', 'date_repeat_calc');
-
+
// Make sure there will be an empty description for any unused parts.
$description = array(
'!interval' => '',
@@ -195,7 +195,7 @@ function date_repeat_rrule_description($rrule, $format = 'D M d Y') {
$description['!interval'] = format_plural($rrule['INTERVAL'], 'every day', 'every @count days') . ' ';
break;
}
-
+
if (!empty($rrule['BYDAY'])) {
$days = date_repeat_dow_day_options();
$counts = date_repeat_dow_count_options();
diff --git a/date_repeat/date_repeat_calc.inc b/date_repeat/date_repeat_calc.inc
index 438f2d6..0a496ed 100644
--- a/date_repeat/date_repeat_calc.inc
+++ b/date_repeat/date_repeat_calc.inc
@@ -33,11 +33,11 @@
*/
function _date_repeat_calc($rrule, $start, $end, $exceptions, $timezone, $additions) {
module_load_include('inc', 'date_api', 'date_api_ical');
-
+
if (empty($timezone)) {
$timezone = date_default_timezone();
}
-
+
// Make sure the 'EXCEPTIONS' string isn't appended to the rule.
$parts = explode("\n", $rrule);
if (count($parts)) {
@@ -45,11 +45,11 @@ function _date_repeat_calc($rrule, $start, $end, $exceptions, $timezone, $additi
}
// Get the parsed array of rule values.
$rrule = date_ical_parse_rrule('RRULE:', $rrule);
-
+
// Create a date object for the start and end dates.
$start_date = new DateObject($start, $timezone);
$end_date = new DateObject($end, $timezone);
-
+
// If the rule has an UNTIL, see if that is earlier than the end date.
if (!empty($rrule['UNTIL'])) {
$until_date = date_ical_date($rrule['UNTIL'], $timezone);
@@ -57,11 +57,11 @@ function _date_repeat_calc($rrule, $start, $end, $exceptions, $timezone, $additi
$end_date = $until_date;
}
}
-
+
// Get an integer value for the interval, if none given, '1' is implied.
$interval = max(1, isset($rrule['INTERVAL']) ? $rrule['INTERVAL'] : 1);
$count = isset($rrule['COUNT']) ? $rrule['COUNT'] : NULL;
-
+
if (empty($rrule['FREQ'])) {
$rrule['FREQ'] = 'DAILY';
}
@@ -73,7 +73,7 @@ function _date_repeat_calc($rrule, $start, $end, $exceptions, $timezone, $additi
else if (!empty($rrule['BYDAY']) && !in_array($rrule['FREQ'], array('MONTHLY', 'WEEKLY', 'YEARLY'))) {
$rrule['FREQ'] = 'WEEKLY';
}
-
+
// Find the time period to jump forward between dates.
switch ($rrule['FREQ']) {
case 'DAILY':
@@ -90,7 +90,7 @@ function _date_repeat_calc($rrule, $start, $end, $exceptions, $timezone, $additi
break;
}
$rrule = date_repeat_adjust_rrule($rrule, $start_date);
-
+
// The start date always goes into the results, whether or not it meets
// the rules. RFC 2445 includes examples where the start date DOES NOT
// meet the rules, but the expected results always include the start date.
@@ -173,7 +173,7 @@ function _date_repeat_calc($rrule, $start, $end, $exceptions, $timezone, $additi
}
else {
-
+
// More complex searches for day names and criteria like '-1SU' or '2TU,2TH',
// require that we interate through the whole time period checking each BYDAY.
@@ -214,7 +214,7 @@ function _date_repeat_calc($rrule, $start, $end, $exceptions, $timezone, $additi
}
}
ksort($week_days);
-
+
// BYDAYs with parameters like -1SU (last Sun) or 2TH (second Thur)
// need to be processed one month or year at a time.
if (!empty($direction_days) && in_array($rrule['FREQ'], array('MONTHLY', 'YEARLY'))) {
@@ -278,7 +278,7 @@ function _date_repeat_calc($rrule, $start, $end, $exceptions, $timezone, $additi
// function is insufficient to test whether to include this date
// if we are using a rule like 'every other month', so we must
// explicitly test it here.
-
+
// If we're already on the right day, don't jump or we
// will prematurely move into the next week.
if (date_format($current_day, 'l') != $day) {
@@ -290,13 +290,13 @@ function _date_repeat_calc($rrule, $start, $end, $exceptions, $timezone, $additi
}
}
$finished = date_repeat_is_finished($current_day, $days, $count, $end_date);
-
+
// Make sure we don't get stuck in endless loop if the current
// day never got changed above.
if (!$moved) {
date_modify($current_day, '+1 day');
}
-
+
// If this is a WEEKLY frequency, stop after each week,
// otherwise, stop when we've moved outside the current period.
// Jump to the end of the week, then test the period.
@@ -307,14 +307,14 @@ function _date_repeat_calc($rrule, $start, $end, $exceptions, $timezone, $additi
$period_finished = TRUE;
}
}
-
+
if ($finished) {
continue;
}
-
+
// We'll be at the end of a week, month, or year when
// we get to this point in the code.
-
+
// Go back to the beginning of this period before we jump, to
// ensure we jump to the first day of the next period.
switch ($rrule['FREQ']) {
@@ -338,12 +338,12 @@ function _date_repeat_calc($rrule, $start, $end, $exceptions, $timezone, $additi
}
}
}
-
+
// add additional dates
foreach($additions as $addition) {
$days[] = date_format($addition, DATE_FORMAT_DATETIME);
}
-
+
sort($days);
return $days;
}
@@ -359,7 +359,7 @@ function date_repeat_adjust_rrule($rrule, $start_date) {
// RFC 2445 says if no day or monthday is specified when creating repeats for
// weeks, months, or years, impute the value from the start date.
-
+
if (empty($rrule['BYDAY']) && $rrule['FREQ'] == 'WEEKLY') {
$rrule['BYDAY'] = array(date_repeat_dow2day(date_format($start_date, 'w')));
}
@@ -471,7 +471,7 @@ function date_repeat_is_finished($current_day, $days, $count, $end_date) {
function date_repeat_set_month_day($date_in, $day, $count = 1, $direction = '+', $timezone = 'UTC') {
if (is_object($date_in)) {
$current_month = date_format($date_in, 'n');
-
+
// Reset to the start of the month.
// We should be able to do this with date_date_set(), but
// for some reason the date occasionally gets confused if run
@@ -489,7 +489,7 @@ function date_repeat_set_month_day($date_in, $day, $count = 1, $direction = '+',
// current month, so we can catch the first of the month.
date_modify($date, '-1 day');
}
-
+
if (empty($day)) {
date_modify($date, $direction . $count . ' days');
}
@@ -500,7 +500,7 @@ function date_repeat_set_month_day($date_in, $day, $count = 1, $direction = '+',
$step = $count <= 5 ? $order[$direction . $count] : $count;
date_modify($date, $step . ' ' . $day);
}
-
+
// If that takes us outside the current month, don't go there.
if (date_format($date, 'n') == $current_month) {
return $date;
@@ -521,7 +521,7 @@ function date_repeat_set_month_day($date_in, $day, $count = 1, $direction = '+',
function date_repeat_set_year_day($date_in, $day, $count = 1, $direction = '+', $timezone = 'UTC') {
if (is_object($date_in)) {
$current_year = date_format($date_in, 'Y');
-
+
// Reset to the start of the month.
// See note above.
$datetime = date_format($date_in, DATE_FORMAT_DATETIME);
@@ -546,7 +546,7 @@ function date_repeat_set_year_day($date_in, $day, $count = 1, $direction = '+',
$step = $count <= 5 ? $order[$direction . $count] : $count;
date_modify($date, $step . ' ' . $day);
}
-
+
// If that takes us outside the current year, don't go there.
if (date_format($date, 'Y') == $current_year) {
return $date;
diff --git a/date_repeat/date_repeat_form.inc b/date_repeat/date_repeat_form.inc
index a8e472d..4aeba8a 100644
--- a/date_repeat/date_repeat_form.inc
+++ b/date_repeat/date_repeat_form.inc
@@ -36,7 +36,7 @@
*/
function _date_repeat_rrule_process($element, $form_state, $form) {
module_load_include('inc', 'date_api', 'date_api_ical');
-
+
if (empty($element['#date_repeat_widget'])) {
$element['#date_repeat_widget'] = module_exists('date_popup') ? 'date_popup' : 'date_select';
}
@@ -47,7 +47,7 @@ function _date_repeat_rrule_process($element, $form_state, $form) {
else {
$rrule = $element['#default_value'];
}
-
+
// Empty the original string value of the RRULE so we can create
// an array of values for the form from the RRULE's contents.
$element['#value'] = '';
@@ -58,14 +58,14 @@ function _date_repeat_rrule_process($element, $form_state, $form) {
$additions = $parts[2];
$timezone = !empty($element['#date_timezone']) ? $element['#date_timezone'] : date_default_timezone();
$merged_values = date_repeat_merge($rrule, $element);
-
+
$UNTIL = '';
if (!empty($merged_values['UNTIL']['datetime'])) {
$until_date = new DateObject($merged_values['UNTIL']['datetime'], $merged_values['UNTIL']['tz']);
date_timezone_set($until_date, timezone_open($timezone));
$UNTIL = date_format($until_date, DATE_FORMAT_DATETIME);
}
-
+
$element['INTERVAL'] = array(
'#type' => 'select',
//'#title' => t('Interval'),
@@ -74,7 +74,7 @@ function _date_repeat_rrule_process($element, $form_state, $form) {
'#prefix' => '<div class="date-repeat-input">',
'#suffix' => '</div>',
);
-
+
$element['FREQ'] = array(
'#type' => 'select',
//'#title' => t('Frequency'),
@@ -102,7 +102,7 @@ function _date_repeat_rrule_process($element, $form_state, $form) {
'all_day' => array('#type' => 'hidden', '#value' => 1),
'granularity' => array('#type' => 'hidden', '#value' => serialize(array('year', 'month', 'day'))),
);
-
+
$collapsed = TRUE;
if (!empty($merged_values['BYDAY']) || !empty($merged_values['BYMONTH'])) {
$collapsed = FALSE;
@@ -241,9 +241,9 @@ function _date_repeat_rrule_process($element, $form_state, $form) {
'wrapper' => 'date-repeat-additions',
),
);
-
+
$element['#date_repeat_collapsed'] = !empty($rrule['INTERVAL']) || !empty($rrule['FREQ']) ? 0 : (!empty($element['#date_repeat_collapsed']) ? $element['#date_repeat_collapsed'] : 0);
-
+
return $element;
}
@@ -290,7 +290,7 @@ function date_repeat_merge($form_values, $element) {
if (array_key_exists('BYDAY', $form_values)) unset($form_values['BYDAY']['']);
if (array_key_exists('BYMONTH', $form_values)) unset($form_values['BYMONTH']['']);
if (array_key_exists('BYMONTHDAY', $form_values)) unset($form_values['BYMONTHDAY']['']);
-
+
if (array_key_exists('UNTIL', $form_values) && is_array($form_values['UNTIL']['datetime'])) {
$function = $element['#date_repeat_widget'] . '_input_date';
$until_element = $element;
diff --git a/date_repeat/tests/date_repeat.test b/date_repeat/tests/date_repeat.test
index c880cdf..61168f0 100644
--- a/date_repeat/tests/date_repeat.test
+++ b/date_repeat/tests/date_repeat.test
@@ -170,7 +170,6 @@ class DateRepeatTestCase extends DrupalWebTestCase {
$result = implode(', ', $dates);
$this->assertEqual($result, $shouldbe, $rule .'; Starting '.$start .'; results: '. $result);
-
//Every Tuesday, every other month:
$start = "1997-09-02 09:00:00";
$end = "1998-02-01 09:00:00";
@@ -255,8 +254,6 @@ class DateRepeatTestCase extends DrupalWebTestCase {
$result = implode(', ', $dates);
$this->assertEqual($result, $shouldbe, $rule .'; Starting '.$start .'; results: '. $result);
-
-
//Every Thursday in March, forever:
// ==> (1997 9:00 AM EST)March 13,20,27
// (1998 9:00 AM EST)March 5,12,19,26
@@ -269,7 +266,6 @@ class DateRepeatTestCase extends DrupalWebTestCase {
$result = implode(', ', $dates);
$this->assertEqual($result, $shouldbe, $rule .'; Starting '.$start .'; results: '. $result);
-
//Every Thursday, but only during June, July, and August, forever:
// ==> (1997 9:00 AM EDT)June 5,12,19,26;July 3,10,17,24,31;August 7,14,21,28
// (1998 9:00 AM EDT)June 4,11,18,25;July 2,9,16,23,30;August 6,13,20,27
@@ -443,6 +439,5 @@ $rule = "RRULE:FREQ=MINUTELY;INTERVAL=20;BYHOUR=9,10,11,12,13,14,15,16";
// ==> (September 2, 1997 EDT)9:00,9:20,9:40,10:00,10:20,16:00,16:20,16:40
// (September 3, 1997 EDT)9:00,9:20,9:40,10:00,10:20,16:00,16:20,16:40
-
}
} \ No newline at end of file
diff --git a/date_repeat/translations/date_repeat.de.po b/date_repeat/translations/date_repeat.de.po
index bc35710..ef95ee0 100644
--- a/date_repeat/translations/date_repeat.de.po
+++ b/date_repeat/translations/date_repeat.de.po
@@ -254,4 +254,3 @@ msgstr "Ein Terminserien-API zur Berechnung von sich wiederholenden Terminen und
#~ msgstr "jede @count-Tage"
#~ msgid "Date/Time"
#~ msgstr "Datum/Zeit"
-
diff --git a/date_repeat/translations/date_repeat.es.po b/date_repeat/translations/date_repeat.es.po
index 23ae320..537fc31 100644
--- a/date_repeat/translations/date_repeat.es.po
+++ b/date_repeat/translations/date_repeat.es.po
@@ -160,4 +160,3 @@ msgstr "Date Repeat API"
#: date_repeat/date_repeat.info:0
msgid "A Date Repeat API to calculate repeating dates and times from iCal rules."
msgstr "Date Repeat API para calcular fechas y horas repetidas a partir de reglas iCal."
-
diff --git a/date_repeat/translations/date_repeat.fr.po b/date_repeat/translations/date_repeat.fr.po
index a901115..dba5c63 100644
--- a/date_repeat/translations/date_repeat.fr.po
+++ b/date_repeat/translations/date_repeat.fr.po
@@ -193,4 +193,3 @@ msgstr "Date Repeat API"
#: date_repeat/date_repeat.info:0
msgid "A Date Repeat API to calculate repeating dates and times from iCal rules."
msgstr "Une API de Répétition de Date pour calculer les dates et heures se répétant à partir de règles iCal"
-
diff --git a/date_token.inc b/date_token.inc
index c51b3cf..cb8dd1a 100644
--- a/date_token.inc
+++ b/date_token.inc
@@ -27,7 +27,7 @@ function date_token_list($type = 'all') {
$tokens['date']['d'] = t("Date day (one or two digit)");
$tokens['date']['dS'] = t("Date day (one or two digit) with ordinal suffix (st, nd, rd or th)");
$tokens['date']['time'] = t("Time H:i");
-
+
$tokens['date']['to-????'] = t("If the field has a to-date defined, the same tokens exist in the form: [to-????], where ???? is the normal token.");
return $tokens;
@@ -45,7 +45,7 @@ function date_token_values($type, $object = NULL) {
if (!empty($date) && $timezone_db != $timezone) {
date_timezone_set($date, timezone_open($timezone));
}
-
+
$tokens['value'] = $item['value'];
$tokens['view'] = $item['view'];
$tokens['timestamp'] = !empty($date) ? date_format_date($date, 'custom', 'U') : '';
diff --git a/date_tools/date_tools.change_type.inc b/date_tools/date_tools.change_type.inc
index 1b94c8f..0482799 100644
--- a/date_tools/date_tools.change_type.inc
+++ b/date_tools/date_tools.change_type.inc
@@ -13,7 +13,7 @@ function date_tools_change_type_form() {
$fields = content_fields();
$date_options = array();
$type_options = array();
-
+
$labels = array();
foreach (date_field_info() as $type => $info) {
$type_options[$type] = $info['label'] .': '. $info['description'];
@@ -73,11 +73,11 @@ function date_tools_change_type_form_submit($form, &$form_state) {
foreach (date_field_info() as $type => $info) {
$labels[$type] = $info['label'];
}
-
+
// Is there any data in this field? If not, we can
// skip some steps.
$has_data = db_query("SELECT COUNT(*) FROM {". $table ."}")->fetchField();
-
+
// Create a backup copy of the original values.
// The values are going to get corrupted when we
// change the column type.
@@ -85,7 +85,7 @@ function date_tools_change_type_form_submit($form, &$form_state) {
$temp_table = $table .'_temp';
db_query("CREATE TABLE {". $temp_table ."} SELECT * FROM {". $table ."}");
}
-
+
// Change the field definition to the new type.
$field['type'] = $new_type;
require_once('./'. drupal_get_path('module', 'content') .'/includes/content.crud.inc');
@@ -98,16 +98,16 @@ function date_tools_change_type_form_submit($form, &$form_state) {
'@field_name' => $field['widget']['label'], '@old_type' => $labels[$old_type], '@new_type' => $labels[$new_type])));
return;
}
-
+
// Replace old values with modified values, massaging the
// original values as necessary for the new type.
-
+
require_once('./'. drupal_get_path('module', 'date_api') .'/date_api_sql.inc');
$date_handler = new date_sql_handler();
$date_handler->construct();
$date_handler->granularity = $field['granularity'];
$date_handler->date_type = $old_type;
-
+
$new_columns = array();
$old_columns = array('nid', 'vid');
$new_columns[] = $temp_table . '.nid AS nid';
@@ -155,18 +155,18 @@ function date_tools_change_type_form_submit($form, &$form_state) {
break;
}
}
-
+
// Make sure database timezone is set to UTC.
$date_handler->set_db_timezone();
-
+
// Make the replacement.
$sql = 'REPLACE INTO {'. $table .'} ('. implode(', ', $old_columns) .') '.
' SELECT '. implode(', ', $new_columns) .' FROM {'. $temp_table .'}';
db_query($sql);
//dsm($sql);
db_query("DROP TABLE {". $temp_table ."}");
-
+
drupal_set_message(t('The field @field_name has been changed from @old_type to @new_type.', array(
'@field_name' => $field['widget']['label'], '@old_type' => $labels[$old_type], '@new_type' => $labels[$new_type])));
-
+
} \ No newline at end of file
diff --git a/date_tools/date_tools.module b/date_tools/date_tools.module
index b36570b..b3f166e 100644
--- a/date_tools/date_tools.module
+++ b/date_tools/date_tools.module
@@ -11,7 +11,7 @@ function date_tools_help($section, $arg) {
case 'admin/structure/date/change':
return '<p>'. t('Change a date field from one type to another. Very experimental, use at your own risk!') .'</p>';
-
+
case 'admin/structure/date/date_wizard':
$output =
@@ -146,7 +146,7 @@ function date_tools_remove_form(&$form_state, $view_name) {
function date_tools_remove_form_submit($form, &$form_state) {
$form_values = $form_state['values'];
$view_name = $form_values['view_name'];
-
+
if ($view_name && $form_values['confirm']) {
calendar_remove($view_name);
drupal_set_message(t('Removed calendar %calendar. ', array(
diff --git a/date_tools/date_tools.wizard.inc b/date_tools/date_tools.wizard.inc
index 6599024..5052df6 100644
--- a/date_tools/date_tools.wizard.inc
+++ b/date_tools/date_tools.wizard.inc
@@ -2,7 +2,7 @@
// $Id$
function date_tools_wizard_form() {
-
+
$form = array();
$form['type'] = array(
'#type' => 'fieldset',
@@ -111,12 +111,12 @@ function date_tools_wizard_form() {
'#title' => t('Add calendar blocks to the current theme'),
'#access' => module_exists('calendar'),
);
-
+
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Save'),
);
-
+
return $form;
}
@@ -149,18 +149,18 @@ function date_tools_wizard_form_submit(&$form, &$form_state) {
else {
$form_state['redirect'] = 'admin/structure/types/manage/' . str_replace('_', '-', $form_state['values']['bundle']) . '/fields';
}
-
+
}
function date_tools_wizard_build($form_values) {
extract($form_values);
-
+
$field_name = 'field_' . $field_name;
-
+
if (!empty($repeat)) {
$widget_type .= '_repeat';
}
-
+
// Create a node type if it doesn't already exist.
// This makes it possible to add additional date fields to
// an existing type.
@@ -168,7 +168,7 @@ function date_tools_wizard_build($form_values) {
$type_settings = array();
if (!array_key_exists($bundle, $types)) {
date_tools_wizard_create_content_type($name, $bundle, $type_description, $type_settings);
-
+
drupal_set_message(t('Your content type @name has been created.', array('@name' => $name)));
}
else {
@@ -182,7 +182,7 @@ function date_tools_wizard_build($form_values) {
}
$name = $type->name;
}
-
+
$field = array(
'field_name' => $field_name,
'type' => $field_type,
@@ -209,7 +209,7 @@ function date_tools_wizard_build($form_values) {
'increment' => 15,
// The number of years to go back and forward in drop-down year selectors.
'year_range' => !empty($year_range) ? $year_range : '-0:+1',
-
+
'input_format' => date_default_format($widget_type),
'text_parts' => array(),
'label_position' => 'above',
@@ -223,7 +223,7 @@ function date_tools_wizard_build($form_values) {
'default_format' => 'long',
)
);
-
+
$instance['display'] = array(
'default' => array(
'label' => 'above',
@@ -254,14 +254,14 @@ function date_tools_wizard_build($form_values) {
'module' => 'date',
),
);
-
+
$field = field_create_field($field);
$instance = field_create_instance($instance);
-
+
//_field_info_collate_fields(TRUE);
field_info_cache_clear(TRUE);
field_cache_clear(TRUE);
-
+
$view_name = '';
if (!empty($calendar) && module_exists('calendar')) {
$view_name = date_tools_wizard_create_calendar($name, $bundle, $field, $instance);
@@ -276,7 +276,7 @@ function date_tools_wizard_build($form_values) {
drupal_set_message(t('Your date field @name has been created.', array('@name' => $label)));
return $view_name;
-
+
}
function date_tools_wizard_include() {
@@ -310,9 +310,9 @@ function date_tools_wizard_tz_handling() {
}
function date_tools_wizard_create_content_type($name, $bundle, $description, $type_settings = array()) {
-
+
date_tools_wizard_include();
-
+
// Create the content type.
$values = array (
'name' => $name,
@@ -338,7 +338,7 @@ function date_tools_wizard_create_content_type($name, $bundle, $description, $ty
'locked' => '0',
'url_str' => str_replace('_', '-', $bundle),
);
-
+
// Allow overrides of these values.
foreach ($type_settings as $key => $value) {
$values[$key] = $value;
@@ -348,7 +348,7 @@ function date_tools_wizard_create_content_type($name, $bundle, $description, $ty
// Add the body field.
$trim_length = variable_get('teaser_length', 600);
-
+
$field = field_info_field('body');
$instance = array(
'field_name' => 'body',
@@ -382,10 +382,10 @@ function date_tools_wizard_create_content_type($name, $bundle, $description, $ty
}
function date_tools_wizard_create_calendar($name, $bundle, $date_field, $date_instance) {
-
+
$date_name = !empty($date_field) ? $date_field['field_name'] : '';
$path = 'calendar-' . str_replace('field_', '', $date_name);
-
+
// Add a default calendar for this content type.
$calendar_options = variable_get('calendar_default_view_options', array());
if (array_key_exists('calendar_' . $bundle, $calendar_options)) {
@@ -401,7 +401,7 @@ function date_tools_wizard_create_calendar($name, $bundle, $date_field, $date_in
);
$calendar_options['calendar_' . $bundle] = $option;
variable_set('calendar_default_view_options', $calendar_options);
-
+
// Make sure menu items get rebuilt as necessary.
menu_rebuild();
@@ -410,7 +410,7 @@ function date_tools_wizard_create_calendar($name, $bundle, $date_field, $date_in
// Clear the page cache.
cache_clear_all();
-
+
// Remove this view from cache so we can edit it properly.
module_load_include('inc', 'ctools', 'includes/object-cache');
ctools_object_cache_clear('view', 'calendar_' . $bundle);
@@ -424,7 +424,7 @@ function date_tools_wizard_create_calendar($name, $bundle, $date_field, $date_in
function date_tools_wizard_create_blocks($bundle) {
// Add calendar blocks to the default theme.
$current_theme = variable_get('theme_default', 'garland');
-
+
// Legend block.
$block = new stdClass();
$block->theme = $current_theme;
@@ -435,12 +435,12 @@ function date_tools_wizard_create_blocks($bundle) {
$block->module = 'calendar';
$block->delta = 0;
date_tools_wizard_add_block($block);
-
+
// Mini calendar block.
$block->module = 'views';
$block->delta = 'calendar_' . $bundle . '-calendar_block_1';
date_tools_wizard_add_block($block);
-
+
// Upcoming events block.
$block->module = 'views';
$block->delta = 'calendar_' . $bundle . '-block_1';
diff --git a/date_tools/tests/date_tools.test b/date_tools/tests/date_tools.test
index 0fc217e..2289687 100644
--- a/date_tools/tests/date_tools.test
+++ b/date_tools/tests/date_tools.test
@@ -20,7 +20,7 @@ class DateToolsTestCase extends DrupalWebTestCase {
'administer content types', 'administer nodes', 'bypass node access', 'administer date tools'
));
$this->drupalLogin($this->privileged_user);
-
+
variable_set('date_format_long', 'D, m/d/Y - H:i');
}
@@ -82,5 +82,5 @@ class DateToolsTestCase extends DrupalWebTestCase {
$this->drupalPost('admin/structure/date/date_wizard', $edit, t('Save'));
$this->assertText('Your date field Test has been created.', 'Create a date field using the Date Wizard.');
}
-
+
}
diff --git a/date_tools/translations/date_tools.de.po b/date_tools/translations/date_tools.de.po
index ffb2b3c..b7330a8 100644
--- a/date_tools/translations/date_tools.de.po
+++ b/date_tools/translations/date_tools.de.po
@@ -454,4 +454,3 @@ msgstr "Ereignisimport"
#: date_tools/date_tools.module:84
msgid "CSV import"
msgstr "CVS-Import"
-
diff --git a/date_tools/translations/date_tools.es.po b/date_tools/translations/date_tools.es.po
index 125e835..ed07476 100644
--- a/date_tools/translations/date_tools.es.po
+++ b/date_tools/translations/date_tools.es.po
@@ -460,4 +460,3 @@ msgstr "Importación de eventos"
#: date_tools/date_tools.module:84
msgid "CSV import"
msgstr "Importación CSV"
-
diff --git a/date_tools/translations/date_tools.fr.po b/date_tools/translations/date_tools.fr.po
index fff9dab..2b444b1 100644
--- a/date_tools/translations/date_tools.fr.po
+++ b/date_tools/translations/date_tools.fr.po
@@ -489,4 +489,3 @@ msgstr "Import d'Evénement"
#: date_tools/date_tools.module:84
msgid "CSV import"
msgstr "Import CSV"
-
diff --git a/date_views/date_views.module b/date_views/date_views.module
index 09d7a7b..a73fd2d 100644
--- a/date_views/date_views.module
+++ b/date_views/date_views.module
@@ -38,7 +38,6 @@ function date_views_views_fetch_fields($base, $type) {
return views_fetch_fields($base, $type);
}
-
/**
* Implement hook_date_api_tables().
*/
@@ -72,7 +71,7 @@ function date_views_date_views_fields($field) {
// Granularity of this date field's db data.
'granularity' => array('year', 'month', 'day', 'hour', 'minute', 'second'),
);
-
+
switch ($field) {
case 'users.created':
case 'users.access':
@@ -123,11 +122,11 @@ function date_api_views_clear() {
function date_real_url($view, $date_type = NULL, $date_arg = NULL, $force_view_url = FALSE) {
$args = $view->args;
$pos = $view->date_info->date_arg_pos;
-
+
// The View arguments array is indexed numerically but is not necessarily
// in numerical order. Sort the arguments to ensure the correct order.
ksort($args);
-
+
// If there are empty arguments before the date argument,
// pad them with the wildcard so the date argument will be in
// the right position.
@@ -139,7 +138,7 @@ function date_real_url($view, $date_type = NULL, $date_arg = NULL, $force_view_u
$args[] = $argument->options['wildcard'];
}
}
-
+
if (!empty($date_type)) {
switch ($date_type) {
case 'year':
@@ -251,4 +250,3 @@ function date_field_views_data_alter(&$result, $field, $module) {
}
}
}
-
diff --git a/date_views/includes/date_handler_field_multiple.inc b/date_views/includes/date_handler_field_multiple.inc
index 08e4c03..0a5723e 100644
--- a/date_views/includes/date_handler_field_multiple.inc
+++ b/date_views/includes/date_handler_field_multiple.inc
@@ -9,7 +9,7 @@
* field and formatter handling can extend this class.
*/
class date_handler_field_multiple extends views_handler_field_field {
-
+
function option_definition() {
$options = parent::option_definition();
$options['repeat'] = array(
@@ -30,7 +30,7 @@ class date_handler_field_multiple extends views_handler_field_field {
return $options;
}
-
+
/**
* Provide 'group multiple values' option,
* adapted to the needs of the Date module.
@@ -38,7 +38,7 @@ class date_handler_field_multiple extends views_handler_field_field {
function options_form(&$form, &$form_state) {
parent::options_form($form, $form_state);
unset($form['multiple']);
-
+
$field_name = $this->content_field_name;
$field = field_info_field($field_name);
$options = $this->options;
@@ -52,15 +52,15 @@ class date_handler_field_multiple extends views_handler_field_field {
'#description' => t('If unchecked, each item in the field will create a new row, which may appear to cause duplicates. This setting is not compatible with click-sorting in table displays.'),
);
}
-
+
function pre_render($values) {
-
+
// If there are no values to render (displaying a summary, or query returned no results),
// or if this is not a grouped field, do nothing specific.
if (isset($this->view->build_info['summary']) || empty($values) || !$this->defer_query) {
return parent::pre_render($values);
}
-
+
$field_name = $this->content_field_name;
$field = field_info_field($field_name);
$db_info = date_api_database_info($field);
@@ -114,16 +114,16 @@ class date_handler_field_multiple extends views_handler_field_field {
}
function render($values) {
-
+
// By this time $values is a pseudo node that will be passed
// to the theme. Add view information to it.
$values->date_info = !empty($this->view->date_info) ? $this->view->date_info : new stdClass();
$values->date_info->date_handler_fields = date_handler_fields($this->view);
-
+
// Add the formatter settings to the pseudo node.
$values->date_info->formatter_settings = $this->options;
$values->date_info->aliases = $this->aliases;
-
+
// If this is not a grouped field, use content_handler_field::render().
if (!$this->defer_query) {
return parent::render($values);
@@ -143,7 +143,7 @@ class date_handler_field_multiple extends views_handler_field_field {
$node->vid = $values->{$this->aliases['vid']};
$items = $this->field_values[$vid];
$node->$field_name = $items;
-
+
// Some formatters need to behave differently depending on the build_mode
// (for instance: preview), so we provide one.
// TODO This has changed in D7.
@@ -153,7 +153,7 @@ class date_handler_field_multiple extends views_handler_field_field {
$formatter_name = $options['format'];
if ($items && ($formatter = _content_get_formatter($formatter_name, $field['type']))) {
$rendered = array();
-
+
// Multiple values formatter.
$output = content_format($field, $items, $formatter_name, $values);
if (!empty($output)) {
@@ -171,7 +171,7 @@ class date_handler_field_multiple extends views_handler_field_field {
}
return '';
-
+
}
} \ No newline at end of file
diff --git a/date_views/includes/date_navigation_plugin_style.inc b/date_views/includes/date_navigation_plugin_style.inc
index 676a879..1d5a1eb 100644
--- a/date_views/includes/date_navigation_plugin_style.inc
+++ b/date_views/includes/date_navigation_plugin_style.inc
@@ -14,13 +14,13 @@
* value is set to the current date.
*/
class date_navigation_plugin_style extends views_plugin_style {
-
+
/**
* Style validation.
*/
function validate() {
$errors = parent::validate();
-
+
$arguments = $this->display->handler->get_option('arguments');
$count = 0;
$found = FALSE;
@@ -41,10 +41,10 @@ class date_navigation_plugin_style extends views_plugin_style {
}
return $errors;
}
-
+
function query() {
module_load_include('inc', 'date_api', 'date_api_sql');
-
+
// Bring the argument information into the view so our theme can access it.
$i = 0;
foreach ($this->view->argument as $id => $argument) {
@@ -62,9 +62,9 @@ class date_navigation_plugin_style extends views_plugin_style {
}
$i++;
}
-
+
// bring the node type into the query so we can use it in the theme
$this->view->query->add_field('node', 'type');
-
+
}
}
diff --git a/date_views/includes/date_views.views.inc b/date_views/includes/date_views.views.inc
index 25b4c53..a5b0cfe 100644
--- a/date_views/includes/date_views.views.inc
+++ b/date_views/includes/date_views.views.inc
@@ -36,7 +36,7 @@ function date_views_views_plugins() {
$path = drupal_get_path('module', 'date_views');
$views_path = drupal_get_path('module', 'views');
module_load_include('inc', 'date_views', 'theme/theme');
-
+
return array(
'module' => 'date_views', // This just tells our themes are elsewhere.
'display' => array(
@@ -88,9 +88,9 @@ function date_views_views_plugins() {
*/
function date_views_views_data() {
$data = array();
-
+
$tables = module_invoke_all('date_views_tables');
-
+
foreach ($tables as $base_table) {
// The flexible date argument.
$data[$base_table]['date_argument'] = array(
@@ -115,7 +115,7 @@ function date_views_views_data() {
),
);
}
-
+
return $data;
}
@@ -126,7 +126,7 @@ function date_views_fields($base = 'node', $reset = FALSE) {
static $fields = array();
$empty = array('name' => array(), 'alias' => array());
module_load_include('inc', 'date_views', 'includes/date_views_fields');
-
+
if (empty($fields[$base]) || $reset) {
$cid = 'date_views_fields_' . $base;
if (!$reset && $cached = cache_get($cid, 'cache_views')) {
diff --git a/date_views/includes/date_views.views_default.inc b/date_views/includes/date_views.views_default.inc
index 6c5975d..1984da0 100644
--- a/date_views/includes/date_views.views_default.inc
+++ b/date_views/includes/date_views.views_default.inc
@@ -10,7 +10,7 @@
* Implementation of hook_views_default_views().
*/
function date_views_views_default_views() {
-
+
$view = new view;
$view->name = 'date_browser';
$view->description = 'Browse through nodes by year, month, day, or week. Date browser attachment adds back/next navigation to the top of the page.';
@@ -98,7 +98,6 @@ $handler->override_option('displays', array(
'default' => 0,
));
-
$views[$view->name] = $view;
return $views;
} \ No newline at end of file
diff --git a/date_views/includes/date_views_argument_handler.inc b/date_views/includes/date_views_argument_handler.inc
index 862b3de..1c08b7d 100644
--- a/date_views/includes/date_views_argument_handler.inc
+++ b/date_views/includes/date_views_argument_handler.inc
@@ -13,7 +13,7 @@ class date_views_argument_handler extends views_handler_argument_date {
function construct() {
parent::construct();
module_load_include('inc', 'date_api', 'date_api_sql');
-
+
$this->date_handler = new date_sql_handler();
$this->date_handler->construct();
@@ -28,15 +28,15 @@ class date_views_argument_handler extends views_handler_argument_date {
// Identify the type of display we're using.
$this->display_handler = $view->display_handler->definition['handler'];
-
+
// Add a date handler to the display.
$date_handler = $this->date_handler;
$date_handler->granularity = $this->options['granularity'];
$this->format = $date_handler->views_formats($date_handler->granularity, 'display');
$this->sql_format = $date_handler->views_formats($date_handler->granularity, 'sql');
-
+
if (empty($this->view->date_info)) $this->view->date_info = new stdClass();
-
+
// Set the view range, do this only if not already set in case there are multiple date arguments.
if (empty($this->view->date_info->min_allowed_year)) {
$range = date_range_years($this->options['year_range']);
@@ -90,13 +90,13 @@ class date_views_argument_handler extends views_handler_argument_date {
foreach ($fields['name'] as $name => $field) {
$options[$name] = $field['label'];
}
-
+
// If this argument was added as a CCK field argument and no other date field
// has been chosen, update the default with the right date.
if (empty($this->options['date_fields']) && $this->field != 'date_argument') {
$this->options['date_fields'] = array($this->table .'.'. $this->field);
}
-
+
$form['date_fields'] = array(
'#title' => t('Date field(s)'),
'#type' => 'checkboxes',
@@ -112,13 +112,13 @@ class date_views_argument_handler extends views_handler_argument_date {
'#default_value' => $this->options['date_method'],
'#description' => t('Method of handling multiple date fields in the same query. Return items that have any matching date field (date = field_1 OR field_2), or only those with matches in all selected date fields (date = field_1 AND field_2). '),
);
-
+
}
-
+
function options_validate(&$form, &$form_state) {
// It is very important to call the parent function here:
parent::options_validate($form, $form_state);
-
+
if ($form_state['values']['form_id'] == 'views_ui_config_item_form') {
$check_fields = array_filter($form_state['values']['options']['date_fields']);
if (empty($check_fields)) {
@@ -129,16 +129,16 @@ class date_views_argument_handler extends views_handler_argument_date {
}
}
}
-
+
function options_submit(&$form, &$form_state) {
// It is very important to call the parent function here:
parent::options_submit($form, $form_state);
-
+
if ($form_state['values']['form_id'] == 'views_ui_config_item_form') {
$form_state['values']['options']['date_fields'] = array_filter($form_state['values']['options']['date_fields']);
}
}
-
+
// Update the summary values to show selected granularity.
function admin_summary() {
$fields = date_views_fields($this->view->base_table);
@@ -153,7 +153,7 @@ class date_views_argument_handler extends views_handler_argument_date {
return parent::admin_summary();
}
}
-
+
/**
* Set the empty argument value to the current date,
* formatted appropriately for this argument.
@@ -174,7 +174,7 @@ class date_views_argument_handler extends views_handler_argument_date {
return parent::get_default_argument($raw);
}
}
-
+
function format() {
if (!empty($this->options['granularity'])) {
$date_handler = new date_sql_handler();
@@ -184,7 +184,7 @@ class date_views_argument_handler extends views_handler_argument_date {
return !empty($this->options[$this->option_name]) ? $this->options[$this->option_name] : 'Y-m';
}
}
-
+
/**
* Provide a link to the next level of the view from the summary.
*/
@@ -209,7 +209,7 @@ class date_views_argument_handler extends views_handler_argument_date {
$range = $this->date_handler->arg_range($value);
return date_format_date($range[0], 'custom', $format);
}
-
+
/**
* Provide a link to the next level of the view from the argument.
*/
@@ -227,25 +227,25 @@ class date_views_argument_handler extends views_handler_argument_date {
*/
function summary_query() {
$this->get_query_fields();
-
+
// No way to do summaries on more than one field at a time.
if (count($this->query_fields) > 1) {
return;
}
-
+
$field = $this->query_fields[0]['field'];
$date_handler = $this->query_fields[0]['date_handler'];
-
+
// Get the SQL format for this granularity, like Y-m,
// and use that as the grouping value.
$format = $date_handler->views_formats($this->options['granularity'], 'sql');
$this->formula = $date_handler->sql_format($format, $date_handler->sql_field($field['fullname']));
-
+
// Add the computed field.
$this->base_alias = $this->name_alias = $this->query->add_field(NULL, $this->formula, $field['query_name']);
$this->query->set_count_field(NULL, $this->formula, $field['query_name']);
return $this->summary_basics(FALSE);
-
+
}
function get_query_fields() {
@@ -266,7 +266,7 @@ class date_views_argument_handler extends views_handler_argument_date {
}
}
}
-
+
/**
* Make sure the date field is added to the query.
*
@@ -283,7 +283,7 @@ class date_views_argument_handler extends views_handler_argument_date {
}
}
}
-
+
/**
* Set up the query for this argument.
*
@@ -317,7 +317,7 @@ class date_views_argument_handler extends views_handler_argument_date {
}
}
$parts = $this->date_handler->arg_parts($this->argument);
-
+
foreach ($parts as $type) {
foreach ($type as $part) {
foreach ($part as $key => $value) {
diff --git a/date_views/includes/date_views_fields.inc b/date_views/includes/date_views_fields.inc
index 428f3ad..7bd6e43 100644
--- a/date_views/includes/date_views_fields.inc
+++ b/date_views/includes/date_views_fields.inc
@@ -16,12 +16,12 @@
* the hook_date_api_fields() for the core date fields.
*/
function _date_views_fields($base = 'node') {
-
+
// Make sure $base is never empty.
if (empty($base)) {
$base = 'node';
}
-
+
$cid = 'date_api_fields_' . $base;
cache_clear_all($cid, 'cache_views');
$all_fields = date_views_views_fetch_fields($base, 'field');
@@ -29,7 +29,7 @@ function _date_views_fields($base = 'node') {
// Iterate over all the fields that Views knows about.
$fields = array();
foreach ((array) $all_fields as $alias => $val) {
-
+
// Set up some default values.
$granularity = array('year', 'month', 'day', 'hour', 'minute');
$tz_handling = 'site';
@@ -40,28 +40,28 @@ function _date_views_fields($base = 'node') {
$delta_field = '';
$sql_type = DATE_UNIX;
$type = '';
-
+
$name = $alias;
$tmp = explode('.', $name);
$field_name = $tmp[1];
$table_name = $tmp[0];
-
+
$fromto = array(str_replace('.', '_', $name), str_replace('.', '_', $name));
-
+
// If we don't have a field handler, we don't need to do anything more.
if (!$handler = views_get_handler($table_name, $field_name, 'field')) {
continue;
}
-
+
$handler_name = $handler->definition['handler'];
-
+
// For Field module fields, get the date type.
$custom = array();
if ($field_name == 'entity_id') {
-
+
$field_name = $content_fields[$table_name]['entity_id']['field']['field_name'];
$field = field_info_field($field_name);
-
+
switch ($field['type']) {
case 'date':
$type = 'cck_string';
@@ -79,16 +79,16 @@ function _date_views_fields($base = 'node') {
// If this is not a date field, nothing more to do.
continue;
}
-
+
$db_info = date_api_database_info($field);
$name = $table_name . "." . $field_name . "_value";
$granularity = !empty($field['granularity']) ? $field['granularity'] : array('year', 'month', 'day', 'hour', 'minute');
-
+
$fromto = array(
$table_name . '_' . $db_info['columns'][$table_name]['value'],
$table_name . '_' . (!empty($field['settings']['todate']) ? $db_info['columns'][$table_name]['value2'] : $db_info['columns'][$table_name]['value']),
);
-
+
if (isset($field['settings']['tz_handling'])) {
$tz_handling = $field['settings']['tz_handling'];
$db_info = date_api_database_info($field);
@@ -116,7 +116,7 @@ function _date_views_fields($base = 'node') {
$delta_field = $table_name . '_delta';
}
}
-
+
// Allow custom modules to provide date fields.
// The instanceof function makes this work for any handler
// that was derived from 'views_handler_field_date' .
@@ -132,7 +132,7 @@ function _date_views_fields($base = 'node') {
// Don't do anything if this is not a date field we can handle.
if (!empty($type)) {
-
+
$alias = str_replace('.', '_', $alias);
$fields['name'][$name] = array(
'type' => $type,
@@ -151,7 +151,7 @@ function _date_views_fields($base = 'node') {
'related_fields' => $related_fields,
'delta_field' => $delta_field,
);
-
+
// Allow the custom fields to over-write values.
if (!empty($custom)) {
foreach ($custom as $key => $val) {
@@ -159,18 +159,18 @@ function _date_views_fields($base = 'node') {
}
}
$fields['name'][$name]['real_field_name'] = $field_name == 'entity_id' ? $real_field_name : $field_name;
-
+
// The D7 field handling is funny, there is only a single record
// with a field name of 'entity_id'. We need the real names for our queries.
// Fields also need an extra record so we have both from and to values.
-
+
if (strstr($alias, 'entity_id')) {
$field_name .= '_value';
$fields['name'][$name]['field_name'] = $field_name;
$alias = $table_name .'_'. $field_name;
$fields['name'][$name]['query_name'] = $alias;
$fields['alias'][$alias] = $fields['name'][$name];
-
+
if (!empty($field['settings']['todate'])) {
$fields['name'][$name]['label'] .= ' value';
$name2 = str_replace('value', 'value2', $name);
diff --git a/date_views/includes/date_views_filter_handler.inc b/date_views/includes/date_views_filter_handler.inc
index be10d77..c3d59ae 100644
--- a/date_views/includes/date_views_filter_handler.inc
+++ b/date_views/includes/date_views_filter_handler.inc
@@ -1,6 +1,5 @@
<?php
// $Id$
-
/**
* @file
* A flexible, configurable date filter.
@@ -23,7 +22,7 @@ class date_views_filter_handler extends views_handler_filter_numeric {
function construct() {
parent::construct();
module_load_include('inc', 'date_api', 'date_api_sql');
-
+
$this->date_handler = new date_sql_handler();
$this->date_handler->construct();
$this->date_handler->granularity = $this->options['granularity'];
@@ -36,9 +35,9 @@ class date_views_filter_handler extends views_handler_filter_numeric {
$handler = $this->date_handler;
$handler->granularity = isset($options['granularity']) ? $options['granularity'] : 'day';
$handler->adjustment_field = isset($options['adjustment_field']) ? $options['adjustment_field'] : 0;
-
+
if (empty($this->view->date_info)) $this->view->date_info = new stdClass();
-
+
// Set the view range, do this only if not already set in case there are multiple date arguments.
if (empty($this->view->date_info->min_allowed_year)) {
$range = date_range_years($this->options['year_range']);
@@ -50,7 +49,7 @@ class date_views_filter_handler extends views_handler_filter_numeric {
}
$this->view->date_info->date_fields = array_merge($this->view->date_info->date_fields, $this->options['date_fields']);
$this->definition['allow empty'] = TRUE;
-
+
// If no value has been submitted on an exposed filter it is treated as
// a submitted value. Send a flag to the date widget processors so they
// know to set #default_value instead of 'input' in that case.
@@ -104,7 +103,7 @@ class date_views_filter_handler extends views_handler_filter_numeric {
}
return $year_range;
}
-
+
function extra_options_form(&$form, &$form_state) {
parent::extra_options_form($form, $form_state);
$form['form_type'] = array(
@@ -114,10 +113,10 @@ class date_views_filter_handler extends views_handler_filter_numeric {
'#options' => $this->widget_options(),
'#description' => t('Choose the form element to use for date selection.'),
);
-
+
$form['granularity'] = $this->date_handler->granularity_form($this->options['granularity']);
$form['granularity']['#description'] = '<p>' . t("Select a granularity for the date filter. For instance, selecting 'day' will create a filter where users can select the year, month, and day.") . '</p>';
-
+
$form['year_range'] = array(
'#title' => t('Date year range'),
'#type' => 'textfield',
@@ -129,13 +128,13 @@ class date_views_filter_handler extends views_handler_filter_numeric {
foreach ($fields['name'] as $name => $field) {
$options[$name] = $field['label'];
}
-
+
// If this filter was added as a CCK field filter and no other date field
// has been chosen, update the default with the right date.
if (empty($this->options['date_fields']) && $this->field != 'date_filter') {
$this->options['date_fields'] = array($this->table .'.'. $this->field);
}
-
+
$form['date_fields'] = array(
'#title' => t('Date field(s)'),
'#type' => 'checkboxes',
@@ -153,9 +152,9 @@ class date_views_filter_handler extends views_handler_filter_numeric {
'#description' => t('Method of handling multiple date fields in the same query. Return items that have any matching date field (date = field_1 OR field_2), or only those with matches in all selected date fields (date = field_1 AND field_2).'),
);
}
-
+
function extra_options_validate($form, &$form_state) {
-
+
$check_fields = array_filter($form_state['values']['options']['date_fields']);
if (empty($check_fields)) {
form_error($form['date_fields'], t('You must select at least one date field for this filter.'));
@@ -164,11 +163,11 @@ class date_views_filter_handler extends views_handler_filter_numeric {
form_error($form['year_range'], t('Date year range must be in the format -9:+9, 2005:2010, -9:2010, or 2005:+9'));
}
}
-
+
function extra_options_submit($form, &$form_state) {
$form_state['values']['options']['date_fields'] = array_filter($form_state['values']['options']['date_fields']);
}
-
+
/**
* Add the selectors to the value form using the date handler.
*/
@@ -177,7 +176,7 @@ class date_views_filter_handler extends views_handler_filter_numeric {
// construct our own form element.
$form['value'] = array();
$form['value']['#tree'] = TRUE;
-
+
// We have to make some choices when creating this as an exposed
// filter form. For example, if the operator is locked and thus
// not rendered, we can't render dependencies; instead we only
@@ -201,7 +200,7 @@ class date_views_filter_handler extends views_handler_filter_numeric {
}
$handler = $this->date_handler;
-
+
if ($which == 'all' || $which == 'value') {
$form['value'] += $this->date_parts_form($form_state, 'value', $source, $which, $this->operator_values(1), $identifier);
if ($this->force_value) {
@@ -244,7 +243,7 @@ class date_views_filter_handler extends views_handler_filter_numeric {
}
//$form['value']['#theme'] = 'date_views_filter_form';
-
+
}
/**
@@ -277,21 +276,21 @@ class date_views_filter_handler extends views_handler_filter_numeric {
$name = '';
break;
}
-
+
$type = $this->options['form_type'];
if ($type == 'date_popup' && !module_exists('date_popup')) {
$type = 'date_text';
}
-
+
$format = $this->date_handler->views_formats($this->options['granularity'], 'sql');
$granularity = array_keys($this->date_handler->date_parts($this->options['granularity']));
-
+
// Don't set a default date in the UI, only in the exposed form.
$default_date = '';
if (!empty($form_state['exposed'])) {
$default_date = $this->default_value($prefix);
}
-
+
$id = !empty($form_state['exposed']) ? 'edit-date-filter-' . $prefix : 'edit-options-value-' . $prefix;
$form[$prefix] = array(
@@ -341,7 +340,7 @@ class date_views_filter_handler extends views_handler_filter_numeric {
}
return $default_date;
}
-
+
/**
* Value validation.
*
@@ -372,7 +371,7 @@ class date_views_filter_handler extends views_handler_filter_numeric {
return t('Missing date fields!');
}
$handler = $this->date_handler;
-
+
$fields = date_views_fields($this->view->base_table);
if (!empty($this->options['date_fields'])) {
$output = array();
@@ -401,7 +400,7 @@ class date_views_filter_handler extends views_handler_filter_numeric {
}
return $output;
}
-
+
// Views treats the form as though it has already been submitted
// even when it hasn't, so we when it is really not submitted we
// have to adjust the values to match what should have been the default.
@@ -416,7 +415,7 @@ class date_views_filter_handler extends views_handler_filter_numeric {
$form_state['values'][$this->options['expose']['identifier']] = $default;
}
}
-
+
/**
* Custom implementation of query() so we can get the
* AND and OR methods in the right places.
@@ -424,7 +423,7 @@ class date_views_filter_handler extends views_handler_filter_numeric {
function query() {
$this->ensure_my_table();
$this->get_query_fields();
-
+
// If we don't add a dummy where clause and there is no other filter defined for this view,
// Views will dump in an invalid WHERE () in addition to our custom filters, so give it a valid value.
// @TODO This is probably the wrong way to solve this problem.
@@ -466,7 +465,7 @@ class date_views_filter_handler extends views_handler_filter_numeric {
}
}
}
-
+
function date_filter($prefix, $query_field, $operator) {
$field = $query_field['field'];
@@ -482,7 +481,7 @@ class date_views_filter_handler extends views_handler_filter_numeric {
// so we when it is really not submitted we have to adjust the
// query to match what should have been the default.
$value_parts = !is_array($this->value[$prefix]) ? array($this->value[$prefix]) : $this->value[$prefix];
-
+
foreach ($value_parts as $part) {
$default = $this->default_value($prefix);
if (!empty($this->force_value) && !empty($default)) {
@@ -494,7 +493,7 @@ class date_views_filter_handler extends views_handler_filter_numeric {
}
}
}
-
+
$granularity = $this->options['granularity'];
$date_handler = $query_field['date_handler'];
$date = date_now();
@@ -521,10 +520,10 @@ class date_views_filter_handler extends views_handler_filter_numeric {
break;
}
}
-
+
$min_date = $range[0];
$max_date = $range[1];
-
+
$this->min_date = $min_date;
$this->max_date = $max_date;
$this->year = date_format($date, 'Y');
@@ -532,7 +531,7 @@ class date_views_filter_handler extends views_handler_filter_numeric {
$this->day = date_format($date, 'j');
$this->week = date_week(date_format($date, DATE_FORMAT_DATE));
$this->date_handler = $date_handler;
-
+
if ($this->date_handler->granularity == 'week') {
$this->format = DATE_FORMAT_DATETIME;
}
@@ -555,7 +554,7 @@ class date_views_filter_handler extends views_handler_filter_numeric {
}
return $sql;
}
-
+
function get_query_fields() {
$fields = date_views_fields($this->view->base_table);
$fields = $fields['name'];
diff --git a/date_views/theme/theme.inc b/date_views/theme/theme.inc
index d1c965c..fa4a141 100644
--- a/date_views/theme/theme.inc
+++ b/date_views/theme/theme.inc
@@ -16,7 +16,7 @@ function template_preprocess_date_navigation(&$vars) {
$pos = $view->date_info->date_arg_pos;
$min_date = is_object($view->date_info->min_date) ? $view->date_info->min_date : date_now();
$max_date = is_object($view->date_info->max_date) ? $view->date_info->max_date : date_now();
-
+
if (empty($view->date_info->hide_nav)) {
$prev_date = clone($min_date);
date_modify($prev_date, '-1 ' . $view->date_info->granularity);
@@ -49,7 +49,7 @@ function template_preprocess_date_navigation(&$vars) {
$vars['prev_url'] = '';
$vars['next_options'] = $vars['prev_options'] = array();
}
-
+
// Check whether navigation links would point to
// a date outside the allowed range.
if (!empty($next_date) && !empty($vars['next_url']) && date_format($next_date, 'Y') > $view->date_info->max_allowed_year) {
@@ -85,11 +85,11 @@ function template_preprocess_date_navigation(&$vars) {
}
$vars['prev_options']['attributes'] += array('title' => $prev_title);
$vars['next_options']['attributes'] += array('title' => $next_title);
-
+
// Add nofollow for next/prev links.
$vars['prev_options']['attributes'] += array('rel' => 'nofollow');
$vars['next_options']['attributes'] += array('rel' => 'nofollow');
-
+
$link = FALSE;
// Month navigation titles are used as links in the block view.
if (!empty($view->date_info->block) && $view->date_info->granularity == 'month') {
@@ -181,12 +181,12 @@ function theme_date_nav_title($params) {
*
*/
function template_preprocess_date_vcalendar(&$vars) {
-
+
$vars['current_date'] = date_format(date_now(), DATE_FORMAT_ICAL);
$vars['current_date_utc'] = date_format(date_now('UTC'), DATE_FORMAT_ICAL);
$vars['site_timezone'] = date_default_timezone();
$vars['calname'] = date_ical_escape_text(!empty($vars['calname']) ? $vars['calname'] : variable_get('site_name', ''));
-
+
// Format the event results as iCal expects.
$events_in = $vars['events'];
$events = array();
@@ -216,7 +216,7 @@ function template_preprocess_date_vcalendar(&$vars) {
$event[trim($key)] = trim($value);
}
}
-
+
// Escape text values.
foreach ($event as $key => $value) {
if ($key == 'alarm') {
@@ -232,7 +232,7 @@ function template_preprocess_date_vcalendar(&$vars) {
}
}
}
-
+
$vars['events'] = $events;
}
diff --git a/help/date-argument.html b/help/date-argument.html
index 1da0dbc..aea7f0e 100644
--- a/help/date-argument.html
+++ b/help/date-argument.html
@@ -1,15 +1,15 @@
<p>The generic date argument is based on ISO 8601 date duration and time interval standards, and allows you to create an flexible argument for any date range for any date field.
</p><p>The argument expects a value like 2006-01-01--2006-01-15, or 2006-W24, or @P1W. Separate from and to dates or date and period with a double hyphen (--)
-
+
</p><p>From and to dates in argument are ISO dates, but can be shortened and missing parts will be added. Omitted parts of ISO dates will be assumed to be the first possible (for the from date) or the last possible (for the to date) value in that time period.
-
+
</p><p>The 'to' portion of the argument can be eliminated if it is the same as the 'from' portion Use @ instead of a date to substitute in the current date and time.
-
+
</p><p>Shortcuts are available:
-
+
</p><p>Use periods (P1H, P1D, P1W, P1M, P1Y) to get next hour/day/week/month/year from now. Use date before P sign to get next hour/day/week/month/year from that date. The ISO standard calls for a separator (--) between a date and the P, but the separator is optional between a start date and a period in this argument to make the result easier to read.
-
+
</p><p>Use format like 2006-W24 to find ISO week number 24 in year 2006.</p>
<h3>Examples:</h3>
<table border="1">
diff --git a/help/date-filter.html b/help/date-filter.html
index 54c82f6..407fdd5 100644
--- a/help/date-filter.html
+++ b/help/date-filter.html
@@ -1,2 +1 @@
<p>The Date API provides a generic Date filter that can filter on any Views date field.</p>
-
diff --git a/help/date-views-dates.html b/help/date-views-dates.html
index 2005422..90ce0ab 100644
--- a/help/date-views-dates.html
+++ b/help/date-views-dates.html
@@ -26,7 +26,7 @@ function date_views_date_views_fields($field) {
// Granularity of this date field's db data.
'granularity' => array('year', 'month', 'day', 'hour', 'minute', 'second'),
);
-
+
switch ($field) {
case 'users.created':
case 'users.access':
diff --git a/help/form-elements.html b/help/form-elements.html
index de80944..6c61289 100644
--- a/help/form-elements.html
+++ b/help/form-elements.html
@@ -24,7 +24,7 @@ function mymodule_form($form_state) {
// If you're using a date_select, the format will control the order of the date parts in the selector,
// rearrange them any way you like. Parts left out of the format will not be displayed to the user.
$format = 'Y-m-d H:i';
-
+
$form['date2'] = array(
'#type' => 'date_select', // types 'date_text' and 'date_timezone' are also supported. See .inc file.
'#title' => 'select a date',
diff --git a/help/overview.html b/help/overview.html
index 71b06c3..4f4646f 100644
--- a/help/overview.html
+++ b/help/overview.html
@@ -1,5 +1,2 @@
<p>The <a href="http://drupal.org/project/date">date module</a> defines a highly configurable date/time field type for the content module and a date API that can be used by other applications.
</p>
-
-
-
diff --git a/tests/README.txt b/tests/README.txt
index 57ebe26..57c11f4 100644
--- a/tests/README.txt
+++ b/tests/README.txt
@@ -9,9 +9,8 @@ or Parser CVS and import these files into a date field.
This file uses the csv export format from Yahoo Calendar, similar to the
format created by Outlook's csv export. The sample contains both timed
and untimed 'All day' events.
-
+
- USHolidays.ics:
An ical export of US Holidays in the 'All day' format used by
Microsoft and Apple (where the Start date is the date of the event
and the End date is the following day).
- \ No newline at end of file
diff --git a/tests/date.test b/tests/date.test
index 6b96cd8..4ebe6a9 100644
--- a/tests/date.test
+++ b/tests/date.test
@@ -20,7 +20,7 @@ class DateUITestCase extends DrupalWebTestCase {
'administer content types', 'administer nodes', 'bypass node access', 'administer date tools'
));
$this->drupalLogin($this->privileged_user);
-
+
variable_set('date_format_long', 'D, m/d/Y - H:i');
}
diff --git a/tests/date_api.test b/tests/date_api.test
index 791cdf5..e617907 100644
--- a/tests/date_api.test
+++ b/tests/date_api.test
@@ -11,7 +11,7 @@ class DateAPITestCase extends DrupalWebTestCase {
'group' => t('Date'),
);
}
-
+
public function setUp() {
// Load the date_api module.
parent::setUp('date_api');
@@ -66,7 +66,7 @@ class DateAPITestCase extends DrupalWebTestCase {
$php_format = date_format(date_now(), $formatter);
$this->assertEqual($date_api_format, $php_format, 'Test that the "' . $formatter . '" formatter is formatted correctly by date_format_date()');
}
-
+
// Test the order of the weeks days for a calendar that starts on Monday and one that starts on Sunday.
variable_set('date_first_day', 1);
$expected = array ( 0 => t('Mon'), 1 => t('Tue'), 2 => t('Wed'), 3 => t('Thu'), 4 => t('Fri'), 5 => t('Sat'), 6 => t('Sun'), );
@@ -84,7 +84,7 @@ class DateAPITestCase extends DrupalWebTestCase {
$expected = 29;
$value = date_days_in_month(2004, 2);
$this->assertEqual($expected, $value, "Test date_days_in_month(2, 2004): should be $expected, found $value.");
-
+
// Test days in year for a leap year and a non-leap year.
$expected = 365;
$value = date_days_in_year('2005-06-01 00:00:00');
@@ -100,7 +100,7 @@ class DateAPITestCase extends DrupalWebTestCase {
$expected = 53;
$value = date_iso_weeks_in_year('2009-06-01 00:00:00');
$this->assertEqual($expected, $value, "Test date_iso_weeks_in_year(2009-06-01): should be $expected, found $value.");
-
+
// Test day of week for March 1, the day after leap day.
$expected = 6;
$value = date_day_of_week('2008-03-01 00:00:00');
@@ -141,7 +141,7 @@ class DateAPITestCase extends DrupalWebTestCase {
$value = $result[0]->format(DATE_FORMAT_DATE) .' to '. $result[1]->format(DATE_FORMAT_DATE);
$this->assertEqual($expected, $value, "Test ISO date_week_range(5, 2009): should be $expected, found $value.");
variable_set('date_api_use_iso8601', FALSE);
-
+
// Find calendar week for a date.
variable_set('date_first_day', 0);
$expected = '09';
@@ -150,7 +150,7 @@ class DateAPITestCase extends DrupalWebTestCase {
$expected = '10';
$value = date_week('2009-03-01');
$this->assertEqual($expected, $value, "Test date_week(2009-03-01): should be $expected, found $value.");
-
+
// Create date object from datetime string.
$input = '2009-03-07 10:30';
$timezone = 'America/Chicago';
@@ -166,7 +166,7 @@ class DateAPITestCase extends DrupalWebTestCase {
$value = $date->format('c');
$expected = '2009-06-07T10:30:00-05:00';
$this->assertEqual($expected, $value, "Test new dateObject($input, $timezone): should be $expected, found $value.");
-
+
// Create date object from date string.
$input = '2009-03-07';
$timezone = 'America/Chicago';
@@ -209,27 +209,27 @@ class DateAPITestCase extends DrupalWebTestCase {
$value = $date->format('c');
$expected = '1970-01-01T00:00:00+00:00';
$this->assertEqual($expected, $value, "Test new dateObject($input, $timezone): should be $expected, found $value.");
-
+
$expected = 'UTC';
$value = $date->getTimeZone()->getName();
$this->assertEqual($expected, $value, "The current timezone is $value: should be $expected.");
$expected = 0;
$value = $date->getOffset();
$this->assertEqual($expected, $value, "The current offset is $value: should be $expected.");
-
+
$timezone = 'America/Los_Angeles';
$date->setTimezone(new DateTimeZone($timezone));
$value = $date->format('c');
$expected = '1969-12-31T16:00:00-08:00';
$this->assertEqual($expected, $value, "Test \$date->setTimezone(new DateTimeZone($timezone)): should be $expected, found $value.");
-
+
$expected = 'America/Los_Angeles';
$value = $date->getTimeZone()->getName();
$this->assertEqual($expected, $value, "The current timezone should be $expected, found $value.");
$expected = '-28800';
$value = $date->getOffset();
$this->assertEqual($expected, $value, "The current offset should be $expected, found $value.");
-
+
// Convert the local version of a timestamp to UTC.
$input = 0;
$timezone = 'America/Los_Angeles';
@@ -251,14 +251,14 @@ class DateAPITestCase extends DrupalWebTestCase {
$value = $date->format('c');
$expected = '1970-01-01T00:00:00+00:00';
$this->assertEqual($expected, $value, "Test \$date->setTimezone(new DateTimeZone($timezone)): should be $expected, found $value.");
-
+
$expected = 'UTC';
$value = $date->getTimeZone()->getName();
$this->assertEqual($expected, $value, "The current timezone should be $expected, found $value.");
$expected = '0';
$value = $date->getOffset();
$this->assertEqual($expected, $value, "The current offset should be $expected, found $value.");
-
+
// Create date object from datetime string and convert it to a local date.
$input = '1970-01-01 00:00:00';
$timezone = 'UTC';
@@ -266,27 +266,27 @@ class DateAPITestCase extends DrupalWebTestCase {
$value = $date->format('c');
$expected = '1970-01-01T00:00:00+00:00';
$this->assertEqual($expected, $value, "Test new dateObject('$input', '$timezone'): should be $expected, found $value.");
-
+
$expected = 'UTC';
$value = $date->getTimeZone()->getName();
$this->assertEqual($expected, $value, "The current timezone is $value: should be $expected.");
$expected = 0;
$value = $date->getOffset();
$this->assertEqual($expected, $value, "The current offset is $value: should be $expected.");
-
+
$timezone = 'America/Los_Angeles';
$date->setTimezone(new DateTimeZone($timezone));
$value = $date->format('c');
$expected = '1969-12-31T16:00:00-08:00';
$this->assertEqual($expected, $value, "Test \$date->setTimezone(new DateTimeZone($timezone)): should be $expected, found $value.");
-
+
$expected = 'America/Los_Angeles';
$value = $date->getTimeZone()->getName();
$this->assertEqual($expected, $value, "The current timezone should be $expected, found $value.");
$expected = '-28800';
$value = $date->getOffset();
$this->assertEqual($expected, $value, "The current offset should be $expected, found $value.");
-
+
// Convert the local version of a datetime string to UTC.
$input = '1969-12-31 16:00:00';
$timezone = 'America/Los_Angeles';
@@ -308,14 +308,14 @@ class DateAPITestCase extends DrupalWebTestCase {
$value = $date->format('c');
$expected = '1970-01-01T00:00:00+00:00';
$this->assertEqual($expected, $value, "Test \$date->setTimezone(new DateTimeZone($timezone)): should be $expected, found $value.");
-
+
$expected = 'UTC';
$value = $date->getTimeZone()->getName();
$this->assertEqual($expected, $value, "The current timezone should be $expected, found $value.");
$expected = '0';
$value = $date->getOffset();
$this->assertEqual($expected, $value, "The current offset should be $expected, found $value.");
-
+
// Create year-only date.
$input = '2009';
$timezone = NULL;
@@ -353,7 +353,7 @@ class DateAPITestCase extends DrupalWebTestCase {
$this->assertEqual($expected, $value, "Test new dateObject($input, $timezone, $format): should be $expected, found $value.");
}
-
+
public function tearDown() {
variable_del('date_first_day');
variable_del('date_api_use_iso8601');
diff --git a/tests/date_field.test b/tests/date_field.test
index f841454..2db0586 100644
--- a/tests/date_field.test
+++ b/tests/date_field.test
@@ -20,7 +20,7 @@ class DateFieldTestCase extends DrupalWebTestCase {
'administer content types', 'administer nodes', 'bypass node access', 'administer date tools'
));
$this->drupalLogin($this->privileged_user);
-
+
variable_set('date_format_long', 'D, m/d/Y - H:i');
module_load_include('inc', 'node', 'content_types');
@@ -36,11 +36,11 @@ class DateFieldTestCase extends DrupalWebTestCase {
$edit['type'] = 'story';
$this->drupalPost('admin/structure/types/add', $edit, t('Save content type'));
$this->assertText('The content type Story has been added.', 'Content type added.');
-
+
// Create a date field with simple values.
$values = array('label' => 'Test', 'widget_type' => 'date_select');
$this->createDateField($values);
-
+
// Create a node with this field.
$edit = array();
$this->dateForm('select');
@@ -86,7 +86,6 @@ class DateFieldTestCase extends DrupalWebTestCase {
$this->assertText($shouldbe, "Found the correct date for a datetime field using the $options widget.");
}
-
/**
* Create a date field from an array of settings values.
* All values have defaults, only need to specify values that need to be different.
@@ -138,7 +137,7 @@ class DateFieldTestCase extends DrupalWebTestCase {
'increment' => $increment,
// The number of years to go back and forward in drop-down year selectors.
'year_range' => $year_range,
-
+
'input_format' => $input_format,
'text_parts' => $text_parts,
'label_position' => 'above',
@@ -152,7 +151,7 @@ class DateFieldTestCase extends DrupalWebTestCase {
'default_format' => $default_format,
)
);
-
+
$instance['display'] = array(
'default' => array(
'label' => 'above',
@@ -183,10 +182,10 @@ class DateFieldTestCase extends DrupalWebTestCase {
'module' => 'date',
),
);
-
+
$field = field_create_field($field);
$instance = field_create_instance($instance);
-
+
//_field_info_collate_fields(TRUE);
field_info_cache_clear(TRUE);
field_cache_clear(TRUE);
diff --git a/tests/date_validation.test b/tests/date_validation.test
index 5eaa7c5..299498c 100644
--- a/tests/date_validation.test
+++ b/tests/date_validation.test
@@ -20,7 +20,7 @@ class DateValidationTestCase extends DrupalWebTestCase {
'administer content types', 'administer nodes', 'bypass node access'
));
$this->drupalLogin($this->privileged_user);
-
+
variable_set('date_format_long', 'D, m/d/Y - H:i');
}
@@ -38,7 +38,7 @@ class DateValidationTestCase extends DrupalWebTestCase {
$this->malFormedDate($options = 'text');
$this->deleteDateField();
}
-
+
function malFormedDate($options, $date_format = 'mm/dd/yyyy') {
// Tests that date field filters improper dates.
$edit = array();
@@ -62,7 +62,7 @@ class DateValidationTestCase extends DrupalWebTestCase {
$this->assertNoText('Test node has been created');
$this->assertText('The month is invalid.');
$this->assertText('The day is invalid.');
-
+
// Test two-digit entry for year where 4-digit is expected
if ($options == 'select') {
$edit['field_test[und][0][value][year]'] = '11';
@@ -81,7 +81,7 @@ class DateValidationTestCase extends DrupalWebTestCase {
$this->drupalPost('node/add/story', $edit, t('Save'));
$this->assertNoText('Test node has been created');
$this->assertText('The year is invalid. Please check that entry includes four digits.');
-
+
// Test invalid hour/minute entry for time
if ($options == 'select') {
$edit['field_test[und][0][value][year]'] = '2011';
@@ -120,5 +120,4 @@ class DateValidationTestCase extends DrupalWebTestCase {
$this->assertText('The field Test has been deleted from the Story content type.', 'Removed date field.');
}
-
} \ No newline at end of file
diff --git a/translations/date_api.da.po b/translations/date_api.da.po
index 943b271..3a1e9e9 100644
--- a/translations/date_api.da.po
+++ b/translations/date_api.da.po
@@ -3469,4 +3469,3 @@ msgstr "Navigér til næste dag"
#: theme/theme.inc:125
msgid "View full page month"
msgstr "Vis måned på fuld side"
-
diff --git a/translations/date_api.de.po b/translations/date_api.de.po
index 16b6505..c6c83a5 100644
--- a/translations/date_api.de.po
+++ b/translations/date_api.de.po
@@ -312,4 +312,3 @@ msgstr "Ein Datum-API kann von anderen Modulen verwendet werden."
#: date_tools/date_tools.info:0
msgid "Date/Time"
msgstr "Datum/Zeit"
-
diff --git a/translations/date_api.es.po b/translations/date_api.es.po
index 8590f6d..6a191cc 100644
--- a/translations/date_api.es.po
+++ b/translations/date_api.es.po
@@ -295,4 +295,3 @@ msgstr "API de fechas que puede ser usada por otros módulos."
#: date_api.info:0 date/date.info:0 date_locale/date_locale.info:0 date_php4/date_php4.info:0 date_popup/date_popup.info:0 date_repeat/date_repeat.info:0 date_timezone/date_timezone.info:0 date_tools/date_tools.info:0
msgid "Date/Time"
msgstr "Fecha/Hora"
-
diff --git a/translations/date_api.fr.po b/translations/date_api.fr.po
index 9f9ea59..f9e4281 100644
--- a/translations/date_api.fr.po
+++ b/translations/date_api.fr.po
@@ -325,4 +325,3 @@ msgstr "Une API de date pouvant être utilisée par d'autres modules"
#: date_tools/date_tools.info:0
msgid "Date/Time"
msgstr "Date/Heure"
-
diff --git a/translations/date_api.he.po b/translations/date_api.he.po
index 8c3999f..448be1d 100644
--- a/translations/date_api.he.po
+++ b/translations/date_api.he.po
@@ -295,5 +295,3 @@ msgstr "ממשק תכנותי של תאריכים (Date API) עבור מודול
#: date_api.info:0 date/date.info:0 date_locale/date_locale.info:0 date_php4/date_php4.info:0 date_popup/date_popup.info:0 date_repeat/date_repeat.info:0 date_timezone/date_timezone.info:0 date_tools/date_tools.info:0
msgid "Date/Time"
msgstr "תאריך/שעה"
-
-
diff --git a/translations/date_api.it.po b/translations/date_api.it.po
index 432508f..8dff280 100644
--- a/translations/date_api.it.po
+++ b/translations/date_api.it.po
@@ -285,4 +285,3 @@ msgstr "Data/Ora"
#~ msgstr "am"
#~ msgid "pm"
#~ msgstr "pm"
-
diff --git a/translations/date_api.nl.po b/translations/date_api.nl.po
index ed76b72..8ed57dc 100644
--- a/translations/date_api.nl.po
+++ b/translations/date_api.nl.po
@@ -168,4 +168,3 @@ msgstr "Een Date API dat gebruikt kan worden door andere modules."
#, fuzzy
msgid "Date/Time"
msgstr "Datum/Tijd"
-
diff --git a/translations/date_api.pt-br.po b/translations/date_api.pt-br.po
index 1728704..989744e 100644
--- a/translations/date_api.pt-br.po
+++ b/translations/date_api.pt-br.po
@@ -294,4 +294,3 @@ msgstr "Uma API de Data que pode ser utilizada por outros módulos."
#: date_api.info:0 date/date.info:0 date_locale/date_locale.info:0 date_php4/date_php4.info:0 date_popup/date_popup.info:0 date_repeat/date_repeat.info:0 date_timezone/date_timezone.info:0 date_tools/date_tools.info:0
msgid "Date/Time"
msgstr "Data/Hora"
-
diff --git a/translations/date_api.tr.po b/translations/date_api.tr.po
index 8fa65be..70f0671 100644
--- a/translations/date_api.tr.po
+++ b/translations/date_api.tr.po
@@ -164,4 +164,3 @@ msgstr "Başka eklentiler tarafından kullanılabilen bir Date API"
#: date_api.info:0
msgid "Date/Time"
msgstr "Tarih/Saat"
-
diff --git a/translations/general.de.po b/translations/general.de.po
index d67279d..acd78b7 100644
--- a/translations/general.de.po
+++ b/translations/general.de.po
@@ -80,4 +80,3 @@ msgstr "Speichern"
#: includes/date_api_filter_handler.inc:77
msgid "Text"
msgstr "Text"
-
diff --git a/translations/general.es.po b/translations/general.es.po
index 2d333fd..7a96bb6 100644
--- a/translations/general.es.po
+++ b/translations/general.es.po
@@ -64,4 +64,3 @@ msgstr "Guardar"
#: date_tools/date_tools.module:419 includes/date_api_filter_handler.inc:77
msgid "Text"
msgstr "Texto"
-
diff --git a/translations/general.fr.po b/translations/general.fr.po
index 603eff0..7e1efef 100644
--- a/translations/general.fr.po
+++ b/translations/general.fr.po
@@ -103,4 +103,3 @@ msgstr "Enregistrer"
#: includes/date_api_filter_handler.inc:77
msgid "Text"
msgstr "Texte"
-
diff --git a/translations/general.he.po b/translations/general.he.po
index 6e73591..1f72304 100644
--- a/translations/general.he.po
+++ b/translations/general.he.po
@@ -64,5 +64,3 @@ msgstr "שמור"
#: date_tools/date_tools.module:419 includes/date_api_filter_handler.inc:77
msgid "Text"
msgstr "טקסט"
-
-
diff --git a/translations/general.it.po b/translations/general.it.po
index c198012..2a4cb04 100644
--- a/translations/general.it.po
+++ b/translations/general.it.po
@@ -87,4 +87,3 @@ msgstr "Testo"
#~ msgstr "Sabato"
#~ msgid "Repeats"
#~ msgstr "Ripetizione"
-
diff --git a/translations/general.nl.po b/translations/general.nl.po
index b14218f..809ae76 100644
--- a/translations/general.nl.po
+++ b/translations/general.nl.po
@@ -141,4 +141,3 @@ msgstr "Herhalingen"
#: date_tools/date_tools.module:193
msgid "Save"
msgstr "Bewaren"
-
diff --git a/translations/general.pt-br.po b/translations/general.pt-br.po
index 7da2068..adbab67 100644
--- a/translations/general.pt-br.po
+++ b/translations/general.pt-br.po
@@ -63,4 +63,3 @@ msgstr "Gravar"
#: date_tools/date_tools.module:419 includes/date_api_filter_handler.inc:77
msgid "Text"
msgstr "Texto"
-
diff --git a/translations/includes.de.po b/translations/includes.de.po
index 1568316..bc8bdf9 100644
--- a/translations/includes.de.po
+++ b/translations/includes.de.po
@@ -188,4 +188,3 @@ msgstr "Das %style erfordert das Datum: Für das Datumsargument wird das aktuell
#, fuzzy
msgid "The %style requires the Date: Date argument."
msgstr "Das %style erfordert das Datum: Datumsargument."
-
diff --git a/translations/includes.es.po b/translations/includes.es.po
index 09a362e..fad6217 100644
--- a/translations/includes.es.po
+++ b/translations/includes.es.po
@@ -173,4 +173,3 @@ msgstr "El %style requiere que el argumento Fecha:Date tenga la fecha actual com
#: includes/date_navigation_plugin_style.inc:34
msgid "The %style requires the Date: Date argument."
msgstr "El %style requiere un argumento Fecha:Date."
-
diff --git a/translations/includes.fr.po b/translations/includes.fr.po
index e55450e..9084c2f 100644
--- a/translations/includes.fr.po
+++ b/translations/includes.fr.po
@@ -213,4 +213,3 @@ msgstr "Le %style requiert que Date : Argument de date soit défini par défaut
#: includes/date_navigation_plugin_style.inc:34
msgid "The %style requires the Date: Date argument."
msgstr "Le %style requiert le Date : Argument de date."
-
diff --git a/translations/includes.he.po b/translations/includes.he.po
index 4f48cf1..47ff235 100644
--- a/translations/includes.he.po
+++ b/translations/includes.he.po
@@ -174,5 +174,3 @@ msgstr "הסגנון %style דורש את התאריך: יש לקבוע את א
#: includes/date_navigation_plugin_style.inc:34
msgid "The %style requires the Date: Date argument."
msgstr "הסגנון %style דורש את התאריך: ארגומנט תאריך."
-
-
diff --git a/translations/includes.it.po b/translations/includes.it.po
index 15c5cb2..a38cd36 100644
--- a/translations/includes.it.po
+++ b/translations/includes.it.po
@@ -170,4 +170,3 @@ msgstr ""
#: includes/date_navigation_plugin_style.inc:34
msgid "The %style requires the Date: Date argument."
msgstr ""
-
diff --git a/translations/includes.nl.po b/translations/includes.nl.po
index 2c4fbc7..fb7e88d 100644
--- a/translations/includes.nl.po
+++ b/translations/includes.nl.po
@@ -183,4 +183,3 @@ msgstr "De %style vereist de Datum: Datum parameter is ingestelt op de standaard
#: includes/date_navigation_plugin_style.inc:34
msgid "The %style requires the Date: Date argument."
msgstr "De %style vereist de Datum: Datum parameter."
-
diff --git a/translations/theme.de.po b/translations/theme.de.po
index d6877c4..2f0aec2 100644
--- a/translations/theme.de.po
+++ b/translations/theme.de.po
@@ -28,4 +28,3 @@ msgstr "Woche von @date"
#: theme/theme.inc:327
msgid "Timezone"
msgstr "Zeitzone"
-
diff --git a/translations/theme.es.po b/translations/theme.es.po
index 121851e..ce8bfbe 100644
--- a/translations/theme.es.po
+++ b/translations/theme.es.po
@@ -25,4 +25,3 @@ msgstr "Semana de @date"
#: theme/theme.inc:327
msgid "Timezone"
msgstr "Zona horaria"
-
diff --git a/translations/theme.fr.po b/translations/theme.fr.po
index 990ab3c..9a8252d 100644
--- a/translations/theme.fr.po
+++ b/translations/theme.fr.po
@@ -61,4 +61,3 @@ msgstr "Semaine du @date"
#: theme/theme.inc:327
msgid "Timezone"
msgstr "Fuseau Horaire"
-
diff --git a/translations/theme.he.po b/translations/theme.he.po
index bee2a23..3289de7 100644
--- a/translations/theme.he.po
+++ b/translations/theme.he.po
@@ -25,5 +25,3 @@ msgstr "שבוע מתאריך @date"
#: theme/theme.inc:327
msgid "Timezone"
msgstr "אזור זמן"
-
-
diff --git a/translations/theme.it.po b/translations/theme.it.po
index d60d98a..3101361 100644
--- a/translations/theme.it.po
+++ b/translations/theme.it.po
@@ -23,4 +23,3 @@ msgstr "Fuso-orario"
#~ msgstr "avanti »"
#~ msgid "am/pm"
#~ msgstr "am/pm"
-
diff --git a/translations/theme.nl.po b/translations/theme.nl.po
index c5aa1ab..d75652d 100644
--- a/translations/theme.nl.po
+++ b/translations/theme.nl.po
@@ -39,4 +39,3 @@ msgstr "am/pm"
#: theme/theme.inc:323
msgid "Timezone"
msgstr "Tijdzone"
-
diff --git a/translations/theme.pt-br.po b/translations/theme.pt-br.po
index 865b56b..7c4c7ab 100644
--- a/translations/theme.pt-br.po
+++ b/translations/theme.pt-br.po
@@ -24,4 +24,3 @@ msgstr "Semana de @date"
#: theme/theme.inc:327
msgid "Timezone"
msgstr "Fuso horário"
-