From 6f386c79d24f2eafdbbc7d94d9e8eb9f4ed450c9 Mon Sep 17 00:00:00 2001 From: "Peter Droogmans (attiks)" Date: Wed, 13 Jul 2022 11:34:49 +0200 Subject: [PATCH 01/40] chore: remove obsolete code --- .../src/Controller/GroupMeetings.php | 21 ------------------- 1 file changed, 21 deletions(-) diff --git a/html/modules/custom/iasc_content/src/Controller/GroupMeetings.php b/html/modules/custom/iasc_content/src/Controller/GroupMeetings.php index 61a318a96..a6dec5e7b 100644 --- a/html/modules/custom/iasc_content/src/Controller/GroupMeetings.php +++ b/html/modules/custom/iasc_content/src/Controller/GroupMeetings.php @@ -42,27 +42,6 @@ class GroupMeetings extends ControllerBase { */ protected $pagerManager; - /** - * Ical controller. - * - * @var \Drupal\hr_paragraphs\Controller\IcalController - */ - protected $icalController; - - /** - * Reliefweb controller. - * - * @var \Drupal\hr_paragraphs\Controller\ReliefwebController - */ - protected $reliefwebController; - - /** - * Hdx controller. - * - * @var \Drupal\hr_paragraphs\Controller\HdxController - */ - protected $hdxController; - /** * {@inheritdoc} */ From a6cd72c341d4f7205206d6b2145c19621be7c87f Mon Sep 17 00:00:00 2001 From: "Peter Droogmans (attiks)" Date: Wed, 13 Jul 2022 11:35:36 +0200 Subject: [PATCH 02/40] feat: Display human readable rrule Refs: #IASC-753 --- .../iasc_common_design.theme | 32 +++++++++++++++++-- .../field/field--field-oa-date.html.twig | 3 ++ 2 files changed, 33 insertions(+), 2 deletions(-) diff --git a/html/themes/custom/iasc_common_design/iasc_common_design.theme b/html/themes/custom/iasc_common_design/iasc_common_design.theme index 615d03cb5..dfdc9df29 100644 --- a/html/themes/custom/iasc_common_design/iasc_common_design.theme +++ b/html/themes/custom/iasc_common_design/iasc_common_design.theme @@ -21,8 +21,36 @@ function iasc_common_design_preprocess_field(&$variables, $hook) { $max_date = strtotime($variables['element']['#items'][0]->end_value); foreach ($variables['element']['#items'] as $item) { - $min_date = min($min_date, strtotime($item->value)); - $max_date = max($max_date, strtotime($item->end_value)); + if (get_class($item) == 'Drupal\date_recur\Plugin\Field\FieldType\DateRecurItem') { + /** @var \Drupal\date_recur\Plugin\Field\FieldType\DateRecurItem $item */ + + if ($item->isRecurring()) { + // Generate all occurences. + foreach ($item->getHelper()->generateOccurrences() as $date) { + $min_date = min($min_date, $date->getStart()->getTimestamp()); + $max_date = max($max_date, $date->getEnd()->getTimestamp()); + } + + // Translate to text. + $rule = $item->rrule; + if ($rule) { + $parser = new \RRule\RRule($rule); + $variables['human_readable'] = $parser->humanReadable([ + 'date_formatter' => function ($date) { + return $date->format('d.m.Y'); + }, + ]); + } + } + else { + $min_date = min($min_date, strtotime($item->value)); + $max_date = max($max_date, strtotime($item->end_value)); + } + } + else { + $min_date = min($min_date, strtotime($item->value)); + $max_date = max($max_date, strtotime($item->end_value)); + } } $variables['min_date'] = [ diff --git a/html/themes/custom/iasc_common_design/templates/field/field--field-oa-date.html.twig b/html/themes/custom/iasc_common_design/templates/field/field--field-oa-date.html.twig index 202f9b1d1..bf22f8989 100644 --- a/html/themes/custom/iasc_common_design/templates/field/field--field-oa-date.html.twig +++ b/html/themes/custom/iasc_common_design/templates/field/field--field-oa-date.html.twig @@ -69,5 +69,8 @@ {% endif %} +
+ {{ human_readable }} +
{% endif %} From a6491212a7a600ef68d472f7426432bd0d44f058 Mon Sep 17 00:00:00 2001 From: "Peter Droogmans (attiks)" Date: Wed, 13 Jul 2022 11:36:26 +0200 Subject: [PATCH 03/40] feat: Default to UTC Refs: #IASC-753 --- config/field.field.node.oa_event.field_oa_date.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/config/field.field.node.oa_event.field_oa_date.yml b/config/field.field.node.oa_event.field_oa_date.yml index 6348d37cc..32d16b668 100644 --- a/config/field.field.node.oa_event.field_oa_date.yml +++ b/config/field.field.node.oa_event.field_oa_date.yml @@ -15,7 +15,9 @@ label: 'Event date' description: '' required: false translatable: false -default_value: { } +default_value: + - + default_time_zone: UTC default_value_callback: '' settings: precreate: P5Y From c90ae9770ec13516f5885c5769c83d0635404e0e Mon Sep 17 00:00:00 2001 From: "Peter Droogmans (attiks)" Date: Wed, 13 Jul 2022 11:37:52 +0200 Subject: [PATCH 04/40] feat: Display human readable rrule Refs: #IASC-753 --- .../themes/custom/iasc_common_design/iasc_common_design.theme | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/html/themes/custom/iasc_common_design/iasc_common_design.theme b/html/themes/custom/iasc_common_design/iasc_common_design.theme index dfdc9df29..f6c1b4c5c 100644 --- a/html/themes/custom/iasc_common_design/iasc_common_design.theme +++ b/html/themes/custom/iasc_common_design/iasc_common_design.theme @@ -5,8 +5,8 @@ * Template overrides, preprocess, and alter hooks for the OCHA Basic theme. */ -use Drupal\Core\Form\FormStateInterface; use Drupal\media\Entity\Media; +use RRule\RRule; /** * Implements template_preprocess_field(). @@ -34,7 +34,7 @@ function iasc_common_design_preprocess_field(&$variables, $hook) { // Translate to text. $rule = $item->rrule; if ($rule) { - $parser = new \RRule\RRule($rule); + $parser = new RRule($rule); $variables['human_readable'] = $parser->humanReadable([ 'date_formatter' => function ($date) { return $date->format('d.m.Y'); From 9b1c098115c426df1cd5140a3ada42016742a067 Mon Sep 17 00:00:00 2001 From: "Peter Droogmans (attiks)" Date: Wed, 13 Jul 2022 12:52:07 +0200 Subject: [PATCH 05/40] bug: Fix paging Refs: #IASC-753 --- .../custom/iasc_content/src/Controller/GroupMeetings.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/html/modules/custom/iasc_content/src/Controller/GroupMeetings.php b/html/modules/custom/iasc_content/src/Controller/GroupMeetings.php index a6dec5e7b..b66c59d25 100644 --- a/html/modules/custom/iasc_content/src/Controller/GroupMeetings.php +++ b/html/modules/custom/iasc_content/src/Controller/GroupMeetings.php @@ -111,6 +111,7 @@ public function getEvents(Request $request, Group $group) : array { $query->addCondition('field_iasc_audience', $group->id()); $query->addCondition('type', 'oa_event'); $query->addCondition('all_dates', $future_start->getTimestamp(), '>='); + $query->range(0,99); $query->sort('all_dates', 'ASC'); $query->sort('changed', 'ASC'); @@ -213,6 +214,7 @@ public function getEvents(Request $request, Group $group) : array { $query->addCondition('field_iasc_audience', $group->id()); $query->addCondition('type', 'oa_event'); $query->addCondition('all_dates', $past_end->getTimestamp(), '<'); + $query->range(0,99); $query->sort('all_dates', 'DESC'); $query->sort('changed', 'DESC'); From 47bfdea15d995ee4814e6532fe60d27a9cc73392 Mon Sep 17 00:00:00 2001 From: "Peter Droogmans (attiks)" Date: Wed, 13 Jul 2022 14:08:34 +0200 Subject: [PATCH 06/40] bug: Allow infinite repeats Refs: #IASC-753 --- .../custom/iasc_content/src/Controller/GroupMeetings.php | 4 ++-- .../src/Plugin/search_api/processor/StoreAllDates.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/html/modules/custom/iasc_content/src/Controller/GroupMeetings.php b/html/modules/custom/iasc_content/src/Controller/GroupMeetings.php index b66c59d25..e1fd37833 100644 --- a/html/modules/custom/iasc_content/src/Controller/GroupMeetings.php +++ b/html/modules/custom/iasc_content/src/Controller/GroupMeetings.php @@ -330,7 +330,7 @@ public function getEvents(Request $request, Group $group) : array { */ protected function getPastReccurrences(DateRecurItem $item, int $end): array { $until = (new \DateTime('@' . $end)); - return $item->getHelper()->getOccurrences(NULL, $until); + return $item->getHelper()->getOccurrences(NULL, $until, 99); } /** @@ -346,7 +346,7 @@ protected function getPastReccurrences(DateRecurItem $item, int $end): array { */ protected function getFutureReccurrences(DateRecurItem $item, int $start): array { $from = (new \DateTime('@' . $start)); - return $item->getHelper()->getOccurrences($from, NULL); + return $item->getHelper()->getOccurrences($from, NULL, 99); } } diff --git a/html/modules/custom/iasc_content/src/Plugin/search_api/processor/StoreAllDates.php b/html/modules/custom/iasc_content/src/Plugin/search_api/processor/StoreAllDates.php index efa3d6f9f..186dc0a7b 100644 --- a/html/modules/custom/iasc_content/src/Plugin/search_api/processor/StoreAllDates.php +++ b/html/modules/custom/iasc_content/src/Plugin/search_api/processor/StoreAllDates.php @@ -97,7 +97,7 @@ public function addFieldValues(ItemInterface $item) { protected function getApplicableItemReccurrences(DateRecurItem $item): array { $from = $item->start_date->getPhpDateTime(); $until = $item->start_date->add(new \DateInterval(static::MAX_FUTURE_DURATION))->getPhpDateTime(); - return $item->getHelper()->getOccurrences($from, $until); + return $item->getHelper()->getOccurrences($from, $until, 99); } } From ab39db4d0d050026ac76dd7e74e02b832db243bc Mon Sep 17 00:00:00 2001 From: "Peter Droogmans (attiks)" Date: Wed, 13 Jul 2022 14:09:28 +0200 Subject: [PATCH 07/40] bug: Allow infinite repeats, expose first_date info Refs: #IASC-753 --- .../custom/iasc_common_design/iasc_common_design.theme | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/html/themes/custom/iasc_common_design/iasc_common_design.theme b/html/themes/custom/iasc_common_design/iasc_common_design.theme index f6c1b4c5c..719a13fdf 100644 --- a/html/themes/custom/iasc_common_design/iasc_common_design.theme +++ b/html/themes/custom/iasc_common_design/iasc_common_design.theme @@ -20,13 +20,19 @@ function iasc_common_design_preprocess_field(&$variables, $hook) { $min_date = strtotime($variables['element']['#items'][0]->value); $max_date = strtotime($variables['element']['#items'][0]->end_value); + $variables['first_date'] = [ + 'day' => \Drupal::service('date.formatter')->format($min_date, 'custom', 'd'), + 'month' => \Drupal::service('date.formatter')->format($min_date, 'custom', 'M'), + 'year' => \Drupal::service('date.formatter')->format($min_date, 'custom', 'Y'), + ]; + foreach ($variables['element']['#items'] as $item) { if (get_class($item) == 'Drupal\date_recur\Plugin\Field\FieldType\DateRecurItem') { /** @var \Drupal\date_recur\Plugin\Field\FieldType\DateRecurItem $item */ if ($item->isRecurring()) { // Generate all occurences. - foreach ($item->getHelper()->generateOccurrences() as $date) { + foreach ($item->getHelper()->getOccurrences(NULL, NULL, 99) as $date) { $min_date = min($min_date, $date->getStart()->getTimestamp()); $max_date = max($max_date, $date->getEnd()->getTimestamp()); } From 5633250a341b68760eb020faffef3d90cb1a077a Mon Sep 17 00:00:00 2001 From: "Peter Droogmans (attiks)" Date: Wed, 13 Jul 2022 14:15:40 +0200 Subject: [PATCH 08/40] bug: Output infinite repeats Refs: #IASC-753 --- .../custom/iasc_common_design/iasc_common_design.theme | 9 +++++++++ .../templates/field/field--field-oa-date.html.twig | 8 ++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/html/themes/custom/iasc_common_design/iasc_common_design.theme b/html/themes/custom/iasc_common_design/iasc_common_design.theme index 719a13fdf..d992647dd 100644 --- a/html/themes/custom/iasc_common_design/iasc_common_design.theme +++ b/html/themes/custom/iasc_common_design/iasc_common_design.theme @@ -17,9 +17,14 @@ function iasc_common_design_preprocess_field(&$variables, $hook) { return; } + // Assume it ends. + $variables['is_infinite'] = FALSE; + + // Calculate first/original date. $min_date = strtotime($variables['element']['#items'][0]->value); $max_date = strtotime($variables['element']['#items'][0]->end_value); + // Expose it to twig. $variables['first_date'] = [ 'day' => \Drupal::service('date.formatter')->format($min_date, 'custom', 'd'), 'month' => \Drupal::service('date.formatter')->format($min_date, 'custom', 'M'), @@ -30,6 +35,10 @@ function iasc_common_design_preprocess_field(&$variables, $hook) { if (get_class($item) == 'Drupal\date_recur\Plugin\Field\FieldType\DateRecurItem') { /** @var \Drupal\date_recur\Plugin\Field\FieldType\DateRecurItem $item */ + // Infinite? + $variables['is_infinite'] = $variables['is_infinite'] || $item->getHelper()->isInfinite(); + + // Recurring. if ($item->isRecurring()) { // Generate all occurences. foreach ($item->getHelper()->getOccurrences(NULL, NULL, 99) as $date) { diff --git a/html/themes/custom/iasc_common_design/templates/field/field--field-oa-date.html.twig b/html/themes/custom/iasc_common_design/templates/field/field--field-oa-date.html.twig index bf22f8989..c0bf9b441 100644 --- a/html/themes/custom/iasc_common_design/templates/field/field--field-oa-date.html.twig +++ b/html/themes/custom/iasc_common_design/templates/field/field--field-oa-date.html.twig @@ -55,7 +55,7 @@
- {% if min_date.month != max_date.month %} + {% if min_date.month != max_date.month and not is_infinite %} {{ min_date.month }} - {{ max_date.month }} {% else %} {{ min_date.month }} @@ -63,7 +63,11 @@ {% if min_date.year != max_date.year %} - {{ min_date.year }} - {{ max_date.year }} + {% if is_infinite %} + {{ min_date.year }} - ... + {% else %} + {{ min_date.year }} - {{ max_date.year }} + {% endif %} {% else %} {{ min_date.year }} {% endif %} From e8016577e8b2c0efee1004e60676da9affb94e92 Mon Sep 17 00:00:00 2001 From: "Peter Droogmans (attiks)" Date: Wed, 13 Jul 2022 14:17:30 +0200 Subject: [PATCH 09/40] bug: Output infinite repeats Refs: #IASC-753 --- .../templates/field/field--field-oa-date.html.twig | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/html/themes/custom/iasc_common_design/templates/field/field--field-oa-date.html.twig b/html/themes/custom/iasc_common_design/templates/field/field--field-oa-date.html.twig index c0bf9b441..eaa11f1db 100644 --- a/html/themes/custom/iasc_common_design/templates/field/field--field-oa-date.html.twig +++ b/html/themes/custom/iasc_common_design/templates/field/field--field-oa-date.html.twig @@ -46,10 +46,10 @@ {% if items|length > 0 %}
- {% if min_date.day != max_date.day %} + {% if min_date.day != max_date.day and not is_infinite %} {{ min_date.day }} - {{ max_date.day }} {% else %} - {{ min_date.day }} + {{ first_date.day }} {% endif %}
@@ -73,7 +73,7 @@ {% endif %}
-
+
{{ human_readable }}
{% endif %} From e353a1e972b3e98f2679925d74b6ae60a5b4f2e5 Mon Sep 17 00:00:00 2001 From: "Peter Droogmans (attiks)" Date: Wed, 13 Jul 2022 14:33:25 +0200 Subject: [PATCH 10/40] chore: CS Refs: #IASC-753 --- .../custom/iasc_content/src/Controller/GroupMeetings.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/html/modules/custom/iasc_content/src/Controller/GroupMeetings.php b/html/modules/custom/iasc_content/src/Controller/GroupMeetings.php index e1fd37833..70f67eef7 100644 --- a/html/modules/custom/iasc_content/src/Controller/GroupMeetings.php +++ b/html/modules/custom/iasc_content/src/Controller/GroupMeetings.php @@ -111,7 +111,7 @@ public function getEvents(Request $request, Group $group) : array { $query->addCondition('field_iasc_audience', $group->id()); $query->addCondition('type', 'oa_event'); $query->addCondition('all_dates', $future_start->getTimestamp(), '>='); - $query->range(0,99); + $query->range(0, 99); $query->sort('all_dates', 'ASC'); $query->sort('changed', 'ASC'); @@ -214,7 +214,7 @@ public function getEvents(Request $request, Group $group) : array { $query->addCondition('field_iasc_audience', $group->id()); $query->addCondition('type', 'oa_event'); $query->addCondition('all_dates', $past_end->getTimestamp(), '<'); - $query->range(0,99); + $query->range(0, 99); $query->sort('all_dates', 'DESC'); $query->sort('changed', 'DESC'); From d130d52d8cf12d6ab48f092264b3b3f6b58757a5 Mon Sep 17 00:00:00 2001 From: "Peter Droogmans (attiks)" Date: Wed, 13 Jul 2022 15:16:11 +0200 Subject: [PATCH 11/40] bug: Allow infinite repeats Refs: #IASC-753 --- html/modules/custom/iasc_content/iasc_content.module | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/html/modules/custom/iasc_content/iasc_content.module b/html/modules/custom/iasc_content/iasc_content.module index 7b228022f..a1fb87c56 100644 --- a/html/modules/custom/iasc_content/iasc_content.module +++ b/html/modules/custom/iasc_content/iasc_content.module @@ -1329,7 +1329,7 @@ function iasc_content_preprocess_paragraph__meetings_upcoming(&$variables) { $meetings = []; foreach ($events as $event) { foreach ($event->field_oa_date as $date_item) { - foreach ($date_item->getHelper()->getOccurrences(new \DateTime(), NULL) as $date) { + foreach ($date_item->getHelper()->getOccurrences(new \DateTime(), NULL, 99) as $date) { if ($date->getStart()->getTimestamp() >= time()) { $new_event = clone $event; $new_event->nid = $event->id() . $date->getStart()->getTimestamp(); @@ -1421,7 +1421,7 @@ function iasc_content_preprocess_paragraph__meetings_past(&$variables) { $meetings = []; foreach ($events as $event) { foreach ($event->field_oa_date as $date_item) { - foreach ($date_item->getHelper()->getOccurrences(NULL, new \DateTime()) as $date) { + foreach ($date_item->getHelper()->getOccurrences(NULL, new \DateTime(), 99) as $date) { if ($date->getStart()->getTimestamp() < time()) { $new_event = clone $event; $new_event->nid = $event->id() . $date->getStart()->getTimestamp(); From 592a5070af6c300368c7cb2c5a3684e1f7fee041 Mon Sep 17 00:00:00 2001 From: "Peter Droogmans (attiks)" Date: Wed, 13 Jul 2022 17:05:06 +0200 Subject: [PATCH 12/40] bug: local time Refs: #IASC-753 --- .../iasc_common_design.libraries.yml | 4 +++ .../iasc_common_design.theme | 30 ++++++++++++++++ .../iasc_common_design/js/local_time.js | 36 +++++++++++++++++++ .../field/field--field-oa-date.html.twig | 22 ++---------- .../node/node--oa-event--full.html.twig | 12 +++---- .../node/node--oa-event--teaser.html.twig | 7 +++- 6 files changed, 83 insertions(+), 28 deletions(-) create mode 100644 html/themes/custom/iasc_common_design/js/local_time.js diff --git a/html/themes/custom/iasc_common_design/iasc_common_design.libraries.yml b/html/themes/custom/iasc_common_design/iasc_common_design.libraries.yml index 39f637702..675d9d329 100644 --- a/html/themes/custom/iasc_common_design/iasc_common_design.libraries.yml +++ b/html/themes/custom/iasc_common_design/iasc_common_design.libraries.yml @@ -104,3 +104,7 @@ cd-select-a11y: css: theme: components/cd-select-a11y/cd-select-a11y.css: {} + +local-time: + js: + js/local_time.js: {} diff --git a/html/themes/custom/iasc_common_design/iasc_common_design.theme b/html/themes/custom/iasc_common_design/iasc_common_design.theme index d992647dd..20c12138c 100644 --- a/html/themes/custom/iasc_common_design/iasc_common_design.theme +++ b/html/themes/custom/iasc_common_design/iasc_common_design.theme @@ -29,8 +29,13 @@ function iasc_common_design_preprocess_field(&$variables, $hook) { 'day' => \Drupal::service('date.formatter')->format($min_date, 'custom', 'd'), 'month' => \Drupal::service('date.formatter')->format($min_date, 'custom', 'M'), 'year' => \Drupal::service('date.formatter')->format($min_date, 'custom', 'Y'), + 'timestamp' => $variables['element']['#items'][0]->value, ]; + // Expose next date. + $now = strtotime('now'); + $variables['next_date'] = NULL; + foreach ($variables['element']['#items'] as $item) { if (get_class($item) == 'Drupal\date_recur\Plugin\Field\FieldType\DateRecurItem') { /** @var \Drupal\date_recur\Plugin\Field\FieldType\DateRecurItem $item */ @@ -44,6 +49,21 @@ function iasc_common_design_preprocess_field(&$variables, $hook) { foreach ($item->getHelper()->getOccurrences(NULL, NULL, 99) as $date) { $min_date = min($min_date, $date->getStart()->getTimestamp()); $max_date = max($max_date, $date->getEnd()->getTimestamp()); + + if ($date->getStart()->getTimestamp() > $now) { + if (empty($variables['next_date']) || $date->getStart()->getTimestamp() < $variables['next_date']['timestamp']) { + // Cache till next date. + $variables['element']['#cache']['max-age'] = $date->getStart()->getTimestamp() - $now; + + // Set next date. + $variables['next_date'] = [ + 'day' => \Drupal::service('date.formatter')->format($date->getStart()->getTimestamp(), 'custom', 'd'), + 'month' => \Drupal::service('date.formatter')->format($date->getStart()->getTimestamp(), 'custom', 'M'), + 'year' => \Drupal::service('date.formatter')->format($date->getStart()->getTimestamp(), 'custom', 'Y'), + 'timestamp' => $date->getStart()->getTimestamp(), + ]; + } + } } // Translate to text. @@ -51,6 +71,10 @@ function iasc_common_design_preprocess_field(&$variables, $hook) { if ($rule) { $parser = new RRule($rule); $variables['human_readable'] = $parser->humanReadable([ + 'explicit_inifite' => FALSE, + 'dtstart' => FALSE, + 'include_start' => FALSE, + 'include_until' => TRUE, 'date_formatter' => function ($date) { return $date->format('d.m.Y'); }, @@ -78,6 +102,10 @@ function iasc_common_design_preprocess_field(&$variables, $hook) { 'month' => \Drupal::service('date.formatter')->format($max_date, 'custom', 'M'), 'year' => \Drupal::service('date.formatter')->format($max_date, 'custom', 'Y'), ]; + + if (empty($variables['next_date'])) { + $variables['next_date'] = $variables['min_date']; + } } } @@ -149,6 +177,8 @@ function iasc_common_design_preprocess_node(&$variables) { ->format(strtotime($node->field_oa_date->first()->end_value), 'custom', 'h.i a'), 'all_day' => FALSE, 'timezone' => $node->field_oa_date->first()->timezone, + 'timestamp_start' => strtotime($node->field_oa_date->first()->value), + 'timestamp_end' => strtotime($node->field_oa_date->first()->end_value), ]; if ($variables['event_time']['start'] == $variables['event_time']['end']) { diff --git a/html/themes/custom/iasc_common_design/js/local_time.js b/html/themes/custom/iasc_common_design/js/local_time.js new file mode 100644 index 000000000..6b4e499f0 --- /dev/null +++ b/html/themes/custom/iasc_common_design/js/local_time.js @@ -0,0 +1,36 @@ +/** + * @file + * Display time in local timezone. + */ + +(function () { + var spans = document.querySelectorAll('.cd-teaser__date__time-user[data-timestamp-start]'); + if (spans) { + spans.forEach(function (span) { + let start = new Date(parseInt(span.getAttribute('data-timestamp-start'), 10) * 1000); + let end = new Date(parseInt(span.getAttribute('data-timestamp-end'), 10) * 1000); + + span.innerHTML = '
'; + + let hours = start.getHours(); + let ampm = 'am'; + if (hours >= 12 ) { + ampm = 'pm'; + } + hours = hours % 12; + hours = hours ? hours : 12; + span.innerHTML += hours.toString().padStart(2, '0') + '.' + start.getMinutes().toString().padStart(2, '0') + ' ' + ampm; + + hours = end.getHours(); + ampm = 'am'; + if (hours >= 12 ) { + ampm = 'pm'; + } + hours = hours % 12; + hours = hours ? hours : 12; + span.innerHTML += ' — ' + hours.toString().padStart(2, '0') + '.' + end.getMinutes().toString().padStart(2, '0'); + span.innerHTML += ' (' + Intl.DateTimeFormat().resolvedOptions().timeZone + ')'; + }); + } +}()); + diff --git a/html/themes/custom/iasc_common_design/templates/field/field--field-oa-date.html.twig b/html/themes/custom/iasc_common_design/templates/field/field--field-oa-date.html.twig index eaa11f1db..40719888d 100644 --- a/html/themes/custom/iasc_common_design/templates/field/field--field-oa-date.html.twig +++ b/html/themes/custom/iasc_common_design/templates/field/field--field-oa-date.html.twig @@ -46,31 +46,15 @@ {% if items|length > 0 %}
- {% if min_date.day != max_date.day and not is_infinite %} - {{ min_date.day }} - {{ max_date.day }} - {% else %} - {{ first_date.day }} - {% endif %} + {{ next_date.day }}
- {% if min_date.month != max_date.month and not is_infinite %} - {{ min_date.month }} - {{ max_date.month }} - {% else %} - {{ min_date.month }} - {% endif %} + {{ next_date.month }} - {% if min_date.year != max_date.year %} - {% if is_infinite %} - {{ min_date.year }} - ... - {% else %} - {{ min_date.year }} - {{ max_date.year }} - {% endif %} - {% else %} - {{ min_date.year }} - {% endif %} + {{ next_date.year }}
diff --git a/html/themes/custom/iasc_common_design/templates/node/node--oa-event--full.html.twig b/html/themes/custom/iasc_common_design/templates/node/node--oa-event--full.html.twig index 9226ceba5..aa83b17ef 100644 --- a/html/themes/custom/iasc_common_design/templates/node/node--oa-event--full.html.twig +++ b/html/themes/custom/iasc_common_design/templates/node/node--oa-event--full.html.twig @@ -82,6 +82,7 @@ ] %} {{ attach_library('common_design/cd-alert') }} +{{ attach_library('iasc_common_design/local-time') }} {% set dialIn = node.field_dial_in_meeting.0.value %} @@ -140,14 +141,9 @@ {{ content.field_oa_date }}
- {{ node.field_oa_date|un_daterange_times(true, true) }} - {% if logged_in and not un_is_all_day(node.field_oa_date) %} - {% if datetime|date('e') != node.field_oa_date[0].timezone %} - - ({{ node.field_oa_date|un_daterange_named('local_times') }}) - - {% endif %} - {% endif %} + {{ event_time.output }} + +
{% if content.field_city|render %} diff --git a/html/themes/custom/iasc_common_design/templates/node/node--oa-event--teaser.html.twig b/html/themes/custom/iasc_common_design/templates/node/node--oa-event--teaser.html.twig index 1f0e1dd0e..9669ee4fd 100644 --- a/html/themes/custom/iasc_common_design/templates/node/node--oa-event--teaser.html.twig +++ b/html/themes/custom/iasc_common_design/templates/node/node--oa-event--teaser.html.twig @@ -113,7 +113,12 @@ {% endset %} {{ contentBody|striptags }} -
{{ node.field_oa_date|un_daterange_times(true, true) }}
+
+ {{ event_time.output }} + + ({{ node.field_oa_date|un_daterange_named('local_times') }}) + +
From e7545ace98fc5ff2184e2d1610e3fb56023e0292 Mon Sep 17 00:00:00 2001 From: "Peter Droogmans (attiks)" Date: Wed, 13 Jul 2022 17:52:12 +0200 Subject: [PATCH 13/40] bug: local time, next 5 dates Refs: #IASC-753 --- .../iasc_common_design.theme | 40 ++++++++++++++----- .../iasc_common_design/js/local_time.js | 2 +- .../field/field--field-oa-date.html.twig | 10 +++++ 3 files changed, 41 insertions(+), 11 deletions(-) diff --git a/html/themes/custom/iasc_common_design/iasc_common_design.theme b/html/themes/custom/iasc_common_design/iasc_common_design.theme index 20c12138c..b8848a28b 100644 --- a/html/themes/custom/iasc_common_design/iasc_common_design.theme +++ b/html/themes/custom/iasc_common_design/iasc_common_design.theme @@ -36,6 +36,9 @@ function iasc_common_design_preprocess_field(&$variables, $hook) { $now = strtotime('now'); $variables['next_date'] = NULL; + // Expose next 5 occurrences. + $variables['next_5'] = []; + foreach ($variables['element']['#items'] as $item) { if (get_class($item) == 'Drupal\date_recur\Plugin\Field\FieldType\DateRecurItem') { /** @var \Drupal\date_recur\Plugin\Field\FieldType\DateRecurItem $item */ @@ -62,6 +65,15 @@ function iasc_common_design_preprocess_field(&$variables, $hook) { 'year' => \Drupal::service('date.formatter')->format($date->getStart()->getTimestamp(), 'custom', 'Y'), 'timestamp' => $date->getStart()->getTimestamp(), ]; + + } + if (count($variables['next_5']) < 5) { + $variables['next_5'][] = [ + 'day' => \Drupal::service('date.formatter')->format($date->getStart()->getTimestamp(), 'custom', 'd'), + 'month' => \Drupal::service('date.formatter')->format($date->getStart()->getTimestamp(), 'custom', 'M'), + 'year' => \Drupal::service('date.formatter')->format($date->getStart()->getTimestamp(), 'custom', 'Y'), + 'timestamp' => $date->getStart()->getTimestamp(), + ]; } } } @@ -169,12 +181,26 @@ function iasc_common_design_preprocess_node(&$variables) { unset($variables['content']['field_additional_locations']); } } + $timezone = new \DateTimeZone($node->field_oa_date->first()->timezone); + $start = new \DateTime($node->field_oa_date->first()->value, $timezone); + if ($start->getOffset() > 0) { + $start->add(new \DateInterval('PT' . $start->getOffset() . 'S')); + } + else { + $start->sub(new \DateInterval('PT' . abs($start->getOffset()) . 'S')); + } + + $end = new \DateTime($node->field_oa_date->first()->end_value, $timezone); + if ($end->getOffset() > 0) { + $end->add(new \DateInterval('PT' . $end->getOffset() . 'S')); + } + else { + $end->sub(new \DateInterval('PT' . abs($end->getOffset()) . 'S')); + } $variables['event_time'] = [ - 'start' => \Drupal::service('date.formatter') - ->format(strtotime($node->field_oa_date->first()->value), 'custom', 'h.i a'), - 'end' => \Drupal::service('date.formatter') - ->format(strtotime($node->field_oa_date->first()->end_value), 'custom', 'h.i a'), + 'start' => $start->format('h.i a'), + 'end' => $end->format('h.i a'), 'all_day' => FALSE, 'timezone' => $node->field_oa_date->first()->timezone, 'timestamp_start' => strtotime($node->field_oa_date->first()->value), @@ -184,16 +210,10 @@ function iasc_common_design_preprocess_node(&$variables) { if ($variables['event_time']['start'] == $variables['event_time']['end']) { $variables['event_time']['all_day'] = TRUE; $variables['event_time']['output'] = '(All day)'; - if (isset($variables['content']['field_oa_date'][0]['#date']['start_date'])) { - $variables['content']['field_oa_date'][0]['#date']['start_date']['#text'] = explode(' - ', $variables['content']['field_oa_date'][0]['#date']['start_date']['#text'])[0]; - $variables['content']['field_oa_date'][0]['#date']['end_date']['#text'] = explode(' - ', $variables['content']['field_oa_date'][0]['#date']['end_date']['#text'])[0]; - } } elseif ($variables['event_time']['start'] == '00:00' && $variables['event_time']['end'] == '23:59') { $variables['event_time']['all_day'] = TRUE; $variables['event_time']['output'] = '(All day)'; - $variables['content']['field_oa_date'][0]['#date']['start_date']['#text'] = explode(' - ', $variables['content']['field_oa_date'][0]['#date']['start_date']['#text'])[0]; - $variables['content']['field_oa_date'][0]['#date']['end_date']['#text'] = explode(' - ', $variables['content']['field_oa_date'][0]['#date']['end_date']['#text'])[0]; } else { $variables['event_time']['output'] = $variables['event_time']['start'] . ' — ' . $variables['event_time']['end'] . ' (' . $variables['event_time']['timezone'] . ')'; diff --git a/html/themes/custom/iasc_common_design/js/local_time.js b/html/themes/custom/iasc_common_design/js/local_time.js index 6b4e499f0..bd4077d2f 100644 --- a/html/themes/custom/iasc_common_design/js/local_time.js +++ b/html/themes/custom/iasc_common_design/js/local_time.js @@ -28,7 +28,7 @@ } hours = hours % 12; hours = hours ? hours : 12; - span.innerHTML += ' — ' + hours.toString().padStart(2, '0') + '.' + end.getMinutes().toString().padStart(2, '0'); + span.innerHTML += ' — ' + hours.toString().padStart(2, '0') + '.' + end.getMinutes().toString().padStart(2, '0') + ' ' + ampm; span.innerHTML += ' (' + Intl.DateTimeFormat().resolvedOptions().timeZone + ')'; }); } diff --git a/html/themes/custom/iasc_common_design/templates/field/field--field-oa-date.html.twig b/html/themes/custom/iasc_common_design/templates/field/field--field-oa-date.html.twig index 40719888d..e4d33a8c0 100644 --- a/html/themes/custom/iasc_common_design/templates/field/field--field-oa-date.html.twig +++ b/html/themes/custom/iasc_common_design/templates/field/field--field-oa-date.html.twig @@ -60,5 +60,15 @@
{{ human_readable }}
+ {% if next_5|length > 0 %} +
+

