Preskoči na sadržaj

API

Generally, the Open Web Calendar is there to be used without restriction. You can use this API to customize the calendar on the fly.

This section can be of use if one of these applies:

  • You are a web developer who wants to embed the Open Web Calendar.
  • You want to exploit the full flexibility, not just what is exposed on the configuration page.
  • You want to use JavaScript to dynamically generate the calendar design and options.
  • You want to extend the functionality of the Open Web Calendar.
  • You want to use the Open Web Calendar as a proxy to request JSON events for your self-made event feed.

Endpoints

The basic parameters are the same at these endpoints:

  • /index.html – uredi kalendar
  • /about.html – pogledaj stranicu s informacijama o aplikaciji
  • /calendar.html – pogledaj kalendar
  • /calendar.spec – preuzmi specifikaciju
  • /calendar.ics – pretplati se na ics datoteku
  • /calendar.events.json - FLEXIBLE - get the events as JSON Please note that you CAN use this but you cannot be sure that the JSON schema remains the same. If you want that, add tests.

Additional parameters are required for /calendar.events.json:

  • timezone=UTC – vremenska zona u kojoj će se prikazati događaji
  • from=YYYY-MM-DD – početak razdoblja u kojem se događaji događaju (uključujući)
  • to=YYYY-MM-DD – kraj razdoblja u kojem se događaji događaju (uključujući)

Parametri

All configuration parameters are described sufficiently in the default_specification. That is the reference. E.g. if you find the parameter title in the default_specification, you have several options:

Change the title in a query parameter:

/index.html?title=calendar

Promijeni naslov u YAML specifikaciji:

title: calendar

Promijeni naslov u JSON specifikaciji:

{
  "title": "calendar"
}

Dodavanje parametara

If you add a new parameter as a developer,

Kompiliranje specifikacije

You can change the calendar behavior and looks with parameters. These are the places to specify parameters:

  1. Query parameters All parameters to the calendar url are put into the specification. The query parameters have the highest precedence. Examples: txt index.html?language=de calendar.html?title=CALENDAR
  2. specification_url If you specify this query parameter, the editor configuration is loaded from this url, too. Query parameters are still more important than what is written in this file. The source format can be YAML or JSON. Examples: calendar.html?specification_url=https://github.com/niccokunzmann/open-web-calendar/raw/master/default_specification.yml

  3. default_specification This file contains the default parameters. They must not be hard-coded in the source code. All of them are there. Query parameters and the specification_url override these values.

Specifikacija u kalendaru

app.py compiles the specification from the given parameters in get_specification(). In the template you can access the specification through the specification variable. The specification is available to JavaScript as the specification variable.

Specifikacija u stranici indeksa

The default specification is available before the calendar is built via JavaScript in the configuration.default_specification variable. There is a getSpecification() function which created the specification from the inputs. Generally, the specification variable should be used.

Arhitektura

Pogledaj sliku arhitekture.

arhitektura

The base of a calendar is the specification, given in the various forms. This specification influences all the steps.

After the specification is compiled, the calendar (ics) files are downloaded from the locations on the Internet.

Događaji se generiraju iz datoteka kalendara.

Zatim se biraju različiti prikazi za prikaz događaja.

Na kraju, to dovodi do promjena HTML-a i stila web stranice kalendara.

U stvarnoj primjeni, ti su koraci pomalo pomiješani i neuređeni ili izostavljeni, ali ovo objašnjava osnovnu, početnu ideju o obradi događaja.