The UI (User Interface) Service allows your Turbine application to be skinned using simple properties files that are located in the WEBAPP/resources/ui/skins/ directory hierarchy.
The service and its associated pull tool provide the following enhancements over the old UIManager pull tool (which has been deprecated as od Turbine 2.3.3):
Skin properties are defined in WEBAPP/resources/ui/skins/, the following might exist in a file WEBAPP/resources/ui/skins/default/skin.props:
and the following might exist in a file WEBAPP/resources/ui/skins/custom_skin_1/skin.props:
Retrieving a value from a skin is as simple as (where user.getSkin() returns the name of the currently selected skin):
or in a template (the current skin is retrieved from user.Temp):
Images, css and javascript files are stored under the skin directory also and can be accessed thus:
You can retrieve an array containing the names of the available skins thus:
or in a template:
You can combine skinning and localization thus:
Please refer to the JavaDocs for the org.apache.turbine.services.ui package for further details.
You can configure the UI Service using the following properties:
Property | Default | Function |
---|---|---|
tool.ui.dir.skin | /ui/skins | The name of the skin directory that is to be used for the web application. |
tool.ui.skin | default | The name of the default skin that is to be used for the web application. |
tool.ui.dir.image | /images | The name of the image directory inside the skin that is to be used for the web application. |
tool.ui.css | skin.css | The name of the css file that is to be used for the web application. |
tool.ui.want.relative | false | You can configure the UI Service to return relative links for the web
application by setting this to true . |
Note that the name of the file within the skin directory that actually contains the name/value pairs for the skin is fixed at skin.props.