Next upcoming dates

+
    + {% for next_event in next_5 %} +
  • {{ next_event.day }} {{ next_event.month }} {{ next_event.year }}
  • + {% endfor %} +
+
+ {% endif %} {% endif %} From 9966992a5155290c032e1cf0df2a89ab38aefdbc Mon Sep 17 00:00:00 2001 From: unocha-jenkins Date: Thu, 14 Jul 2022 06:38:02 +0000 Subject: [PATCH 14/40] chore: Update all outdated drupal/* packages. --- composer.lock | 106 +++++++++++++++++++++++++------------------------- 1 file changed, 53 insertions(+), 53 deletions(-) diff --git a/composer.lock b/composer.lock index 451a79a09..1f084e59f 100644 --- a/composer.lock +++ b/composer.lock @@ -3289,20 +3289,20 @@ }, { "name": "drupal/facets", - "version": "2.0.2", + "version": "2.0.4", "source": { "type": "git", "url": "https://git.drupalcode.org/project/facets.git", - "reference": "2.0.2" + "reference": "2.0.4" }, "dist": { "type": "zip", - "url": "https://ftp.drupal.org/files/projects/facets-2.0.2.zip", - "reference": "2.0.2", - "shasum": "17afc46d3f4e4300e8e69f23b3b01a4935b57104" + "url": "https://ftp.drupal.org/files/projects/facets-2.0.4.zip", + "reference": "2.0.4", + "shasum": "7735fa8d4422fa320a36a122a35adee5b5192f34" }, "require": { - "drupal/core": "^9.2 || ^10.0" + "drupal/core": "^9.3 || ^10.0" }, "conflict": { "drupal/search_api": "<1.14" @@ -3310,7 +3310,7 @@ "require-dev": { "drupal/jquery_ui_slider": "~1.1", "drupal/jquery_ui_touch_punch": "~1.0", - "drupal/search_api": "~1.21" + "drupal/search_api": "^1.24||1.x-dev" }, "suggest": { "drupal/jquery_ui_slider": "Required for the 'Facets Range Widget' module to work", @@ -3319,8 +3319,8 @@ "type": "drupal-module", "extra": { "drupal": { - "version": "2.0.2", - "datestamp": "1649151557", + "version": "2.0.4", + "datestamp": "1657367469", "security-coverage": { "status": "covered", "message": "Covered by Drupal's security advisory policy" @@ -3336,14 +3336,6 @@ "name": "See all contributors", "homepage": "https://www.drupal.org/node/2348769/committers" }, - { - "name": "StryKaizer", - "homepage": "https://www.drupal.org/user/462700" - }, - { - "name": "borisson_", - "homepage": "https://www.drupal.org/user/2393360" - }, { "name": "drunken monkey", "homepage": "https://www.drupal.org/user/205582" @@ -3351,6 +3343,14 @@ { "name": "mkalkbrenner", "homepage": "https://www.drupal.org/user/124705" + }, + { + "name": "Nick_vh", + "homepage": "https://www.drupal.org/user/122682" + }, + { + "name": "StryKaizer", + "homepage": "https://www.drupal.org/user/462700" } ], "description": "The Facet module allows site builders to easily create and manage faceted search interfaces.", @@ -5090,30 +5090,30 @@ }, { "name": "drupal/search_api_solr", - "version": "4.2.7", + "version": "4.2.8", "source": { "type": "git", "url": "https://git.drupalcode.org/project/search_api_solr.git", - "reference": "4.2.7" + "reference": "4.2.8" }, "dist": { "type": "zip", - "url": "https://ftp.drupal.org/files/projects/search_api_solr-4.2.7.zip", - "reference": "4.2.7", - "shasum": "a88ffc04e24224c61658675a8832f6939916614b" + "url": "https://ftp.drupal.org/files/projects/search_api_solr-4.2.8.zip", + "reference": "4.2.8", + "shasum": "2d38bec1302a1cede15cf9aab9ff1e62ba19d671" }, "require": { "composer/semver": "^1.0|^3.0", "consolidation/annotated-command": "^2.12|^4.1", - "drupal/core": "^9.2 || ^10.0", - "drupal/search_api": "~1.23", + "drupal/core": "^9.3 || ^10.0", + "drupal/search_api": "~1.24", "ext-dom": "*", "ext-json": "*", "ext-simplexml": "*", "laminas/laminas-stdlib": "^3.2", - "maennchen/zipstream-php": "^1.2|^2.0", + "maennchen/zipstream-php": "^2.2", "php": "^7.3|^8.0", - "solarium/solarium": "^6.2.3" + "solarium/solarium": "^6.2.4" }, "conflict": { "drupal/acquia_search_solr": "<1.0.0-beta8", @@ -5124,7 +5124,7 @@ "drupal/devel": "^4.0", "drupal/facets": "1.x-dev", "drupal/geofield": "1.x-dev", - "drupal/search_api_autocomplete": "*", + "drupal/search_api_autocomplete": "1.x-dev", "drupal/search_api_location": "1.x-dev", "drupal/search_api_spellcheck": "3.x-dev", "monolog/monolog": "^1.25", @@ -5140,8 +5140,8 @@ "type": "drupal-module", "extra": { "drupal": { - "version": "4.2.7", - "datestamp": "1643655324", + "version": "4.2.8", + "datestamp": "1657270260", "security-coverage": { "status": "covered", "message": "Covered by Drupal's security advisory policy" @@ -13365,16 +13365,16 @@ }, { "name": "composer/composer", - "version": "2.2.16", + "version": "2.2.17", "source": { "type": "git", "url": "https://github.com/composer/composer.git", - "reference": "8c0ee53ff67399b0eec4eee2c5dc5189ec6938a6" + "reference": "a8ab5070fb99396e4710baee286478ad697724c2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/composer/zipball/8c0ee53ff67399b0eec4eee2c5dc5189ec6938a6", - "reference": "8c0ee53ff67399b0eec4eee2c5dc5189ec6938a6", + "url": "https://api.github.com/repos/composer/composer/zipball/a8ab5070fb99396e4710baee286478ad697724c2", + "reference": "a8ab5070fb99396e4710baee286478ad697724c2", "shasum": "" }, "require": { @@ -13444,7 +13444,7 @@ "support": { "irc": "ircs://irc.libera.chat:6697/composer", "issues": "https://github.com/composer/composer/issues", - "source": "https://github.com/composer/composer/tree/2.2.16" + "source": "https://github.com/composer/composer/tree/2.2.17" }, "funding": [ { @@ -13460,7 +13460,7 @@ "type": "tidelift" } ], - "time": "2022-07-05T14:50:29+00:00" + "time": "2022-07-13T13:27:38+00:00" }, { "name": "composer/metadata-minifier", @@ -15718,16 +15718,16 @@ }, { "name": "laminas/laminas-servicemanager", - "version": "3.13.0", + "version": "3.14.0", "source": { "type": "git", "url": "https://github.com/laminas/laminas-servicemanager.git", - "reference": "6f96556ee314f9e0d57d83967c0087332836c31d" + "reference": "918de970b2c3d42acebff3d431d76db52b6a32a2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laminas/laminas-servicemanager/zipball/6f96556ee314f9e0d57d83967c0087332836c31d", - "reference": "6f96556ee314f9e0d57d83967c0087332836c31d", + "url": "https://api.github.com/repos/laminas/laminas-servicemanager/zipball/918de970b2c3d42acebff3d431d76db52b6a32a2", + "reference": "918de970b2c3d42acebff3d431d76db52b6a32a2", "shasum": "" }, "require": { @@ -15805,7 +15805,7 @@ "type": "community_bridge" } ], - "time": "2022-06-29T08:01:37+00:00" + "time": "2022-07-07T16:13:26+00:00" }, { "name": "laminas/laminas-text", @@ -15918,21 +15918,21 @@ }, { "name": "mglaman/phpstan-drupal", - "version": "1.1.20", + "version": "1.1.22", "source": { "type": "git", "url": "https://github.com/mglaman/phpstan-drupal.git", - "reference": "f9d8493835cc50ab9e3592486d129c2b355db335" + "reference": "87e64fb4c8370000b4e235c6e7314e48f486662c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/mglaman/phpstan-drupal/zipball/f9d8493835cc50ab9e3592486d129c2b355db335", - "reference": "f9d8493835cc50ab9e3592486d129c2b355db335", + "url": "https://api.github.com/repos/mglaman/phpstan-drupal/zipball/87e64fb4c8370000b4e235c6e7314e48f486662c", + "reference": "87e64fb4c8370000b4e235c6e7314e48f486662c", "shasum": "" }, "require": { "php": "^7.4 || ^8.0", - "phpstan/phpstan": "^1.7.0", + "phpstan/phpstan": "^1.6.0", "symfony/finder": "~3.4.5 ||^4.2 || ^5.0 || ^6.0", "symfony/yaml": "~3.4.5 || ^4.2|| ^5.0 || ^6.0", "webflo/drupal-finder": "^1.2" @@ -16002,7 +16002,7 @@ "description": "Drupal extension and rules for PHPStan", "support": { "issues": "https://github.com/mglaman/phpstan-drupal/issues", - "source": "https://github.com/mglaman/phpstan-drupal/tree/1.1.20" + "source": "https://github.com/mglaman/phpstan-drupal/tree/1.1.22" }, "funding": [ { @@ -16018,7 +16018,7 @@ "type": "tidelift" } ], - "time": "2022-06-07T14:32:27+00:00" + "time": "2022-07-13T18:37:22+00:00" }, { "name": "mikey179/vfsstream", @@ -16793,16 +16793,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.8.0", + "version": "1.8.1", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "b7648d4ee9321665acaf112e49da9fd93df8fbd5" + "reference": "8dbba631fa32f4b289404469c2afd6122fd61d67" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/b7648d4ee9321665acaf112e49da9fd93df8fbd5", - "reference": "b7648d4ee9321665acaf112e49da9fd93df8fbd5", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/8dbba631fa32f4b289404469c2afd6122fd61d67", + "reference": "8dbba631fa32f4b289404469c2afd6122fd61d67", "shasum": "" }, "require": { @@ -16828,7 +16828,7 @@ "description": "PHPStan - PHP Static Analysis Tool", "support": { "issues": "https://github.com/phpstan/phpstan/issues", - "source": "https://github.com/phpstan/phpstan/tree/1.8.0" + "source": "https://github.com/phpstan/phpstan/tree/1.8.1" }, "funding": [ { @@ -16848,7 +16848,7 @@ "type": "tidelift" } ], - "time": "2022-06-29T08:53:31+00:00" + "time": "2022-07-12T16:08:06+00:00" }, { "name": "phpstan/phpstan-deprecation-rules", From 8104de2afe335761fc1fa5463254b9fbf530a5c3 Mon Sep 17 00:00:00 2001 From: "Peter Droogmans (attiks)" Date: Thu, 14 Jul 2022 08:55:49 +0200 Subject: [PATCH 15/40] bug: display date from teaser Refs: #IASC-753 --- .../custom/iasc_common_design/js/local_time.js | 15 +++++++++++++++ .../field/field--field-oa-date.html.twig | 8 +++++--- .../node/node--oa-event--teaser.html.twig | 2 +- 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/html/themes/custom/iasc_common_design/js/local_time.js b/html/themes/custom/iasc_common_design/js/local_time.js index bd4077d2f..bac2950c8 100644 --- a/html/themes/custom/iasc_common_design/js/local_time.js +++ b/html/themes/custom/iasc_common_design/js/local_time.js @@ -32,5 +32,20 @@ span.innerHTML += ' (' + Intl.DateTimeFormat().resolvedOptions().timeZone + ')'; }); } + + // Check query string. + if (window.location.search.length > 0) { + const searchParams = new URLSearchParams(window.location.search); + if (searchParams.has('ts')) { + const month_names_short = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']; + + let container = document.querySelector('.node__content .cd-date'); + let date = new Date(parseInt(searchParams.get('ts'), 10) * 1000); + + container.querySelector('.cd-date__day').innerHTML = date.getDate(); + container.querySelector('.cd-date__month').innerHTML = month_names_short[date.getMonth()]; + container.querySelector('.cd-date__year').innerHTML = date.getFullYear(); + } + } }()); diff --git a/html/themes/custom/iasc_common_design/templates/field/field--field-oa-date.html.twig b/html/themes/custom/iasc_common_design/templates/field/field--field-oa-date.html.twig index e4d33a8c0..0157ccfbe 100644 --- a/html/themes/custom/iasc_common_design/templates/field/field--field-oa-date.html.twig +++ b/html/themes/custom/iasc_common_design/templates/field/field--field-oa-date.html.twig @@ -57,9 +57,11 @@ {{ next_date.year }} -
- {{ human_readable }} -
+ {% if human_readable %} +
+ {{ human_readable }} +
+ {% endif %} {% if next_5|length > 0 %}

Next upcoming dates

diff --git a/html/themes/custom/iasc_common_design/templates/node/node--oa-event--teaser.html.twig b/html/themes/custom/iasc_common_design/templates/node/node--oa-event--teaser.html.twig index 9669ee4fd..54c3aebfa 100644 --- a/html/themes/custom/iasc_common_design/templates/node/node--oa-event--teaser.html.twig +++ b/html/themes/custom/iasc_common_design/templates/node/node--oa-event--teaser.html.twig @@ -101,7 +101,7 @@ {{ title_prefix }} {% if label and not page %} - {{ label }} + {{ label }} {% endif %} {{ title_suffix }} From ebd8ccb6ebf99256b5df67505733099ed6377741 Mon Sep 17 00:00:00 2001 From: left23 Date: Thu, 14 Jul 2022 09:57:51 +0200 Subject: [PATCH 16/40] chore: rearrange markup, style upcoming date list, and improve event layout Refs: IASC-753 --- .../components/iasc-custom/node--event.css | 59 +++++++++++++++++++ .../components/iasc-custom/node.css | 5 -- .../field/field--field-oa-date.html.twig | 34 ++++++----- 3 files changed, 78 insertions(+), 20 deletions(-) diff --git a/html/themes/custom/iasc_common_design/components/iasc-custom/node--event.css b/html/themes/custom/iasc_common_design/components/iasc-custom/node--event.css index 5d3e1fa1a..3ef1d7318 100644 --- a/html/themes/custom/iasc_common_design/components/iasc-custom/node--event.css +++ b/html/themes/custom/iasc_common_design/components/iasc-custom/node--event.css @@ -20,6 +20,14 @@ margin-top: 0; } +.node--type-oa-event.node--view-mode-full .cd-teaser__date { + min-height: 80px; + /* height of calendar icon, helps clear elements below.*/ + margin-bottom: 1rem; + display: flex; + flex-wrap: wrap; +} + .node--type-oa-event.node--view-mode-full .cd-date { margin-right: 1rem; } @@ -41,3 +49,54 @@ .cd-grid--2-col .node--type-oa-event.node--view-mode-teaser.cd-teaser { border-bottom: 0 none; } + +.cd-teaser__date .next-5 { + clear: both; + padding-top: 1rem; +} + +.cd-teaser__date .next-5 h3 { + margin: 0; +} + +.cd-teaser__date .next-5 { + padding-top: 2rem; + order: 4; + flex: 1 0 100%; + width: 100%; +} + +.date__human_readable { + flex: 1 0 25%; +} + +.cd-teaser__date__time-only { + flex: 1 0 100%; + padding: 1rem 0 0; +} + +.cd-teaser__date .next-5 ul { + padding: 0; + list-style-position: inside; +} + +@media (min-width: 576px) { + .date__human_readable { + flex: 0 1 25%; + border-right: 1px dotted var(--iasc-secondary); + padding-right: 0.5rem; + margin-right: 1rem; + } + + .cd-teaser__date .next-5 { + padding-top: 2rem; + order: 4; + flex: 1 0 100%; + width: 100%; + } + + .cd-teaser__date__time-only { + flex: 1 0 25%; + padding: 0; + } +} diff --git a/html/themes/custom/iasc_common_design/components/iasc-custom/node.css b/html/themes/custom/iasc_common_design/components/iasc-custom/node.css index 0a53e405e..9e9e9299e 100644 --- a/html/themes/custom/iasc_common_design/components/iasc-custom/node.css +++ b/html/themes/custom/iasc_common_design/components/iasc-custom/node.css @@ -85,11 +85,6 @@ margin-bottom: 2rem; } -.node--type-oa-event.node--view-mode-full .cd-teaser__date { - min-height: 80px; /* height of calendar icon, helps clear elements below.*/ - margin-bottom: 1rem; -} - .align-left { margin-right: 1rem; } diff --git a/html/themes/custom/iasc_common_design/templates/field/field--field-oa-date.html.twig b/html/themes/custom/iasc_common_design/templates/field/field--field-oa-date.html.twig index 0157ccfbe..c0cdaeaa1 100644 --- a/html/themes/custom/iasc_common_design/templates/field/field--field-oa-date.html.twig +++ b/html/themes/custom/iasc_common_design/templates/field/field--field-oa-date.html.twig @@ -57,20 +57,24 @@ {{ next_date.year }}
- {% if human_readable %} -
- {{ human_readable }} -
- {% endif %} - {% if next_5|length > 0 %} -
-

