Project

General

Profile

1
<h2>Skins, CSS and multilingual support</h2>
2

    
3
<p>
4
It's relatively easy to change the way your application looks, 
5
including the text and images output by the widgets.  
6
This is accomplished using a "skin" concept in addition to 
7
Cascading Stylesheets (CSS).
8
</p>
9

    
10
<h3>The skin directory</h3>
11
<p>
12
The skin directory is a property of the config file and points to a directory 
13
on the web server where images and other items coded into widget stylesheets
14
can be located.
15
The directory can be an absolute path or relative to the base directory
16
of the page being loaded.
17
</p>
18

    
19
<p>
20
Currently only Button images come from the skin dir, but all future Mapbuilder
21
extensions using images will come from this directory.
22
To create the SRC URL for a button image, the button enabled/disabledSrc path in
23
config is appended to the skin directory.
24
This directory is also used as the root for the widget text file (see below).
25
</p>
26

    
27
<p>
28
Unless you want to keep the default look and feel of Mapbuilder, you should 
29
create your own skin directory and set the path to it in the config file.
30
This directory should be outside of the mapbuilder directory so that you can
31
easily upgrade to newer versions of the package by simply replacing it.
32
(This is recommended for your applications as well.)
33
</p>
34

    
35
<h3>Multilingual support</h3>
36
<p>
37
All text that is output by widget stylesheets should be passed in to the 
38
stylesheet as a stylesheet param, and there are two ways to do this 
39
automatically in Mapbuilder.
40
The first way is is to set the text values as a widget property in config, 
41
however this will only support one language.
42
</p>
43

    
44
<p>
45
Multiple languages are supported. The standard widget texts are available in English,
46
French, Dutch and Italian; those reside under the lib/text/ directory.
47
You can also set a &lt;userWidgetTextDir&gt; property on the config model to add
48
or override widget texts.
49
This property is a partial path to a directory containing language dependant texts.
50
The full path to the file is created from the userWidgetTextDir value plus language code
51
value plus the file name widgetText.xml.
52
</p>
53

    
54
<p>
55
The language code is a standard language code values, e.g. "en", "fr", etc., 
56
and can be set as a parameter passed to the page when it loads,
57
or set as a JavaScript "language" variable in the page head.
58
This value can be retrieved at any time through the config.lang property.
59
</p>
60

    
61
<p>
62
The widget text file has a structure very similar to the config file, except
63
that it only contains Widget elements and the text values to be set as
64
parameters for the stylesheet.
65
The property name is the same as the stylesheet parameter name.
66
</p>
67

    
68
<h3>Use of CSS in mapbuilder</h3>
69
<p>
70
CSS can and should be used to modify how your page looks.
71
This is typically done by using the widget ID (or htmlTagId value) from config
72
as a CSS selector.
73
As an example, the complete demo uses this piece of CSS to give the mainMapContainer
74
element an olive 1 pixel border and change the cursor to a crosshair:
75
</p>
76

    
77
<pre>
78
#mainMapContainer {
79
  border: 1px solid olive;
80
  cursor: crosshair;
81
}
82
</pre>
83

    
84
<p>
85
The CSS file is typically stored in the skin directory as well, 
86
but this isn't a requirement.
87
It must be included manually in the page head, that is CSS files are not
88
loaded automatically by Mapbuilder.
89
</p>
90

    
91

    
92

    
93
<p align="right">
94
<a href="?page=config/patterns">previous</a>&nbsp;&nbsp;&nbsp; 
95
<a href="?page=config/listeners">next</a>
96
</p>
(7-7/7)