Current Record: Calendar_Action #43

Calendar Action Table of Contents Calendar Action Features Requirements Setting up the Calendar Using a datetime field to store both ...

Current Record: Calendar_Action #43

Calendar Action Table of Contents Calendar Action Features Requirements Setting up the Calendar Using a datetime field to store both ...

Calendar_Action

[Permalink]

Calendar Action

Xataface 1.0 includes a built-in calendar action that is disabled by default. If enabled, it allows you to view the records in any found set as a calendar of events, as follows:

Features

  • Monthly display
  • Hourly schedule for any day by clicking on it.
  • Show record details instantly by clicking on it in the calendar.
  • Recognizes dates, start and end times for records when interpreted as calendar events.
  • Respects searches (i.e. you can filter the records and the calendar will only show those records in the found set).

Requirements

Your table records should contain at least dates in order for them to be interpreted as events that can be placed in a calendar.

Setting up the Calendar

Suppose I have a table called Lessons that stores information about scheduled music lessons. If I want to add the calendar to this table, then I would add an actions.ini file to the tables/Lessons directory with the following contents:

[calendar > calendar]
    condition="true"
This overrides the calendar action which is disabled by default, and enables it for the Lessons table.

Next I need to inform Xataface which fields store the event dates and times so that the records can be laid out in the calendar appropriately. (Note that if you skip this step, Xataface will make a best guess based on column types and names - but it is better to specify these explicitly).

In the Lessons table I have the following fields that are relevant here:

  • lesson_date - A date field containing the date and start time of the event.
  • start_time - A time field with the start time of the lesson.

We can tell Xataface to treat these fields accordingly by adding the following directives to the appropriate field sections of the fields.ini file for the Lessons table:

  • event.date=1 - Specifies that the field stores the date of the event.
  • event.start=1 - Specifies that the field stores the start time of the event.

So in our case we'll modify the fields.ini file as follows:

[lesson_date]
    event.date=1

[start_time]
    event.start=1

Now if we load up our application, we should now see a calendar tab along side list, details, and find for the Lessons table. Click on this tab to see your records displayed in a calendar.

Using a datetime field to store both date and start time

You can also use a single field to store both the date and start time for an event. In this case you just provide the event.date and event.start directives for the same field. For example if the lesson_date was a datetime field that marked the date and time of the lesson, we would modify our fields.ini? file as follows:

[lesson_date]
    event.date=1
    event.start=1

Available Fields

The Calendar action will look for the following pieces of information in your records:

Name Description Version
event.date Indicates that the field contains the date of the event. 1.0
event.start Indicates that the field contains the start time of the event. 1.0
event.end Indicates that the field contains the end time of the event. 1.0
event.location Indicates that the field contains the location of the event. 1.0
event.category Indicates that the field contains the category of the event. 1.0
blog comments powered by Disqus
Powered by Xataface
(c) 2005-2024 All rights reserved