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

"ushindi bienvenu \(@usbbush\) via TikiWiki-cvs" <[email protected]>
Newsgroups gmane.comp.cms.tiki.cvs
Message-ID <6a9563e46c464_39224cd84990ec@gitlab-sidekiq-low-urgency-cpu-bound-v2-55667cdfbd-ll9vp.mail>

ushindi bienvenu pushed to branch master at Tiki Wiki CMS Groupware / Tiki


Commits:
eea6038a by MAGENE Sem Joel at 2026-08-31T11:05:28+00:00
[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

- - - - -


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
=====================================
@@ -199,7 +199,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") {
@@ -222,6 +222,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) {
@@ -443,7 +447,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/eea6038a26fc091ea93d9289950cd03638681275

-- 
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/eea6038a26fc091ea93d9289950cd03638681275
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.