Changes for page Calendar Macro

Last modified by Vladislav ANTOLÍK on 19.10.2026, 08:01

From version 2.1
edited by Vladislav ANTOLÍK
on 31.10.2025, 19:27
Change comment: Install extension [org.xwiki.contrib:macro-fullcalendar-ui/2.4.6]
To version 6.1
edited by Vladislav ANTOLÍK
on 19.10.2026, 08:01
Change comment: Install extension [org.xwiki.contrib:macro-fullcalendar-ui/2.5.5]

Summary

Details

Page properties
Content
... ... @@ -7,7 +7,7 @@
7 7  
8 8   {{calendar classname="Blog.BlogPostClass" startfield="publishDate" editable="false" year="2009" month="5" date="1" /}}
9 9  
10 -or
10 +or
11 11  
12 12   {{velocity}}
13 13   {{calendar json="${xwiki.getDocument("Calendar.ExampleJSON").getURL("get")}" editable="false" year="2012" month="5" date="18" /}}
XWiki.WikiMacroClass[0]
Macro code
... ... @@ -6,7 +6,11 @@
6 6  #else
7 7   #set($calcounter = 1)
8 8  #end
9 -(% id="calendar${calcounter}" %)
9 +#set($containerId = "calendar${calcounter}")
10 +#if ($xcontext.macro.params.id)
11 + #set ($containerId = $xcontext.macro.params.id)
12 +#end
13 +(% id="$services.rendering.escape($containerId, 'xwiki/2.1')" class="xwiki-fullcalendar" %)
10 10  (((
11 11  )))
12 12  
... ... @@ -154,7 +154,7 @@
154 154   function init() {
155 155   // The page is now ready, initialize the calendar...
156 156   var progressNotification;
157 - $('#calendar${calcounter}').fullCalendar({
161 + $('#${containerId}').fullCalendar({
158 158   views: {
159 159   month : {
160 160   columnFormat: "$!services.localization.render('xwiki.calendar.columnFormat.month')",
... ... @@ -230,6 +230,7 @@
230 230   tooltip = tooltip + "$services.localization.render('xwiki.calendar.event.description') " + event.description;
231 231   }
232 232   element.attr('title', tooltip);
237 + document.fire("xwiki:fullcalendar:${containerId}:eventrendering", { eventObj: event, eventElement: element });
233 233   },
234 234   loading: function( isLoading) {
235 235   if (isLoading) {
... ... @@ -252,14 +252,13 @@
252 252   });
253 253   }
254 254  
255 - // Load the calendar in edit mode.
256 - $(window).on('xwiki:dom:updated', function() {
257 - init();
258 - });
259 - // Load the calendar in view mode.
260 - $(document).ready(function() {
261 - init();
262 - });
260 + function scheduleInit() {
261 + clearTimeout(window['_calMacroTimer${calcounter}']);
262 + window['_calMacroTimer${calcounter}'] = setTimeout(init, 200);
263 + }
264 +
265 + $(window).off('.calMacro${calcounter}').on('xwiki:dom:updated.calMacro${calcounter}', scheduleInit);
266 + scheduleInit();
263 263   });
264 264  });
265 265  </script>
defaultCategory
... ... @@ -1,1 +1,0 @@
1 -Content
XWiki.WikiMacroParameterClass[19]
Parameter description
... ... @@ -1,0 +1,1 @@
1 +The id (html attribute) that will be set to the wrapper of the calendar.
Parameter mandatory
... ... @@ -1,0 +1,1 @@
1 +No
Parameter name
... ... @@ -1,0 +1,1 @@
1 +id