diff --git a/patches/2460643_incompatble_with_views_cache_2.patch b/patches/2460643_incompatble_with_views_cache_2.patch
new file mode 100644
index 000000000..5cad736ce
--- /dev/null
+++ b/patches/2460643_incompatble_with_views_cache_2.patch
@@ -0,0 +1,23 @@
+diff --git a/leaflet.module b/leaflet.module
+index e72a3e9..aa9ba3c 100644
+--- a/leaflet.module
++++ b/leaflet.module
+@@ -121,14 +121,16 @@ function leaflet_build_map($map, $features = array(), $height = '400px') {
+ );
+
+ // Load the leaflet library, which includes integration files.
+- libraries_load('leaflet');
++ $build['#attached']['libraries_load'][] = array(
++ 'leaflet'
++ );
+
+ return $build;
+ }
+
+ /**
+ * DEPRECATED. Use leaflet_build_map() instead.
+- *
++ *
+ * Load all Leaflet required client files and return markup for a map.
+ *
+ * @param array $map
diff --git a/www7/sites/all/modules/contrib/date/.gitignore b/www7/sites/all/modules/contrib/date/.gitignore
new file mode 100644
index 000000000..a0238825e
--- /dev/null
+++ b/www7/sites/all/modules/contrib/date/.gitignore
@@ -0,0 +1,4 @@
+*.patch
+*.diff
+.idea/
+.idea/*
diff --git a/www7/sites/all/modules/contrib/date/date.devel_generate.inc b/www7/sites/all/modules/contrib/date/date.devel_generate.inc
index 47de0847c..6c61e23cf 100644
--- a/www7/sites/all/modules/contrib/date/date.devel_generate.inc
+++ b/www7/sites/all/modules/contrib/date/date.devel_generate.inc
@@ -15,8 +15,14 @@ function date_devel_generate($entity, $field, $instance, $bundle) {
$entity_field = array();
if (isset($instance['widget']['settings']['year_range'])) {
$split = explode(':', $instance['widget']['settings']['year_range']);
- $back = str_replace('-', '', $split[0]);
- $forward = str_replace('+', '', $split[1]);
+ // Determine how much to go back and forward depending on whether a relative
+ // number of years (with - or + sign) or an absolute year is given.
+ $back = strpos($split[0], '-') === 0
+ ? str_replace('-', '', $split[0])
+ : date_format(date_now(), 'Y') - $split[0];
+ $forward = strpos($split[1], '+') === 0
+ ? str_replace('+', '', $split[1])
+ : $split[1] - date_format(date_now(), 'Y');
}
else {
$back = 2;
@@ -61,9 +67,11 @@ function date_devel_generate($entity, $field, $instance, $bundle) {
case 'date':
$format = DATE_FORMAT_ISO;
break;
+
case 'datestamp':
$format = DATE_FORMAT_UNIX;
break;
+
case 'datetime':
$format = DATE_FORMAT_DATETIME;
break;
diff --git a/www7/sites/all/modules/contrib/date/date.field.inc b/www7/sites/all/modules/contrib/date/date.field.inc
index 46ea317b9..fa311224e 100644
--- a/www7/sites/all/modules/contrib/date/date.field.inc
+++ b/www7/sites/all/modules/contrib/date/date.field.inc
@@ -19,6 +19,7 @@ function date_field_formatter_info() {
'multiple_from' => '',
'multiple_to' => '',
'fromto' => 'both',
+ 'show_remaining_days' => FALSE,
),
),
'format_interval' => array(
@@ -48,6 +49,7 @@ function date_field_formatter_settings_form($field, $instance, $view_mode, $form
case 'format_interval':
$form = date_interval_formatter_settings_form($field, $instance, $view_mode, $form, $form_state);
break;
+
default:
$form = date_default_formatter_settings_form($field, $instance, $view_mode, $form, $form_state);
break;
@@ -72,6 +74,7 @@ function date_field_formatter_settings_summary($field, $instance, $view_mode) {
case 'format_interval':
$summary = date_interval_formatter_settings_summary($field, $instance, $view_mode);
break;
+
default:
$summary = date_default_formatter_settings_summary($field, $instance, $view_mode);
break;
@@ -169,11 +172,16 @@ function date_field_formatter_view($entity_type, $entity, $field, $instance, $la
$element[$delta] = array('#markup' => $item['value']);
}
else {
- $element[$delta] = array('#markup' => t('!start-date to !end-date', array('!start-date' => $item['value'], '!end-date' => $item['value2'])));
+ $element[$delta] = array(
+ '#markup' => t('!start-date to !end-date', array(
+ '!start-date' => $item['value'],
+ '!end-date' => $item['value2']
+ )));
}
}
}
break;
+
case 'format_interval':
foreach ($items as $delta => $item) {
if (!empty($entity->date_id) && !in_array($delta, $selected_deltas)) {
@@ -188,6 +196,7 @@ function date_field_formatter_view($entity_type, $entity, $field, $instance, $la
}
}
break;
+
default:
foreach ($items as $delta => $item) {
if (!empty($entity->date_id) && !in_array($delta, $selected_deltas)) {
@@ -198,6 +207,7 @@ function date_field_formatter_view($entity_type, $entity, $field, $instance, $la
$variables['item'] = $item;
$variables['dates'] = date_formatter_process($formatter, $entity_type, $entity, $field, $instance, $langcode, $item, $display);
$variables['attributes'] = !empty($rdf_mapping) ? rdf_rdfa_attributes($rdf_mapping, $item['value']) : array();
+ $variables['show_remaining_days'] = $display['settings']['show_remaining_days'];
$output = theme('date_display_combination', $variables);
if (!empty($output)) {
$element[$delta] = array('#markup' => $output);
@@ -231,10 +241,11 @@ function date_field_is_empty($item, $field) {
* Implements hook_field_info().
*/
function date_field_info() {
+ $granularity = array('year', 'month', 'day', 'hour', 'minute');
$settings = array(
'settings' => array(
'todate' => '',
- 'granularity' => drupal_map_assoc(array('year', 'month', 'day', 'hour', 'minute')),
+ 'granularity' => drupal_map_assoc($granularity),
'tz_handling' => 'site',
'timezone_db' => 'UTC',
),
@@ -250,26 +261,26 @@ function date_field_info() {
);
return array(
'datetime' => array(
- 'label' => 'Date',
+ 'label' => t('Date'),
'description' => t('Store a date in the database as a datetime field, recommended for complete dates and times that may need timezone conversion.'),
'default_widget' => 'date_select',
'default_formatter' => 'date_default',
'default_token_formatter' => 'date_plain',
- ) + $settings,
+ ) + $settings,
'date' => array(
- 'label' => 'Date (ISO format)',
+ 'label' => t('Date (ISO format)'),
'description' => t('Store a date in the database as an ISO date, recommended for historical or partial dates.'),
'default_widget' => 'date_select',
'default_formatter' => 'date_default',
'default_token_formatter' => 'date_plain',
- ) + $settings,
+ ) + $settings,
'datestamp' => array(
- 'label' => 'Date (Unix timestamp)',
+ 'label' => t('Date (Unix timestamp)'),
'description' => t('Store a date in the database as a timestamp, deprecated format to support legacy data.'),
'default_widget' => 'date_select',
'default_formatter' => 'date_default',
'default_token_formatter' => 'date_plain',
- ) + $settings,
+ ) + $settings,
);
}
@@ -294,18 +305,18 @@ function date_field_widget_info() {
$info = array(
'date_select' => array(
- 'label' => t('Select list'),
+ 'label' => t('Select list'),
'field types' => array('date', 'datestamp', 'datetime'),
) + $settings,
'date_text' => array(
- 'label' => t('Text field'),
+ 'label' => t('Text field'),
'field types' => array('date', 'datestamp', 'datetime'),
- ) + $settings,
+ ) + $settings,
);
if (module_exists('date_popup')) {
$info['date_popup'] = array(
- 'label' => t('Pop-up calendar'),
+ 'label' => t('Pop-up calendar'),
'field types' => array('date', 'datestamp', 'datetime'),
) + $settings;
}
diff --git a/www7/sites/all/modules/contrib/date/date.info b/www7/sites/all/modules/contrib/date/date.info
index a1731de03..c6fdde552 100644
--- a/www7/sites/all/modules/contrib/date/date.info
+++ b/www7/sites/all/modules/contrib/date/date.info
@@ -11,10 +11,12 @@ files[] = tests/date_field.test
files[] = tests/date_migrate.test
files[] = tests/date_validation.test
files[] = tests/date_timezone.test
+files[] = tests/date_views_pager.test
+files[] = tests/date_views_popup.test
-; Information added by Drupal.org packaging script on 2014-07-29
-version = "7.x-2.8"
+; Information added by Drupal.org packaging script on 2015-09-08
+version = "7.x-2.9"
core = "7.x"
project = "date"
-datestamp = "1406653438"
+datestamp = "1441727353"
diff --git a/www7/sites/all/modules/contrib/date/date.install b/www7/sites/all/modules/contrib/date/date.install
index 23fb07eb2..9a9b6d350 100644
--- a/www7/sites/all/modules/contrib/date/date.install
+++ b/www7/sites/all/modules/contrib/date/date.install
@@ -19,6 +19,7 @@ function date_field_schema($field) {
'views' => TRUE,
);
break;
+
case 'datetime':
$db_columns['value'] = array(
'type' => 'datetime',
@@ -31,6 +32,7 @@ function date_field_schema($field) {
'views' => TRUE,
);
break;
+
default:
$db_columns['value'] = array(
'type' => 'varchar',
@@ -66,7 +68,12 @@ function date_field_schema($field) {
'views' => FALSE,
);
if (!empty($field['settings']['todate'])) {
- $db_columns['offset2'] = array('type' => 'int', 'not null' => FALSE, 'sortable' => TRUE, 'views' => FALSE);
+ $db_columns['offset2'] = array(
+ 'type' => 'int',
+ 'not null' => FALSE,
+ 'sortable' => TRUE,
+ 'views' => FALSE
+ );
}
}
if (isset($field['settings']['repeat']) && $field['settings']['repeat'] == 1) {
@@ -88,8 +95,9 @@ function date_update_last_removed() {
}
/**
- * Get rid of the individual formatters for each format type,
- * these are now settings in the default formatter.
+ * Get rid of the individual formatters for each format type.
+ *
+ * These are now settings in the default formatter.
*/
function date_update_7000() {
$instances = field_info_instances();
@@ -115,8 +123,9 @@ function date_update_7000() {
}
/**
- * Get rid of the separate widgets for repeating dates. The code now handles
- * repeating dates correctly using the regular widgets.
+ * Get rid of the separate widgets for repeating dates.
+ *
+ * The code now handles repeating dates correctly using the regular widgets.
*/
function date_update_7001() {
$query = db_select('field_config_instance', 'fci', array('fetch' => PDO::FETCH_ASSOC));
@@ -127,7 +136,11 @@ function date_update_7001() {
foreach ($results as $record) {
$instance = unserialize($record['data']);
- if (in_array($instance['widget']['type'], array('date_popup_repeat', 'date_text_repeat', 'date_select_repeat'))) {
+ if (in_array($instance['widget']['type'], array(
+ 'date_popup_repeat',
+ 'date_text_repeat',
+ 'date_select_repeat'
+ ))) {
$instance['widget']['type'] = str_replace('_repeat', '', $instance['widget']['type']);
db_update('field_config_instance')
->fields(array(
@@ -191,4 +204,3 @@ function date_update_7004() {
field_cache_clear();
drupal_set_message(t('Date text widgets have been updated to use an increment of 1.'));
}
-
diff --git a/www7/sites/all/modules/contrib/date/date.js b/www7/sites/all/modules/contrib/date/date.js
index 2e60175fb..b58d3be65 100644
--- a/www7/sites/all/modules/contrib/date/date.js
+++ b/www7/sites/all/modules/contrib/date/date.js
@@ -27,7 +27,7 @@ Drupal.date.EndDateHandler = function (widget) {
this.$widget = $(widget);
this.$start = this.$widget.find('.form-type-date-select[class$=value]');
this.$end = this.$widget.find('.form-type-date-select[class$=value2]');
- if (this.$end.length == 0) {
+ if (this.$end.length === 0) {
return;
}
this.initializeSelects();
@@ -68,7 +68,7 @@ Drupal.date.EndDateHandler.prototype.endDateIsBlank = function () {
var id;
for (id in this.selects) {
if (this.selects.hasOwnProperty(id)) {
- if (this.selects[id].end.val() != '') {
+ if (this.selects[id].end.val() !== '') {
return false;
}
}
diff --git a/www7/sites/all/modules/contrib/date/date.migrate.inc b/www7/sites/all/modules/contrib/date/date.migrate.inc
index 095c789e1..ad2a56815 100644
--- a/www7/sites/all/modules/contrib/date/date.migrate.inc
+++ b/www7/sites/all/modules/contrib/date/date.migrate.inc
@@ -40,7 +40,7 @@ class DateMigrateFieldHandler extends MigrateFieldHandler {
* @return array
* An array of the defined variables in this scope.
*/
- static function arguments($timezone = 'UTC', $timezone_db = 'UTC', $rrule = NULL, $language = NULL) {
+ public static function arguments($timezone = 'UTC', $timezone_db = 'UTC', $rrule = NULL, $language = NULL) {
return get_defined_vars();
}
@@ -129,6 +129,7 @@ class DateMigrateFieldHandler extends MigrateFieldHandler {
// timestamp for 'now'.
if (empty($from)) {
$return[$language][$delta]['value'] = NULL;
+ $return[$language][$delta]['timezone'] = NULL;
if (!empty($field_info['settings']['todate'])) {
$return[$language][$delta]['value2'] = NULL;
}
@@ -151,6 +152,7 @@ class DateMigrateFieldHandler extends MigrateFieldHandler {
case 'datestamp':
// Already done.
break;
+
case 'datetime':
// YYYY-MM-DD HH:MM:SS.
$from = format_date($from, 'custom', 'Y-m-d H:i:s', $timezone);
@@ -158,6 +160,7 @@ class DateMigrateFieldHandler extends MigrateFieldHandler {
$to = format_date($to, 'custom', 'Y-m-d H:i:s', $timezone);
}
break;
+
case 'date':
// ISO date: YYYY-MM-DDTHH:MM:SS.
$from = format_date($from, 'custom', 'Y-m-d\TH:i:s', $timezone);
@@ -165,6 +168,7 @@ class DateMigrateFieldHandler extends MigrateFieldHandler {
$to = format_date($to, 'custom', 'Y-m-d\TH:i:s', $timezone);
}
break;
+
default:
break;
}
@@ -173,12 +177,17 @@ class DateMigrateFieldHandler extends MigrateFieldHandler {
// created.
if (function_exists('date_repeat_build_dates') && !empty($field_info['settings']['repeat']) && $rrule) {
include_once DRUPAL_ROOT . '/' . drupal_get_path('module', 'date_api') . '/date_api_ical.inc';
- $item = array('value' => $from, 'value2' => $to, 'timezone' => $timezone);
+ $item = array(
+ 'value' => $from,
+ 'value2' => $to,
+ 'timezone' => $timezone,
+ );
// Can be de-uglified when http://drupal.org/node/1159404 is committed.
$return[$language] = date_repeat_build_dates(NULL, date_ical_parse_rrule($field_info, $rrule), $field_info, $item);
}
else {
$return[$language][$delta]['value'] = $from;
+ $return[$language][$delta]['timezone'] = $timezone;
if (!empty($to)) {
$return[$language][$delta]['value2'] = $to;
}
@@ -190,6 +199,9 @@ class DateMigrateFieldHandler extends MigrateFieldHandler {
return $return;
}
+ /**
+ * {@inheritdoc}
+ */
public function fields($migration = NULL) {
return array(
'timezone' => t('Timezone'),
diff --git a/www7/sites/all/modules/contrib/date/date.module b/www7/sites/all/modules/contrib/date/date.module
index 91c0b65ac..6f849dfad 100644
--- a/www7/sites/all/modules/contrib/date/date.module
+++ b/www7/sites/all/modules/contrib/date/date.module
@@ -1,8 +1,10 @@
field_name;
break;
+
default:
$bundle = field_extract_bundle($entity_type, $entity);
break;
@@ -40,13 +43,20 @@ function date_default_format($type) {
* Wrapper function around each of the widget types for creating a date object.
*/
function date_input_date($field, $instance, $element, $input) {
+ // Trim extra spacing off user input of text fields.
+ if (isset($input['date'])) {
+ $input['date'] = trim($input['date']);
+ }
+
switch ($instance['widget']['type']) {
case 'date_text':
$function = 'date_text_input_date';
break;
+
case 'date_popup':
$function = 'date_popup_input_date';
break;
+
default:
$function = 'date_select_input_date';
}
@@ -66,6 +76,7 @@ function date_theme() {
);
$themes = array(
'date_combo' => $base + array('render element' => 'element'),
+ 'date_form_element' => $base + array('render element' => 'element'),
'date_text_parts' => $base + array('render element' => 'element'),
'date' => $base + array('render element' => 'element'),
'date_display_single' => $base + array(
@@ -97,7 +108,13 @@ function date_theme() {
'add_rdf' => NULL,
'microdata' => NULL,
'add_microdata' => NULL,
- )),
+ ),
+ ),
+ 'date_display_remaining' => $base + array(
+ 'variables' => array(
+ 'remaining_days' => NULL,
+ ),
+ ),
'date_display_combination' => $base + array(
'variables' => array(
'entity_type' => NULL,
@@ -130,7 +147,7 @@ function date_theme() {
'attributes' => array(),
'rdf_mapping' => NULL,
'add_rdf' => NULL,
- ),
+ ),
),
);
@@ -209,8 +226,10 @@ function date_formatter_process($formatter, $entity_type, $entity, $field, $inst
$settings = $display['settings'];
$field_name = $field['field_name'];
$format = date_formatter_format($formatter, $settings, $granularity, $langcode);
- $timezone = isset($item['timezone']) ? $item['timezone'] : '';
- $timezone = date_get_timezone($field['settings']['tz_handling'], $timezone);
+ if (!isset($field['settings']['tz_handling']) || $field['settings']['tz_handling'] !== 'utc') {
+ $timezone = isset($item['timezone']) ? $item['timezone'] : '';
+ $timezone = date_get_timezone($field['settings']['tz_handling'], $timezone);
+ }
$timezone_db = date_get_timezone_db($field['settings']['tz_handling']);
$db_format = date_type_format($field['type']);
$process = date_process_values($field);
@@ -246,10 +265,10 @@ function date_formatter_process($formatter, $entity_type, $entity, $field, $inst
$dates[$processed]['formatted_iso'] = date_format_date($date, 'custom', 'c');
if (is_object($date)) {
if ($format == 'format_interval') {
- $dates[$processed]['interval'] = date_format_interval($date);
+ $dates[$processed]['interval'] = date_format_interval($date);
}
elseif ($format == 'format_calendar_day') {
- $dates[$processed]['calendar_day'] = date_format_calendar_day($date);
+ $dates[$processed]['calendar_day'] = date_format_calendar_day($date);
}
elseif ($format == 'U' || $format == 'r' || $format == 'c') {
$dates[$processed]['formatted'] = date_format_date($date, 'custom', $format);
@@ -258,10 +277,11 @@ function date_formatter_process($formatter, $entity_type, $entity, $field, $inst
$dates[$processed]['formatted_timezone'] = '';
}
elseif (!empty($format)) {
- $dates[$processed]['formatted'] = date_format_date($date, 'custom', $format);
- $dates[$processed]['formatted_date'] = date_format_date($date, 'custom', date_limit_format($format, array('year', 'month', 'day')));
- $dates[$processed]['formatted_time'] = date_format_date($date, 'custom', date_limit_format($format, array('hour', 'minute', 'second')));
- $dates[$processed]['formatted_timezone'] = date_format_date($date, 'custom', date_limit_format($format, array('timezone')));
+ $formats = _get_custom_date_format($date, $format);
+ $dates[$processed]['formatted'] = $formats['formatted'];
+ $dates[$processed]['formatted_date'] = $formats['date'];
+ $dates[$processed]['formatted_time'] = $formats['time'];
+ $dates[$processed]['formatted_timezone'] = $formats['zone'];
}
}
}
@@ -288,6 +308,30 @@ function date_formatter_process($formatter, $entity_type, $entity, $field, $inst
return $dates;
}
+/**
+ * Get a custom date format.
+ */
+function _get_custom_date_format($date, $format) {
+ $custom = array();
+ $custom['granularities'] = array(
+ 'date' => array('year', 'month', 'day'),
+ 'time' => array('hour', 'minute', 'second'),
+ 'zone' => array('timezone'),
+ );
+ $custom['limits'] = array(
+ 'date' => date_limit_format($format, $custom['granularities']['date']),
+ 'time' => date_limit_format($format, $custom['granularities']['time']),
+ 'zone' => date_limit_format($format, $custom['granularities']['zone']),
+ );
+
+ return array(
+ 'formatted' => date_format_date($date, 'custom', $format),
+ 'date' => date_format_date($date, 'custom', $custom['limits']['date']),
+ 'time' => date_format_date($date, 'custom', $custom['limits']['time']),
+ 'zone' => date_format_date($date, 'custom', $custom['limits']['zone']),
+ );
+}
+
/**
* Retrieves the granularity for a field.
*
@@ -301,14 +345,14 @@ function date_formatter_process($formatter, $entity_type, $entity, $field, $inst
*/
function date_granularity($field) {
if (!is_array($field) || !is_array($field['settings']['granularity'])) {
- $field['settings']['granularity'] = drupal_map_assoc(array('year', 'month', 'day'));
+ $granularity = drupal_map_assoc(array('year', 'month', 'day'));
+ $field['settings']['granularity'] = $granularity;
}
return array_values(array_filter($field['settings']['granularity']));
}
/**
- * Helper function to create an array of the date values in a
- * field that need to be processed.
+ * Helper function to create an array of the date values in a field that need to be processed.
*/
function date_process_values($field) {
return $field['settings']['todate'] ? array('value', 'value2') : array('value');
@@ -394,10 +438,10 @@ function date_formatter_format($formatter, $settings, $granularity = array(), $l
switch ($formatter) {
case 'format_interval':
return 'format_interval';
- break;
+
case 'date_plain':
return 'date_plain';
- break;
+
default:
$format = date_format_type_format($format_type, $langcode);
break;
@@ -410,6 +454,7 @@ function date_formatter_format($formatter, $settings, $granularity = array(), $l
/**
* Helper function to get the right format for a format type.
+ *
* Checks for locale-based format first.
*/
function date_format_type_format($format_type, $langcode = NULL) {
@@ -432,27 +477,30 @@ function date_format_type_format($format_type, $langcode = NULL) {
case 'short':
$default = 'm/d/Y - H:i';
break;
+
case 'long':
$default = 'l, F j, Y - H:i';
break;
+
// If it's not one of the core date types and isn't stored in the
// database, we'll fall back on using the same default format as the
// 'medium' type.
case 'medium':
default:
// @todo: If a non-core module provides a date type and does not
- // variable_set() a default for it, the default assumed here may
- // not be correct (since the default format used by 'medium' may
- // not even be one of the allowed formats for the date type in
- // question). To fix this properly, we should really call
- // system_get_date_formats($format_type) and take the first
- // format from that list as the default. However, this function
- // is called often (on many different page requests), so calling
- // system_get_date_formats() from here would be a performance hit
- // since that function writes several records to the database
- // during each page request that calls it.
+ // variable_set() a default for it, the default assumed here may
+ // not be correct (since the default format used by 'medium' may
+ // not even be one of the allowed formats for the date type in
+ // question). To fix this properly, we should really call
+ // system_get_date_formats($format_type) and take the first
+ // format from that list as the default. However, this function
+ // is called often (on many different page requests), so calling
+ // system_get_date_formats() from here would be a performance hit
+ // since that function writes several records to the database
+ // during each page request that calls it.
$default = 'D, m/d/Y - H:i';
break;
+
}
$format = variable_get('date_format_' . $format_type, $default);
}
@@ -506,7 +554,7 @@ function date_prepare_entity($formatter, $entity_type, $entity, $field, $instanc
elseif ((!empty($max_count) && is_numeric($max_count) && $count >= $max_count) ||
(!empty($value['value']) && $value['value'] < $start) ||
(!empty($value['value2']) && $value['value2'] > $end)) {
- unset($entity->{$field_name}[$langcode][$delta]);
+ unset($entity->{$field_name}[$langcode][$delta]);
}
else {
$count++;
@@ -647,7 +695,7 @@ function date_entity_metadata_field_setter(&$entity, $name, $value, $langcode, $
}
/**
- * Auto creation callback for fields which contain two date values in one
+ * Auto creation callback for fields which contain two date values in one.
*/
function date_entity_metadata_struct_create($name, $property_info) {
return array(
@@ -658,10 +706,10 @@ function date_entity_metadata_struct_create($name, $property_info) {
/**
* Callback for setting an individual field value if a to-date may be there too.
+ *
* Based on entity_property_verbatim_set().
*
- * The passed in unix timestamp (UTC) is converted to the right value and
- * format dependent on the field.
+ * The passed in unix timestamp (UTC) is converted to the right value and format dependent on the field.
*
* $name is either 'value' or 'value2'.
*/
@@ -683,9 +731,9 @@ function date_entity_metadata_struct_setter(&$item, $name, $value, $langcode, $t
}
/**
- * Duplicate functionality of what is now date_all_day_field() in
- * the Date All Day module. Copy left here to avoid breaking other
- * modules that use this function.
+ * Duplicate functionality of what is now date_all_day_field() in the Date All Day module.
+ *
+ * Copy left here to avoid breaking other modules that use this function.
*
* DEPRECATED!, will be removed at some time in the future.
*/
@@ -759,7 +807,7 @@ function date_field_widget_properties_alter(&$widget, $context) {
$entity = $context['entity'];
$info = entity_get_info($entity_type);
$id = $info['entity keys']['id'];
- $widget['is_new']= FALSE;
+ $widget['is_new'] = FALSE;
if (empty($entity->$id)) {
$widget['is_new'] = TRUE;
}
diff --git a/www7/sites/all/modules/contrib/date/date.theme b/www7/sites/all/modules/contrib/date/date.theme
old mode 100644
new mode 100755
index a1f7d939e..5cec8b420
--- a/www7/sites/all/modules/contrib/date/date.theme
+++ b/www7/sites/all/modules/contrib/date/date.theme
@@ -77,6 +77,7 @@ function theme_date_display_combination($variables) {
$microdata = $variables['microdata'];
$add_microdata = $variables['add_microdata'];
$precision = date_granularity_precision($field['settings']['granularity']);
+ $show_remaining_days = $variables['show_remaining_days'];
$output = '';
@@ -121,10 +122,12 @@ function theme_date_display_combination($variables) {
$date1 = $dates['value']['formatted'];
$date2 = $date1;
break;
+
case 'value2':
$date2 = $dates['value2']['formatted'];
$date1 = $date2;
break;
+
default:
$date1 = $dates['value']['formatted'];
$date2 = $dates['value2']['formatted'];
@@ -151,6 +154,20 @@ function theme_date_display_combination($variables) {
$has_time_string = FALSE;
}
+ // Check remaining days.
+ $show_remaining_days = '';
+ if (!empty($variables['show_remaining_days'])) {
+ $remaining_days = floor((strtotime($variables['dates']['value']['formatted_iso'])
+ - strtotime('now')) / (24 * 3600));
+
+ // Show remaining days only for future events.
+ if ($remaining_days >= 0) {
+ $show_remaining_days = theme('date_display_remaining', array(
+ 'remaining_days' => $remaining_days,
+ ));
+ }
+ }
+
// No date values, display nothing.
if (empty($date1) && empty($date2)) {
$output .= '';
@@ -167,6 +184,7 @@ function theme_date_display_combination($variables) {
'microdata' => $microdata,
'add_microdata' => $add_microdata,
'dates' => $dates,
+ 'show_remaining_days' => $show_remaining_days,
));
}
// Same day, different times, don't repeat the date but show both Start and
@@ -186,6 +204,7 @@ function theme_date_display_combination($variables) {
'microdata' => $microdata,
'add_microdata' => $add_microdata,
'dates' => $dates,
+ 'show_remaining_days' => $show_remaining_days,
));
$replaced = str_replace($time1, $time, $date1);
$output .= theme('date_display_single', array(
@@ -209,6 +228,7 @@ function theme_date_display_combination($variables) {
'microdata' => $microdata,
'add_microdata' => $add_microdata,
'dates' => $dates,
+ 'show_remaining_days' => $show_remaining_days,
));
}
@@ -236,12 +256,12 @@ function template_preprocess_date_display_single(&$variables) {
// Because the Entity API integration for Date has a variable data
// structure depending on whether there is an end value, the attributes
// could be attached to the field or to the value property.
- if(!empty($variables['microdata']['#attributes']['itemprop'])) {
+ if (!empty($variables['microdata']['#attributes']['itemprop'])) {
$variables['microdata']['value']['#attributes'] = $variables['microdata']['#attributes'];
}
// Add the machine readable time using the content attribute.
- if(!empty($variables['microdata']['value']['#attributes'])) {
+ if (!empty($variables['microdata']['value']['#attributes'])) {
$variables['microdata']['value']['#attributes']['content'] = $variables['dates']['value']['formatted_iso'];
}
else {
@@ -257,6 +277,7 @@ function theme_date_display_single($variables) {
$date = $variables['date'];
$timezone = $variables['timezone'];
$attributes = $variables['attributes'];
+ $show_remaining_days = isset($variables['show_remaining_days']) ? $variables['show_remaining_days'] : '';
// Wrap the result with the attributes.
$output = '' . $date . $timezone . '';
@@ -265,7 +286,8 @@ function theme_date_display_single($variables) {
$output .= '';
}
- return $output;
+ // Add remaining message and return.
+ return $output . $show_remaining_days;
}
/**
@@ -314,6 +336,7 @@ function theme_date_display_range($variables) {
$timezone = $variables['timezone'];
$attributes_start = $variables['attributes_start'];
$attributes_end = $variables['attributes_end'];
+ $show_remaining_days = $variables['show_remaining_days'];
$start_date = '' . $date1 . '';
$end_date = '' . $date2 . $timezone . '';
@@ -326,10 +349,13 @@ function theme_date_display_range($variables) {
}
// Wrap the result with the attributes.
- return t('!start-date to !end-date', array(
+ $output = '
' . t('!start-date to !end-date', array(
'!start-date' => $start_date,
'!end-date' => $end_date,
- ));
+ )) . '
';
+
+ // Add remaining message and return.
+ return $output . $show_remaining_days;
}
/**
@@ -375,7 +401,7 @@ function theme_date_combo($variables) {
'#title' => field_filter_xss(t($element['#title'])) . ' ' . ($element['#delta'] > 0 ? intval($element['#delta'] + 1) : ''),
'#value' => '',
'#description' => !empty($element['#fieldset_description']) ? $element['#fieldset_description'] : '',
- '#attributes' => array(),
+ '#attributes' => array('class' => array('date-combo')),
'#children' => $element['#children'],
);
// Add marker to required date fields.
@@ -396,7 +422,11 @@ function theme_date_text_parts($variables) {
$rows[] = drupal_render($element[$key]);
}
else {
- $rows[] = array($part, drupal_render($element[$key][0]), drupal_render($element[$key][1]));
+ $rows[] = array(
+ $part,
+ drupal_render($element[$key][0]),
+ drupal_render($element[$key][1]),
+ );
}
}
if ($element['year']['#type'] == 'hidden') {
@@ -408,4 +438,49 @@ function theme_date_text_parts($variables) {
}
}
+/**
+ * Render a date combo as a form element.
+ */
+function theme_date_form_element($variables) {
+ $element = &$variables['element'];
+
+ // Detect whether element is multiline.
+ $count = preg_match_all('`<(?:div|span)\b[^>]* class="[^"]*\b(?:date-no-float|date-clear)\b`', $element['#children'], $matches, PREG_OFFSET_CAPTURE);
+ $multiline = FALSE;
+ if ($count > 1) {
+ $multiline = TRUE;
+ }
+ elseif ($count) {
+ $before = substr($element['#children'], 0, $matches[0][0][1]);
+ if (preg_match('`<(?:div|span)\b[^>]* class="[^"]*\bdate-float\b`', $before)) {
+ $multiline = TRUE;
+ }
+ }
+
+ // Detect if there is more than one subfield.
+ $count = count(explode('