[TikiWiki-commits] [Git][tikiwiki/tiki][master] [FIX] Calendar module: set default calendar ID and update add-event link action

"Alvin Bauma \(@alvinBM\) via TikiWiki-cvs" <[email protected]>
Newsgroups gmane.comp.cms.tiki.cvs
Message-ID <69048619de133_2ce211c798dc@gitlab-sidekiq-low-urgency-cpu-bound-v2-6dd557cc7-7x5tw.mail>

Alvin Bauma pushed to branch master at Tiki Wiki CMS Groupware / Tiki


Commits:
98e7790a by Alvin Bauma at 2025-10-31T10:41:23+01:00
[FIX] Calendar module: set default calendar ID and update add-event link action
---
* [FIX] Calendar module: set default calendar ID and update add-event link action

See merge request tikiwiki/tiki!8918

- - - - -


2 changed files:

- modules/mod-func-calendar_new.php
- templates/modules/mod-calendar_new.tpl


Changes:

=====================================
modules/mod-func-calendar_new.php
=====================================
@@ -81,6 +81,7 @@ function module_calendar_new($mod_reference, $module_params)
     global $calendarViewMode, $focusdate;
     $default = ['viewnavbar' => 'y', 'viewmode' => 'month', 'showaction' => 'y'];
     $module_params = array_merge($default, $module_params);
+    $defaultCalendarId = 0;
 
     if (isset($_REQUEST['viewmode'])) {
         $save_viewmode = $_REQUEST['viewmode'];
@@ -132,6 +133,7 @@ function module_calendar_new($mod_reference, $module_params)
     } else {
         $calIds = [];
     }
+    $defaultCalendarId = $calIds[0] ?? 0;
     $moduleCalendarIds = implode(',', $calIds);
 
     $_REQUEST['gbi'] = 'y';
@@ -157,6 +159,7 @@ function module_calendar_new($mod_reference, $module_params)
     );
     $smarty->assign('moduleCalendarFocusdate', $moduleCalendarFocusdate);
     $smarty->assign('moduleCalendarIds', $moduleCalendarIds);
+    $smarty->assign('defaultCalendarId', $defaultCalendarId);
     if ($calendarInitialParams['canEditAnything']) {
         TikiLib::lib('header')
             ->add_cssfile('themes/base_files/feature_css/calendar.css', 20)


=====================================
templates/modules/mod-calendar_new.tpl
=====================================
@@ -3,7 +3,7 @@
         {if $tiki_p_add_events eq 'y' && (empty($module_params.showaction) || $module_params.showaction ne 'n')}
             <br>
             <p>
-                <a class="btn btn-link" href="{bootstrap_modal controller='calendar' action=$prefs.calendar_event_click_action size='modal-lg'}" role="button">
+                <a class="btn btn-link" href="{bootstrap_modal controller='calendar' action='edit_item' size='modal-lg' defaultCalendarId=$defaultCalendarId}" role="button">
                     {icon name="add"}
                     {tr}Add Event{/tr}
                 </a>



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

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