The daisyskin and wikidata sources
Introduction
The daisyskin and wikidata sources are Cocoon (Excalibur/Avalon) sources. Sources in Cocoon are additional schemes you can use in URLs. For example, for the daisyskin source this means you can use URLs of the form "daisyskin:something".
What makes the daisyskin and the wikidata sources special is that they have fallback behaviour. If a file is not found in a first location, it is searched for in another location. It is as if directories are transparently layered on top of each other.
The wikidata source only performs fallback between the wikidata directory and the Daisy Wiki webapp, while the daisyskin sources additionally can fall back to 'base' (parent) skins.
wikidata source
The wikidata source performs fallback between a wikidata directory and the Daisy Wiki webapp. Thus if a file is not found in the wikidata directory, it is taken from the Daisy Wiki webapp.
For example, the publication types for the books are accessed via the wikidata scheme. The Daisy Wiki has some built-in default publication types, and in addition you can define your own ones in the wikidata directory. By using the wikidata scheme, the Daisy Wiki sees both without requiring any special effort.
In some cases, it can be useful to refer directly to the file in the webapp. This can be done using a "(webapp)" hint in the URL:
wikidata:/(webapp)/path/to/file
This would basically be the same as not using the wikidata source at all. The advantage is that the 'wikidata' source knows about the location of the webapp and we keep working through the same abstraction, which at some point might prove useful.
One case where this might be useful is when you have an XSL in the wikidata dir that hides the original XSL in the webapp dir. In that case, you could include the hidden XSL in the hiding XSL like this:
<xsl:include href="wikidata:/(webapp)/path/to/my.xsl"/>
How the location of the actual wikidata directory used by the wikidata scheme is determined, is described in Specifying the wikidata directory location.
daisyskin source
The daisyskin source:
- takes the specified file automatically from the current skin (the 'current skin' changes depending on the current site)
- has fallback behaviour:
- if a file doesn't exist in a skin, it will be searched for in its base skin (recursively, untill a skin without base skin is encountered).
- if a file doesn't exist in the wikidata directory, it will be searched for in the Daisy Wiki webapp.
The fallback first goes from wikidata to webapp, and then to the next base skin, as illustrated by the arrow in the image below.
URL structure
Most of the time one will use relative URLs like for example:
daisyskin:images/foo.png
This will load the file images/foo.png from the directory of the current skin. If this file isn't available in the skin, it will be loaded from this skins' base, or the base skin of that skin, and so on, until it is found (or not found).
Additionally, the URL can specify the name of the skin using the following syntax:
daisyskin:/(myskin)images/foo.png
This can be useful in you have an XSL in a custom skin, in which you want to import the corresponding XSL from the default skin.
And as last option, it is also possible to indicate that the file should always be taken from the webapp, without checking the wikidata directory:
daisyskin:/(myskin)(webapp)images/foo.png
Specifying the base skin
The base skin of a skin is specified by having a file called baseskin.txt in the directory of the skin. This file should simply contain one line (with no blanks before it) with the name of the base skin. The presence of the baseskin.txt file is optional, a skin isn't required to have a base skin. Recursive base skin references are of course not allowed (and are detected).
Note about caching
The content of the baseskin.txt files is cached, this cache is updated asynchronously, with a certain frequency, by default every 10 seconds. So if you change the content of a baseskin.txt file, it can take up to 10 seconds before the change will be noticed. The file-changed-checks are performed by a component called the ActiveMonitor, see the cocoon.xconf to change its execution interval.
Other than this, nothing is cached so file additions or removals are detected immediately.



There are no comments.