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

Benoit Grégoire (@benoitg) via TikiWiki-cvs <[email protected]>
Newsgroups gmane.comp.cms.tiki.cvs
Message-ID <68913e37abfb2_2c10f6b8439068@gitlab-sidekiq-low-urgency-cpu-bound-v2-58b475bb65-g28r4.mail>

Benoit Grégoire pushed to branch master at Tiki Wiki CMS Groupware / Tiki


Commits:
360610ec by MAGENE Sem Joel at 2025-08-04T22:27:32+00:00
[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

- - - - -


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
=====================================
@@ -145,6 +145,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 = [];
 
@@ -191,6 +199,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'],
                         [
@@ -206,7 +215,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
=====================================
@@ -201,7 +201,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
=====================================
@@ -286,41 +286,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/360610ece50f7564267417b9e0f427276d063735

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