Next upcoming dates

-
    - {% for next_event in next_5 %} -
  • {{ next_event.day }} {{ next_event.month }} {{ next_event.year }}
  • - {% endfor %} -
-
- {% endif %} {% endif %} + +{% if human_readable %} +
+ {{ human_readable }} +
+{% endif %} + +{% if next_5|length > 0 %} +
+

Next upcoming dates

+
    + {% for next_event in next_5 %} +
  • {{ next_event.day }} + {{ next_event.month }} + {{ next_event.year }}
  • + {% endfor %} +
+
+{% endif %} From 5ab018325dfb80937e3806e69ced27375cbb4c84 Mon Sep 17 00:00:00 2001 From: left23 Date: Thu, 14 Jul 2022 10:08:48 +0200 Subject: [PATCH 17/40] chore: rearrange markup so previous event details display as usual Refs: IASC-753 --- .../templates/node/node--oa-event--full.html.twig | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/html/themes/custom/iasc_common_design/templates/node/node--oa-event--full.html.twig b/html/themes/custom/iasc_common_design/templates/node/node--oa-event--full.html.twig index aa83b17ef..5e5fbc0a8 100644 --- a/html/themes/custom/iasc_common_design/templates/node/node--oa-event--full.html.twig +++ b/html/themes/custom/iasc_common_design/templates/node/node--oa-event--full.html.twig @@ -145,12 +145,12 @@ - - {% if content.field_city|render %} -

{{ content.field_city[0]['#context']['value'] }}

- {% endif %} + {% if content.field_city|render %} +

{{ content.field_city[0]['#context']['value'] }}

