First, the disclaimer stuff: I am not a PHP / MapScript guru and learned much of the skills used in developing this Widget by reviewing and understanding code written by DM Solutions. DM Solutions developed Chameleon as a interface to MapServer. DJAJSLegend Widget is provided “as is” and I offer no warranties or guarantees that will work in your environment yada yada yada. The code was developed and tested on IE 6, IIS 5.x running on both Win 2000 and XP machines.
Now on to the nitty-gritty. The purpose of this Widget is to allow a user to create a tree-like legend. It is flexible and can be modified using a variety of different parameters in the Widget call. A sample call is here:
TREESOURCE – optional – if specified, you can provide the virtual reference to the file
tree.js. If not specified, the default location is used.
MENUSRC – optional – if specified, you can provide the virtual reference to the file
zenondemo.js This file contains an array that is used to construct the tree and parent/child nodes. Please read the notes in the file for details on features that can be added / removed.
TREECSS – optoinal – allows you to specify the location of the style sheet file. The CS Stylesheet used to change the look of the tree.
OPENNODES – optoional (recommended) – user can specify which parent nodes are to be open by default. You must use the  brackets. If none, do not incude the option.
AUTOSUBMIT – optional – set this value to 1 of you want to map to turn on/off layers when any layer checkbox is clicked. default is 0.
LEGENDSTYLE – user can change the graphic icons used in the display of the legend. There are 3 choices. If you want to add more, see tree.js.
For those that are optional, if you want to use the defaults, do not even include the item in the widget call
For a basic Widget call, you would use the following:
Feel free to download the source and try it out yourself. I ask only that you participate in the same public license practises that others do by keeping the original copyright information intact. If you mofify, fix, update, change any part of this code, please pass it back to me. 🙂 .
:: Chameleon 1.1
:: MapServer 4.0/4.1
NS 6+ *
IE 5.x+ *
(* limited testing)
Rate This Post: