[TikiWiki-commits] [Git][tikiwiki/tiki][30.x] [BP][FIX][UX] Calendar: preserve all-day status when creating events from drag selection

"MAGENE Sem Joel \(@Jomagene\) via TikiWiki-cvs" <[email protected]>
Newsgroups gmane.comp.cms.tiki.cvs
Message-ID <6a95826be549c_3818e3b832494@gitlab-sidekiq-low-urgency-cpu-bound-v2-74dc959445-ktv5x.mail>

MAGENE Sem Joel pushed to branch 30.x at Tiki Wiki CMS Groupware / Tiki


Commits:
97b87177 by MAGENE Sem Joel at 2026-08-31T13:25:27+00:00
[BP][FIX][UX] Calendar: preserve all-day status when creating events from drag selection
---
* [FIX][UX] Calendar: preserve all-day status when creating events from drag selection
---
* [FIX][UX] Calendar: preserve all-day status when creating events from drag selection

See merge request tikiwiki/tiki!11087

(cherry picked from commit eea6038a26fc091ea93d9289950cd03638681275)

See merge request tikiwiki/tiki!11101

- - - - -


2 changed files:

- lib/core/Services/Calendar/Controller.php
- src/js/jquery-tiki/tiki-calendar.js


Changes:

=====================================
lib/core/Services/Calendar/Controller.php
=====================================
@@ -415,18 +415,22 @@ class Services_Calendar_Controller extends Services_Calendar_BaseController
                 }
                 // set up default start and end
                 $dateNow->setTZbyID($displayTimezone);
+                $prefillAllDay = null;
                 if ($input->prefill_start->text()) {
                     $prefillStart = trim($input->prefill_start->text());
                     $prefillEnd = trim((string) $input->prefill_end->text());
                     $prefillTimezoneRequested = trim((string) $input->prefill_tz->text());
                     $prefillTimezone = $this->resolvePrefillTimezone($prefillTimezoneRequested, $displayTimezone);
+                    $prefillAllDay = $input->offsetExists('prefill_allday')
+                        ? $input->prefill_allday->int() === 1
+                        : null;
 
                     $start = $this->parsePrefillDateTime($prefillStart, $prefillTimezone);
                     if (! is_null($start) && $prefillEnd !== '') {
                         $end = $this->parsePrefillDateTime($prefillEnd, $prefillTimezone);
                         if (! is_null($end)) {
                             // convert exclusive all-day selection end to inclusive end
-                            if ($this->isPrefillStartOfDay($prefillEnd, $prefillTimezone)) {
+                            if ($prefillAllDay !== false && $this->isPrefillStartOfDay($prefillEnd, $prefillTimezone)) {
                                 $end -= 1;
                             }
                             if ($end <= $start) {
@@ -481,7 +485,7 @@ class Services_Calendar_Controller extends Services_Calendar_BaseController
                     'end'                   => $end,
                     'duration'              => $duration,
                     'recurrenceId'          => 0,
-                    'allday'                => $calendar['allday'] == 'y' ? 1 : 0,
+                    'allday'                => $prefillAllDay ?? ($calendar['allday'] == 'y' ? 1 : 0),
                     'organizers'            => [$user],
                     'participants'          => $participants,
                     'returnURL'             => $return_url,


=====================================
src/js/jquery-tiki/tiki-calendar.js
=====================================
@@ -198,7 +198,7 @@ $.fn.setupEventCalendar = function (
             true
         );
 
-        const openNewEventModal = (startValue, endValue = null) => {
+        const openNewEventModal = (startValue, endValue = null, allDay = null) => {
             if (isOpeningModal) return;
             const countCals = $(".filtercal .calcheckbox").length;
             if (countCals >= 1 || targetId != "calendar") {
@@ -220,6 +220,10 @@ $.fn.setupEventCalendar = function (
                     params.prefill_tz = browserTimezone;
                 }
 
+                if (typeof allDay === "boolean") {
+                    params.prefill_allday = allDay ? 1 : 0;
+                }
+
                 if (endValue !== null && typeof endValue !== "undefined") {
                     const prefillEnd = toPrefillParamValue(endValue);
                     if (prefillEnd) {
@@ -389,7 +393,7 @@ $.fn.setupEventCalendar = function (
             eventSources: [{ url: urlEventSource }],
             select: function (info) {
                 // Handle Drag Selection
-                openNewEventModal(info.startStr ?? info.start, info.endStr ?? info.end);
+                openNewEventModal(info.startStr ?? info.start, info.endStr ?? info.end, info.allDay);
             },
             slotMinTime: eventCalendarParams.minHourOfDay,
             slotMaxTime: eventCalendarParams.maxHourOfDay,



View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/97b871779e8c51de419ad0038973a04f78f142a9

-- 
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/97b871779e8c51de419ad0038973a04f78f142a9
You're receiving this email because of your account on gitlab.com. Manage all notifications: https://gitlab.com/-/profile/notifications | Help: https://gitlab.com/help

_______________________________________________
TikiWiki-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tikiwiki-cvs
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.