+ {% endif %} + {{ content|without('field_oa_date', 'field_content', 'field_sidebar', 'field_footer', 'field_featured_image', 'field_contact', 'field_city', 'field_additional_locations', 'field_venue', 'field_room', 'field_host', 'field_contact', 'field_iasc_audience', 'field_meeting_agendas', 'field_meeting_notes', 'field_dial_in_meeting', 'field_info_private') }} {{ content.field_content }} From 1eca1fa158225f822d2167332af6a0a560464f9b Mon Sep 17 00:00:00 2001 From: "Peter Droogmans (attiks)" Date: Thu, 14 Jul 2022 13:50:40 +0200 Subject: [PATCH 18/40] bug: display time on teaser Refs: #IASC-753 --- html/themes/custom/iasc_common_design/js/local_time.js | 4 +++- .../templates/node/node--oa-event--teaser.html.twig | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/html/themes/custom/iasc_common_design/js/local_time.js b/html/themes/custom/iasc_common_design/js/local_time.js index bac2950c8..da9831965 100644 --- a/html/themes/custom/iasc_common_design/js/local_time.js +++ b/html/themes/custom/iasc_common_design/js/local_time.js @@ -29,7 +29,9 @@ hours = hours % 12; hours = hours ? hours : 12; span.innerHTML += ' — ' + hours.toString().padStart(2, '0') + '.' + end.getMinutes().toString().padStart(2, '0') + ' ' + ampm; - span.innerHTML += ' (' + Intl.DateTimeFormat().resolvedOptions().timeZone + ')'; + if (Intl.DateTimeFormat().resolvedOptions().timeZone) { + span.innerHTML += ' (' + Intl.DateTimeFormat().resolvedOptions().timeZone + ')'; + } }); } diff --git a/html/themes/custom/iasc_common_design/templates/node/node--oa-event--teaser.html.twig b/html/themes/custom/iasc_common_design/templates/node/node--oa-event--teaser.html.twig index 54c3aebfa..8a15d179f 100644 --- a/html/themes/custom/iasc_common_design/templates/node/node--oa-event--teaser.html.twig +++ b/html/themes/custom/iasc_common_design/templates/node/node--oa-event--teaser.html.twig @@ -87,6 +87,7 @@ ] %} {{ attach_library('common_design/cd-teaser') }} +{{ attach_library('iasc_common_design/local-time') }} @@ -115,8 +116,7 @@
{{ event_time.output }} - - ({{ node.field_oa_date|un_daterange_named('local_times') }}) +
From 9be92ed3ccc866d3870d0c0fa72f1084894df600 Mon Sep 17 00:00:00 2001 From: left23 Date: Thu, 14 Jul 2022 17:15:31 +0200 Subject: [PATCH 19/40] chore: reduce font size for date time on teasers Refs: IASC-753 --- .../iasc_common_design/components/iasc-custom/node--event.css | 4 ++++ .../templates/node/node--oa-event--teaser.html.twig | 3 +-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/html/themes/custom/iasc_common_design/components/iasc-custom/node--event.css b/html/themes/custom/iasc_common_design/components/iasc-custom/node--event.css index 3ef1d7318..ec98fd93e 100644 --- a/html/themes/custom/iasc_common_design/components/iasc-custom/node--event.css +++ b/html/themes/custom/iasc_common_design/components/iasc-custom/node--event.css @@ -80,6 +80,10 @@ list-style-position: inside; } +.cd-date-time { + font-size: 1rem; +} + @media (min-width: 576px) { .date__human_readable { flex: 0 1 25%; diff --git a/html/themes/custom/iasc_common_design/templates/node/node--oa-event--teaser.html.twig b/html/themes/custom/iasc_common_design/templates/node/node--oa-event--teaser.html.twig index 8a15d179f..c91607bae 100644 --- a/html/themes/custom/iasc_common_design/templates/node/node--oa-event--teaser.html.twig +++ b/html/themes/custom/iasc_common_design/templates/node/node--oa-event--teaser.html.twig @@ -116,8 +116,7 @@
{{ event_time.output }} - - +
From deb6a0728d5eaf5bbe9249910b078698628c0275 Mon Sep 17 00:00:00 2001 From: "Peter Droogmans (attiks)" Date: Fri, 15 Jul 2022 13:18:44 +0200 Subject: [PATCH 20/40] feat: various fixes - fix timezone with occurrences - add extra info for all day events in other timezone - add support for events spanning multiple days - use Date objects where possible Refs: #IASC-753 --- .../custom/iasc_content/iasc_content.module | 25 +++- .../src/Controller/GroupMeetings.php | 24 +++- .../iasc_common_design.theme | 120 +++++++++++------- .../iasc_common_design/js/local_time.js | 51 +++++--- .../node/node--oa-event--full.html.twig | 2 +- .../node/node--oa-event--teaser.html.twig | 2 +- 6 files changed, 150 insertions(+), 74 deletions(-) diff --git a/html/modules/custom/iasc_content/iasc_content.module b/html/modules/custom/iasc_content/iasc_content.module index a1fb87c56..a19afb784 100644 --- a/html/modules/custom/iasc_content/iasc_content.module +++ b/html/modules/custom/iasc_content/iasc_content.module @@ -1329,16 +1329,25 @@ function iasc_content_preprocess_paragraph__meetings_upcoming(&$variables) { $meetings = []; foreach ($events as $event) { foreach ($event->field_oa_date as $date_item) { + /** @var \Drupal\date_recur\DateRange $date */ foreach ($date_item->getHelper()->getOccurrences(new \DateTime(), NULL, 99) as $date) { if ($date->getStart()->getTimestamp() >= time()) { $new_event = clone $event; $new_event->nid = $event->id() . $date->getStart()->getTimestamp(); $new_event->original_nid = $event->id(); + + // Needed for timezone offset. + $new_start = $date->getStart()->getTimestamp(); + $new_start = new \DateTime('@' . $new_start); + $new_end = $date->getEnd()->getTimestamp(); + $new_end = new \DateTime('@' . $new_end); + $new_event->set('field_oa_date', [ - 'value' => $date->getStart()->format('Y-m-d\TH:i:s'), - 'end_value' => $date->getEnd()->format('Y-m-d\TH:i:s'), + 'value' => $new_start->format('Y-m-d\TH:i:s'), + 'end_value' => $new_end->format('Y-m-d\TH:i:s'), 'timezone' => $date->getStart()->getTimezone()->getName(), ]); + $meetings[$event->id() . ':' . $date->getStart()->getTimestamp()] = $new_event; } } @@ -1426,11 +1435,19 @@ function iasc_content_preprocess_paragraph__meetings_past(&$variables) { $new_event = clone $event; $new_event->nid = $event->id() . $date->getStart()->getTimestamp(); $new_event->original_nid = $event->id(); + + // Needed for timezone offset. + $new_start = $date->getStart()->getTimestamp(); + $new_start = new \DateTime('@' . $new_start); + $new_end = $date->getEnd()->getTimestamp(); + $new_end = new \DateTime('@' . $new_end); + $new_event->set('field_oa_date', [ - 'value' => $date->getStart()->format('Y-m-d\TH:i:s'), - 'end_value' => $date->getEnd()->format('Y-m-d\TH:i:s'), + 'value' => $new_start->format('Y-m-d\TH:i:s'), + 'end_value' => $new_end->format('Y-m-d\TH:i:s'), 'timezone' => $date->getStart()->getTimezone()->getName(), ]); + $meetings[$event->id() . ':' . $date->getStart()->getTimestamp()] = $new_event; } } diff --git a/html/modules/custom/iasc_content/src/Controller/GroupMeetings.php b/html/modules/custom/iasc_content/src/Controller/GroupMeetings.php index 70f67eef7..9ca0e8569 100644 --- a/html/modules/custom/iasc_content/src/Controller/GroupMeetings.php +++ b/html/modules/custom/iasc_content/src/Controller/GroupMeetings.php @@ -138,11 +138,19 @@ public function getEvents(Request $request, Group $group) : array { $new_event = clone $event; $new_event->nid = $event->id() . $date->getStart()->getTimestamp(); $new_event->original_nid = $event->id(); + + // Needed for timezone offset. + $new_start = $date->getStart()->getTimestamp(); + $new_start = new \DateTime('@' . $new_start); + $new_end = $date->getEnd()->getTimestamp(); + $new_end = new \DateTime('@' . $new_end); + $new_event->set('field_oa_date', [ - 'value' => $date->getStart()->format('Y-m-d\TH:i:s'), - 'end_value' => $date->getEnd()->format('Y-m-d\TH:i:s'), + 'value' => $new_start->format('Y-m-d\TH:i:s'), + 'end_value' => $new_end->format('Y-m-d\TH:i:s'), 'timezone' => $date->getStart()->getTimezone()->getName(), ]); + $meetings[$event->id() . ':' . $date->getStart()->getTimestamp()] = $new_event; } elseif ($date->getStart()->getTimestamp() > $future_end->getTimestamp()) { @@ -241,11 +249,19 @@ public function getEvents(Request $request, Group $group) : array { $new_event = clone $event; $new_event->nid = $event->id() . $date->getStart()->getTimestamp(); $new_event->original_nid = $event->id(); + + // Needed for timezone offset. + $new_start = $date->getStart()->getTimestamp(); + $new_start = new \DateTime('@' . $new_start); + $new_end = $date->getEnd()->getTimestamp(); + $new_end = new \DateTime('@' . $new_end); + $new_event->set('field_oa_date', [ - 'value' => $date->getStart()->format('Y-m-d\TH:i:s'), - 'end_value' => $date->getEnd()->format('Y-m-d\TH:i:s'), + 'value' => $new_start->format('Y-m-d\TH:i:s'), + 'end_value' => $new_end->format('Y-m-d\TH:i:s'), 'timezone' => $date->getStart()->getTimezone()->getName(), ]); + $meetings[$event->id() . ':' . $date->getStart()->getTimestamp()] = $new_event; } elseif ($date->getStart()->getTimestamp() < $past_start->getTimestamp()) { diff --git a/html/themes/custom/iasc_common_design/iasc_common_design.theme b/html/themes/custom/iasc_common_design/iasc_common_design.theme index b8848a28b..e4233f359 100644 --- a/html/themes/custom/iasc_common_design/iasc_common_design.theme +++ b/html/themes/custom/iasc_common_design/iasc_common_design.theme @@ -20,16 +20,23 @@ function iasc_common_design_preprocess_field(&$variables, $hook) { // Assume it ends. $variables['is_infinite'] = FALSE; + /** @var \Drupal\date_recur\Plugin\Field\FieldType\DateRecurItem $date_item */ + $date_item = $variables['element']['#items'][0]; + + // Entered timezone. + $timezone = $date_item->timezone; + $format_options = ['timezone' => $timezone]; + // Calculate first/original date. - $min_date = strtotime($variables['element']['#items'][0]->value); - $max_date = strtotime($variables['element']['#items'][0]->end_value); + $min_date = $date_item->start_date; + $max_date = $date_item->end_date; // Expose it to twig. $variables['first_date'] = [ - 'day' => \Drupal::service('date.formatter')->format($min_date, 'custom', 'd'), - 'month' => \Drupal::service('date.formatter')->format($min_date, 'custom', 'M'), - 'year' => \Drupal::service('date.formatter')->format($min_date, 'custom', 'Y'), - 'timestamp' => $variables['element']['#items'][0]->value, + 'day' => $min_date->format('d', $format_options), + 'month' => $min_date->format('M', $format_options), + 'year' => $min_date->format('Y', $format_options), + 'timestamp' => $min_date->getTimestamp(), ]; // Expose next date. @@ -50,8 +57,12 @@ function iasc_common_design_preprocess_field(&$variables, $hook) { if ($item->isRecurring()) { // Generate all occurences. foreach ($item->getHelper()->getOccurrences(NULL, NULL, 99) as $date) { - $min_date = min($min_date, $date->getStart()->getTimestamp()); - $max_date = max($max_date, $date->getEnd()->getTimestamp()); + if ($date->getStart()->getTimestamp() < $min_date->getTimestamp()) { + $min_date = $date->getStart(); + } + if ($date->getEnd()->getTimestamp() > $max_date->getTimestamp()) { + $max_date = $date->getEnd(); + } if ($date->getStart()->getTimestamp() > $now) { if (empty($variables['next_date']) || $date->getStart()->getTimestamp() < $variables['next_date']['timestamp']) { @@ -60,18 +71,17 @@ function iasc_common_design_preprocess_field(&$variables, $hook) { // Set next date. $variables['next_date'] = [ - 'day' => \Drupal::service('date.formatter')->format($date->getStart()->getTimestamp(), 'custom', 'd'), - 'month' => \Drupal::service('date.formatter')->format($date->getStart()->getTimestamp(), 'custom', 'M'), - 'year' => \Drupal::service('date.formatter')->format($date->getStart()->getTimestamp(), 'custom', 'Y'), + 'day' => $date->getStart()->format('d'), + 'month' => $date->getStart()->format('M'), + 'year' => $date->getStart()->format('Y'), 'timestamp' => $date->getStart()->getTimestamp(), ]; - } if (count($variables['next_5']) < 5) { $variables['next_5'][] = [ - 'day' => \Drupal::service('date.formatter')->format($date->getStart()->getTimestamp(), 'custom', 'd'), - 'month' => \Drupal::service('date.formatter')->format($date->getStart()->getTimestamp(), 'custom', 'M'), - 'year' => \Drupal::service('date.formatter')->format($date->getStart()->getTimestamp(), 'custom', 'Y'), + 'day' => $date->getStart()->format('d'), + 'month' => $date->getStart()->format('M'), + 'year' => $date->getStart()->format('Y'), 'timestamp' => $date->getStart()->getTimestamp(), ]; } @@ -94,25 +104,36 @@ function iasc_common_design_preprocess_field(&$variables, $hook) { } } else { - $min_date = min($min_date, strtotime($item->value)); - $max_date = max($max_date, strtotime($item->end_value)); + if ($item->start_date->getTimestamp() < $min_date->getTimestamp()) { + $min_date = $item->start_date; + } + if ($item->end_date->getTimestamp() > $max_date->getTimestamp()) { + $max_date = $item->end_date; + } } } else { - $min_date = min($min_date, strtotime($item->value)); - $max_date = max($max_date, strtotime($item->end_value)); + /** @var \DateTimeInterface $item */ + if ($item->getTimestamp() < $min_date->getTimestamp()) { + $min_date = $item; + } + if ($item->getTimestamp() > $max_date->getTimestamp()) { + $max_date = $item; + } } } $variables['min_date'] = [ - 'day' => \Drupal::service('date.formatter')->format($min_date, 'custom', 'd'), - 'month' => \Drupal::service('date.formatter')->format($min_date, 'custom', 'M'), - 'year' => \Drupal::service('date.formatter')->format($min_date, 'custom', 'Y'), + 'day' => $min_date->format('d', $format_options), + 'month' => $min_date->format('M', $format_options), + 'year' => $min_date->format('Y', $format_options), + 'timestamp' => $min_date->getTimestamp(), ]; $variables['max_date'] = [ - 'day' => \Drupal::service('date.formatter')->format($max_date, 'custom', 'd'), - 'month' => \Drupal::service('date.formatter')->format($max_date, 'custom', 'M'), - 'year' => \Drupal::service('date.formatter')->format($max_date, 'custom', 'Y'), + 'day' => $max_date->format('d'), + 'month' => $max_date->format('M'), + 'year' => $max_date->format('Y'), + 'timestamp' => $max_date->getTimestamp(), ]; if (empty($variables['next_date'])) { @@ -181,42 +202,43 @@ function iasc_common_design_preprocess_node(&$variables) { unset($variables['content']['field_additional_locations']); } } - $timezone = new \DateTimeZone($node->field_oa_date->first()->timezone); - $start = new \DateTime($node->field_oa_date->first()->value, $timezone); - if ($start->getOffset() > 0) { - $start->add(new \DateInterval('PT' . $start->getOffset() . 'S')); - } - else { - $start->sub(new \DateInterval('PT' . abs($start->getOffset()) . 'S')); - } - $end = new \DateTime($node->field_oa_date->first()->end_value, $timezone); - if ($end->getOffset() > 0) { - $end->add(new \DateInterval('PT' . $end->getOffset() . 'S')); - } - else { - $end->sub(new \DateInterval('PT' . abs($end->getOffset()) . 'S')); - } + /** @var \Drupal\date_recur\Plugin\Field\FieldType\DateRecurItem $date_item */ + $date_item = $node->field_oa_date->first(); + $timezone = $date_item->timezone; + $format_options = ['timezone' => $timezone]; + + $start = $date_item->start_date; + $end = $date_item->end_date; $variables['event_time'] = [ - 'start' => $start->format('h.i a'), - 'end' => $end->format('h.i a'), + 'start' => $start->format('h.i a', $format_options), + 'end' => $end->format('h.i a', $format_options), + 'start_day' => $start->format('d.m.Y', $format_options), + 'end_day' => $end->format('d.m.Y', $format_options), 'all_day' => FALSE, - 'timezone' => $node->field_oa_date->first()->timezone, - 'timestamp_start' => strtotime($node->field_oa_date->first()->value), - 'timestamp_end' => strtotime($node->field_oa_date->first()->end_value), + 'multiple_days' => $start->format('d.m.Y', $format_options) != $end->format('d.m.Y', $format_options), + 'timezone' => $timezone, + 'timestamp_start' => $start->getTimestamp(), + 'timestamp_end' => $end->getTimestamp(), + 'output' => '', ]; + // Add dates for multiple day events. + if ($variables['event_time']['multiple_days']) { + $variables['event_time']['output'] = $variables['event_time']['start_day'] . ' — ' . $variables['event_time']['end_day'] . ', '; + } + if ($variables['event_time']['start'] == $variables['event_time']['end']) { $variables['event_time']['all_day'] = TRUE; - $variables['event_time']['output'] = '(All day)'; + $variables['event_time']['output'] .= 'All day'; } - elseif ($variables['event_time']['start'] == '00:00' && $variables['event_time']['end'] == '23:59') { + elseif ($variables['event_time']['start'] == '12.00 am' && $variables['event_time']['end'] == '11.59 pm') { $variables['event_time']['all_day'] = TRUE; - $variables['event_time']['output'] = '(All day)'; + $variables['event_time']['output'] .= 'All day'; } else { - $variables['event_time']['output'] = $variables['event_time']['start'] . ' — ' . $variables['event_time']['end'] . ' (' . $variables['event_time']['timezone'] . ')'; + $variables['event_time']['output'] .= $variables['event_time']['start'] . ' — ' . $variables['event_time']['end'] . ' (' . $variables['event_time']['timezone'] . ')'; } } diff --git a/html/themes/custom/iasc_common_design/js/local_time.js b/html/themes/custom/iasc_common_design/js/local_time.js index da9831965..7ddc7f9f1 100644 --- a/html/themes/custom/iasc_common_design/js/local_time.js +++ b/html/themes/custom/iasc_common_design/js/local_time.js @@ -9,26 +9,47 @@ spans.forEach(function (span) { let start = new Date(parseInt(span.getAttribute('data-timestamp-start'), 10) * 1000); let end = new Date(parseInt(span.getAttribute('data-timestamp-end'), 10) * 1000); + let allDay = span.getAttribute('data-all-day'); span.innerHTML = '
'; - let hours = start.getHours(); - let ampm = 'am'; - if (hours >= 12 ) { - ampm = 'pm'; + // Check if we have multiple days. + let day_start = start.getDate().toString().padStart(2, '0') + '.' + (start.getMonth() + 1).toString().padStart(2, '0') + '.' + start.getFullYear().toString(); + let day_end = end.getDate().toString().padStart(2, '0') + '.' + (end.getMonth() + 1).toString().padStart(2, '0') + '.' + end.getFullYear().toString(); + if (day_start != day_end) { + span.innerHTML += day_start + ' — ' + day_end + ', '; } - hours = hours % 12; - hours = hours ? hours : 12; - span.innerHTML += hours.toString().padStart(2, '0') + '.' + start.getMinutes().toString().padStart(2, '0') + ' ' + ampm; - - hours = end.getHours(); - ampm = 'am'; - if (hours >= 12 ) { - ampm = 'pm'; + + if (allDay) { + let hours = start.getHours(); + let ampm = 'am'; + if (hours >= 12 ) { + ampm = 'pm'; + } + hours = hours % 12; + hours = hours ? hours : 12; + span.innerHTML += 'starting at ' + hours.toString().padStart(2, '0') + '.' + start.getMinutes().toString().padStart(2, '0') + ' ' + ampm; + } + else { + let hours = start.getHours(); + let ampm = 'am'; + if (hours >= 12 ) { + ampm = 'pm'; + } + hours = hours % 12; + hours = hours ? hours : 12; + span.innerHTML += hours.toString().padStart(2, '0') + '.' + start.getMinutes().toString().padStart(2, '0') + ' ' + ampm; + + hours = end.getHours(); + ampm = 'am'; + if (hours >= 12 ) { + ampm = 'pm'; + } + hours = hours % 12; + hours = hours ? hours : 12; + span.innerHTML += ' — ' + hours.toString().padStart(2, '0') + '.' + end.getMinutes().toString().padStart(2, '0') + ' ' + ampm; } - hours = hours % 12; - hours = hours ? hours : 12; - span.innerHTML += ' — ' + hours.toString().padStart(2, '0') + '.' + end.getMinutes().toString().padStart(2, '0') + ' ' + ampm; + if (Intl.DateTimeFormat().resolvedOptions().timeZone) { span.innerHTML += ' (' + Intl.DateTimeFormat().resolvedOptions().timeZone + ')'; } diff --git a/html/themes/custom/iasc_common_design/templates/node/node--oa-event--full.html.twig b/html/themes/custom/iasc_common_design/templates/node/node--oa-event--full.html.twig index 5e5fbc0a8..b72bc30b7 100644 --- a/html/themes/custom/iasc_common_design/templates/node/node--oa-event--full.html.twig +++ b/html/themes/custom/iasc_common_design/templates/node/node--oa-event--full.html.twig @@ -142,7 +142,7 @@
{{ event_time.output }} - +
diff --git a/html/themes/custom/iasc_common_design/templates/node/node--oa-event--teaser.html.twig b/html/themes/custom/iasc_common_design/templates/node/node--oa-event--teaser.html.twig index c91607bae..775336614 100644 --- a/html/themes/custom/iasc_common_design/templates/node/node--oa-event--teaser.html.twig +++ b/html/themes/custom/iasc_common_design/templates/node/node--oa-event--teaser.html.twig @@ -116,7 +116,7 @@
{{ event_time.output }} - +
From b71d8a8bb6b2ee3aa558cca9a11c5e6d85135cb0 Mon Sep 17 00:00:00 2001 From: "Peter Droogmans (attiks)" Date: Fri, 15 Jul 2022 15:39:50 +0200 Subject: [PATCH 21/40] - helpers added - all day does not have a timezone, so no local time shown - used UN standards for date and time --- .../custom/iasc_content/iasc_content.module | 97 +++++++++++++++++++ .../src/Controller/GroupMeetings.php | 6 +- .../iasc_common_design.theme | 34 ++++--- .../iasc_common_design/js/local_time.js | 51 +++++----- 4 files changed, 144 insertions(+), 44 deletions(-) diff --git a/html/modules/custom/iasc_content/iasc_content.module b/html/modules/custom/iasc_content/iasc_content.module index a19afb784..dd6f539e1 100644 --- a/html/modules/custom/iasc_content/iasc_content.module +++ b/html/modules/custom/iasc_content/iasc_content.module @@ -1515,3 +1515,100 @@ function iasc_content_migrate_meetings_paragraphs() { } } } + +/** + * Format time according the UN standards. + * + * @param \DateTimeInterface|\Drupal\Core\Datetime\DrupalDateTime $date + * Date. + * @param string $timezone + * Timezone. + */ +function iasc_content_format_time($date, $timezone = 'UTC') { + if (get_class($date) != 'Drupal\Core\Datetime\DrupalDateTime') { + $date = \Drupal\Core\Datetime\DrupalDateTime::createFromDateTime($date); + } + + $options = [ + 'timezone' => $timezone, + ]; + + $ampm = 'a.m.'; + if ($date->format('a', $options) === 'pm') { + $ampm = 'p.m.'; + } + + // Hide zero minutes. + if ($date->format('i', $options) === '00') { + return $date->format('g', $options) . ' ' . $ampm; + } + else { + return $date->format('g.i', $options) . ' ' . $ampm; + } +} + +/** + * Format date according the UN standards. + * + * @param \DateTimeInterface|\Drupal\Core\Datetime\DrupalDateTime $date + * Date. + * @param string $timezone + * Timezone. + */ +function iasc_content_format_date($date, $timezone = 'UTC') { + if (get_class($date) != 'Drupal\Core\Datetime\DrupalDateTime') { + $date = \Drupal\Core\Datetime\DrupalDateTime::createFromDateTime($date); + } + + $options = [ + 'timezone' => $timezone, + ]; + + return $date->format('d.m.Y', $options); +} + +/** + * Is multiple days. + * + * @param \DateTimeInterface|\Drupal\Core\Datetime\DrupalDateTime $start + * Start date. + * @param \DateTimeInterface|\Drupal\Core\Datetime\DrupalDateTime $end + * End date. + * @param string $timezone + * Timezone. + */ +function iasc_content_is_multiple_days($start, $end, $timezone = 'UTC') { + if (get_class($start) != 'Drupal\Core\Datetime\DrupalDateTime') { + $start = \Drupal\Core\Datetime\DrupalDateTime::createFromDateTime($start); + } + if (get_class($end) != 'Drupal\Core\Datetime\DrupalDateTime') { + $end = \Drupal\Core\Datetime\DrupalDateTime::createFromDateTime($end); + } + + $options = [ + 'timezone' => $timezone, + ]; + + return $start->format('d.m.Y', $options) != $end->format('d.m.Y', $options); +} + +/** + * Get first upcoming occurrence of a date. + */ +function iasc_content_first_upcoming_as_daterange(\Drupal\date_recur\Plugin\Field\FieldType\DateRecurItem $item) { + if (!$item->isRecurring()) { + return $item->getHelper()->getOccurrences()[0]; + } + + // Generate all occurences. + $today = new \DateTime('now'); + $today->setTime(0, 0, 0, 0); + foreach ($item->getHelper()->getOccurrences($today, NULL, 99) as $date) { + if ($date->getStart()->getTimestamp() >= $today->getTimestamp()) { + return $date; + } + } + + // Return first one, if no future one is found. + return $item->getHelper()->getOccurrences()[0]; +} diff --git a/html/modules/custom/iasc_content/src/Controller/GroupMeetings.php b/html/modules/custom/iasc_content/src/Controller/GroupMeetings.php index 9ca0e8569..362c59c8a 100644 --- a/html/modules/custom/iasc_content/src/Controller/GroupMeetings.php +++ b/html/modules/custom/iasc_content/src/Controller/GroupMeetings.php @@ -91,7 +91,7 @@ public function getEvents(Request $request, Group $group) : array { $past_end->add(new \DateInterval('P' . $months_per_page . 'M')); // Calculate future dates. - $future_start = new \DateTime(); + $future_start = new \DateTime('now'); $future_start->setTime(0, 0, 0); if ($future_offset > 0) { $future_start->add(new \DateInterval('P' . $future_offset * $months_per_page . 'M')); @@ -345,7 +345,7 @@ public function getEvents(Request $request, Group $group) : array { * A list of occurrences. */ protected function getPastReccurrences(DateRecurItem $item, int $end): array { - $until = (new \DateTime('@' . $end)); + $until = new \DateTime('@' . $end); return $item->getHelper()->getOccurrences(NULL, $until, 99); } @@ -361,7 +361,7 @@ protected function getPastReccurrences(DateRecurItem $item, int $end): array { * A list of occurrences. */ protected function getFutureReccurrences(DateRecurItem $item, int $start): array { - $from = (new \DateTime('@' . $start)); + $from = new \DateTime('@' . $start); return $item->getHelper()->getOccurrences($from, NULL, 99); } diff --git a/html/themes/custom/iasc_common_design/iasc_common_design.theme b/html/themes/custom/iasc_common_design/iasc_common_design.theme index e4233f359..739fa903e 100644 --- a/html/themes/custom/iasc_common_design/iasc_common_design.theme +++ b/html/themes/custom/iasc_common_design/iasc_common_design.theme @@ -40,7 +40,10 @@ function iasc_common_design_preprocess_field(&$variables, $hook) { ]; // Expose next date. - $now = strtotime('now'); + $today = new \DateTime('now'); + $today->setTime(0, 0, 0, 0); + + // Track next date. $variables['next_date'] = NULL; // Expose next 5 occurrences. @@ -64,10 +67,10 @@ function iasc_common_design_preprocess_field(&$variables, $hook) { $max_date = $date->getEnd(); } - if ($date->getStart()->getTimestamp() > $now) { + if ($date->getStart()->getTimestamp() >= $today->getTimestamp()) { if (empty($variables['next_date']) || $date->getStart()->getTimestamp() < $variables['next_date']['timestamp']) { // Cache till next date. - $variables['element']['#cache']['max-age'] = $date->getStart()->getTimestamp() - $now; + $variables['element']['#cache']['max-age'] = $date->getStart()->getTimestamp() - time(); // Set next date. $variables['next_date'] = [ @@ -77,7 +80,7 @@ function iasc_common_design_preprocess_field(&$variables, $hook) { 'timestamp' => $date->getStart()->getTimestamp(), ]; } - if (count($variables['next_5']) < 5) { + elseif (count($variables['next_5']) < 5) { $variables['next_5'][] = [ 'day' => $date->getStart()->format('d'), 'month' => $date->getStart()->format('M'), @@ -148,6 +151,7 @@ function iasc_common_design_preprocess_field(&$variables, $hook) { function iasc_common_design_preprocess_node(&$variables) { /** @var \Drupal\node\NodeInterface $node */ $node = $variables['elements']['#node']; + $bundle = $node->bundle(); if ($node->hasField('field_oa_date') && $node->field_oa_date->first() && is_numeric(strtotime($node->field_oa_date->first()->value))) { // Check if all paragraph fields are empty. If so, remove instance. @@ -206,18 +210,20 @@ function iasc_common_design_preprocess_node(&$variables) { /** @var \Drupal\date_recur\Plugin\Field\FieldType\DateRecurItem $date_item */ $date_item = $node->field_oa_date->first(); $timezone = $date_item->timezone; - $format_options = ['timezone' => $timezone]; - $start = $date_item->start_date; - $end = $date_item->end_date; + /** @var \Drupal\date_recur\DateRange $daterange */ + $daterange = iasc_content_first_upcoming_as_daterange($date_item); + + $start = $daterange->getStart(); + $end = $daterange->getEnd(); $variables['event_time'] = [ - 'start' => $start->format('h.i a', $format_options), - 'end' => $end->format('h.i a', $format_options), - 'start_day' => $start->format('d.m.Y', $format_options), - 'end_day' => $end->format('d.m.Y', $format_options), + 'start' => iasc_content_format_time($start, $timezone), + 'end' => iasc_content_format_time($end, $timezone), + 'start_day' => iasc_content_format_date($start, $timezone), + 'end_day' => iasc_content_format_date($end, $timezone), 'all_day' => FALSE, - 'multiple_days' => $start->format('d.m.Y', $format_options) != $end->format('d.m.Y', $format_options), + 'multiple_days' => iasc_content_is_multiple_days($start, $end, $timezone), 'timezone' => $timezone, 'timestamp_start' => $start->getTimestamp(), 'timestamp_end' => $end->getTimestamp(), @@ -233,7 +239,7 @@ function iasc_common_design_preprocess_node(&$variables) { $variables['event_time']['all_day'] = TRUE; $variables['event_time']['output'] .= 'All day'; } - elseif ($variables['event_time']['start'] == '12.00 am' && $variables['event_time']['end'] == '11.59 pm') { + elseif ($variables['event_time']['start'] == '12 a.m.' && $variables['event_time']['end'] == '11.59 p.m.') { $variables['event_time']['all_day'] = TRUE; $variables['event_time']['output'] .= 'All day'; } @@ -242,8 +248,6 @@ function iasc_common_design_preprocess_node(&$variables) { } } - $bundle = $node->bundle(); - if ($bundle == 'oa_wiki_page' && ($variables['elements']['#view_mode'] == 'teaser' || $variables['elements']['#view_mode'] == 'title')) { $document_file = $node->get('field_media_files')->getValue(); diff --git a/html/themes/custom/iasc_common_design/js/local_time.js b/html/themes/custom/iasc_common_design/js/local_time.js index 7ddc7f9f1..40d017fc4 100644 --- a/html/themes/custom/iasc_common_design/js/local_time.js +++ b/html/themes/custom/iasc_common_design/js/local_time.js @@ -10,6 +10,9 @@ let start = new Date(parseInt(span.getAttribute('data-timestamp-start'), 10) * 1000); let end = new Date(parseInt(span.getAttribute('data-timestamp-end'), 10) * 1000); let allDay = span.getAttribute('data-all-day'); + if (allDay) { + return; + } span.innerHTML = '
'; @@ -20,35 +23,31 @@ span.innerHTML += day_start + ' — ' + day_end + ', '; } - if (allDay) { - let hours = start.getHours(); - let ampm = 'am'; - if (hours >= 12 ) { - ampm = 'pm'; - } - hours = hours % 12; - hours = hours ? hours : 12; - span.innerHTML += 'starting at ' + hours.toString().padStart(2, '0') + '.' + start.getMinutes().toString().padStart(2, '0') + ' ' + ampm; + let hours = start.getHours(); + let ampm = 'a.m.'; + if (hours >= 12 ) { + ampm = 'p.m.'; } - else { - let hours = start.getHours(); - let ampm = 'am'; - if (hours >= 12 ) { - ampm = 'pm'; - } - hours = hours % 12; - hours = hours ? hours : 12; - span.innerHTML += hours.toString().padStart(2, '0') + '.' + start.getMinutes().toString().padStart(2, '0') + ' ' + ampm; + hours = hours % 12; + hours = hours ? hours : 12; + span.innerHTML += hours.toString(); + if (start.getMinutes() > 0) { + span.innerHTML += '.' + start.getMinutes().toString().padStart(2, '0'); + } + span.innerHTML += ' ' + ampm; - hours = end.getHours(); - ampm = 'am'; - if (hours >= 12 ) { - ampm = 'pm'; - } - hours = hours % 12; - hours = hours ? hours : 12; - span.innerHTML += ' — ' + hours.toString().padStart(2, '0') + '.' + end.getMinutes().toString().padStart(2, '0') + ' ' + ampm; + hours = end.getHours(); + ampm = 'a.m.'; + if (hours >= 12 ) { + ampm = 'p.m.'; + } + hours = hours % 12; + hours = hours ? hours : 12; + span.innerHTML += ' — ' + hours.toString(); + if (start.getMinutes() > 0) { + span.innerHTML += '.' + start.getMinutes().toString().padStart(2, '0'); } + span.innerHTML += ' ' + ampm; if (Intl.DateTimeFormat().resolvedOptions().timeZone) { span.innerHTML += ' (' + Intl.DateTimeFormat().resolvedOptions().timeZone + ')'; From 0213d8ca115551b2dd01800a429ce1e1b7ce52e0 Mon Sep 17 00:00:00 2001 From: "Peter Droogmans (attiks)" Date: Fri, 15 Jul 2022 15:46:58 +0200 Subject: [PATCH 22/40] CS --- html/modules/custom/iasc_content/iasc_content.module | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/html/modules/custom/iasc_content/iasc_content.module b/html/modules/custom/iasc_content/iasc_content.module index dd6f539e1..444df5f7d 100644 --- a/html/modules/custom/iasc_content/iasc_content.module +++ b/html/modules/custom/iasc_content/iasc_content.module @@ -6,6 +6,7 @@ */ use Drupal\Core\Access\AccessResult; +use Drupal\Core\Datetime\DrupalDateTime; use Drupal\Core\Entity\ContentEntityInterface; use Drupal\Core\Entity\EntityInterface; use Drupal\Core\Form\FormStateInterface; @@ -13,6 +14,7 @@ use Drupal\Core\Link; use Drupal\Core\Session\AccountInterface; use Drupal\Core\StreamWrapper\StreamWrapperManager; use Drupal\Core\Url; +use Drupal\date_recur\Plugin\Field\FieldType\DateRecurItem; use Drupal\entityqueue\Entity\EntitySubqueue; use Drupal\field\Entity\FieldConfig; use Drupal\field\Entity\FieldStorageConfig; @@ -1526,7 +1528,7 @@ function iasc_content_migrate_meetings_paragraphs() { */ function iasc_content_format_time($date, $timezone = 'UTC') { if (get_class($date) != 'Drupal\Core\Datetime\DrupalDateTime') { - $date = \Drupal\Core\Datetime\DrupalDateTime::createFromDateTime($date); + $date = DrupalDateTime::createFromDateTime($date); } $options = [ @@ -1557,7 +1559,7 @@ function iasc_content_format_time($date, $timezone = 'UTC') { */ function iasc_content_format_date($date, $timezone = 'UTC') { if (get_class($date) != 'Drupal\Core\Datetime\DrupalDateTime') { - $date = \Drupal\Core\Datetime\DrupalDateTime::createFromDateTime($date); + $date = DrupalDateTime::createFromDateTime($date); } $options = [ @@ -1579,10 +1581,10 @@ function iasc_content_format_date($date, $timezone = 'UTC') { */ function iasc_content_is_multiple_days($start, $end, $timezone = 'UTC') { if (get_class($start) != 'Drupal\Core\Datetime\DrupalDateTime') { - $start = \Drupal\Core\Datetime\DrupalDateTime::createFromDateTime($start); + $start = DrupalDateTime::createFromDateTime($start); } if (get_class($end) != 'Drupal\Core\Datetime\DrupalDateTime') { - $end = \Drupal\Core\Datetime\DrupalDateTime::createFromDateTime($end); + $end = DrupalDateTime::createFromDateTime($end); } $options = [ @@ -1595,7 +1597,7 @@ function iasc_content_is_multiple_days($start, $end, $timezone = 'UTC') { /** * Get first upcoming occurrence of a date. */ -function iasc_content_first_upcoming_as_daterange(\Drupal\date_recur\Plugin\Field\FieldType\DateRecurItem $item) { +function iasc_content_first_upcoming_as_daterange(DateRecurItem $item) { if (!$item->isRecurring()) { return $item->getHelper()->getOccurrences()[0]; } From 81d69d02779da4ba71452a0df211fdb2c1e4915f Mon Sep 17 00:00:00 2001 From: "Peter Droogmans (attiks)" Date: Fri, 15 Jul 2022 16:12:12 +0200 Subject: [PATCH 23/40] typo --- html/themes/custom/iasc_common_design/js/local_time.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/html/themes/custom/iasc_common_design/js/local_time.js b/html/themes/custom/iasc_common_design/js/local_time.js index 40d017fc4..7e2b32967 100644 --- a/html/themes/custom/iasc_common_design/js/local_time.js +++ b/html/themes/custom/iasc_common_design/js/local_time.js @@ -44,8 +44,8 @@ hours = hours % 12; hours = hours ? hours : 12; span.innerHTML += ' — ' + hours.toString(); - if (start.getMinutes() > 0) { - span.innerHTML += '.' + start.getMinutes().toString().padStart(2, '0'); + if (end.getMinutes() > 0) { + span.innerHTML += '.' + end.getMinutes().toString().padStart(2, '0'); } span.innerHTML += ' ' + ampm; From 97e47c2f1fe648f7ed3d496c2dd59cf9726d5712 Mon Sep 17 00:00:00 2001 From: "Peter Droogmans (attiks)" Date: Fri, 15 Jul 2022 16:14:13 +0200 Subject: [PATCH 24/40] next 5, including first --- .../themes/custom/iasc_common_design/iasc_common_design.theme | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/html/themes/custom/iasc_common_design/iasc_common_design.theme b/html/themes/custom/iasc_common_design/iasc_common_design.theme index 739fa903e..f10837eb7 100644 --- a/html/themes/custom/iasc_common_design/iasc_common_design.theme +++ b/html/themes/custom/iasc_common_design/iasc_common_design.theme @@ -80,7 +80,9 @@ function iasc_common_design_preprocess_field(&$variables, $hook) { 'timestamp' => $date->getStart()->getTimestamp(), ]; } - elseif (count($variables['next_5']) < 5) { + + // Add first to next 5 as well, date might be changed by javascript. + if (count($variables['next_5']) < 5) { $variables['next_5'][] = [ 'day' => $date->getStart()->format('d'), 'month' => $date->getStart()->format('M'), From cf9e6f9e5a82488781ade3f4301dc3b475f76730 Mon Sep 17 00:00:00 2001 From: "Peter Droogmans (attiks)" Date: Mon, 18 Jul 2022 14:11:26 +0200 Subject: [PATCH 25/40] bug: local time --- .../src/Controller/GroupMeetings.php | 202 +++++++++--------- .../iasc_common_design/js/local_time.js | 51 ----- 2 files changed, 101 insertions(+), 152 deletions(-) diff --git a/html/modules/custom/iasc_content/src/Controller/GroupMeetings.php b/html/modules/custom/iasc_content/src/Controller/GroupMeetings.php index 362c59c8a..f22f1f92e 100644 --- a/html/modules/custom/iasc_content/src/Controller/GroupMeetings.php +++ b/html/modules/custom/iasc_content/src/Controller/GroupMeetings.php @@ -216,118 +216,118 @@ public function getEvents(Request $request, Group $group) : array { '#links' => $pager_links, ], ]; + } - // Create list of events with all past occurences. - $query = $index->query(); - $query->addCondition('field_iasc_audience', $group->id()); - $query->addCondition('type', 'oa_event'); - $query->addCondition('all_dates', $past_end->getTimestamp(), '<'); - $query->range(0, 99); - $query->sort('all_dates', 'DESC'); - $query->sort('changed', 'DESC'); - - // Execute the search. - $results = $query->execute(); - - // Extratc Ids. - $ids = []; - foreach ($results as $item) { - $data = explode(':', $item->getId()); - $data = explode('/', $data[1]); - $ids[] = $data[1]; - } + // Create list of events with all past occurences. + $query = $index->query(); + $query->addCondition('field_iasc_audience', $group->id()); + $query->addCondition('type', 'oa_event'); + $query->addCondition('all_dates', $past_end->getTimestamp(), '<'); + $query->range(0, 99); + $query->sort('all_dates', 'DESC'); + $query->sort('changed', 'DESC'); - if (!empty($ids)) { - $has_past_meetings = FALSE; - $events = $this->entityTypeManager->getStorage('node')->loadMultiple($ids); - $view_builder = $this->entityTypeManager->getViewBuilder('node'); - $meetings = []; - foreach ($events as $event) { - foreach ($event->field_oa_date as $date_item) { - foreach ($this->getPastReccurrences($date_item, $past_end->getTimestamp()) as $date) { - if ($date->getStart()->getTimestamp() >= $past_start->getTimestamp() && $date->getStart()->getTimestamp() < $past_end->getTimestamp()) { - $new_event = clone $event; - $new_event->nid = $event->id() . $date->getStart()->getTimestamp(); - $new_event->original_nid = $event->id(); - - // Needed for timezone offset. - $new_start = $date->getStart()->getTimestamp(); - $new_start = new \DateTime('@' . $new_start); - $new_end = $date->getEnd()->getTimestamp(); - $new_end = new \DateTime('@' . $new_end); - - $new_event->set('field_oa_date', [ - 'value' => $new_start->format('Y-m-d\TH:i:s'), - 'end_value' => $new_end->format('Y-m-d\TH:i:s'), - 'timezone' => $date->getStart()->getTimezone()->getName(), - ]); - - $meetings[$event->id() . ':' . $date->getStart()->getTimestamp()] = $new_event; - } - elseif ($date->getStart()->getTimestamp() < $past_start->getTimestamp()) { - $has_past_meetings = TRUE; - } + // Execute the search. + $results = $query->execute(); + + // Extratc Ids. + $ids = []; + foreach ($results as $item) { + $data = explode(':', $item->getId()); + $data = explode('/', $data[1]); + $ids[] = $data[1]; + } + + if (!empty($ids)) { + $has_past_meetings = FALSE; + $events = $this->entityTypeManager->getStorage('node')->loadMultiple($ids); + $view_builder = $this->entityTypeManager->getViewBuilder('node'); + $meetings = []; + foreach ($events as $event) { + foreach ($event->field_oa_date as $date_item) { + foreach ($this->getPastReccurrences($date_item, $past_end->getTimestamp()) as $date) { + if ($date->getStart()->getTimestamp() >= $past_start->getTimestamp() && $date->getStart()->getTimestamp() < $past_end->getTimestamp()) { + $new_event = clone $event; + $new_event->nid = $event->id() . $date->getStart()->getTimestamp(); + $new_event->original_nid = $event->id(); + + // Needed for timezone offset. + $new_start = $date->getStart()->getTimestamp(); + $new_start = new \DateTime('@' . $new_start); + $new_end = $date->getEnd()->getTimestamp(); + $new_end = new \DateTime('@' . $new_end); + + $new_event->set('field_oa_date', [ + 'value' => $new_start->format('Y-m-d\TH:i:s'), + 'end_value' => $new_end->format('Y-m-d\TH:i:s'), + 'timezone' => $date->getStart()->getTimezone()->getName(), + ]); + + $meetings[$event->id() . ':' . $date->getStart()->getTimestamp()] = $new_event; + } + elseif ($date->getStart()->getTimestamp() < $past_start->getTimestamp()) { + $has_past_meetings = TRUE; } } } + } - // Sort the meetings. - usort($meetings, function ($a, $b) { - return strcmp($b->field_oa_date->first()->getValue()['value'], $a->field_oa_date->first()->getValue()['value']); - }); - - // Build pager links. - $pager_links = []; - if ($has_past_meetings) { - $pager_links[] = [ - 'text' => $this->t('Previous @months months', [ - '@months' => $months_per_page, - ]), - 'href' => Url::fromUserInput($current_uri, [ - 'query' => [ - 'past' => $past_offset + 1, - 'future' => $future_offset, - ], - ])->toString(), - ]; - } + // Sort the meetings. + usort($meetings, function ($a, $b) { + return strcmp($b->field_oa_date->first()->getValue()['value'], $a->field_oa_date->first()->getValue()['value']); + }); - if ($past_offset > 0) { - $pager_links[] = [ - 'text' => $this->t('Next @months months', [ - '@months' => $months_per_page, - ]), - 'href' => Url::fromUserInput($current_uri, [ - 'query' => [ - 'past' => $past_offset - 1, - 'future' => $future_offset, - ], - ])->toString(), - ]; - } + // Build pager links. + $pager_links = []; + if ($has_past_meetings) { + $pager_links[] = [ + 'text' => $this->t('Previous @months months', [ + '@months' => $months_per_page, + ]), + 'href' => Url::fromUserInput($current_uri, [ + 'query' => [ + 'past' => $past_offset + 1, + 'future' => $future_offset, + ], + ])->toString(), + ]; + } - $build['meetings_wrapper']['meetings_wrapper_past'] = [ - '#type' => 'container', - '#attributes' => [ - 'class' => [ - 'meetings_wrapper__past [ cd-flow ]', + if ($past_offset > 0) { + $pager_links[] = [ + 'text' => $this->t('Next @months months', [ + '@months' => $months_per_page, + ]), + 'href' => Url::fromUserInput($current_uri, [ + 'query' => [ + 'past' => $past_offset - 1, + 'future' => $future_offset, ], - ], - 'past_title' => [ - '#type' => 'markup', - '#markup' => $this->t('

Past meetings

Meetings from @from until @until.

', [ - '@from' => $past_start->format($date_format), - '@until' => $past_end->format($date_format), - ]), - ], - 'past' => $view_builder->viewMultiple($meetings, 'teaser'), - 'past_pager' => [ - '#theme' => 'iasc_content_pager', - '#pager_id' => 2, - '#links' => $pager_links, - ], + ])->toString(), ]; } + + $build['meetings_wrapper']['meetings_wrapper_past'] = [ + '#type' => 'container', + '#attributes' => [ + 'class' => [ + 'meetings_wrapper__past [ cd-flow ]', + ], + ], + 'past_title' => [ + '#type' => 'markup', + '#markup' => $this->t('

Past meetings

Meetings from @from until @until.

', [ + '@from' => $past_start->format($date_format), + '@until' => $past_end->format($date_format), + ]), + ], + 'past' => $view_builder->viewMultiple($meetings, 'teaser'), + 'past_pager' => [ + '#theme' => 'iasc_content_pager', + '#pager_id' => 2, + '#links' => $pager_links, + ], + ]; } return $build; diff --git a/html/themes/custom/iasc_common_design/js/local_time.js b/html/themes/custom/iasc_common_design/js/local_time.js index 7e2b32967..02c351d44 100644 --- a/html/themes/custom/iasc_common_design/js/local_time.js +++ b/html/themes/custom/iasc_common_design/js/local_time.js @@ -4,57 +4,6 @@ */ (function () { - var spans = document.querySelectorAll('.cd-teaser__date__time-user[data-timestamp-start]'); - if (spans) { - spans.forEach(function (span) { - let start = new Date(parseInt(span.getAttribute('data-timestamp-start'), 10) * 1000); - let end = new Date(parseInt(span.getAttribute('data-timestamp-end'), 10) * 1000); - let allDay = span.getAttribute('data-all-day'); - if (allDay) { - return; - } - - span.innerHTML = '
'; - - // Check if we have multiple days. - let day_start = start.getDate().toString().padStart(2, '0') + '.' + (start.getMonth() + 1).toString().padStart(2, '0') + '.' + start.getFullYear().toString(); - let day_end = end.getDate().toString().padStart(2, '0') + '.' + (end.getMonth() + 1).toString().padStart(2, '0') + '.' + end.getFullYear().toString(); - if (day_start != day_end) { - span.innerHTML += day_start + ' — ' + day_end + ', '; - } - - let hours = start.getHours(); - let ampm = 'a.m.'; - if (hours >= 12 ) { - ampm = 'p.m.'; - } - hours = hours % 12; - hours = hours ? hours : 12; - span.innerHTML += hours.toString(); - if (start.getMinutes() > 0) { - span.innerHTML += '.' + start.getMinutes().toString().padStart(2, '0'); - } - span.innerHTML += ' ' + ampm; - - hours = end.getHours(); - ampm = 'a.m.'; - if (hours >= 12 ) { - ampm = 'p.m.'; - } - hours = hours % 12; - hours = hours ? hours : 12; - span.innerHTML += ' — ' + hours.toString(); - if (end.getMinutes() > 0) { - span.innerHTML += '.' + end.getMinutes().toString().padStart(2, '0'); - } - span.innerHTML += ' ' + ampm; - - if (Intl.DateTimeFormat().resolvedOptions().timeZone) { - span.innerHTML += ' (' + Intl.DateTimeFormat().resolvedOptions().timeZone + ')'; - } - }); - } - // Check query string. if (window.location.search.length > 0) { const searchParams = new URLSearchParams(window.location.search); From 13037437df6a47758108dfca41c7d2f35f6fb663 Mon Sep 17 00:00:00 2001 From: Andy Footner Date: Mon, 18 Jul 2022 18:07:54 +0200 Subject: [PATCH 26/40] fix: enable csp module and remove seckit Refs: OPS-8232 --- composer.json | 1 + composer.lock | 52 ++++++++++++++++++++++++++++++- composer.patches.json | 3 -- config/core.extension.yml | 4 +-- config/csp.settings.yml | 64 ++++++++++++++++++++++++++++++++++++++ config/seckit.settings.yml | 56 --------------------------------- 6 files changed, 117 insertions(+), 63 deletions(-) create mode 100644 config/csp.settings.yml delete mode 100644 config/seckit.settings.yml diff --git a/composer.json b/composer.json index 42bbfa13b..4f904193a 100755 --- a/composer.json +++ b/composer.json @@ -40,6 +40,7 @@ "drupal/core-composer-scaffold": "^9.3.8", "drupal/core-project-message": "^9.3.8", "drupal/core-recommended": "^9.3.8", + "drupal/csp": "^1.16", "drupal/ctools": "^4.0", "drupal/date_recur": "^3.0", "drupal/date_recur_modular": "^3.0", diff --git a/composer.lock b/composer.lock index 1f084e59f..58fe5bedd 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "5b187174b30847955f7bda02d3e6d8de", + "content-hash": "f57ce748c57d3b5b70eb0f0ce66f86b9", "packages": [ { "name": "algolia/places", @@ -2650,6 +2650,56 @@ }, "time": "2022-07-07T01:18:39+00:00" }, + { + "name": "drupal/csp", + "version": "1.16.0", + "source": { + "type": "git", + "url": "https://git.drupalcode.org/project/csp.git", + "reference": "8.x-1.16" + }, + "dist": { + "type": "zip", + "url": "https://ftp.drupal.org/files/projects/csp-8.x-1.16.zip", + "reference": "8.x-1.16", + "shasum": "0d6568ff2b176497ff97a440bfae6b7135ad2d6b" + }, + "require": { + "drupal/core": "^8.5 || ^9.0", + "ext-json": "*", + "php": ">=7.2" + }, + "type": "drupal-module", + "extra": { + "drupal": { + "version": "8.x-1.16", + "datestamp": "1641415148", + "security-coverage": { + "status": "covered", + "message": "Covered by Drupal's security advisory policy" + } + } + }, + "notification-url": "https://packages.drupal.org/8/downloads", + "license": [ + "GPL-2.0-or-later" + ], + "authors": [ + { + "name": "gapple", + "homepage": "https://www.drupal.org/user/490940" + } + ], + "description": "Provide Content-Security-Policy headers", + "homepage": "https://www.drupal.org/project/csp", + "keywords": [ + "Drupal" + ], + "support": { + "source": "https://git.drupalcode.org/project/csp", + "issues": "https://www.drupal.org/project/issues/csp" + } + }, { "name": "drupal/csv_serialization", "version": "2.1.0", diff --git a/composer.patches.json b/composer.patches.json index d23d5d3d6..4d90d80fb 100644 --- a/composer.patches.json +++ b/composer.patches.json @@ -14,9 +14,6 @@ "drupal/search_api": { "https://www.drupal.org/project/search_api/issues/3130004 - Facets query part is lost in views": "https://git.drupalcode.org/project/search_api/-/merge_requests/8.diff" }, - "drupal/seckit": { - "https://www.drupal.org/project/seckit/issues/2844205#comment-14455849": "https://www.drupal.org/files/issues/2021-09-13/2844205-alter-csp-directives-10.patch" - }, "drupal/user_expire": { "Allow the notification email to be customised": "https://git.drupalcode.org/project/user_expire/-/merge_requests/5.diff", "Reset expiration when user is reactivated": "https://git.drupalcode.org/project/user_expire/-/merge_requests/6.diff" diff --git a/config/core.extension.yml b/config/core.extension.yml index 4f200072b..516ca1cf7 100644 --- a/config/core.extension.yml +++ b/config/core.extension.yml @@ -16,6 +16,7 @@ module: config: 0 config_split: 0 contextual: 0 + csp: 0 csv_serialization: 0 ctools: 0 date_recur: 0 @@ -70,7 +71,6 @@ module: node: 0 node_view_permissions: 0 ocha_integrations: 0 - ocha_security: 0 ocha_viewsreference_filter: 0 options: 0 page_cache: 0 @@ -89,7 +89,6 @@ module: search_api_db: 0 search_api_solr: 0 search_api_solr_admin: 0 - seckit: 0 select2: 0 select2_facets: 0 select_a11y: 0 @@ -117,7 +116,6 @@ module: user_expire: 0 variationcache: 0 views_data_export: 0 - views_ui: 0 viewsreference: 0 webform: 0 webform_submission_log: 0 diff --git a/config/csp.settings.yml b/config/csp.settings.yml new file mode 100644 index 000000000..7d88fc773 --- /dev/null +++ b/config/csp.settings.yml @@ -0,0 +1,64 @@ +_core: + default_config_hash: yOPH6uEZYRHbg2OFP-bze0jGr06fI-Gr_66W-vA8Faw +report-only: + enable: true + directives: + connect-src: + base: self + sources: + - www.google-analytics.com + font-src: + base: self + sources: + - 'data:' + - interagencystandingcommittee.org + - fonts.gstatic.com + img-src: + base: self + sources: + - 'data:' + - '*.twimg.com' + - '*.twitter.com' + - '*.google-analytics.com' + - www.googletagmanager.com + - '*.ytimg.com' + - '*.google.com' + - mcusercontent.com + - '*.mailchimp.com' + - '*.gstatic.com' + object-src: + base: none + script-src: + base: self + sources: + - fonts.googleapis.com + - www.gstatic.com + - platform.twitter.com + - '*.twimg.com' + - www.google.com + - www.googletagmanager.com + - www.google-analytics.com + - cdn.jsdelivr.net + script-src-attr: + base: self + script-src-elem: + base: self + style-src: + base: self + style-src-attr: + base: self + style-src-elem: + base: self + frame-ancestors: + base: self + reporting: + plugin: sitelog +enforce: + enable: true + directives: + object-src: + base: none + frame-ancestors: + base: self + reporting: + plugin: sitelog diff --git a/config/seckit.settings.yml b/config/seckit.settings.yml deleted file mode 100644 index d7efeab47..000000000 --- a/config/seckit.settings.yml +++ /dev/null @@ -1,56 +0,0 @@ -_core: - default_config_hash: x6bhN6WZwfVUI_LLMvRJIUW_2c26VTaBozbfXmJWmro -seckit_xss: - csp: - checkbox: true - vendor-prefix: - x: false - webkit: false - report-only: true - default-src: '' - script-src: '''self'' fonts.googleapis.com www.gstatic.com platform.twitter.com *.twimg.com www.google.com www.googletagmanager.com www.google-analytics.com cdn.jsdelivr.net' - object-src: '' - style-src: '' - img-src: '''self'' data: *.twimg.com *.twitter.com *.google-analytics.com www.googletagmanager.com *.ytimg.com *.google.com mcusercontent.com *.mailchimp.com *.gstatic.com' - media-src: '' - frame-src: '' - frame-ancestors: '' - child-src: '' - font-src: 'data: interagencystandingcommittee.org fonts.gstatic.com' - connect-src: '''self'' www.google-analytics.com' - report-uri: /report-csp-violation - upgrade-req: false - policy-uri: '' - x_xss: - seckit_x_xss_option_disable: Disabled - seckit_x_xss_option_0: '0' - seckit_x_xss_option_1: 1; - seckit_x_xss_option_1_block: '1; mode=block' - select: 0 -seckit_csrf: - origin: false - origin_whitelist: fonts.gstatic.com -seckit_clickjacking: - js_css_noscript: false - noscript_message: 'Sorry, you need to enable JavaScript to visit this website.' - x_frame: '1' - x_frame_allow_from: '' -seckit_ssl: - hsts: false - hsts_subdomains: false - hsts_max_age: 1000 - hsts_preload: false -seckit_ct: - expect_ct: false - max_age: 86400 - report_uri: '' - enforce: false -seckit_fp: - feature_policy: false - feature_policy_policy: '' -seckit_various: - from_origin: false - from_origin_destination: same - referrer_policy: false - referrer_policy_policy: no-referrer-when-downgrade - disable_autocomplete: false From d8a4b22c9a989363d47f9b1f3057425666aa8a29 Mon Sep 17 00:00:00 2001 From: "Peter Droogmans (attiks)" Date: Tue, 19 Jul 2022 12:27:41 +0200 Subject: [PATCH 27/40] feat: RRule to human text Refs: #IASC-753 --- .../iasc_content/src/RRuleHumanReadable.php | 365 ++++++++++++++++++ .../tests/src/Unit/RRuleHumanReadableTest.php | 98 +++++ .../iasc_common_design.theme | 9 +- phpunit.xml | 4 +- 4 files changed, 471 insertions(+), 5 deletions(-) create mode 100644 html/modules/custom/iasc_content/src/RRuleHumanReadable.php create mode 100644 html/modules/custom/iasc_content/tests/src/Unit/RRuleHumanReadableTest.php diff --git a/html/modules/custom/iasc_content/src/RRuleHumanReadable.php b/html/modules/custom/iasc_content/src/RRuleHumanReadable.php new file mode 100644 index 000000000..8c0d286db --- /dev/null +++ b/html/modules/custom/iasc_content/src/RRuleHumanReadable.php @@ -0,0 +1,365 @@ + self::intlLoaded(), + 'locale' => NULL, + 'date_formatter' => NULL, + 'fallback' => 'en', + 'explicit_infinite' => TRUE, + 'include_start' => TRUE, + 'include_until' => TRUE, + 'custom_path' => NULL, + ]; + + // Attempt to detect default locale. + if ($opt['use_intl']) { + $default_opt['locale'] = \Locale::getDefault(); + } + else { + $default_opt['locale'] = setlocale(LC_CTYPE, 0); + if ($default_opt['locale'] == 'C') { + $default_opt['locale'] = 'en'; + } + } + + if ($opt['use_intl']) { + $default_opt['date_format'] = \IntlDateFormatter::SHORT; + if ($this->freq >= self::SECONDLY || !empty($this->rule['BYSECOND'])) { + $default_opt['time_format'] = \IntlDateFormatter::LONG; + } + elseif ($this->freq >= self::HOURLY || !empty($this->rule['BYHOUR']) || !empty($this->rule['BYMINUTE'])) { + $default_opt['time_format'] = \IntlDateFormatter::SHORT; + } + else { + $default_opt['time_format'] = \IntlDateFormatter::NONE; + } + } + + $opt = array_merge($default_opt, $opt); + + $i18n = self::i18nLoad($opt['locale'], $opt['fallback'], $opt['use_intl'], $opt['custom_path']); + + // Adapt some strings. + $i18n['byweekday'] = '%{weekdays}'; + $i18n['infinite'] = ', indefinitely'; + + if ($opt['date_formatter'] && !is_callable($opt['date_formatter'])) { + throw new \InvalidArgumentException('The option date_formatter must callable'); + } + + if (!$opt['date_formatter']) { + if ($opt['use_intl']) { + $timezone = $this->dtstart->getTimezone()->getName(); + + if ($timezone === 'Z') { + // Otherwise IntlDateFormatter::create fails because... reasons. + $timezone = 'GMT'; + } + elseif (preg_match('/[-+]\d{2}/', $timezone)) { + // Otherwise IntlDateFormatter::create fails because... other reasons. + $timezone = 'GMT' . $timezone; + } + $formatter = \IntlDateFormatter::create( + $opt['locale'], + $opt['date_format'], + $opt['time_format'], + $timezone + ); + if (!$formatter) { + throw new \RuntimeException('IntlDateFormatter::create() failed. Error Code: ' . intl_get_error_code() . ' "' . intl_get_error_message() . '" (this should not happen, please open a bug report!)'); + } + $opt['date_formatter'] = function ($date) use ($formatter) { + return $formatter->format($date); + }; + } + else { + $opt['date_formatter'] = function ($date) { + return $date->format('Y-m-d H:i:s'); + }; + } + } + + $parts = [ + 'freq' => '', + 'on' => '', + 'bysetpos' => '', + 'byweekday' => '', + 'bymonth' => '', + 'byweekno' => '', + 'byyearday' => '', + 'bymonthday' => '', + 'byhour' => '', + 'byminute' => '', + 'bysecond' => '', + ]; + + if (isset($this->rule['INTERVAL']) && $this->rule['INTERVAL'] == 1 && isset($this->rule['COUNT']) && $this->rule['COUNT'] == 1) { + if (!isset($this->rule['BYDAY']) || empty($this->rule['BYDAY'])) { + return ''; + } + } + + // Every (INTERVAL) FREQ... + $freq_str = strtolower(array_search($this->freq, self::FREQUENCIES)); + $parts['freq'] = ucfirst(strtr( + self::i18nSelect($i18n[$freq_str], $this->interval), + [ + '%{interval}' => $this->interval, + ] + )); + + // BYXXX rules. + if (!empty($this->rule['BYMONTH'])) { + $tmp = $this->bymonth; + foreach ($tmp as & $value) { + $value = $i18n['months'][$value]; + } + $parts['bymonth'] = strtr(self::i18nSelect($i18n['bymonth'], count($tmp)), [ + '%{months}' => self::i18nList($tmp, $i18n['and']), + ]); + } + + if (!empty($this->rule['BYWEEKNO'])) { + // XXX negative week number are not great here. + $tmp = $this->byweekno; + foreach ($tmp as & $value) { + $value = strtr($i18n['nth_weekno'], [ + '%{n}' => $value, + ]); + } + $parts['byweekno'] = strtr( + self::i18nSelect($i18n['byweekno'], count($this->byweekno)), + [ + '%{weeks}' => self::i18nList($tmp, $i18n['and']), + ] + ); + } + + if (!empty($this->rule['BYYEARDAY'])) { + $tmp = $this->byyearday; + foreach ($tmp as & $value) { + $value = strtr(self::i18nSelect($i18n[$value > 0 ? 'nth_yearday' : '-nth_yearday'], $value), [ + '%{n}' => abs($value), + ]); + } + $tmp = strtr(self::i18nSelect($i18n['byyearday'], count($tmp)), [ + '%{yeardays}' => self::i18nList($tmp, $i18n['and']), + ]); + // ... of the month + $tmp = strtr(self::i18nSelect($i18n['x_of_the_y'], 'yearly'), [ + '%{x}' => $tmp, + ]); + $parts['byyearday'] = $tmp; + } + + if (!empty($this->rule['BYMONTHDAY'])) { + $parts['bymonthday'] = []; + if ($this->bymonthday) { + $tmp = $this->bymonthday; + foreach ($tmp as & $value) { + $value = strtr(self::i18nSelect($i18n['nth_monthday'], $value), [ + '%{n}' => $value, + ]); + } + $tmp = strtr(self::i18nSelect($i18n['bymonthday'], count($tmp)), [ + '%{monthdays}' => self::i18nList($tmp, $i18n['and']), + ]); + // ... of the month + $tmp = strtr(self::i18nSelect($i18n['x_of_the_y'], 'monthly'), [ + '%{x}' => $tmp, + ]); + $parts['bymonthday'][] = $tmp; + } + if ($this->bymonthday_negative) { + $tmp = $this->bymonthday_negative; + foreach ($tmp as & $value) { + $value = strtr(self::i18nSelect($i18n['-nth_monthday'], $value), [ + '%{n}' => -$value, + ]); + } + $tmp = strtr(self::i18nSelect($i18n['bymonthday'], count($tmp)), [ + '%{monthdays}' => self::i18nList($tmp, $i18n['and']), + ]); + // ... of the month + $tmp = strtr(self::i18nSelect($i18n['x_of_the_y'], 'monthly'), [ + '%{x}' => $tmp, + ]); + $parts['bymonthday'][] = $tmp; + } + // Because the 'on the Xth day' strings start with the space, + // and the "and" ends with a space + // it's necessary to collapse double spaces into one. + // @see https://github.com/rlanvin/php-rrule/pull/95 + $parts['bymonthday'] = str_replace(' ', ' ', implode(' ' . $i18n['and'], $parts['bymonthday'])); + } + + if (!empty($this->rule['BYDAY'])) { + $parts['byweekday'] = []; + if ($this->byweekday) { + $tmp = $this->byweekday; + + $selector = 'weekdays'; + $prefix = ''; + if (!empty($i18n['shorten_weekdays_in_list']) && count($tmp) > 1) { + // Special case for Hebrew (and possibly other languages) + // see https://github.com/rlanvin/php-rrule/pull/95 for the reasoning. + $selector = 'weekdays_shortened_for_list'; + $prefix = $i18n['shorten_weekdays_days']; + } + + foreach ($tmp as & $value) { + $value = $i18n[$selector][$value]; + } + + $parts['byweekday'][] = strtr(self::i18nSelect($i18n['byweekday'], count($tmp)), [ + '%{weekdays}' => $prefix . self::i18nList($tmp, $i18n['and']), + ]); + } + + if ($this->byweekday_nth) { + $tmp = $this->byweekday_nth; + foreach ($tmp as & $value) { + + list($day, $n) = $value; + $value = strtr(self::i18nSelect($i18n[$n > 0 ? 'nth_weekday' : '-nth_weekday'], $n), [ + '%{weekday}' => $i18n['weekdays'][$day], + '%{n}' => abs($n), + ]); + } + $tmp = strtr(self::i18nSelect($i18n['byweekday'], count($tmp)), [ + '%{weekdays}' => self::i18nList($tmp, $i18n['and']), + ]); + // ... of the year|month + $tmp = strtr(self::i18nSelect($i18n['x_of_the_y'], $freq_str), [ + '%{x}' => $tmp, + ]); + $parts['byweekday'][] = $tmp; + } + $parts['on'] = ' on '; + $parts['byweekday'] = implode(' ' . $i18n['and'], $parts['byweekday']); + } + + if (!empty($this->rule['BYHOUR'])) { + $tmp = $this->byhour; + foreach ($tmp as &$value) { + $value = strtr($i18n['nth_hour'], [ + '%{n}' => $value, + ]); + } + $parts['byhour'] = strtr(self::i18nSelect($i18n['byhour'], count($tmp)), [ + '%{hours}' => self::i18nList($tmp, $i18n['and']), + ]); + } + + if (!empty($this->rule['BYMINUTE'])) { + $tmp = $this->byminute; + foreach ($tmp as &$value) { + $value = strtr($i18n['nth_minute'], [ + '%{n}' => $value, + ]); + } + $parts['byminute'] = strtr(self::i18nSelect($i18n['byminute'], count($tmp)), [ + '%{minutes}' => self::i18nList($tmp, $i18n['and']), + ]); + } + + if (!empty($this->rule['BYSECOND'])) { + $tmp = $this->bysecond; + foreach ($tmp as &$value) { + $value = strtr($i18n['nth_second'], [ + '%{n}' => $value, + ]); + } + $parts['bysecond'] = strtr(self::i18nSelect($i18n['bysecond'], count($tmp)), [ + '%{seconds}' => self::i18nList($tmp, $i18n['and']), + ]); + } + + if ($this->bysetpos) { + $tmp = $this->bysetpos; + $tmp_parts = $this->getRule(); + + // Translate to offsets. + $weekDays = isset($tmp_parts['BYDAY']) ? explode(',', $tmp_parts['BYDAY']) : []; + $weekdayCount = count($weekDays); + sort($tmp); + + // Collapse all ordinals into simplified ordinals. + $chunks = array_chunk($tmp, $weekdayCount); + $ordinals = []; + foreach ($chunks as $chunk) { + $first = reset($chunk); + $end = ($first < 0) ? min($chunk) : max($chunk); + $ordinals[] = $end / $weekdayCount; + } + + // As string. + $ordinalNames = [ + 1 => strtolower($this->t('First')), + 2 => strtolower($this->t('Second')), + 3 => strtolower($this->t('Third')), + 4 => strtolower($this->t('Fourth')), + 5 => strtolower($this->t('Fifth')), + -1 => strtolower($this->t('Last')), + -2 => strtolower($this->t('2nd to last')), + ]; + $ordinal = array_intersect_key($ordinalNames, array_flip($ordinals)); + $parts['on'] = ' on '; + $parts['bysetpos'] = self::i18nList(array_values($ordinal), $i18n['and']) . ' '; + } + + if ($opt['include_start']) { + // From X. + $parts['start'] = strtr($i18n['dtstart'], [ + '%{date}' => $opt['date_formatter']($this->dtstart), + ]); + } + + // To X, or N times, or indefinitely. + if ($opt['include_until']) { + if (!$this->until && !$this->count) { + if ($opt['explicit_infinite']) { + $parts['end'] = $i18n['infinite']; + } + } + elseif ($this->until) { + $parts['end'] = strtr($i18n['until'], [ + '%{date}' => $opt['date_formatter']($this->until), + ]); + } + elseif ($this->count) { + $parts['end'] = strtr( + self::i18nSelect($i18n['count'], $this->count), + [ + '%{count}' => $this->count, + ] + ); + } + } + + $parts = array_filter($parts); + $str = implode('', $parts); + return $str; + } + +} diff --git a/html/modules/custom/iasc_content/tests/src/Unit/RRuleHumanReadableTest.php b/html/modules/custom/iasc_content/tests/src/Unit/RRuleHumanReadableTest.php new file mode 100644 index 000000000..438340d5e --- /dev/null +++ b/html/modules/custom/iasc_content/tests/src/Unit/RRuleHumanReadableTest.php @@ -0,0 +1,98 @@ +set('string_translation', self::getStringTranslationStub()); + } + + /** + * Tests RRule text output. + * + * @covers ::humanReadable + * + * @dataProvider providerTests + */ + public function testHumanText($rule, $result) { + $parser = new RRuleHumanReadable($rule); + $output = $parser->humanReadable([ + 'use_intl' => FALSE, + 'explicit_inifite' => TRUE, + 'dtstart' => FALSE, + 'include_start' => FALSE, + 'include_until' => TRUE, + 'date_formatter' => function ($date) { + return $date->format('d.m.Y'); + }, + ]); + + self::assertSame($output, $result); + } + + /** + * Provides test strings. + */ + public function providerTests() { + $tests = [ + 'FREQ=MONTHLY;BYDAY=TU' => [ + 'FREQ=MONTHLY;BYDAY=TU', + 'Monthly on Tuesday, indefinitely', + ], + 'FREQ=MONTHLY;INTERVAL=1;BYDAY=TU;BYSETPOS=1' => [ + 'FREQ=MONTHLY;INTERVAL=1;BYDAY=TU;BYSETPOS=1', + 'Monthly on first Tuesday, indefinitely', + ], + 'FREQ=MONTHLY;INTERVAL=1;BYDAY=TU;BYSETPOS=-1' => [ + 'FREQ=MONTHLY;INTERVAL=1;BYDAY=TU;BYSETPOS=-1', + 'Monthly on last Tuesday, indefinitely', + ], + 'FREQ=DAILY;INTERVAL=1;COUNT=3' => [ + 'FREQ=DAILY;INTERVAL=1;COUNT=3', + 'Daily, 3 times', + ], + 'FREQ=MONTHLY;BYDAY=TU,WE,TH;BYSETPOS=-6,-5,-4,4,5,6,10,11,12' => [ + 'FREQ=MONTHLY;BYDAY=TU,WE,TH;BYSETPOS=-6,-5,-4,4,5,6,10,11,12', + 'Monthly on second, fourth and 2nd to last Tuesday, Wednesday and Thursday, indefinitely', + ], + 'FREQ=DAILY;INTERVAL=1;COUNT=1' => [ + 'FREQ=DAILY;INTERVAL=1;COUNT=1', + '', + ], + 'FREQ=WEEKLY;INTERVAL=1;COUNT=1' => [ + 'FREQ=WEEKLY;INTERVAL=1;COUNT=1', + '', + ], + 'FREQ=WEEKLY;INTERVAL=1;BYDAY=WE;COUNT=1' => [ + 'FREQ=WEEKLY;INTERVAL=1;BYDAY=WE;COUNT=1', + 'Weekly on Wednesday, one time', + ], + 'FREQ=WEEKLY;INTERVAL=1;BYDAY=WE,SA;COUNT=1' => [ + 'FREQ=WEEKLY;INTERVAL=1;BYDAY=WE,SA;COUNT=1', + 'Weekly on Wednesday and Saturday, one time', + ], + 'FREQ=WEEKLY;INTERVAL=2;BYDAY=WE,SA;UNTIL=20220831T000000Z' => [ + 'FREQ=WEEKLY;INTERVAL=2;BYDAY=WE,SA;UNTIL=20220831T000000Z', + 'Every other week on Wednesday and Saturday, until 31.08.2022', + ], + ]; + + return $tests; + } +} diff --git a/html/themes/custom/iasc_common_design/iasc_common_design.theme b/html/themes/custom/iasc_common_design/iasc_common_design.theme index f10837eb7..7ed0d66ec 100644 --- a/html/themes/custom/iasc_common_design/iasc_common_design.theme +++ b/html/themes/custom/iasc_common_design/iasc_common_design.theme @@ -5,8 +5,10 @@ * Template overrides, preprocess, and alter hooks for the OCHA Basic theme. */ +use Drupal\iasc_content\RRuleHumanReadable; use Drupal\media\Entity\Media; -use RRule\RRule; + +use function PHPUnit\Framework\assertSame; /** * Implements template_preprocess_field(). @@ -96,9 +98,10 @@ function iasc_common_design_preprocess_field(&$variables, $hook) { // Translate to text. $rule = $item->rrule; if ($rule) { - $parser = new RRule($rule); + $parser = new RRuleHumanReadable($rule); $variables['human_readable'] = $parser->humanReadable([ - 'explicit_inifite' => FALSE, + 'use_intl' => FALSE, + 'explicit_inifite' => TRUE, 'dtstart' => FALSE, 'include_start' => FALSE, 'include_until' => TRUE, diff --git a/phpunit.xml b/phpunit.xml index 90b02dfcd..13b0e2895 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -3,9 +3,9 @@ - + - + From 8460599ac5e63a095138e01a3db5bf3a5286182d Mon Sep 17 00:00:00 2001 From: "Peter Droogmans (attiks)" Date: Tue, 19 Jul 2022 12:28:33 +0200 Subject: [PATCH 28/40] test: Run unit tests --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index d9544687e..acb2b8aee 100755 --- a/.travis.yml +++ b/.travis.yml @@ -65,7 +65,7 @@ script: - set +e # Run unit, kernel tests - - # ./vendor/bin/phpunit --debug --colors --testsuite=unit,kernel + - ./vendor/bin/phpunit --debug --colors --testsuite=unit # Drupal install - mysql -e "CREATE DATABASE drupal;" From c4121b7cbf57d159447239343fc72cd5ccf5a141 Mon Sep 17 00:00:00 2001 From: "Peter Droogmans (attiks)" Date: Tue, 19 Jul 2022 12:32:57 +0200 Subject: [PATCH 29/40] CS --- html/modules/custom/iasc_content/src/RRuleHumanReadable.php | 2 +- .../iasc_content/tests/src/Unit/RRuleHumanReadableTest.php | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/html/modules/custom/iasc_content/src/RRuleHumanReadable.php b/html/modules/custom/iasc_content/src/RRuleHumanReadable.php index 8c0d286db..07092ac8d 100644 --- a/html/modules/custom/iasc_content/src/RRuleHumanReadable.php +++ b/html/modules/custom/iasc_content/src/RRuleHumanReadable.php @@ -240,7 +240,7 @@ public function humanReadable(array $opt = []) { $tmp = $this->byweekday_nth; foreach ($tmp as & $value) { - list($day, $n) = $value; + [$day, $n] = $value; $value = strtr(self::i18nSelect($i18n[$n > 0 ? 'nth_weekday' : '-nth_weekday'], $n), [ '%{weekday}' => $i18n['weekdays'][$day], '%{n}' => abs($n), diff --git a/html/modules/custom/iasc_content/tests/src/Unit/RRuleHumanReadableTest.php b/html/modules/custom/iasc_content/tests/src/Unit/RRuleHumanReadableTest.php index 438340d5e..c7a49b668 100644 --- a/html/modules/custom/iasc_content/tests/src/Unit/RRuleHumanReadableTest.php +++ b/html/modules/custom/iasc_content/tests/src/Unit/RRuleHumanReadableTest.php @@ -95,4 +95,5 @@ public function providerTests() { return $tests; } + } From 794c193d843f48709dcbf4d902b434ffa573c17d Mon Sep 17 00:00:00 2001 From: "Peter Droogmans (attiks)" Date: Tue, 19 Jul 2022 16:03:42 +0200 Subject: [PATCH 30/40] feat: multi day event Refs: #IASC-753 --- .../iasc_common_design.theme | 10 +++++++++ .../iasc_common_design/js/local_time.js | 22 ++++++++++++++++--- .../field/field--field-oa-date.html.twig | 6 ++--- .../node/node--oa-event--teaser.html.twig | 2 +- 4 files changed, 33 insertions(+), 7 deletions(-) diff --git a/html/themes/custom/iasc_common_design/iasc_common_design.theme b/html/themes/custom/iasc_common_design/iasc_common_design.theme index 7ed0d66ec..c0cb3d173 100644 --- a/html/themes/custom/iasc_common_design/iasc_common_design.theme +++ b/html/themes/custom/iasc_common_design/iasc_common_design.theme @@ -47,6 +47,7 @@ function iasc_common_design_preprocess_field(&$variables, $hook) { // Track next date. $variables['next_date'] = NULL; + $variables['next_date_end'] = NULL; // Expose next 5 occurrences. $variables['next_5'] = []; @@ -81,6 +82,14 @@ function iasc_common_design_preprocess_field(&$variables, $hook) { 'year' => $date->getStart()->format('Y'), 'timestamp' => $date->getStart()->getTimestamp(), ]; + + // Set next date. + $variables['next_date_end'] = [ + 'day' => $date->getEnd()->format('d'), + 'month' => $date->getEnd()->format('M'), + 'year' => $date->getEnd()->format('Y'), + 'timestamp' => $date->getEnd()->getTimestamp(), + ]; } // Add first to next 5 as well, date might be changed by javascript. @@ -146,6 +155,7 @@ function iasc_common_design_preprocess_field(&$variables, $hook) { if (empty($variables['next_date'])) { $variables['next_date'] = $variables['min_date']; + $variables['next_date_end'] = $variables['max_date']; } } } diff --git a/html/themes/custom/iasc_common_design/js/local_time.js b/html/themes/custom/iasc_common_design/js/local_time.js index 02c351d44..c69f26918 100644 --- a/html/themes/custom/iasc_common_design/js/local_time.js +++ b/html/themes/custom/iasc_common_design/js/local_time.js @@ -12,10 +12,26 @@ let container = document.querySelector('.node__content .cd-date'); let date = new Date(parseInt(searchParams.get('ts'), 10) * 1000); + let date_end = new Date(parseInt(searchParams.get('tse'), 10) * 1000); - container.querySelector('.cd-date__day').innerHTML = date.getDate(); - container.querySelector('.cd-date__month').innerHTML = month_names_short[date.getMonth()]; - container.querySelector('.cd-date__year').innerHTML = date.getFullYear(); + let day = date.getDate(); + if (date.getDate() != date_end.getDate()) { + day = day + ' - ' + date_end.getDate(); + } + + let month = month_names_short[date.getMonth()]; + if (date.getMonth() != date_end.getMonth()) { + month = month + ' - ' + month_names_short[date_end.getDate()]; + } + + let year = date.getFullYear(); + if (date.getFullYear() != date_end.getFullYear()) { + year = year + ' - ' + date_end.getFullYear(); + } + + container.querySelector('.cd-date__day').innerHTML = day; + container.querySelector('.cd-date__month').innerHTML = month; + container.querySelector('.cd-date__year').innerHTML = year; } } }()); diff --git a/html/themes/custom/iasc_common_design/templates/field/field--field-oa-date.html.twig b/html/themes/custom/iasc_common_design/templates/field/field--field-oa-date.html.twig index c0cdaeaa1..534e5a3c0 100644 --- a/html/themes/custom/iasc_common_design/templates/field/field--field-oa-date.html.twig +++ b/html/themes/custom/iasc_common_design/templates/field/field--field-oa-date.html.twig @@ -46,15 +46,15 @@ {% if items|length > 0 %}
- {{ next_date.day }} + {{ next_date.day }}{% if next_date.day != next_date_end.day %} - {{ next_date_end.day }}{% endif %}
- {{ next_date.month }} + {{ next_date.month }}{% if next_date.month != next_date_end.month %} - {{ next_date_end.month }}{% endif %} - {{ next_date.year }} + {{ next_date.year }}{% if next_date.year != next_date_end.year %} - {{ next_date_end.year }}{% endif %}
{% endif %} diff --git a/html/themes/custom/iasc_common_design/templates/node/node--oa-event--teaser.html.twig b/html/themes/custom/iasc_common_design/templates/node/node--oa-event--teaser.html.twig index 775336614..0c90fc2c4 100644 --- a/html/themes/custom/iasc_common_design/templates/node/node--oa-event--teaser.html.twig +++ b/html/themes/custom/iasc_common_design/templates/node/node--oa-event--teaser.html.twig @@ -102,7 +102,7 @@ {{ title_prefix }} {% if label and not page %} - {{ label }} + {{ label }} {% endif %} {{ title_suffix }} From 868f8fb69e29731d043ae45b933f998fe3a3ec9b Mon Sep 17 00:00:00 2001 From: "Peter Droogmans (attiks)" Date: Tue, 19 Jul 2022 16:37:00 +0200 Subject: [PATCH 31/40] feat: use js utc methods Refs: #IASC-753 --- .../iasc_common_design/js/local_time.js | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/html/themes/custom/iasc_common_design/js/local_time.js b/html/themes/custom/iasc_common_design/js/local_time.js index c69f26918..1b72d99b7 100644 --- a/html/themes/custom/iasc_common_design/js/local_time.js +++ b/html/themes/custom/iasc_common_design/js/local_time.js @@ -12,21 +12,24 @@ let container = document.querySelector('.node__content .cd-date'); let date = new Date(parseInt(searchParams.get('ts'), 10) * 1000); - let date_end = new Date(parseInt(searchParams.get('tse'), 10) * 1000); + let date_end = date; + if (searchParams.has('tse')) { + date_end = new Date(parseInt(searchParams.get('tse'), 10) * 1000); + } - let day = date.getDate(); - if (date.getDate() != date_end.getDate()) { - day = day + ' - ' + date_end.getDate(); + let day = date.getUTCDate(); + if (date.getUTCDate() != date_end.getUTCDate()) { + day = day + ' - ' + date_end.getUTCDate(); } - let month = month_names_short[date.getMonth()]; - if (date.getMonth() != date_end.getMonth()) { + let month = month_names_short[date.getUTCMonth()]; + if (date.getUTCMonth() != date_end.getUTCMonth()) { month = month + ' - ' + month_names_short[date_end.getDate()]; } - let year = date.getFullYear(); - if (date.getFullYear() != date_end.getFullYear()) { - year = year + ' - ' + date_end.getFullYear(); + let year = date.getUTCFullYear(); + if (date.getUTCFullYear() != date_end.getUTCFullYear()) { + year = year + ' - ' + date_end.getUTCFullYear(); } container.querySelector('.cd-date__day').innerHTML = day; From ef74e8f5d2180bc2d6076f8e123e9573a9f41563 Mon Sep 17 00:00:00 2001 From: "Peter Droogmans (attiks)" Date: Wed, 20 Jul 2022 10:17:59 +0200 Subject: [PATCH 32/40] feat: Replace all event blocks with new ones Refs: #IASC-753 --- .../custom/iasc_content/iasc_content.install | 7 +++ .../custom/iasc_content/iasc_content.module | 53 +++++++++++++++++++ 2 files changed, 60 insertions(+) diff --git a/html/modules/custom/iasc_content/iasc_content.install b/html/modules/custom/iasc_content/iasc_content.install index 6e0be9ff9..ac21c752b 100644 --- a/html/modules/custom/iasc_content/iasc_content.install +++ b/html/modules/custom/iasc_content/iasc_content.install @@ -18,3 +18,10 @@ function iasc_content_update_8029() { function iasc_content_update_8030() { iasc_content_migrate_meetings_paragraphs(); } + +/** + * Change old all meeting blocks to new ones. + */ +function iasc_content_update_8031() { + iasc_content_migrate_all_meetings_paragraphs(); +} diff --git a/html/modules/custom/iasc_content/iasc_content.module b/html/modules/custom/iasc_content/iasc_content.module index 444df5f7d..fea3d9034 100644 --- a/html/modules/custom/iasc_content/iasc_content.module +++ b/html/modules/custom/iasc_content/iasc_content.module @@ -1518,6 +1518,59 @@ function iasc_content_migrate_meetings_paragraphs() { } } +/** + * Change old meeting paragraphs to new ones. + */ +function iasc_content_migrate_all_meetings_paragraphs() { + $query = \Drupal::entityQuery('paragraph'); + $query->condition('type', 'view'); + $query->exists('field_view'); + $query->condition('field_view', 'iasc_events'); + $ids = $query->execute(); + + $paragraphs = \Drupal::entityTypeManager() + ->getStorage('paragraph') + ->loadMultiple($ids); + + /** @var \Drupal\paragraphs\Entity\Paragraph $paragraph */ + foreach ($paragraphs as $paragraph) { + $display = $paragraph->field_view->getValue()[0]['display_id']; + + switch ($display) { + case 'all_upcoming_meetings': + $paragraph->type = 'meetings_upcoming'; + $paragraph->save(); + $paragraph = \Drupal::entityTypeManager()->getStorage('paragraph')->load($paragraph->id()); + + $paragraph->set('field_max_number_of_events', [ + 'value' => 20, + ]); + $paragraph->set('field_link_to_all_meetings', [ + 'value' => TRUE, + ]); + + $paragraph->save(); + break; + + case 'all_past_meetings': + $paragraph->type = 'meetings_past'; + $paragraph->save(); + $paragraph = \Drupal::entityTypeManager()->getStorage('paragraph')->load($paragraph->id()); + + $paragraph->set('field_max_number_of_events', [ + 'value' => 20, + ]); + $paragraph->set('field_link_to_all_meetings', [ + 'value' => TRUE, + ]); + + $paragraph->save(); + break; + + } + } +} + /** * Format time according the UN standards. * From f6c4e76ee20c004c0de09efc2c3e060efbae34fa Mon Sep 17 00:00:00 2001 From: "Peter Droogmans (attiks)" Date: Wed, 20 Jul 2022 12:46:21 +0200 Subject: [PATCH 33/40] feat: More links with fragment Refs: #IASC-753 --- html/modules/custom/iasc_content/iasc_content.module | 8 ++++++-- .../custom/iasc_content/src/Controller/GroupMeetings.php | 4 ++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/html/modules/custom/iasc_content/iasc_content.module b/html/modules/custom/iasc_content/iasc_content.module index fea3d9034..eac89bb55 100644 --- a/html/modules/custom/iasc_content/iasc_content.module +++ b/html/modules/custom/iasc_content/iasc_content.module @@ -1375,9 +1375,11 @@ function iasc_content_preprocess_paragraph__meetings_upcoming(&$variables) { if ($paragraph->field_link_to_all_meetings->value) { $build['future_link'] = [ '#type' => 'link', - '#title' => 'View more meetings', + '#title' => 'View more upcoming meetings', '#url' => Url::fromRoute('iasc_content.group.meetings', [ 'group' => $group->id(), + ], [ + 'fragment' => 'meetings-upcoming', ]), ]; } @@ -1475,9 +1477,11 @@ function iasc_content_preprocess_paragraph__meetings_past(&$variables) { if ($paragraph->field_link_to_all_meetings->value) { $build['past_link'] = [ '#type' => 'link', - '#title' => 'View more meetings', + '#title' => 'View more past meetings', '#url' => Url::fromRoute('iasc_content.group.meetings', [ 'group' => $group->id(), + ], [ + 'fragment' => 'meetings-past', ]), ]; } diff --git a/html/modules/custom/iasc_content/src/Controller/GroupMeetings.php b/html/modules/custom/iasc_content/src/Controller/GroupMeetings.php index f22f1f92e..2d9838eca 100644 --- a/html/modules/custom/iasc_content/src/Controller/GroupMeetings.php +++ b/html/modules/custom/iasc_content/src/Controller/GroupMeetings.php @@ -204,7 +204,7 @@ public function getEvents(Request $request, Group $group) : array { ], 'future_title' => [ '#type' => 'markup', - '#markup' => $this->t('

Upcoming meetings

Meetings from @from until @until.

', [ + '#markup' => $this->t('

Upcoming meetings

Meetings from @from until @until.

', [ '@from' => $future_start->format($date_format), '@until' => $future_end->format($date_format), ]), @@ -316,7 +316,7 @@ public function getEvents(Request $request, Group $group) : array { ], 'past_title' => [ '#type' => 'markup', - '#markup' => $this->t('

Past meetings

Meetings from @from until @until.

', [ + '#markup' => $this->t('

Past meetings

Meetings from @from until @until.

', [ '@from' => $past_start->format($date_format), '@until' => $past_end->format($date_format), ]), From bf87ec1cc1a3ffb2a36ea6e1c9f5c629f8eb6082 Mon Sep 17 00:00:00 2001 From: "Peter Droogmans (attiks)" Date: Wed, 20 Jul 2022 12:51:32 +0200 Subject: [PATCH 34/40] feat: Remove until Refs: #IASC-753 --- .../themes/custom/iasc_common_design/iasc_common_design.theme | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/html/themes/custom/iasc_common_design/iasc_common_design.theme b/html/themes/custom/iasc_common_design/iasc_common_design.theme index c0cb3d173..aa732ec16 100644 --- a/html/themes/custom/iasc_common_design/iasc_common_design.theme +++ b/html/themes/custom/iasc_common_design/iasc_common_design.theme @@ -110,10 +110,10 @@ function iasc_common_design_preprocess_field(&$variables, $hook) { $parser = new RRuleHumanReadable($rule); $variables['human_readable'] = $parser->humanReadable([ 'use_intl' => FALSE, - 'explicit_inifite' => TRUE, + 'explicit_inifite' => FALSE, 'dtstart' => FALSE, 'include_start' => FALSE, - 'include_until' => TRUE, + 'include_until' => FALSE, 'date_formatter' => function ($date) { return $date->format('d.m.Y'); }, From 82680c99ef0cbc9fefa79621637a526357e25588 Mon Sep 17 00:00:00 2001 From: "Peter Droogmans (attiks)" Date: Wed, 20 Jul 2022 12:51:48 +0200 Subject: [PATCH 35/40] feat: Do not repeat date Refs: #IASC-753 --- .../custom/iasc_common_design/iasc_common_design.theme | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/html/themes/custom/iasc_common_design/iasc_common_design.theme b/html/themes/custom/iasc_common_design/iasc_common_design.theme index aa732ec16..20205b382 100644 --- a/html/themes/custom/iasc_common_design/iasc_common_design.theme +++ b/html/themes/custom/iasc_common_design/iasc_common_design.theme @@ -245,11 +245,7 @@ function iasc_common_design_preprocess_node(&$variables) { 'output' => '', ]; - // Add dates for multiple day events. - if ($variables['event_time']['multiple_days']) { - $variables['event_time']['output'] = $variables['event_time']['start_day'] . ' — ' . $variables['event_time']['end_day'] . ', '; - } - + $variables['event_time']['output'] = ''; if ($variables['event_time']['start'] == $variables['event_time']['end']) { $variables['event_time']['all_day'] = TRUE; $variables['event_time']['output'] .= 'All day'; From 5be459352363a2dfa8f60e93c64fef119f5560b5 Mon Sep 17 00:00:00 2001 From: left23 Date: Wed, 20 Jul 2022 17:13:43 +0200 Subject: [PATCH 36/40] chore: adjust vertical rhythm for teaser event fields Refs: IASC-753 --- .../components/iasc-custom/node--event.css | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/html/themes/custom/iasc_common_design/components/iasc-custom/node--event.css b/html/themes/custom/iasc_common_design/components/iasc-custom/node--event.css index ec98fd93e..30cfa61e9 100644 --- a/html/themes/custom/iasc_common_design/components/iasc-custom/node--event.css +++ b/html/themes/custom/iasc_common_design/components/iasc-custom/node--event.css @@ -20,6 +20,14 @@ margin-top: 0; } +.node--type-oa-event.node--view-mode-teaser .cd-teaser__description > .field { + margin-bottom: 0; +} + +.node--type-oa-event.node--view-mode-teaser .cd-teaser__description .cd-date-time { + margin-top: 1rem; +} + .node--type-oa-event.node--view-mode-full .cd-teaser__date { min-height: 80px; /* height of calendar icon, helps clear elements below.*/ From 94bae6c58474a53ae95d1e5136940da8f384b25d Mon Sep 17 00:00:00 2001 From: unocha-jenkins Date: Thu, 21 Jul 2022 06:39:17 +0000 Subject: [PATCH 37/40] chore: Update all outdated drupal/* packages. --- composer.lock | 312 ++++++++++++------------ html/sites/default/default.settings.php | 23 ++ 2 files changed, 178 insertions(+), 157 deletions(-) diff --git a/composer.lock b/composer.lock index 58fe5bedd..f77af8fb8 100644 --- a/composer.lock +++ b/composer.lock @@ -2217,16 +2217,16 @@ }, { "name": "drupal/core", - "version": "9.4.2", + "version": "9.4.3", "source": { "type": "git", "url": "https://github.com/drupal/core.git", - "reference": "5a4d6acc99e279f70a914804ff3dd08111707de1" + "reference": "7b1a403c093c7abc89ef3df1a6b05bdb19b3ffad" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/drupal/core/zipball/5a4d6acc99e279f70a914804ff3dd08111707de1", - "reference": "5a4d6acc99e279f70a914804ff3dd08111707de1", + "url": "https://api.github.com/repos/drupal/core/zipball/7b1a403c093c7abc89ef3df1a6b05bdb19b3ffad", + "reference": "7b1a403c093c7abc89ef3df1a6b05bdb19b3ffad", "shasum": "" }, "require": { @@ -2469,13 +2469,13 @@ ], "description": "Drupal is an open source content management platform powering millions of websites and applications.", "support": { - "source": "https://github.com/drupal/core/tree/9.4.2" + "source": "https://github.com/drupal/core/tree/9.4.3" }, - "time": "2022-07-07T01:18:39+00:00" + "time": "2022-07-20T15:11:38+00:00" }, { "name": "drupal/core-composer-scaffold", - "version": "9.4.2", + "version": "9.4.3", "source": { "type": "git", "url": "https://github.com/drupal/core-composer-scaffold.git", @@ -2519,13 +2519,13 @@ "drupal" ], "support": { - "source": "https://github.com/drupal/core-composer-scaffold/tree/9.4.2" + "source": "https://github.com/drupal/core-composer-scaffold/tree/9.4.3" }, "time": "2022-06-19T16:14:23+00:00" }, { "name": "drupal/core-project-message", - "version": "9.4.2", + "version": "9.4.3", "source": { "type": "git", "url": "https://github.com/drupal/core-project-message.git", @@ -2560,22 +2560,22 @@ "drupal" ], "support": { - "source": "https://github.com/drupal/core-project-message/tree/9.4.2" + "source": "https://github.com/drupal/core-project-message/tree/9.4.3" }, "time": "2022-02-24T17:40:53+00:00" }, { "name": "drupal/core-recommended", - "version": "9.4.2", + "version": "9.4.3", "source": { "type": "git", "url": "https://github.com/drupal/core-recommended.git", - "reference": "c10da85434356b27e2bf0516a7b6f8103b473038" + "reference": "ff8662af0a5963a88ea856e9786e17a51f8e640c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/drupal/core-recommended/zipball/c10da85434356b27e2bf0516a7b6f8103b473038", - "reference": "c10da85434356b27e2bf0516a7b6f8103b473038", + "url": "https://api.github.com/repos/drupal/core-recommended/zipball/ff8662af0a5963a88ea856e9786e17a51f8e640c", + "reference": "ff8662af0a5963a88ea856e9786e17a51f8e640c", "shasum": "" }, "require": { @@ -2584,7 +2584,7 @@ "doctrine/annotations": "~1.13.2", "doctrine/lexer": "~1.2.3", "doctrine/reflection": "~1.2.3", - "drupal/core": "9.4.2", + "drupal/core": "9.4.3", "egulias/email-validator": "~3.2", "guzzlehttp/guzzle": "~6.5.8", "guzzlehttp/promises": "~1.5.1", @@ -2646,9 +2646,9 @@ ], "description": "Core and its dependencies with known-compatible minor versions. Require this project INSTEAD OF drupal/core.", "support": { - "source": "https://github.com/drupal/core-recommended/tree/9.4.2" + "source": "https://github.com/drupal/core-recommended/tree/9.4.3" }, - "time": "2022-07-07T01:18:39+00:00" + "time": "2022-07-20T15:11:38+00:00" }, { "name": "drupal/csp", @@ -3339,17 +3339,17 @@ }, { "name": "drupal/facets", - "version": "2.0.4", + "version": "2.0.5", "source": { "type": "git", "url": "https://git.drupalcode.org/project/facets.git", - "reference": "2.0.4" + "reference": "2.0.5" }, "dist": { "type": "zip", - "url": "https://ftp.drupal.org/files/projects/facets-2.0.4.zip", - "reference": "2.0.4", - "shasum": "7735fa8d4422fa320a36a122a35adee5b5192f34" + "url": "https://ftp.drupal.org/files/projects/facets-2.0.5.zip", + "reference": "2.0.5", + "shasum": "8be11b5bca088212270603cd3f3e69185022e379" }, "require": { "drupal/core": "^9.3 || ^10.0" @@ -3360,7 +3360,7 @@ "require-dev": { "drupal/jquery_ui_slider": "~1.1", "drupal/jquery_ui_touch_punch": "~1.0", - "drupal/search_api": "^1.24||1.x-dev" + "drupal/search_api": "^1.25||1.x-dev" }, "suggest": { "drupal/jquery_ui_slider": "Required for the 'Facets Range Widget' module to work", @@ -3369,8 +3369,8 @@ "type": "drupal-module", "extra": { "drupal": { - "version": "2.0.4", - "datestamp": "1657367469", + "version": "2.0.5", + "datestamp": "1658315614", "security-coverage": { "status": "covered", "message": "Covered by Drupal's security advisory policy" @@ -3970,27 +3970,27 @@ }, { "name": "drupal/geofield", - "version": "1.40.0", + "version": "1.41.0", "source": { "type": "git", "url": "https://git.drupalcode.org/project/geofield.git", - "reference": "8.x-1.40" + "reference": "8.x-1.41" }, "dist": { "type": "zip", - "url": "https://ftp.drupal.org/files/projects/geofield-8.x-1.40.zip", - "reference": "8.x-1.40", - "shasum": "7ab34cd7bda6c4bb9a9ab621d807264242b2a418" + "url": "https://ftp.drupal.org/files/projects/geofield-8.x-1.41.zip", + "reference": "8.x-1.41", + "shasum": "dba35ddfa782cdd59ed07a1b105ee8d104fe59b2" }, "require": { "drupal/core": "^8.8 || ^9 || ^10", - "phayes/geophp": "^1.2" + "itamair/geophp": "^1.3" }, "type": "drupal-module", "extra": { "drupal": { - "version": "8.x-1.40", - "datestamp": "1655934637", + "version": "8.x-1.41", + "datestamp": "1657834871", "security-coverage": { "status": "covered", "message": "Covered by Drupal's security advisory policy" @@ -3999,23 +3999,23 @@ }, "notification-url": "https://packages.drupal.org/8/downloads", "license": [ - "GPL-2.0-or-later" + "GPL-2.0+" ], "authors": [ + { + "name": "Italo Mairo", + "homepage": "https://www.drupal.org/u/itamair", + "role": "Drupal 8+ Maintainer" + }, { "name": "Brandon Morrison", "homepage": "https://www.drupal.org/u/brandonian", - "role": "Maintainer" + "role": "Drupal 7 Maintainer" }, { "name": "Pablo López", "homepage": "https://www.drupal.org/u/plopesc", - "role": "Maintainer" - }, - { - "name": "Italo Mairo", - "homepage": "https://www.drupal.org/u/itamair", - "role": "Maintainer" + "role": "Drupal 7 Maintainer" }, { "name": "phayes", @@ -4269,16 +4269,16 @@ "authors": [ { "name": "Jeff Geerling", - "homepage": "https://www.drupal.org/user/213194", + "homepage": "https://www.drupal.org/user/389011", "email": "geerlingguy@mac.com" }, { - "name": "TR", - "homepage": "https://www.drupal.org/user/202830" + "name": "Manuel Garcia", + "homepage": "https://www.drupal.org/user/213194" }, { - "name": "geerlingguy", - "homepage": "https://www.drupal.org/user/389011" + "name": "TR", + "homepage": "https://www.drupal.org/user/202830" }, { "name": "vijaycs85", @@ -5023,17 +5023,17 @@ }, { "name": "drupal/search_api", - "version": "1.24.0", + "version": "1.25.0", "source": { "type": "git", "url": "https://git.drupalcode.org/project/search_api.git", - "reference": "8.x-1.24" + "reference": "8.x-1.25" }, "dist": { "type": "zip", - "url": "https://ftp.drupal.org/files/projects/search_api-8.x-1.24.zip", - "reference": "8.x-1.24", - "shasum": "c4e93b8cc5bcdf7c7817bec06470af223f919f6c" + "url": "https://ftp.drupal.org/files/projects/search_api-8.x-1.25.zip", + "reference": "8.x-1.25", + "shasum": "823bf5a6010cd08c7d1b287fcd855fbf81140e39" }, "require": { "drupal/core": "^9.2 || ^10.0" @@ -5054,8 +5054,8 @@ "type": "drupal-module", "extra": { "drupal": { - "version": "8.x-1.24", - "datestamp": "1657180584", + "version": "8.x-1.25", + "datestamp": "1658149514", "security-coverage": { "status": "covered", "message": "Covered by Drupal's security advisory policy" @@ -5216,10 +5216,6 @@ "name": "Other contributors", "homepage": "https://www.drupal.org/node/982682/committers" }, - { - "name": "amateescu", - "homepage": "https://www.drupal.org/user/729614" - }, { "name": "cspitzlay", "homepage": "https://www.drupal.org/user/419305" @@ -5231,6 +5227,10 @@ { "name": "mkalkbrenner", "homepage": "https://www.drupal.org/user/124705" + }, + { + "name": "Nick_vh", + "homepage": "https://www.drupal.org/user/122682" } ], "description": "Offers an implementation of the Search API that uses an Apache Solr server for indexing content.", @@ -7091,6 +7091,52 @@ }, "time": "2018-06-28T20:32:51+00:00" }, + { + "name": "itamair/geophp", + "version": "1.3", + "source": { + "type": "git", + "url": "https://github.com/itamair/geoPHP.git", + "reference": "d7bccf9902a62430ceb2ac0771bb1e9d1deac4e9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/itamair/geoPHP/zipball/d7bccf9902a62430ceb2ac0771bb1e9d1deac4e9", + "reference": "d7bccf9902a62430ceb2ac0771bb1e9d1deac4e9", + "shasum": "" + }, + "require-dev": { + "phpunit/phpunit": "4.1.* || 9.5.*" + }, + "type": "library", + "autoload": { + "classmap": [ + "geoPHP.inc" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "GPL-2.0+" + ], + "authors": [ + { + "name": "Italo Mairo", + "homepage": "https://www.linkedin.com/in/italomairo/", + "role": "Maintanier of this Library Repo" + }, + { + "name": "Patrick Hayes", + "homepage": "https://www.linkedin.com/in/patrickdhayes/", + "role": "Maintanier of original Repositary/Library (https://github.com/phayes/geoPHP)" + } + ], + "description": "GeoPHP is a open-source native PHP library for doing geometry operations. It is written entirely in PHP and can therefore run on shared hosts. It can read and write a wide variety of formats: WKT (including EWKT), WKB (including EWKB), GeoJSON, KML, GPX, GeoRSS). It works with all Simple-Feature geometries (Point, LineString, Polygon, GeometryCollection etc.) and can be used to get centroids, bounding-boxes, area, and a wide variety of other useful information.", + "homepage": "https://github.com/itamair/geoPHP", + "support": { + "source": "https://github.com/itamair/geoPHP/tree/1.3" + }, + "time": "2022-07-04T23:09:18+00:00" + }, { "name": "jquery/chosen", "version": "1.8.7", @@ -8528,46 +8574,6 @@ }, "time": "2021-03-21T15:43:46+00:00" }, - { - "name": "phayes/geophp", - "version": "1.2", - "source": { - "type": "git", - "url": "https://github.com/phayes/geoPHP.git", - "reference": "015404e85b602e0df1f91441f8db0f9e98f7e567" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/phayes/geoPHP/zipball/015404e85b602e0df1f91441f8db0f9e98f7e567", - "reference": "015404e85b602e0df1f91441f8db0f9e98f7e567", - "shasum": "" - }, - "require-dev": { - "phpunit/phpunit": "4.1.*" - }, - "type": "library", - "autoload": { - "classmap": [ - "geoPHP.inc" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "GPL-2 or New-BSD" - ], - "authors": [ - { - "name": "Patrick Hayes" - } - ], - "description": "GeoPHP is a open-source native PHP library for doing geometry operations. It is written entirely in PHP and can therefore run on shared hosts. It can read and write a wide variety of formats: WKT (including EWKT), WKB (including EWKB), GeoJSON, KML, GPX, GeoRSS). It works with all Simple-Feature geometries (Point, LineString, Polygon, GeometryCollection etc.) and can be used to get centroids, bounding-boxes, area, and a wide variety of other useful information.", - "homepage": "https://github.com/phayes/geoPHP", - "support": { - "issues": "https://github.com/phayes/geoPHP/issues", - "source": "https://github.com/phayes/geoPHP/tree/master" - }, - "time": "2014-12-02T06:11:22+00:00" - }, { "name": "php-http/guzzle6-adapter", "version": "v2.0.2", @@ -9588,19 +9594,20 @@ }, { "name": "solarium/solarium", - "version": "6.2.4", + "version": "6.2.5", "source": { "type": "git", "url": "https://github.com/solariumphp/solarium.git", - "reference": "fcec5684ee3f2d73a8f06a9fbd0e25d2537e1ab2" + "reference": "b3de12c7c5bba3f9a5955729ff5f7938c2b79789" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/solariumphp/solarium/zipball/fcec5684ee3f2d73a8f06a9fbd0e25d2537e1ab2", - "reference": "fcec5684ee3f2d73a8f06a9fbd0e25d2537e1ab2", + "url": "https://api.github.com/repos/solariumphp/solarium/zipball/b3de12c7c5bba3f9a5955729ff5f7938c2b79789", + "reference": "b3de12c7c5bba3f9a5955729ff5f7938c2b79789", "shasum": "" }, "require": { + "composer-runtime-api": ">=2.0", "ext-json": "*", "php": "^7.3 || ^8.0", "psr/event-dispatcher": "^1.0", @@ -9645,9 +9652,9 @@ ], "support": { "issues": "https://github.com/solariumphp/solarium/issues", - "source": "https://github.com/solariumphp/solarium/tree/6.2.4" + "source": "https://github.com/solariumphp/solarium/tree/6.2.5" }, - "time": "2022-06-30T10:48:47+00:00" + "time": "2022-07-20T11:51:35+00:00" }, { "name": "stack/builder", @@ -13339,16 +13346,16 @@ }, { "name": "composer/ca-bundle", - "version": "1.3.2", + "version": "1.3.3", "source": { "type": "git", "url": "https://github.com/composer/ca-bundle.git", - "reference": "fd5dd441932a7e10ca6e5b490e272d34c8430640" + "reference": "30897edbfb15e784fe55587b4f73ceefd3c4d98c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/ca-bundle/zipball/fd5dd441932a7e10ca6e5b490e272d34c8430640", - "reference": "fd5dd441932a7e10ca6e5b490e272d34c8430640", + "url": "https://api.github.com/repos/composer/ca-bundle/zipball/30897edbfb15e784fe55587b4f73ceefd3c4d98c", + "reference": "30897edbfb15e784fe55587b4f73ceefd3c4d98c", "shasum": "" }, "require": { @@ -13395,7 +13402,7 @@ "support": { "irc": "irc://irc.freenode.org/composer", "issues": "https://github.com/composer/ca-bundle/issues", - "source": "https://github.com/composer/ca-bundle/tree/1.3.2" + "source": "https://github.com/composer/ca-bundle/tree/1.3.3" }, "funding": [ { @@ -13411,7 +13418,7 @@ "type": "tidelift" } ], - "time": "2022-05-24T11:56:16+00:00" + "time": "2022-07-20T07:14:26+00:00" }, { "name": "composer/composer", @@ -14956,7 +14963,7 @@ }, { "name": "drupal/core-dev", - "version": "9.4.2", + "version": "9.4.3", "source": { "type": "git", "url": "https://github.com/drupal/core-dev.git", @@ -15000,7 +15007,7 @@ ], "description": "require-dev dependencies from drupal/drupal; use in addition to drupal/core-recommended to run tests from drupal/core.", "support": { - "source": "https://github.com/drupal/core-dev/tree/9.4.2" + "source": "https://github.com/drupal/core-dev/tree/9.4.3" }, "time": "2022-04-14T00:37:13+00:00" }, @@ -15768,16 +15775,16 @@ }, { "name": "laminas/laminas-servicemanager", - "version": "3.14.0", + "version": "3.15.1", "source": { "type": "git", "url": "https://github.com/laminas/laminas-servicemanager.git", - "reference": "918de970b2c3d42acebff3d431d76db52b6a32a2" + "reference": "216f972b179191b14c33a79337947b63bf7808ff" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laminas/laminas-servicemanager/zipball/918de970b2c3d42acebff3d431d76db52b6a32a2", - "reference": "918de970b2c3d42acebff3d431d76db52b6a32a2", + "url": "https://api.github.com/repos/laminas/laminas-servicemanager/zipball/216f972b179191b14c33a79337947b63bf7808ff", + "reference": "216f972b179191b14c33a79337947b63bf7808ff", "shasum": "" }, "require": { @@ -15855,7 +15862,7 @@ "type": "community_bridge" } ], - "time": "2022-07-07T16:13:26+00:00" + "time": "2022-07-20T09:48:45+00:00" }, { "name": "laminas/laminas-text", @@ -15968,16 +15975,16 @@ }, { "name": "mglaman/phpstan-drupal", - "version": "1.1.22", + "version": "1.1.25", "source": { "type": "git", "url": "https://github.com/mglaman/phpstan-drupal.git", - "reference": "87e64fb4c8370000b4e235c6e7314e48f486662c" + "reference": "480245d5d0bd1858e01c43d738718dab85be0ad2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/mglaman/phpstan-drupal/zipball/87e64fb4c8370000b4e235c6e7314e48f486662c", - "reference": "87e64fb4c8370000b4e235c6e7314e48f486662c", + "url": "https://api.github.com/repos/mglaman/phpstan-drupal/zipball/480245d5d0bd1858e01c43d738718dab85be0ad2", + "reference": "480245d5d0bd1858e01c43d738718dab85be0ad2", "shasum": "" }, "require": { @@ -16052,7 +16059,7 @@ "description": "Drupal extension and rules for PHPStan", "support": { "issues": "https://github.com/mglaman/phpstan-drupal/issues", - "source": "https://github.com/mglaman/phpstan-drupal/tree/1.1.22" + "source": "https://github.com/mglaman/phpstan-drupal/tree/1.1.25" }, "funding": [ { @@ -16068,7 +16075,7 @@ "type": "tidelift" } ], - "time": "2022-07-13T18:37:22+00:00" + "time": "2022-07-18T17:17:55+00:00" }, { "name": "mikey179/vfsstream", @@ -16182,48 +16189,39 @@ }, { "name": "palantirnet/drupal-rector", - "version": "0.12.4", + "version": "0.13.0", "source": { "type": "git", "url": "https://github.com/palantirnet/drupal-rector.git", - "reference": "504792220c90910e581ec0750c8cf8ee412d4c7c" + "reference": "9495bce8009dd5b7f1b920abf438052d397d348c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/palantirnet/drupal-rector/zipball/504792220c90910e581ec0750c8cf8ee412d4c7c", - "reference": "504792220c90910e581ec0750c8cf8ee412d4c7c", + "url": "https://api.github.com/repos/palantirnet/drupal-rector/zipball/9495bce8009dd5b7f1b920abf438052d397d348c", + "reference": "9495bce8009dd5b7f1b920abf438052d397d348c", "shasum": "" }, "require": { - "rector/rector": "~0.12.21", + "rector/rector": "~0.13.8", "webflo/drupal-finder": "^1.2" }, - "conflict": { - "rector/rector": ">0.12.21" - }, "replace": { "drupal8-rector/drupal8-rector": "*", "palantirnet/drupal8-rector": "*" }, "require-dev": { + "cweagans/composer-patches": "^1.7.2", "php": "^8.0", "phpstan/extension-installer": "^1.1", "phpstan/phpstan": "^1.0", "phpstan/phpstan-deprecation-rules": "^1.0", "phpunit/phpunit": "^9.5", - "rector/rector-cakephp": "dev-main#d1fa93dbf332a0170deaf37467b40735727003fb", - "rector/rector-doctrine": "dev-main#ae06e92e71b741f43906374a699eb041882259c3", - "rector/rector-laravel": "dev-main#48a1f3458dc9536a32dae0507ba53fc2d3d28f01", - "rector/rector-nette": "dev-main#e01d41e5caa10ff5057d3b922c95ba4f15d41657", - "rector/rector-phpoffice": "dev-main#4b9837410f4b1f2002693d94a0c4c483abf37e7f", - "rector/rector-phpunit": "dev-main#41775450593f1a94c30a562865c5340f4118880c", - "rector/rector-src": "dev-main#11fdd74f8abe3deefbb2492c00868c57184fd484", - "rector/rector-symfony": "dev-main#6e679917c27895e94314c436b44821e091384e8e", - "symfony/yaml": "^5 || ^6" + "rector/rector-src": "dev-main", + "symfony/yaml": "^5 || ^6", + "symplify/vendor-patches": "^11.0" }, "type": "library", "extra": { - "enable-patching-note": "We need the following to allow rector/rector-src to patch dependencies.", "enable-patching": true }, "autoload": { @@ -16262,9 +16260,9 @@ "rector" ], "support": { - "source": "https://github.com/palantirnet/drupal-rector/tree/0.12.4" + "source": "https://github.com/palantirnet/drupal-rector/tree/0.13.0" }, - "time": "2022-06-01T15:22:43+00:00" + "time": "2022-07-15T15:40:32+00:00" }, { "name": "pdepend/pdepend", @@ -16843,16 +16841,16 @@ }, { "name": "phpstan/phpstan", - "version": "1.8.1", + "version": "1.8.2", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "8dbba631fa32f4b289404469c2afd6122fd61d67" + "reference": "c53312ecc575caf07b0e90dee43883fdf90ca67c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/8dbba631fa32f4b289404469c2afd6122fd61d67", - "reference": "8dbba631fa32f4b289404469c2afd6122fd61d67", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/c53312ecc575caf07b0e90dee43883fdf90ca67c", + "reference": "c53312ecc575caf07b0e90dee43883fdf90ca67c", "shasum": "" }, "require": { @@ -16878,7 +16876,7 @@ "description": "PHPStan - PHP Static Analysis Tool", "support": { "issues": "https://github.com/phpstan/phpstan/issues", - "source": "https://github.com/phpstan/phpstan/tree/1.8.1" + "source": "https://github.com/phpstan/phpstan/tree/1.8.2" }, "funding": [ { @@ -16898,7 +16896,7 @@ "type": "tidelift" } ], - "time": "2022-07-12T16:08:06+00:00" + "time": "2022-07-20T09:57:31+00:00" }, { "name": "phpstan/phpstan-deprecation-rules", @@ -17448,24 +17446,24 @@ }, { "name": "rector/rector", - "version": "0.12.21", + "version": "0.13.8", "source": { "type": "git", "url": "https://github.com/rectorphp/rector.git", - "reference": "2fb3b1c1d85e784a55e5806cf50734e5aa872eb4" + "reference": "6e01478f8239bfe28e003fad98d402589fa6861e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/rectorphp/rector/zipball/2fb3b1c1d85e784a55e5806cf50734e5aa872eb4", - "reference": "2fb3b1c1d85e784a55e5806cf50734e5aa872eb4", + "url": "https://api.github.com/repos/rectorphp/rector/zipball/6e01478f8239bfe28e003fad98d402589fa6861e", + "reference": "6e01478f8239bfe28e003fad98d402589fa6861e", "shasum": "" }, "require": { "php": "^7.2|^8.0", - "phpstan/phpstan": "^1.5.6" + "phpstan/phpstan": "^1.8" }, "conflict": { - "phpstan/phpdoc-parser": "<1.2", + "phpstan/phpdoc-parser": "<1.6.2", "rector/rector-cakephp": "*", "rector/rector-doctrine": "*", "rector/rector-laravel": "*", @@ -17481,7 +17479,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-main": "0.12-dev" + "dev-main": "0.13-dev" } }, "autoload": { @@ -17496,7 +17494,7 @@ "description": "Instant Upgrade and Automated Refactoring of any PHP code", "support": { "issues": "https://github.com/rectorphp/rector/issues", - "source": "https://github.com/rectorphp/rector/tree/0.12.21" + "source": "https://github.com/rectorphp/rector/tree/0.13.8" }, "funding": [ { @@ -17504,7 +17502,7 @@ "type": "github" } ], - "time": "2022-04-18T12:12:41+00:00" + "time": "2022-07-07T09:46:05+00:00" }, { "name": "sebastian/cli-parser", diff --git a/html/sites/default/default.settings.php b/html/sites/default/default.settings.php index 72be7750b..f3dca008f 100644 --- a/html/sites/default/default.settings.php +++ b/html/sites/default/default.settings.php @@ -490,6 +490,29 @@ */ # $settings['file_public_path'] = 'sites/default/files'; +/** + * Additional public file schemes: + * + * Public schemes are URI schemes that allow download access to all users for + * all files within that scheme. + * + * The "public" scheme is always public, and the "private" scheme is always + * private, but other schemes, such as "https", "s3", "example", or others, + * can be either public or private depending on the site. By default, they're + * private, and access to individual files is controlled via + * hook_file_download(). + * + * Typically, if a scheme should be public, a module makes it public by + * implementing hook_file_download(), and granting access to all users for all + * files. This could be either the same module that provides the stream wrapper + * for the scheme, or a different module that decides to make the scheme + * public. However, in cases where a site needs to make a scheme public, but + * is unable to add code in a module to do so, the scheme may be added to this + * variable, the result of which is that system_file_download() grants public + * access to all files within that scheme. + */ +# $settings['file_additional_public_schemes'] = ['example']; + /** * Private file path: * From 4fe18767293c9fcbd7a3b1612c33a1aaadaa68ef Mon Sep 17 00:00:00 2001 From: Andy Footner Date: Mon, 25 Jul 2022 14:54:51 +0200 Subject: [PATCH 38/40] fix: include patch for clearer logging Refs: OPS-8232 --- PATCHES/csp-log-format.patch | 18 ++++++++++++ composer.patches.json | 53 +++++++++++++++++++----------------- 2 files changed, 46 insertions(+), 25 deletions(-) create mode 100644 PATCHES/csp-log-format.patch diff --git a/PATCHES/csp-log-format.patch b/PATCHES/csp-log-format.patch new file mode 100644 index 000000000..470e2f411 --- /dev/null +++ b/PATCHES/csp-log-format.patch @@ -0,0 +1,18 @@ +diff --git a/src/Controller/ReportUri.php b/src/Controller/ReportUri.php +index d7229fa..744a40a 100644 +--- a/src/Controller/ReportUri.php ++++ b/src/Controller/ReportUri.php +@@ -87,9 +87,11 @@ public function log($type) { + } + + $this->logger +- ->info("@type
\n
@data
", [ ++ ->info("(@type) - Unmatched @directive: @blocked on page @page", [ + '@type' => $type, +- '@data' => json_encode($report, JSON_PRETTY_PRINT), ++ '@directive' => $report->{'csp-report'}->{'violated-directive'}, ++ '@blocked' => $report->{'csp-report'}->{'blocked-uri'}, ++ '@page' => $report->{'csp-report'}->{'document-uri'}, + ]); + + // 202: Accepted. diff --git a/composer.patches.json b/composer.patches.json index 4d90d80fb..e20576899 100644 --- a/composer.patches.json +++ b/composer.patches.json @@ -1,28 +1,31 @@ { - "patches": { - "drupal/core": { - "https://www.drupal.org/project/drupal/issues/1819538#comment-14019597 - More link disappears when time-based views cache is enabled": "https://www.drupal.org/files/issues/2021-03-05/1819538-57-D9.patch", - "https://www.drupal.org/project/drupal/issues/2833734 - Allow views attachment display use own pager options": "https://www.drupal.org/files/issues/2020-11-29/2833734-allow-attachment-pager-42.patch", - "https://www.drupal.org/project/drupal/issues/2628230#comment-13213379 - Adding File Usage 'File' relationship results in broken/missing handler": "https://www.drupal.org/files/issues/2019-08-08/2628230-53.patch" - }, - "drupal/group": { - "https://www.drupal.org/project/group/issues/2817109 - How to redirect to the owning group after adding a gnode?": "https://www.drupal.org/files/issues/2817109-by-rachel_norfolk-ericras-How-to-redir.patch" - }, - "drupal/paragraphs": { - "https://www.drupal.org/project/paragraphs/issues/2868252#comment-13622986": "https://www.drupal.org/files/issues/2020-05-20/i2868252-28.patch" - }, - "drupal/search_api": { - "https://www.drupal.org/project/search_api/issues/3130004 - Facets query part is lost in views": "https://git.drupalcode.org/project/search_api/-/merge_requests/8.diff" - }, - "drupal/user_expire": { - "Allow the notification email to be customised": "https://git.drupalcode.org/project/user_expire/-/merge_requests/5.diff", - "Reset expiration when user is reactivated": "https://git.drupalcode.org/project/user_expire/-/merge_requests/6.diff" - }, - "drupal/views_data_export": { - "https://www.drupal.org/project/views_data_export/issues/3173296": "https://www.drupal.org/files/issues/2021-02-12/3173296-9-batch-query-alter.patch" - }, - "drupal/viewsreference": { - "https://dgo.to/3166490 - Trigger ajax refresh when display ID is changed": "https://www.drupal.org/files/issues/2020-09-02/viewsreference-ajax_after_display_selection-3166490-3.patch" + "patches": { + "drupal/core": { + "https://www.drupal.org/project/drupal/issues/1819538#comment-14019597 - More link disappears when time-based views cache is enabled": "https://www.drupal.org/files/issues/2021-03-05/1819538-57-D9.patch", + "https://www.drupal.org/project/drupal/issues/2833734 - Allow views attachment display use own pager options": "https://www.drupal.org/files/issues/2020-11-29/2833734-allow-attachment-pager-42.patch", + "https://www.drupal.org/project/drupal/issues/2628230#comment-13213379 - Adding File Usage 'File' relationship results in broken/missing handler": "https://www.drupal.org/files/issues/2019-08-08/2628230-53.patch" + }, + "drupal/csp": { + "Simplify log format": "PATCHES/csp-log-format.patch" + }, + "drupal/group": { + "https://www.drupal.org/project/group/issues/2817109 - How to redirect to the owning group after adding a gnode?": "https://www.drupal.org/files/issues/2817109-by-rachel_norfolk-ericras-How-to-redir.patch" + }, + "drupal/paragraphs": { + "https://www.drupal.org/project/paragraphs/issues/2868252#comment-13622986": "https://www.drupal.org/files/issues/2020-05-20/i2868252-28.patch" + }, + "drupal/search_api": { + "https://www.drupal.org/project/search_api/issues/3130004 - Facets query part is lost in views": "https://git.drupalcode.org/project/search_api/-/merge_requests/8.diff" + }, + "drupal/user_expire": { + "Allow the notification email to be customised": "https://git.drupalcode.org/project/user_expire/-/merge_requests/5.diff", + "Reset expiration when user is reactivated": "https://git.drupalcode.org/project/user_expire/-/merge_requests/6.diff" + }, + "drupal/views_data_export": { + "https://www.drupal.org/project/views_data_export/issues/3173296": "https://www.drupal.org/files/issues/2021-02-12/3173296-9-batch-query-alter.patch" + }, + "drupal/viewsreference": { + "https://dgo.to/3166490 - Trigger ajax refresh when display ID is changed": "https://www.drupal.org/files/issues/2020-09-02/viewsreference-ajax_after_display_selection-3166490-3.patch" + } } - } } From bc2b50bd6bf6155b12663476a1d14a79e70ac175 Mon Sep 17 00:00:00 2001 From: left23 Date: Wed, 27 Jul 2022 17:41:22 +0200 Subject: [PATCH 39/40] feat: google search script in html template override for frontpage Refs: IASC-749 --- .../templates/html--front.html.twig | 75 +++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 html/themes/custom/iasc_common_design/templates/html--front.html.twig diff --git a/html/themes/custom/iasc_common_design/templates/html--front.html.twig b/html/themes/custom/iasc_common_design/templates/html--front.html.twig new file mode 100644 index 000000000..46d2289ef --- /dev/null +++ b/html/themes/custom/iasc_common_design/templates/html--front.html.twig @@ -0,0 +1,75 @@ +{# +/** + * @file + * Theme override for the basic structure of a single Drupal page. + * + * Variables: + * - logged_in: A flag indicating if user is logged in. + * - root_path: The root path of the current page (e.g., node, admin, user). + * - node_type: The content type for the current node, if the page is a node. + * - head_title: List of text elements that make up the head_title variable. + * May contain one or more of the following: + * - title: The title of the page. + * - name: The name of the site. + * - slogan: The slogan of the site. + * - page_top: Initial rendered markup. This should be printed before 'page'. + * - page: The rendered page markup. + * - page_bottom: Closing rendered markup. This variable should be printed after + * 'page'. + * - db_offline: A flag indicating if the database is offline. + * - placeholder_token: The token for generating head, css, js and js-bottom + * placeholders. + * + * @see template_preprocess_html() + */ +#} +{% + set body_classes = [ + logged_in ? 'user-logged-in', + not root_path ? 'path-frontpage' : 'path-' ~ root_path|clean_class, + node_type ? 'page-node-type-' ~ node_type|clean_class, + db_offline ? 'db-offline', + ] +%} + + + + + {{ head_title|safe_join(' | ') }} + + + + + {# + Keyboard navigation/accessibility link to main content section in + page.html.twig. + #} + + {{ page_top }} + {{ page }} + {{ page_bottom }} + + {% block icons %} + {% include '@common_design/cd/cd-icons/cd-icons.html.twig' %} + {% endblock %} + + + + + From 9dc6dcb8bada99a2bee8b5542d94bb7f33b801cf Mon Sep 17 00:00:00 2001 From: unocha-jenkins Date: Thu, 28 Jul 2022 06:38:29 +0000 Subject: [PATCH 40/40] chore: Update all outdated drupal/* packages. --- composer.lock | 169 +++++++++++++++++++++++++------------------------- 1 file changed, 83 insertions(+), 86 deletions(-) diff --git a/composer.lock b/composer.lock index f77af8fb8..e6d80731c 100644 --- a/composer.lock +++ b/composer.lock @@ -2168,7 +2168,7 @@ "extra": { "drupal": { "version": "2.0.0-rc3", - "datestamp": "1656976745", + "datestamp": "1658393897", "security-coverage": { "status": "not-covered", "message": "RC releases are not covered by Drupal security advisories." @@ -3583,26 +3583,26 @@ }, { "name": "drupal/field_permissions", - "version": "1.1.0", + "version": "1.2.0", "source": { "type": "git", "url": "https://git.drupalcode.org/project/field_permissions.git", - "reference": "8.x-1.1" + "reference": "8.x-1.2" }, "dist": { "type": "zip", - "url": "https://ftp.drupal.org/files/projects/field_permissions-8.x-1.1.zip", - "reference": "8.x-1.1", - "shasum": "11e31db94999e6871ad7633455315bc27989a7ea" + "url": "https://ftp.drupal.org/files/projects/field_permissions-8.x-1.2.zip", + "reference": "8.x-1.2", + "shasum": "0b1a5edfac518fe6005d015b3781774b41cdec76" }, "require": { - "drupal/core": "^8 || ^9" + "drupal/core": ">=8.9 <11" }, "type": "drupal-module", "extra": { "drupal": { - "version": "8.x-1.1", - "datestamp": "1598646882", + "version": "8.x-1.2", + "datestamp": "1658941749", "security-coverage": { "status": "covered", "message": "Covered by Drupal's security advisory policy" @@ -3617,10 +3617,6 @@ "GPL-2.0-or-later" ], "authors": [ - { - "name": "RobLoach", - "homepage": "https://www.drupal.org/user/61114" - }, { "name": "japerry", "homepage": "https://www.drupal.org/user/45640" @@ -3636,6 +3632,10 @@ { "name": "markus_petrux", "homepage": "https://www.drupal.org/user/39593" + }, + { + "name": "RobLoach", + "homepage": "https://www.drupal.org/user/61114" } ], "description": "The Field Permissions module allows site administrators to set field-level permissions to edit, view and create fields on any entity.", @@ -3970,17 +3970,17 @@ }, { "name": "drupal/geofield", - "version": "1.41.0", + "version": "1.43.0", "source": { "type": "git", "url": "https://git.drupalcode.org/project/geofield.git", - "reference": "8.x-1.41" + "reference": "8.x-1.43" }, "dist": { "type": "zip", - "url": "https://ftp.drupal.org/files/projects/geofield-8.x-1.41.zip", - "reference": "8.x-1.41", - "shasum": "dba35ddfa782cdd59ed07a1b105ee8d104fe59b2" + "url": "https://ftp.drupal.org/files/projects/geofield-8.x-1.43.zip", + "reference": "8.x-1.43", + "shasum": "2b10564b7419e9647e92589f65d4b1ff861f40bd" }, "require": { "drupal/core": "^8.8 || ^9 || ^10", @@ -3989,8 +3989,8 @@ "type": "drupal-module", "extra": { "drupal": { - "version": "8.x-1.41", - "datestamp": "1657834871", + "version": "8.x-1.43", + "datestamp": "1658960151", "security-coverage": { "status": "covered", "message": "Covered by Drupal's security advisory policy" @@ -5860,14 +5860,6 @@ "GPL-2.0-or-later" ], "authors": [ - { - "name": "Dave Reid", - "homepage": "https://www.drupal.org/user/53892" - }, - { - "name": "Deciphered", - "homepage": "https://www.drupal.org/user/103796" - }, { "name": "ademarco", "homepage": "https://www.drupal.org/user/186696" @@ -5880,6 +5872,14 @@ "name": "darvanen", "homepage": "https://www.drupal.org/user/1068770" }, + { + "name": "Dave Reid", + "homepage": "https://www.drupal.org/user/53892" + }, + { + "name": "Deciphered", + "homepage": "https://www.drupal.org/user/103796" + }, { "name": "pescetti", "homepage": "https://www.drupal.org/user/436244" @@ -6125,17 +6125,17 @@ }, { "name": "drupal/viewsreference", - "version": "2.0.0-beta2", + "version": "2.0.0-beta3", "source": { "type": "git", "url": "https://git.drupalcode.org/project/viewsreference.git", - "reference": "8.x-2.0-beta2" + "reference": "8.x-2.0-beta3" }, "dist": { "type": "zip", - "url": "https://ftp.drupal.org/files/projects/viewsreference-8.x-2.0-beta2.zip", - "reference": "8.x-2.0-beta2", - "shasum": "146bf8c68e6cbb3805b4368b508d43931fe77c67" + "url": "https://ftp.drupal.org/files/projects/viewsreference-8.x-2.0-beta3.zip", + "reference": "8.x-2.0-beta3", + "shasum": "27fbfb92021df6f161cdd4a126ba3a4d8157ceed" }, "require": { "drupal/core": "^8 || ^9" @@ -6146,8 +6146,8 @@ "type": "drupal-module", "extra": { "drupal": { - "version": "8.x-2.0-beta2", - "datestamp": "1597243219", + "version": "8.x-2.0-beta3", + "datestamp": "1658840434", "security-coverage": { "status": "not-covered", "message": "Beta releases are not covered by Drupal security advisories." @@ -6159,10 +6159,6 @@ "GPL-2.0-or-later" ], "authors": [ - { - "name": "New Zeal", - "homepage": "https://www.drupal.org/user/93571" - }, { "name": "jasonawant", "homepage": "https://www.drupal.org/user/589890" @@ -6171,6 +6167,10 @@ "name": "joekers", "homepage": "https://www.drupal.org/user/2229066" }, + { + "name": "kent@passingphase.nz", + "homepage": "https://www.drupal.org/user/93571" + }, { "name": "seanB", "homepage": "https://www.drupal.org/user/545912" @@ -9594,16 +9594,16 @@ }, { "name": "solarium/solarium", - "version": "6.2.5", + "version": "6.2.6", "source": { "type": "git", "url": "https://github.com/solariumphp/solarium.git", - "reference": "b3de12c7c5bba3f9a5955729ff5f7938c2b79789" + "reference": "cefde7709ba6290b78bb98d4ca11899cc0eb956e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/solariumphp/solarium/zipball/b3de12c7c5bba3f9a5955729ff5f7938c2b79789", - "reference": "b3de12c7c5bba3f9a5955729ff5f7938c2b79789", + "url": "https://api.github.com/repos/solariumphp/solarium/zipball/cefde7709ba6290b78bb98d4ca11899cc0eb956e", + "reference": "cefde7709ba6290b78bb98d4ca11899cc0eb956e", "shasum": "" }, "require": { @@ -9652,9 +9652,9 @@ ], "support": { "issues": "https://github.com/solariumphp/solarium/issues", - "source": "https://github.com/solariumphp/solarium/tree/6.2.5" + "source": "https://github.com/solariumphp/solarium/tree/6.2.6" }, - "time": "2022-07-20T11:51:35+00:00" + "time": "2022-07-22T10:29:01+00:00" }, { "name": "stack/builder", @@ -14202,34 +14202,31 @@ }, { "name": "doctrine/event-manager", - "version": "1.1.1", + "version": "1.1.2", "source": { "type": "git", "url": "https://github.com/doctrine/event-manager.git", - "reference": "41370af6a30faa9dc0368c4a6814d596e81aba7f" + "reference": "eb2ecf80e3093e8f3c2769ac838e27d8ede8e683" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/event-manager/zipball/41370af6a30faa9dc0368c4a6814d596e81aba7f", - "reference": "41370af6a30faa9dc0368c4a6814d596e81aba7f", + "url": "https://api.github.com/repos/doctrine/event-manager/zipball/eb2ecf80e3093e8f3c2769ac838e27d8ede8e683", + "reference": "eb2ecf80e3093e8f3c2769ac838e27d8ede8e683", "shasum": "" }, "require": { "php": "^7.1 || ^8.0" }, "conflict": { - "doctrine/common": "<2.9@dev" + "doctrine/common": "<2.9" }, "require-dev": { - "doctrine/coding-standard": "^6.0", - "phpunit/phpunit": "^7.0" + "doctrine/coding-standard": "^9", + "phpstan/phpstan": "~1.4.10 || ^1.5.4", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.5", + "vimeo/psalm": "^4.22" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, "autoload": { "psr-4": { "Doctrine\\Common\\": "lib/Doctrine/Common" @@ -14276,7 +14273,7 @@ ], "support": { "issues": "https://github.com/doctrine/event-manager/issues", - "source": "https://github.com/doctrine/event-manager/tree/1.1.x" + "source": "https://github.com/doctrine/event-manager/tree/1.1.2" }, "funding": [ { @@ -14292,7 +14289,7 @@ "type": "tidelift" } ], - "time": "2020-05-29T18:28:51+00:00" + "time": "2022-07-27T22:18:11+00:00" }, { "name": "doctrine/inflector", @@ -15775,16 +15772,16 @@ }, { "name": "laminas/laminas-servicemanager", - "version": "3.15.1", + "version": "3.16.0", "source": { "type": "git", "url": "https://github.com/laminas/laminas-servicemanager.git", - "reference": "216f972b179191b14c33a79337947b63bf7808ff" + "reference": "863c66733740cd36ebf5e700f4258ef2c68a2a24" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laminas/laminas-servicemanager/zipball/216f972b179191b14c33a79337947b63bf7808ff", - "reference": "216f972b179191b14c33a79337947b63bf7808ff", + "url": "https://api.github.com/repos/laminas/laminas-servicemanager/zipball/863c66733740cd36ebf5e700f4258ef2c68a2a24", + "reference": "863c66733740cd36ebf5e700f4258ef2c68a2a24", "shasum": "" }, "require": { @@ -15807,7 +15804,7 @@ "require-dev": { "composer/package-versions-deprecated": "^1.0", "laminas/laminas-coding-standard": "~2.3.0", - "laminas/laminas-container-config-test": "^0.6", + "laminas/laminas-container-config-test": "^0.7", "laminas/laminas-dependency-plugin": "^2.1.2", "mikey179/vfsstream": "^1.6.10@alpha", "ocramius/proxy-manager": "^2.11", @@ -15862,7 +15859,7 @@ "type": "community_bridge" } ], - "time": "2022-07-20T09:48:45+00:00" + "time": "2022-07-27T14:58:17+00:00" }, { "name": "laminas/laminas-text", @@ -16079,16 +16076,16 @@ }, { "name": "mikey179/vfsstream", - "version": "v1.6.10", + "version": "v1.6.11", "source": { "type": "git", "url": "https://github.com/bovigo/vfsStream.git", - "reference": "250c0825537d501e327df879fb3d4cd751933b85" + "reference": "17d16a85e6c26ce1f3e2fa9ceeacdc2855db1e9f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/bovigo/vfsStream/zipball/250c0825537d501e327df879fb3d4cd751933b85", - "reference": "250c0825537d501e327df879fb3d4cd751933b85", + "url": "https://api.github.com/repos/bovigo/vfsStream/zipball/17d16a85e6c26ce1f3e2fa9ceeacdc2855db1e9f", + "reference": "17d16a85e6c26ce1f3e2fa9ceeacdc2855db1e9f", "shasum": "" }, "require": { @@ -16126,7 +16123,7 @@ "source": "https://github.com/bovigo/vfsStream/tree/master", "wiki": "https://github.com/bovigo/vfsStream/wiki" }, - "time": "2021-09-25T08:05:01+00:00" + "time": "2022-02-23T02:02:42+00:00" }, { "name": "myclabs/deep-copy", @@ -17446,21 +17443,21 @@ }, { "name": "rector/rector", - "version": "0.13.8", + "version": "0.13.9", "source": { "type": "git", "url": "https://github.com/rectorphp/rector.git", - "reference": "6e01478f8239bfe28e003fad98d402589fa6861e" + "reference": "d6319ec783876579b608840cdfe1d8b566c72f74" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/rectorphp/rector/zipball/6e01478f8239bfe28e003fad98d402589fa6861e", - "reference": "6e01478f8239bfe28e003fad98d402589fa6861e", + "url": "https://api.github.com/repos/rectorphp/rector/zipball/d6319ec783876579b608840cdfe1d8b566c72f74", + "reference": "d6319ec783876579b608840cdfe1d8b566c72f74", "shasum": "" }, "require": { "php": "^7.2|^8.0", - "phpstan/phpstan": "^1.8" + "phpstan/phpstan": "^1.8.2" }, "conflict": { "phpstan/phpdoc-parser": "<1.6.2", @@ -17494,7 +17491,7 @@ "description": "Instant Upgrade and Automated Refactoring of any PHP code", "support": { "issues": "https://github.com/rectorphp/rector/issues", - "source": "https://github.com/rectorphp/rector/tree/0.13.8" + "source": "https://github.com/rectorphp/rector/tree/0.13.9" }, "funding": [ { @@ -17502,7 +17499,7 @@ "type": "github" } ], - "time": "2022-07-07T09:46:05+00:00" + "time": "2022-07-23T10:55:44+00:00" }, { "name": "sebastian/cli-parser", @@ -18582,27 +18579,27 @@ }, { "name": "sirbrillig/phpcs-variable-analysis", - "version": "v2.11.3", + "version": "v2.11.4", "source": { "type": "git", "url": "https://github.com/sirbrillig/phpcs-variable-analysis.git", - "reference": "c921498b474212fe4552928bbeb68d70250ce5e8" + "reference": "e9c99cda31b21ccb4da4c2124b57c8355ddce48e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sirbrillig/phpcs-variable-analysis/zipball/c921498b474212fe4552928bbeb68d70250ce5e8", - "reference": "c921498b474212fe4552928bbeb68d70250ce5e8", + "url": "https://api.github.com/repos/sirbrillig/phpcs-variable-analysis/zipball/e9c99cda31b21ccb4da4c2124b57c8355ddce48e", + "reference": "e9c99cda31b21ccb4da4c2124b57c8355ddce48e", "shasum": "" }, "require": { "php": ">=5.4.0", - "squizlabs/php_codesniffer": "^3.5" + "squizlabs/php_codesniffer": "^3.5.6" }, "require-dev": { "dealerdirect/phpcodesniffer-composer-installer": "^0.7.0", - "limedeck/phpunit-detailed-printer": "^3.1 || ^4.0 || ^5.0", - "phpstan/phpstan": "^0.11.8", - "phpunit/phpunit": "^5.0 || ^6.5 || ^7.0 || ^8.0", + "phpcsstandards/phpcsdevcs": "^1.1", + "phpstan/phpstan": "^1.7", + "phpunit/phpunit": "^4.8.36 || ^5.7.21 || ^6.5 || ^7.0 || ^8.0 || ^9.0", "sirbrillig/phpcs-import-detection": "^1.1" }, "type": "phpcodesniffer-standard", @@ -18631,7 +18628,7 @@ "source": "https://github.com/sirbrillig/phpcs-variable-analysis", "wiki": "https://github.com/sirbrillig/phpcs-variable-analysis/wiki" }, - "time": "2022-02-21T17:01:13+00:00" + "time": "2022-06-13T13:49:41+00:00" }, { "name": "slevomat/coding-standard",