Full Calendar Macro

Last modified by Andreea Popescu on 2014/07/01 12:29

calendarDisplays a Calendar in Javascript and allows to get events from XWiki pages.
TypeXAR
Developed by

Vincent Massol, Ludovic Dubost, Ecaterina Moraru (Valica), Alexandru Chelariu, Manuel Smeria, Anca Luca

LicenseGNU Lesser General Public License 2.1
Installable with the Extension Manager

View Source

Download v1.1.8

Description

Integrates the FullCalendar JQuery plugin into XWiki to display custom Calendars.

Usage

This application provides a calendar macro. There are multiple ways to use this macro, either by referring to an XWiki class or by writing your custom JSON script to read the data.

Example with an XWiki class

This example will display the blog articles on the calendar based on the publishDate field. Additionally the calendar is displayed by default on June 2009 (year=2009 and month=5).

{{calendar classname="Blog.BlogPostClass" startfield="publishDate" editable="false"  year="2009" month="5" date="1"  /}}

Example with custom JSON

For example put the following in a page named MyCalendar in the Main space (i.e. Main.MyCalendar):

{{velocity}}
  {{calendar json="$xwiki.getURL('Main.MyCalendarJSON', 'get', 'outputSyntax=plain')"/}}
{{/velocity}}

Now since we've specified to use the Main.MyCalendarJSON page to get the calendar events you also need to create a MyCalendarJSON page in the Main space and put the following in it:

{{velocity filter="html"}}
#if($xcontext.action == 'get' && "$!{request.outputSyntax}" == 'plain')
 $response.setContentType('application/json')
#end

[{"id":111,"title":"Event1","start":"2012-06-10","url":"http:\/\/yahoo.com\/"},{"id":222,"title":"Event2","start":"2012-06-20","end":"2012-06-22","url":"http:\/\/yahoo.com\/"}]
{{/velocity}}

Reference

Here is the reference of all parameters

 Parameter  Detail  Default  Possible values
 classname¬† Name of the class to retrieve data for  None  Any xwiki class name. This setting is not used if a "json" url is provided
 startfield  Field of the class to use as the date  None  any date field in the class chosen. This setting is not used if a "json" url is provided
 durationfield  Field of the class to use as the duration of the event. When not set the events will be "day" events  None  any number field in the class chosen.  This setting is not used if a "json" url is provided
 editable  Used to activate the edit feature allowing to move events  true  true or false
 defaultView  default agenda to show on load of the agenda  month  month, agendaWeek, agendaDay, basicWeek, basicDay
 year  Year of the date to show when loading the calendar. Leave empty for today  Will set the day as today  Any year
 month  Month (from 0 to 11) of the date to show when loading the calendar. Leave empty for today  Will set the day as today  0-11 for January-December
 date  Day (from 1 to 31) of the date to show when loading the calendar. Leave empty for today  Will set the day as today  1-31
 firstDay  First day (from 0 being Sunday to 6 being Monday) of the week to show in the calendar.  Will be sunday by default  0-6 for Sunday-Saturday
 firstHour  First hour to show in the calendar ¬† 0-24
 minMin  First time to show in the calendar. Users won't see hours before this time  8.00  0.00 to 23.00
 maxMin  Last time to show in the calendar. Users won't see hours before this time  23.00  0.00 to 23.00
 json  URL of the JSON page to retrieve the data from  None 

URL to a page generating JSON. Example format:

[
    {
        "id": 111,
        "title": "Event1",
        "start": "2012-06-10",
        "url": "http://yahoo.com/"
    },
    {
        "id": 222,
        "title": "Event2",
        "start": "2012-06-20",
        "end": "2012-06-22",
        "url": "http://yahoo.com/"
    }
]

This is only needed if the JSON generated by the Calendar.JSONService does not fit your needs. The Calendar.JSONService can query events from any class with a date and a duration field (string) 

Example value in velocity:

An XWiki url: $xwiki.getURL('Main.MyCalendarJSON', 'get', 'outputSyntax=plain') 

 updateurl  URL of the page to call for updates  None 

