| 197 | | * if use with "legendonly" plugin, TOC behavior become very simple (but with less functionalities !) for GIS beginner |
| 198 | | |
| 199 | | === Activation === |
| 200 | | * add the string "themesandviews" to the plugins list in the pmapper config file. |
| 201 | | * add parameters to your pmapper ini config file: |
| 202 | | * ''tavFile'': XML file path and name describing your themes and views |
| 203 | | * ''tavThemesBoxType'': how to insert themesbox |
| 204 | | * ''tavThemesBoxContainer'': container for themesbox |
| 205 | | * ''tavThemesKeepSelected'': when a theme is selected in the selectbox, should the box keep it selected ? |
| 206 | | * ''tavViewsBoxType'': see tavThemesBoxType |
| 207 | | * ''tavViewsBoxContainer'': see tavThemesBoxContainer |
| 208 | | * ''tavViewsKeepSelected'': see tavThemesKeepSelected |
| 209 | | * ''tavSetDefault'': indicate if a theme or a view will be automaticaly applied |
| 210 | | * ''tavDefaultCodeValue'': code of the theme or view auto-loaded |
| 211 | | * configure your themes and views (either with [wiki:AvailablePlugins#ThemesAndViewsAdmin Themes and views Administration] plugin, either directly in a XML file) |
| 212 | | * if you want, you add new tools in your button bar. To do that, modify your "$buttons" variable in "php_config.php" (in your config directory) like this: |
| 213 | | {{{"themesbox" => array(_p("Apply theme"), "0")}}} for themes |
| 214 | | {{{"viewsbox" => array(_p("Apply vue"), "0")}}} for views |
| 215 | | |
| 216 | | === Config.ini example === |
| 217 | | {{{ |
| 218 | | ;============================================================== |
| 219 | | ; Plugin ThemesAndViews options : |
| 220 | | ;-------------------------------------------------------------- |
| 221 | | ; tavThemesType and tavViewsType : |
| 222 | | ; - 0 = disabled (default value), but can be use with buttons tools |
| 223 | | ; - 1 = div fixed in the window with manual insert of the div |
| 224 | | ; - 2 = div fixed in the window but automaticaly inserted in the div |
| 225 | | ; as first element specified by tavThemesBoxContainer and tavViewsBoxContainer |
| 226 | | ; - 3 = div fixed in the window but automaticaly inserted in the div |
| 227 | | ; as last element specified by tavThemesBoxContainer and tavViewsBoxContainer |
| 228 | | ;-------------------------------------------------------------- |
| 229 | | ; tavThemesBoxContainer and tavViewsBoxContainer : |
| 230 | | ; id of the div containing the boxes |
| 231 | | ; (default is "mapNorth") |
| 232 | | ;-------------------------------------------------------------- |
| 233 | | ; tavThemesKeepSelected and tavViewsKeepSelected: |
| 234 | | ; indicate if the selected element keep selected, or if the box is re-initialized |
| 235 | | ; (default value is false) |
| 236 | | ; Indeed, this parameters is only interesting with the "legendonly" plugin. |
| 237 | | ;-------------------------------------------------------------- |
| 238 | | ; tavSetDefault : |
| 239 | | ; if specified, then just after loading, the chosen theme or view (specified |
| 240 | | ; by "tavDefaultCodeValue" parameter) is applied. |
| 241 | | ; Possible values : "theme", "view", "none" |
| 242 | | ; (default value is "none") |
| 243 | | ;-------------------------------------------------------------- |
| 244 | | ; tavDefaultCodeValue |
| 245 | | ; Name of the theme or vue to use by default. |
| 246 | | ; If not specified, then the first one in the TAV file will be use. |
| 247 | | ;-------------------------------------------------------------- |
| 248 | | ; tavFile : |
| 249 | | ; path to the file (default is "themesandviews.xml" in the config directiry) |
| 250 | | ;-------------------------------------------------------------- |
| 251 | | tavThemesBoxType = 2 |
| 252 | | tavThemesBoxContainer = toc |
| 253 | | ;tavThemesKeepSelected = false |
| 254 | | ;tavViewsBoxType = 2 |
| 255 | | ;tavViewsBoxContainer = mapSouth |
| 256 | | ;tavViewsKeepSelected = false |
| 257 | | ;tavSetDefault = view |
| 258 | | ;tavDefaultCodeValue = France |
| 259 | | ;tavFile = xxxx/themesandviews.xml |
| 260 | | }}} |
| | 198 | * if you don't show TOC but only legend, the layer management behavior become very simple (but with less functionalities !) for GIS beginner |
| | 199 | |
| | 200 | Complementary plugin : ThemesAndViewsAdmin plugin (maybe soon available...) |
| | 201 | |
| | 202 | === How to use === |
| | 203 | |
| | 204 | ==== Configuration ==== |
| | 205 | |
| | 206 | Enable the plugin by adding a line in config_XXXXX.xml file: |
| | 207 | {{{ |
| | 208 | <pmapper> |
| | 209 | <ini> |
| | 210 | <pmapper> |
| | 211 | .... |
| | 212 | <plugins>themesandviews</plugins> |
| | 213 | .... |
| | 214 | </pmapper> |
| | 215 | </ini> |
| | 216 | </pmapper> |
| | 217 | }}} |
| | 218 | |
| | 219 | Set plugin configuration by adding a line in config_XXXXX.xml file: |
| | 220 | {{{ |
| | 221 | <pmapper> |
| | 222 | <ini> |
| | 223 | .... |
| | 224 | <pluginsConfig> |
| | 225 | .... |
| | 226 | <themesandviews> |
| | 227 | <file>common/themesAndViews.xml</file> |
| | 228 | <defaultType>none</defaultType> |
| | 229 | <defaultCodeValue></defaultCodeValue> |
| | 230 | <themes> |
| | 231 | <insertBoxType>first</insertBoxType> |
| | 232 | <boxContainer>.pm-header</boxContainer> |
| | 233 | <initAfterTOC>0</initAfterTOC> |
| | 234 | <selBoxStr><div id='selThemeBox' class='tavSelectBox' /></selBoxStr> |
| | 235 | <keepSelected>0</keepSelected> |
| | 236 | </themes> |
| | 237 | <views> |
| | 238 | <insertBoxType>last</insertBoxType> |
| | 239 | <boxContainer>.pm-header</boxContainer> |
| | 240 | <initAfterTOC>0</initAfterTOC> |
| | 241 | <selBoxStr><div id='selViewBox' class='tavSelectBox' /></selBoxStr> |
| | 242 | <keepSelected>0</keepSelected> |
| | 243 | </views> |
| | 244 | </themesandviews> |
| | 245 | .... |
| | 246 | </pluginsConfig> |
| | 247 | </ini> |
| | 248 | </pmapper> |
| | 249 | }}} |
| | 250 | |
| | 251 | Common parameters for themes and views: |
| | 252 | - file: file that will define the themes and views |
| | 253 | - defaultType: what to automatically apply at startup. Possible values: none, theme, view |
| | 254 | - defaultCodeValue: empty or name of a theme or view to load at startup (depends on defaultType) |
| | 255 | |
| | 256 | Parameters that can be different for themes and views: |
| | 257 | - insertBoxType: user (user defined in layout), first (= at first position in the specifyed container), last (= at the end of the specified container) |
| | 258 | - boxContainer: jQuery selector for box container |
| | 259 | - initAfterTOC: 0=before or 1=after |
| | 260 | - selBoxStr: HTML code for container |
| | 261 | - keepSelected: 0 (the box will not keep selected value) or 1 (keep selected value) |
| | 262 | |
| | 263 | (optional) Add the themesandviews tool buttons to the interface in /config/XXXXX/js_config.php file: |
| | 264 | {{{ |
| | 265 | PM.buttonsDefault = { |
| | 266 | ..... |
| | 267 | buttons: [ |
| | 268 | ..... |
| | 269 | {tool:'themesbox', name:'themesbox'}, |
| | 270 | {tool:'viewsbox', name:'viewsbox'}, |
| | 271 | ..... |
| | 272 | ] |
| | 273 | } |
| | 274 | }}} |
| | 275 | |
| | 276 | ==== Integration ==== |
| | 277 | |
| | 278 | Add default translation from ''plugins/themesandviews /install/language_en-part.php'' to ''incphp/locale/language_en.php''. You can add translations for other language (French is provided) by doing the same. |
| | 279 | |
| | 280 | (optional) Add the appropriate icons for the buttons in images/buttons/default (or the corresponding theme directory) |
| | 281 | |
| | 282 | |
| | 283 | === Themes and views file content === |
| | 284 | Example provided in ''plugins/themesandviews/install/themesAndViews.xml'' |
| | 285 | |
| | 286 | {{{ |
| | 287 | <?xml version="1.0" standalone="yes"?> |
| | 288 | <themesorviews> |
| | 289 | <themeorview> |
| | 290 | <type>Theme</type> |
| | 291 | <name>theme1</name> |
| | 292 | <description>Vector data</description> |
| | 293 | <layers> |
| | 294 | <layer> |
| | 295 | <name>countries</name> |
| | 296 | <opacity>95</opacity> |
| | 297 | </layer> |
| | 298 | <layer> |
| | 299 | <name>cities10000eu</name> |
| | 300 | <opacity>map</opacity> |
| | 301 | </layer> |
| | 302 | <layer> |
| | 303 | <name>rivers</name> |
| | 304 | <opacity>map</opacity> |
| | 305 | </layer> |
| | 306 | </layers> |
| | 307 | <extent/> |
| | 308 | </themeorview> |
| | 309 | <themeorview> |
| | 310 | <type>Theme</type> |
| | 311 | <name>theme2</name> |
| | 312 | <description>All</description> |
| | 313 | <layers> |
| | 314 | <layer> |
| | 315 | <name>dem</name> |
| | 316 | <opacity>map</opacity> |
| | 317 | </layer> |
| | 318 | <layer> |
| | 319 | <name>jpl_wms_global_mosaic</name> |
| | 320 | <opacity>map</opacity> |
| | 321 | </layer> |
| | 322 | <layer> |
| | 323 | <name>countries</name> |
| | 324 | <opacity>75</opacity> |
| | 325 | </layer> |
| | 326 | <layer> |
| | 327 | <name>cities10000eu</name> |
| | 328 | <opacity>map</opacity> |
| | 329 | </layer> |
| | 330 | <layer> |
| | 331 | <name>rivers</name> |
| | 332 | <opacity>map</opacity> |
| | 333 | </layer> |
| | 334 | </layers> |
| | 335 | <extent/> |
| | 336 | </themeorview> |
| | 337 | </themesorviews> |
| | 338 | }}} |
| | 339 | |