Skin dependent resources
How to enable/disable resources based on the currently active skin
For the soon-to-be-released Voting machines info site of the CCC I'm using the current trunk of NuPlone for both its public facing pages, as well as for the editors.
NuPlone has a neat new feature called multiresolution layout, which is great, especially for editors. Basically it means, if you have a bigger screen or wider window you get a three column layout, if not, the layout is based on two columns (you can test that feature here at tomster.org).
However, for the CCC site the feature proved to be more confusing than useful for public visitors, so I wanted to make sure that the JS resource, responsible for that feature was only rendered, if the NuPlone skin was used.
The initial idea, was to include an empty multi-resolution.js file with the Wahlcomputer skin but it turns out, it's possible to evaluate the name of the current skin in the conditional expression of a resource. In this case I used the following snippet inside jsregistry.xml:
<javascript cacheable="True"
compression="safe"
cookable="True"
enabled="True"
expression="python:portal.getCurrentSkinName()=='NuPlone'"
id="multi-resolution.js"
inline="False"/>
Instead of the default empty expression I used python:portal.getCurrentSkinName()=='NuPlone' and bingo!
