Subversion Repositories eFlore/Applications.cel

Rev

Rev 503 | Rev 518 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
        <head>
                <title>Observations publiques du CEL - Tela Botanica</title>
                
                <meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
                <meta http-equiv="Content-style-type" content="text/css" />
                <meta http-equiv="Content-script-type" content="text/javascript" />
                <meta http-equiv="Content-language" content="fr" />
                
                <meta name="revisit-after" content="15 days" />
        <meta name="robots" content="index,follow" />
        <meta name="author" content="Delphine CAUQUIL, Jean-Pascal MILCENT" />
        <meta name="keywords" content="Tela Botanica, cartographie, CEL" />
        <meta name="description" content="Widget de cartographie des observations publiques de plantes saisies dans le Carnet en Ligne (CEL)" />

                <!-- Spécial mobile -->
                <meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
                                                
                <!-- Favicones -->
                <link rel="icon" type="image/png" href="http://www.tela-botanica.org/sites/commun/generique/images/favicones/tela_botanica.png" />
                <link rel="shortcut icon" type="image/x-icon" href="http://www.tela-botanica.org/sites/commun/generique/images/favicones/tela_botanica.ico" />
                
                <!-- Javascript : bibliothèques -->
                <script type="text/javascript" src="http://maps.google.com/maps/api/js?v=3.2&amp;sensor=false"></script>
                <script type="text/javascript" src="<?=$url_base?>modules/carto/squelettes/markerclusterer_compiled.js"></script>
                <script type="text/javascript" src="http://www.tela-botanica.org/commun/jquery/<?=$jquery_version?>/jquery-<?=$jquery_version?>.min.js"></script>
                <script type="text/javascript" src="http://www.tela-botanica.org/commun/jquery/tablesorter/2.0.5/jquery.tablesorter.min.js"></script>
                
                <!-- Javascript : données -->
                <script src="<?=$url_json?>" type="text/javascript"></script>
                
                <!-- Javascript : appli carto -->
                <script type="text/javascript">
                //<![CDATA[
                        var pointImageUrl = 'http://chart.apis.google.com/chart?cht=mm&chs=24x32&chco=FFFFFF,008CFF,000000&ext=.png';
                        var pointsOrigine = null;
                        var boundsOrigine = null;
                        var markerClusterer = null;
                        var map = null;
                        var nt = '<?=$num_taxon?>';
                        var infoBulle = new google.maps.InfoWindow();
                        google.maps.event.addListener(infoBulle, 'domready', function() {
                                if ($("#observations table").get() != 'undefined') {
                                        $("#observations table").tablesorter();
                                }
                        });
                        var carteCentre = new google.maps.LatLng(46.4, 3.10);
                        var carteOptions = {
                                zoom: 6,
                                mapTypeId: google.maps.MapTypeId.ROADMAP
                        };
                        var ctaLayer = null;
                        
                        function refreshMap() {
                                var points = [];
                                var bounds = new google.maps.LatLngBounds();
                                for (var i = 0; i < obs.nombre; ++i) {
                                        var maLatLng = new google.maps.LatLng(obs.points[i].coord_x, obs.points[i].coord_y);
                                        var pointImage = new google.maps.MarkerImage(pointImageUrl, new google.maps.Size(24, 32));
                                        var point = new google.maps.Marker({
                                                position: maLatLng,
                                                map: map,
                                                icon: pointImage,
                                                stationId: obs.points[i].id
                                        });

                                        bounds.extend(maLatLng);
                                        
                                        google.maps.event.addListener(point, 'click', function() {
                                                afficherMsgChargement();
                                                infoBulle.open(map, this);
                                                chargerFormatObs(this.stationId, '*');
                                        });
                                        
                                        points.push(point);
                                }

                                if (pointsOrigine == null && boundsOrigine == null) {
                                        pointsOrigine = points;
                                        boundsOrigine = bounds;
                                }
                                
                                executerMarkerClusterer(points, bounds);
                        }

                        function executerMarkerClusterer(points, bounds) {
                                if (markerClusterer) {
                                        markerClusterer.clearMarkers();
                                }
                                markerClusterer = new MarkerClusterer(map, points);
                                map.fitBounds(bounds);
                        }

                        function afficherMsgChargement() {
                                var chargement = document.getElementById('chargement').cloneNode(true);
                                chargement.setAttribute('id', 'chargement-copie');
                                infoBulle.setContent(chargement);
                        }

                        function chargerFormatObs(stationId, format) {
                                var url = '<?=$url_base?>carto?carte=observations'+
                                        '&utilisateur=<?=$utilisateur?>'+
                                        '&projet=<?=$projet?>'+
                                        '&num_taxon='+nt+
                                        '&dept=<?=$dept?>'+
                                        '&format='+format+'&station='+stationId;
                                $.get(url, function(observations){
                                        infoBulle.setContent(observations);
                                });
                        }

                        function arreter(event) {
                                if (event.stopPropagation) {
                                        event.stopPropagation();
                                }
                                return false;
                        }
                        
                        function afficher() {
                                document.getElementById('panneau-lateral').style.display = 'block';
                                document.getElementById('pl-ouverture').style.display = 'none';
                                google.maps.event.trigger(map, 'resize');
                        };
                        
                        function cacher() {
                                document.getElementById('panneau-lateral').style.display = 'none';
                                document.getElementById('pl-ouverture').style.display = 'block';
                                google.maps.event.trigger(map, 'resize');
                        };

                        function ouvrirPopUp(url, nom) {
                                window.open(url, nom, 'directories=no, location=no, menubar=no, scrollbars=yes, status=no, toolbar=no, width=650,height=600');
                        };
                        
                        function filtrerParTaxon(ntAFiltrer) {
                                infoBulle.close();
                                $('#taxon-'+nt).removeClass('taxon-actif');
                                if (nt == ntAFiltrer) {
                                        nt = '*';
                                        executerMarkerClusterer(pointsOrigine, boundsOrigine);
                                } else {
                                        var url = '<?=$url_cel_carto?>/carte-defaut-json/<?=$utilisateur?>/<?=$projet?>/<?=$dept?>/'+ntAFiltrer+'?formatRetour=jsonp&callback=?';
                                        $.getJSON(url, function (observations) {
                                                obs = observations;
                                                nt = ntAFiltrer;
                                                $('#taxon-'+nt).addClass('taxon-actif');
                                                refreshMap();
                                        });
                                }
                        };
                        
                        function initialize() {
                                map = new google.maps.Map(document.getElementById('carte'), carteOptions);

                                // Ajout des limites communales sur la carte
                                <? if (isset($url_limites_communales)) : ?>
                                        <? foreach ($url_limites_communales as $url) : ?>
                                                ctaLayer = new google.maps.KmlLayer('<?=$url?>');
                                                ctaLayer.setMap(map);
                                        <? endforeach; ?>
                                <? endif; ?>
                                
                                // Create the DIV to hold the control and call the HomeControl()
                                // constructor passing in this DIV.
                                
                                var panneauDiv = document.getElementById('panneau-lateral');
                                panneauDiv.index = 0;
                                map.controls[google.maps.ControlPosition.TOP_LEFT].push(panneauDiv);

                                var ouverturePanneauDiv = document.getElementById('pl-ouverture');
                                ouverturePanneauDiv.index = 0;
                                map.controls[google.maps.ControlPosition.TOP_LEFT].push(ouverturePanneauDiv);

                                
                                var ouvertureDiv = document.getElementById('pl-ouverture');
                                google.maps.event.addDomListener(ouvertureDiv, 'click', afficher);

                                var fermetureDiv = document.getElementById('pl-fermeture');
                                google.maps.event.addDomListener(fermetureDiv, 'click', cacher);
                                
                                cacher();
                                refreshMap();
                        }
                //]]>
                </script>
                
                <!-- CSS -->
                <link href="<?=$url_base?>modules/carto/squelettes/css/carto.css" rel="stylesheet" type="text/css" media="screen" />
        </head>

        <body onload="initialize()">
                <div id="zone-titre">
                        <h1 id="carte-titre">
                                Observations issues des membres de <a href="http://www.tela-botanica.org/" onclick="window.open(this.href); arreter(event); return false;">Tela Botanica</a>
                        </h1>
                        <div id="zone-info">
                                <a href="<?=$url_base?>carto?carte=avertissement" onClick="ouvrirPopUp('<?=$url_base?>carto?carte=avertissement', 'Avertissement'); arreter(event); return false;">
                                        <img src="<?=$url_base?>modules/carto/squelettes/images/information.png" 
                                                alt="Avertissements" title="Avertissements &amp; informations" />
                                </a>
                        </div>
                </div>
                <div id="panneau-lateral">
                        <div id="pl-ouverture" title="Ouvrir le panneau latéral"><span>Panneau >></span></div>
                        <div id="pl-fermeture" title="Fermer le panneau latéral"><span><< Fermer [x]</span></div>
                        <div id="pl-entete">
                                <h2>Filtre par plante</h2>      
                                <p>
                                        Cliquez sur un nom de plante pour filtrer les observations sur la carte.<br /> 
                                        Pour revenir à l'état initial, cliquez à nouveau sur le nom sélectionné.
                                </p>
                        </div>
                        <div id="pl-corps" onMouseOver="map.setOptions({'scrollwheel':false});" onMouseOut="map.setOptions({'scrollwheel':true});">
                                <ol id="taxons">
                                <? foreach ($taxons as $taxon) : ?>
                                        <li id="taxon-<?=$taxon['nt']?>">
                                                <a href="#" onclick="filtrerParTaxon(<?=$taxon['nt']?>);" title="<?=$taxon['famille']?>">
                                                        <?=$taxon['nom']?> 
                                                </a>
                                        </li>
                                <? endforeach; ?>
                                </ol>
                        </div>
                </div>
                <div id="carte"></div>
                
                <!-- Blocs chargés à la demande : par défaut avec un style display à none -->
                <div id="chargement">
                        <img src="<?=$url_base?>modules/carto/squelettes/images/chargement.gif" alt="Chargement en cours..." />
                        <p>Chargement des observations en cours...</p>
                </div>
        </body>
</html>