API¶
Všeobecne platí, že Open Web Calendar je používaný bez obmedzenia. Toto API môžete použiť na prispôsobenie kalendára na letáku.
Táto časť môže byť použitá, ak jeden z nich platí:
- Ste web developer, ktorý chce vložiť Open Web Calendar.
- Chcete využiť plnú flexibilitu, nie len to, čo je vystavené na stránke konfigurácie.
- Chcete používať JavaScript dynamicky generovať dizajn kalendára a možnosti.
- Chcete rozšíriť funkčnosť Open Web Calendar.
- Chcete použiť Open Web Calendar ako proxy požiadať JSON udalosti pre vaše vlastné akcie krmivo.
Endpointy¶
Základné parametre sú rovnaké v týchto bodoch:
/index.html
- upraviť kalendár/about.html
- zobraziť stránku/calendar.html
- zobraziť kalendár/calendar.spec
- stiahnuť špecifikácie/calendar.ics
- prihlásiť sa k súboru ics/calendar.events.json
- FLEXIBLE - dostať udalosti ako JSON Upozorňujeme, že to môžete použiť, ale nemôžete si byť istí, že JSON schema zostáva rovnaký. Ak to chcete, pridajte testy.
Additional parameters are required for /calendar.events.json
:
timezone=UTC
- časové pásmo, ktoré musíte zobraziť udalosti vod=YYYYYY-MM-DD
- začiatok obdobia, v ktorom sa udalosti stávajú (inclusive)to=YYYYY-MM-DD
- koniec obdobia, v ktorom sa udalosti stávajú (exkluzívne)
Parametry¶
Všetky parametre konfigurácie sú dostatočne opísané v [predvolené_specification]. To je odkaz. E.g. Ak nájdete parameter title
v [predvolené_specification], máte niekoľko možností:
Zmena titulu v kalóriu parameter:
/index.html?title=calendar
Zmena titulu v špecifikácie YAML:
title: calendar
Zmena titulu v špecifikácie JSON:
{
"title": "calendar"
}
Dodržiavanie špecifikácie¶
You can change the calendar behavior and looks with parameters. If the same parameter is specified in different places, the earlier place listed below has the highest precedence. These are the places to specify parameters:
Query parameters¶
All parameters to the calendar url are put into the specification. The query parameters have the highest precedence.
Examples:
index.html?language=de
calendar.html?title=CALENDAR
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/open_web_calendar/default_specification.yml
open_web_calendar.app.DEFAULT_SPECIFICATION¶
This is intended for developers and Python-internal.
from open_web_calendar.app import DEFAULT_SPECIFICATION
DEFAULT_SPECIFICATION['title'] = 'calendar'
OWC_SPECIFICATION¶
This is an optional environment variable. Please read more about it in the Server Configuration.
default_specification¶
This file contains the default parameters. They must not be hard-coded in the source code. All parameters are listed and documented there so this file can be used for reference. Do not modify this file, instead use the OWC_SPECIFICATION
environment variable.
Pridávanie parametrov¶
If you add a new parameter as a developer:
- Pridajte parameter s predvolenou hodnotou [predvolené_specification]
- Pridajte implementáciu, v závislosti od jeho použitia v
app.py
alebo šablóny JavaScriptových súborov. Špecifikácia je už k dispozícii vo všetkých z nich použiť. - Add tests in features/configure-the-calendar.feature to check that the calendar responds to the feature.
- Add tests in features/edit-the-calendar.feature to make sure that the parameter can be used when a calendar is edited.
Špecifikácia v kalendári¶
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.
See also:
Špecifikácia v sekcii Index¶
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.
Architektúra¶
Nižšie nájdete obrázok architektúry.
Základ kalendára je špecifikácia, vzhľadom na rôzne formy. Táto špecifikácia ovplyvňuje všetky kroky.
Po zostavení špecifikácie, kalendár (ics) súbory sú stiahnuté z miest na internete.
Z kalendárových súborov sa vygenerujú udalosti.
Potom sa vyberajú rôzne názory na zobrazenie udalostí.
Na konci, tieto vedú k HTML a štýlu zmeny webovej stránky kalendára.
V skutočnej aplikácii sú tieto kroky trochu zmiešané a neobjednané alebo vynechané, ale to vysvetľuje jednoducho základnú, počiatočnú myšlienku za spracovanie udalostí.