Aplikprograma interfaco¶
Ĝenerale, la Malfermita Reta Kalendaro estas uzebla sen restrikto. Vi povas uzi ĉi tiun API por adapti la kalendaron laŭbezone.
Ĉi tiu paragrafo povas esti tial utila, kial:
- Vi estas retprogramisto, kiu volas enmeti la Malfermitan Retan Kalendaron.
- Vi volas ekspluati la plenan flekseblecon, ne nur tion, kio estas havebla sur la agorda paĝo.
- Vi volas uzi JavaScript por dinamike generi la kalendarajn dezajnon kaj opciojn.
- Vi volas pliigi la funkciojn de la Malfermita Reta Kalendaro.
- Vi volas uzi la Malfermitan Retan Kalendaron kiel perilon por peti JSON-eventojn por via propra eventolisto.
Finpunktoj¶
La bazaj parametroj estas samaj ĉe la jenaj finpunktoj:
/index.html
– modifi la kalendaron/about.html
– vidi la paĝon de metainformoj/calendar.html
– vidi la kalendaron/calendar.spec
– elŝuti la specifon/calendar.ics
– aboni la ics-dosieron/calendar.events.json
- FLEKSEBLA - ricevi la eventojn kiel JSON. Bonvolu noti, ke vi ja povas uzi tion, sed vi ne povas certigi, ke la JSON-skemo restas sama. Se vi deziras tion, aldonu testojn.
Additional parameters are required for /calendar.events.json
:
timezone=UTC
– la horzono, laŭ kiu la eventoj estas montrotajfrom=JJJJ-MM-TT
– la komenco de la periodo de eventoj (inkluziva)to=JJJJ-MM-TT
– la fino de la periodo de eventoj (ekskluziva)
Parametroj¶
Ĉiuj agordaj parametroj estas priskribitaj sufiĉe en la default_specification. Tiu estas la manlibro. Ekz. se vi trovas la parametron title
en la default_specification, vi havas plurajn opciojn:
Ŝanĝi la titolon per parametro en la informpeto:
/index.html?title=calendar
Ŝanĝi la titolon per YAML-specifo:
title: calendar
Ŝanĝi la titolon per JSON-specifo:
{
"title": "calendar"
}
Kompili la specifon¶
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.
Aldoni parametrojn¶
If you add a new parameter as a developer:
- Metu la parametron kun implicita valoro al la default_specification
- Aldonu kodon, depende de ĝia uzo en la dosiero
app.py
aŭ en la ŝablonoj de la JavaScript-dosieroj. La specifo jam estas havebla en ĉiuj el ili por uzado. - 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.
Specifo en la kalendaro¶
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.
Vidu ankaŭ:
Specifo en la indeksa paĝo¶
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.
Arĥitekturo¶
Jen diagramo de la arĥitekturo.
La bazo de kalendaro estas la specifo, donita en diversaj formoj. Ĉi tiu specifo influas ĉiujn paŝojn.
Post kiam la specifo estas kompilita, la kalendaraj (.ics-) dosieroj estas elŝutitaj de la lokoj sur Interreto.
El la kalendaraj dosieroj, la eventoj estas generitaj.
Poste, diversaj vidoj estas elektitaj por elmontri la eventojn.
Fine, tio kaŭzas HTML-ajn kaj stilajn ŝanĝojn de la kalendara retpaĝo.
En la reala programo, tiuj paŝoj estas iom intermiksitaj kaj malordigitaj aŭ pretersaltitaj, sed tio klarigas simple la bazan principon pri la traktado de la eventoj.