URL page to update events when they are moved or resized in the Calendar. The following parameters are passed:

  • classname: the classname holding the object (from the classname parameter of the macro)
  • startfield: the startdate field where the event start date is stored (from the startfield parameter of the macro)
  • durationfield: the duration field where the event duration is stored as a string (from the durationfield parameter of the macro)
  • isResize: if the event is resized, otherwise the event start date is moved
  • deltaDays: the delta in days of the move or resize
  • deltaMinutes: the delta in minutes of the move or resize
  • allDay: if the event is moved to be an allDay event

The default update service handles updating a document holding a specific classname with a start date and a duration field as specified in the macro parameters.

The editable parameter needs to be set to true for this field to be used.

Screenshot

Screenshot using the Lyrebird skin:

calendar.png

Release Notes for previous versions (not available anymore in Extension Manager)

 

v1.1.5

  • Fixed the formatting of the date of the JSONService to not rely on the wiki default anymore, otherwise it can break if the wiki default is not supported or does not contain time information, and the items will not be displayed properly on the calendar.

v1.1.4

  • Changed the authors/creators of the pages to xwiki:XWiki.Admin, to match the standard xar format.

v1.1.3

Compared to 1.1.2 this release adds:

  • Updated query string to fix the JSON example query
  • Added titles and set parents for some pages that didn't have them

v1.1.2


Compared to 1.1.1 this release adds:

  • adding JQuery as an attachment to avoid issues with the length of the code property

v1.1.1

Compared to 1.1 this releases adds:

  • minor CSS improvements in order to assure compatibility with Colibri skin: removed the bottom scroll and added right border

v1.1

Compared to 1.0.2 this releases adds:

  • many parameters to configure the calendar (default view, firstDay, firstHour, minTime, maxTime, etc..)
  • a new default JSONService to lookup for document with a specific classname with a date field and an optional duration field (the class and fields names are provided as parameter to the macro). For instance you can query Blog posts with this default JSON Service
  • a new update service which allows to update the date and duration field when moving the event on the calendar
  • a fix to allow to display multiple calendars on the same page

v1.0.2

Compared to version 1.0.1 this release fixes the CSS issue with table borders showing in the Calendar header when on the Colibri skin.

This is an early integration and lots of things remain to be done. Just to cite a few:

  • Test edition and drag and drop of Events
  • Improve the Calendar Macro to support other sources
  • Fix CSS style bugs when used with the Colibri skin

v1.0.1

This is a very first integration and lots of things remain to be done. Just to cite a few:

  • Test edition and drag and drop of Events
  • Improve the Calendar Macro to support other sources
  • Fix CSS style bugs when used with the Colibri skin

v1.0

This is a very first integration and lots of things remain to be done. Just to cite a few:

  • Test edition and drag and drop of Events
  • Improve the Calendar Macro to support other sources
  • Fix CSS style bugs when used with the Colibri skin
  • Some issue between JQuery and XWiki (try clicking on a Tab at the bottom of pages). Strangely this doesn't happen with the JQuery Helper extension

Compatibility

This extension has been tested with the following configurations.

Extension VersionXWiki FlavorNotes
1.1.8XWiki Enterprise 6.0.1

Prerequisites & Installation Instructions

We recommend using the Extension Manager to install this extension (Make sure that the text "Installable with the Extension Manager" is displayed at the top right location on this page to know if this extension can be installed with the Extension Manager).

You can also use the following manual method, which is useful if this extension cannot be installed with the Extension Manager or if you're using an old version of XWiki that doesn't have the Extension Manager:

  1. Log in the wiki with a user having Administration rights
  2. Go to the Administration page and select the Import category
  3. Follow the on-screen instructions to upload the downloaded XAR
  4. Click on the uploaded XAR and follow the instructions

Release Notes

v1.1.8

This version includes the following fixes:

  • Closed FULLCAL-5 The calendar macro should not generate unnecessary whitespaces
  • Closed FULLCAL-6 The calendar header does not scale when using more dashboard columns
  • Closed FULLCAL-7 Calendar events do not always display the complete minutes information
  • Closed FULLCAL-3 Mark internal pages as hidden

v1.1.7

This version includes the following fixes:

  • Closed FULLCAL-4 Html encoding issues for the title of events

v1.1.6

This version includes the following fixes:

  • Closed FULLCAL-1 Full Calendar macro should be translated in the current language

Tags:
Created by Vincent Massol on 2012/06/13 15:10
    

Download XWiki

My Recent Modifications

Get Connected