<div dir="ltr">Amedeo, thanks a lot for sharing this!</div><div class="gmail_extra"><br><div class="gmail_quote">2016-08-02 10:11 GMT+02:00 Amedeo Fadini <span dir="ltr"><<a href="mailto:amefad@gmail.com" target="_blank">amefad@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi everybody,<br>
<br>
maybe all of you already knows how to setup different groups in the<br>
geoexplorer toc (layercontainer) for geonode maps... the default<br>
installations has two groups, "overlay" an "backgrounds".<br>
<br>
As long as the gxp.plugins.LayerTre has a property "groups" that is<br>
default setted to null,<br>
(see the file /var/www/geonode/static/geoexplorer/GeoExplorer.js 80302 )<br>
<br>
I've found this way to overwrite it and set my custom groups:<br>
in the map templates dir I've created different templates<br>
<br>
/usr/local/lib/python2.7/dist-packages/geonode/maps/templates/maps<br>
<br>
map_view.html<br>
map_geoexplorer.js<br>
<br>
(original)<br>
<br>
map_view_company.html<br>
map_geoexplorer_company.js<br>
<br>
(custom)<br>
where map_view_company.html has only the different script line:<br>
<br>
{% include 'maps/map_geoexplorer_company.js' %}<br>
<br>
<br>
and in map_geoexplorer_company.js the code to load custom groups<br>
<br>
<script type="text/javascript"><br>
/* modifica amedeo 27/07/16<br>
* vengono definiti i layergroup per le mappe di tipo "Abaco"<br>
*/<br>
gxp.plugins.LayerTree.prototype.groups = {<br>
<br>
"agen": "Agenzie",<br>
"come":{<br>
title: "Commesse",<br>
exclusive: true<br>
},<br>
"comp": "Competitors",<br>
"mark": "Commerciali",<br>
"default": "Utilità", // title can be<br>
overridden with overlayNodeText<br>
"background": {<br>
title: "Sfondi", // can be overridden with baseNodeText<br>
exclusive: true<br>
}<br>
};<br>
</script><br>
<br>
<br>
Each group is defined in the form "name": "Title" or can have another<br>
property "exclusive": true for radio button group.<br>
<br>
see <a href="http://gxp.opengeo.org/master/doc/lib/plugins/LayerTree.html" rel="noreferrer" target="_blank">http://gxp.opengeo.org/master/doc/lib/plugins/LayerTree.html</a><br>
<br>
Now I'm wondering what's the better way to call differnte templates<br>
based on map name or map id,<br>
I've added a dictionary { "mapid": "templatename"} in<br>
local_settings.py and by now I've customized the<br>
geonode.maps.view.map_view to parse that dictionary, but I'm pretty<br>
sure that the template can be used as an argument of that function so<br>
I can parse the dictionary in <a href="http://geonode.urls.py" rel="noreferrer" target="_blank">geonode.urls.py</a>.<br>
<br>
<br>
Any comments or suggestions are appreciated.<br>
<span class="HOEnZb"><font color="#888888"><br>
Amedeo Fadini<br>
_______________________________________________<br>
geonode-users mailing list<br>
<a href="mailto:geonode-users@lists.osgeo.org">geonode-users@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/geonode-users" rel="noreferrer" target="_blank">http://lists.osgeo.org/mailman/listinfo/geonode-users</a><br>
</font></span></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature" data-smartmail="gmail_signature">Simone </div>
</div>