[TikiWiki-commits] [Git][tikiwiki/tiki][29.x] [BP][FIX][REF] Calendar : Restore event details popup in table view

"Baraka Kinywa \(@bkinywa24\) via TikiWiki-cvs" <[email protected]>
Newsgroups gmane.comp.cms.tiki.cvs
Message-ID <689488c25e35e_2cd5b4c35272@gitlab-sidekiq-low-urgency-cpu-bound-v2-fcfcfbbb-v8ctt.mail>

Baraka Kinywa pushed to branch 29.x at Tiki Wiki CMS Groupware / Tiki


Commits:
f8e9e2c0 by MAGENE Sem Joel at 2025-08-07T13:58:36+03:00
[BP][FIX][REF] Calendar : Restore event details popup in table view
---
* [FIX][REF] Calendar : Restore event details popup in table view
---
* [REF] Calendar : Remove obsolete event fetching logic

* [FIX] Calendar : Restore event details popup in table view

See merge request tikiwiki/tiki!8100

See merge request tikiwiki/tiki!8219

- - - - -


3 changed files:

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


Changes:

=====================================
lib/core/Services/Calendar/Controller.php
=====================================
@@ -143,6 +143,14 @@ class Services_Calendar_Controller extends Services_Calendar_BaseController
             $listevents = [];
         }
 
+        $listevents = Perms::filter(
+            ['type' => 'calendaritem'],
+            'object',
+            $listevents,
+            ['object' => 'calitemId'],
+            ['view_events']
+        );
+
         $parserLib = TikiLib::lib('parser');
         $events = [];
 
@@ -189,6 +197,7 @@ class Services_Calendar_Controller extends Services_Calendar_BaseController
                 'id'          => $event['calitemId'],
                 'title'       => $event['name'],
                 'extendedProps' => [
+                    'viewable'    => $event['perms']->view_events,
                     'description' => ! empty($event['description']) ? $parserLib->parse_data(
                         $event['description'],
                         [
@@ -204,7 +213,6 @@ class Services_Calendar_Controller extends Services_Calendar_BaseController
                 'allDay'      => $allDay,
                 'start'       => $start->format(DATE_ATOM),
                 'end'         => $end->format(DATE_ATOM),
-                'viewable'    => $event['perms']->view_events,
                 'editable'    => $event['perms']->change_events,
                 'color'       => '#' . $calendars[$event['calendarId']]['custombgcolor'],
                 'textColor'   => '#' . $calendars[$event['calendarId']]['customfgcolor'],


=====================================
src/js/jquery-tiki/tiki-calendar.js
=====================================
@@ -200,7 +200,7 @@ $.fn.setupEventCalendar = function (eventCalendarParams) {
                 console.log(info.el);
                 const event = info.event;
                 console.log(event);
-                if (event.id && event.viewable) {
+                if (event.id && event.extendedProps.viewable) {
                     let $this = $(info.el).tikiModal(" ");
                     $.openModal({
                         title: tr("New event"),


=====================================
tiki-calendar.php
=====================================
@@ -283,41 +283,39 @@ if (isset($_REQUEST['sort_mode'])) {
 $viewstart = $_REQUEST['todate'] ?? $tikilib->now;
 $viewend = $viewstart + 90 * 86400 - 1; // 1 month approx
 
-if ($_SESSION['CalendarViewGroups']) {
-    if (array_key_exists('CalendarViewList', $_SESSION) && $_SESSION['CalendarViewList'] == "list") {
-        if (! isset($sort_mode)) {
-            $sort_mode = "start_asc";
-        }
-        $smarty->assign_by_ref('sort_mode', $sort_mode);
-
-        $listevents = $calendarlib->list_raw_items(
-            $_SESSION['CalendarViewGroups'],
-            $user,
-            $viewstart,
-            $viewend,
-            0,
-            $prefs['maxRecords'],
-            $sort_mode
-        );
+$listevents = [];
+if (! empty($_SESSION['CalendarViewGroups']) && ! empty($_SESSION['CalendarViewList']) && $_SESSION['CalendarViewList'] === 'list') {
+    // This logic is only for the 'list' view. The 'table' view is handled by AJAX.
 
-        $listevents = Perms::filter(
-            ['type' => 'calendaritem'],
-            'object',
-            $listevents,
-            ['object' => 'calitemId'],
-            ['view_events']
-        );
-
-        foreach ($listevents as & $event) {
-            $event['perms'] = Perms::get([ 'type' => 'calendaritem', 'object' => $event['calitemId']]);
-        }
-    } else {
-        $listevents = $calendarlib->list_items($_SESSION['CalendarViewGroups'], $user, $viewstart, $viewend, 0, -1);
+    if (! isset($sort_mode)) {
+        $sort_mode = "start_asc";
     }
-    $smarty->assign_by_ref('listevents', $listevents);
-} else {
-    $listevents = [];
+    $smarty->assign_by_ref('sort_mode', $sort_mode);
+
+    $listevents = $calendarlib->list_raw_items(
+        $_SESSION['CalendarViewGroups'],
+        $user,
+        $viewstart,
+        $viewend,
+        0,
+        $prefs['maxRecords'],
+        $sort_mode
+    );
+
+    $listevents = Perms::filter(
+        ['type' => 'calendaritem'],
+        'object',
+        $listevents,
+        ['object' => 'calitemId'],
+        ['view_events']
+    );
+
+    foreach ($listevents as & $event) {
+        $event['perms'] = Perms::get([ 'type' => 'calendaritem', 'object' => $event['calitemId']]);
+    }
+    unset($event);
 }
+$smarty->assign_by_ref('listevents', $listevents);
 
 $mloop = TikiLib::date_format("%m", $viewstart);
 $dloop = TikiLib::date_format("%d", $viewstart);



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

-- 
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/f8e9e2c06ae18deb7f2959af36b2a8615951e257
You're receiving this email because of your account on gitlab.com.

_______________________________________________
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.