Subversion Repositories eFlore/Applications.cel

Rev

Rev 479 | Rev 491 | 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 markerClusterer = null;
                        var map = null;
                        var infoBulle = new google.maps.InfoWindow();
                        google.maps.event.addListener(infoBulle, 'domready', function() {
                                if ($("#observations table").get() != 'undefined') {
                                        $("#observations table").tablesorter();
                                }
                        });
                        var pointImageUrl = 'http://chart.apis.google.com/chart?cht=mm&chs=24x32&chco=FFFFFF,008CFF,000000&ext=.png';
                        var carteCentre = new google.maps.LatLng(46.4, 3.10);
                        var carteOptions = {
                                zoom: 6,
                                center: carteCentre,
                                mapTypeId: google.maps.MapTypeId.ROADMAP
                        };
                        var ctaLayer = null;

                        function refreshMap() {
                                if (markerClusterer) {
                                        markerClusterer.clearMarkers();
                                }

                                var points = [];
                                var pointImage = new google.maps.MarkerImage(pointImageUrl, new google.maps.Size(24, 32));
                                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 point = new google.maps.Marker({
                                                position: maLatLng,
                                                map: map,
                                                icon: pointImage,
                                                stationId: obs.points[i].id
                                        });

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

                                markerClusterer = new MarkerClusterer(map, points);
                        }

                        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=<?=$num_taxon?>'+
                                        '&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 filtrerParTaxon(nt) {
                                var url = '<?=$url_cel_carto?>/carte-defaut-json/<?=$utilisateur?>/<?=$projet?>/<?=$dept?>/'+nt+'?formatRetour=jsonp&callback=?';
                                $.getJSON(url, function (observations) {
                                        obs = observations;
                                        alert(obs.nombre);
                                        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="panneau-lateral">
                        <div id="pl-entete">
                                <div id="pl-ouverture">Panneau >></div>
                                <div id="pl-fermeture"><< Fermer [x]</div>
                        </div>
                        <div id="pl-corps">
                                <ul>
                                <? foreach ($taxons as $taxon) : ?>
                                        <li>
                                                <a href="#" onclick="filtrerParTaxon(<?=$taxon['nt']?>);">
                                                        <?=$taxon['nom']?> 
                                                        <span class="famille"><?=$taxon['famille']?></span>
                                                </a>
                                        </li>
                                <? endforeach; ?>
                                </ul>
                        </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>