[TikiWiki-commits] [Git][tikiwiki/tiki][master] [FIX][UX] Calendar: show a setup prompt when no calendars exist

"Bruno Kambere \(@kambereBr\) via TikiWiki-cvs" <[email protected]>
Newsgroups gmane.comp.cms.tiki.cvs
Message-ID <6a3d2e1c3177e_3869654a0993e9@gitlab-sidekiq-low-urgency-cpu-bound-v2-d68649794-8rtqh.mail>

Bruno Kambere pushed to branch master at Tiki Wiki CMS Groupware / Tiki


Commits:
65ec6ff2 by MAGENE Sem Joel at 2026-06-25T16:12:27+03:00
[FIX][UX] Calendar: show a setup prompt when no calendars exist
---
* [FIX][UX] Calendar: show a setup prompt when no calendars exist

See merge request tikiwiki/tiki!10574

- - - - -


2 changed files:

- templates/tiki-calendar.tpl
- tiki-calendar.php


Changes:

=====================================
templates/tiki-calendar.tpl
=====================================
@@ -1,4 +1,18 @@
 {include file='token_view_actions.tpl'}
+{if !empty($calendarEmptyState)}
+{title admpage="calendar"}{tr}Calendar{/tr}{/title}
+<div id="calscreen">
+    {remarksbox type="info" title="{tr}No calendars available{/tr}" close="n"}
+        <p>{tr}You don't have any calendars yet.{/tr}</p>
+        {if $tiki_p_admin_calendar eq 'y' or $tiki_p_admin eq 'y' or $tiki_p_admin_private_calendar eq 'y'}
+            <p>{tr}Create a calendar to start adding and viewing events.{/tr}</p>
+            {button href="tiki-admin_calendars.php?cookietab=2" _type="primary" _icon_name="create" _text="{tr}Create Calendar{/tr}"}
+        {else}
+            <p>{tr}Please ask an administrator to create one.{/tr}</p>
+        {/if}
+    {/remarksbox}
+</div>
+{else}
 {title admpage="calendar"}
     {if $displayedcals|@count eq 1}
     {tr}Calendar:{/tr} {$calendars[$displayedcals[0]].displayName|escape}
@@ -121,3 +135,4 @@
 {if $prefs.feature_jscalendar eq 'y'}
     {js_insert_icon type="jscalendar"}
 {/if}
+{/if}


=====================================
tiki-calendar.php
=====================================
@@ -68,12 +68,11 @@ if (! isset($cookietab)) {
 $rawcals = $calendarlib->list_calendars();
 
 if (empty($rawcals['data'])) {
-    if (Perms::get(['type' => 'calendar'])->admin_calendar) {
-        $message = tr('You need to %0create a calendar%1', '<a href="tiki-admin_calendars.php?cookietab=2">', '</a>');
-    } else {
-        $message = tra('No calendars found');
-    }
-    Feedback::errorAndDie($message, \Laminas\Http\Response::STATUS_CODE_404);
+    $smarty->assign('calendarEmptyState', true);
+    $smarty->assign('mid', 'tiki-calendar.tpl');
+    $smarty->assign('metatag_robots', 'NOINDEX, NOFOLLOW');
+    $smarty->display("tiki.tpl");
+    die;
 }
 
 $rawcals['data'] = Perms::filter(



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

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