Browse Source

Special maps for Crozet

poi-dev
Léo Serre 11 months ago
parent
commit
08f5410448
4 changed files with 35 additions and 39 deletions
  1. +7
    -21
      controllers/d.poi.php
  2. +6
    -2
      views/d.poi.edit.html
  3. +11
    -8
      views/js/d.map.js
  4. +11
    -8
      views/js/d.poi_map.js

+ 7
- 21
controllers/d.poi.php View File

@ -7,31 +7,17 @@ $head['css'] = "d.index.css;d.poi.css";
$poi = new Kabano\Poi();
// In case we are in the list of articles, we set url to switch with according parameters
// if (!isset($controller->splitted_url[1]) OR $controller->splitted_url[1]=="" OR is_numeric($controller->splitted_url[1])) {
// $head['title'] = "Blog";
// // Get the correct page number
// if (!isset($controller->splitted_url[1]) OR $controller->splitted_url[1]=="") {
// $page = 0;
// } else {
// $page = $controller->splitted_url[1] - 1;
// }
// $controller->splitted_url[1] = "list";
// $list = "html";
// $articles_per_pages = 5;
// }
switch ($controller->splitted_url[1]) {
case "new":
if($user->rankIsHigher("registered")) {
if(isset($_POST['submit'])) {
$blogArticle->content = $_POST['content'];
$blogArticle->locale = $_POST['locale'];
$blogArticle->name = $_POST['name'];
$blogArticle->is_commentable = isset($_POST['is_commentable'])?'t':'f';
$blogArticle->author = $user->id;
$poi->name = $_POST['name'];
$poi->locale = $_POST['locale'];
$poi->poi_type = $_POST['poi_type'];
$poi->lat = $_POST['lat'];
$poi->lon = $_POST['lon'];
$poi->alt = $_POST['alt'];
$poi->author = $user->id;
if(!$blogArticle->checkPermalink($_POST['permalink'],1)) {
$blogArticle->permalink = $_POST['permalink'];
$blogArticle->insert();


+ 6
- 2
views/d.poi.edit.html View File

@ -12,8 +12,12 @@
<div id="sticky">
<section>
<i id="slide-icon" class="fas fa-chevron-up"></i>
<form class="form" action="<?=$config['rel_root_folder']?>wiki/<?=$poi->permalink?>/edit" method="post">
<h1 class="flex_line">
<? if(isset($new) AND $new==1) { ?>
<form class="form" action="<?=$config['rel_root_folder']?>poi/new" method="post">
<? }
else { ?>
<form class="form" action="<?=$config['rel_root_folder']?>poi/<?=$poi->permalink?>/edit" method="post">
<? } ?> <h1 class="flex_line">
<input type="text" value="<?=$poi->name?>" name="name" id="name" placeholder="Nom de l'hébergement">
<select name="locale" id="locale">
<? foreach($locales->objs as $locale) { ?>


+ 11
- 8
views/js/d.map.js View File

@ -2,22 +2,25 @@ var mymap;
$( document ).ready(function() {
// Differents layers for the map
var osmfr = L.tileLayer('//{s}.tile.openstreetmap.fr/osmfr/{z}/{x}/{y}.png', {tms: true, maxZoom: 20, attribution: 'Maps © <a href="http://www.openstreetmap.fr">OpenSreetMap France</a>, Data © <a href="http://www.openstreetmap.org/copyright">OpenStreetMap contributors</a>'});
var wikimedia = L.tileLayer('//maps.wikimedia.org/osm-intl/{z}/{x}/{y}.png', {tms: true, maxZoom: 18, attribution: 'Maps © <a href="http://wikimedia.org">Wikimedia</a>, Data © <a href="http://www.openstreetmap.org/copyright">OpenStreetMap contributors</a>'});
var crozet = L.tileLayer('/_maps/sat_cro/{z}/{x}/{y}.png', {tms: true, maxZoom: 17, attribution: 'For dev purpose only'});
/* var osmfr = L.tileLayer('//{s}.tile.openstreetmap.fr/osmfr/{z}/{x}/{y}.png', {tms: true, maxZoom: 20, attribution: 'Maps © <a href="http://www.openstreetmap.fr">OpenSreetMap France</a>, Data © <a href="http://www.openstreetmap.org/copyright">OpenStreetMap contributors</a>'});
var wikimedia = L.tileLayer('//maps.wikimedia.org/osm-intl/{z}/{x}/{y}.png', {tms: true, maxZoom: 18, attribution: 'Maps © <a href="http://wikimedia.org">Wikimedia</a>, Data © <a href="http://www.openstreetmap.org/copyright">OpenStreetMap contributors</a>'});*/
var sat_cro = L.tileLayer('/_maps/sat_cro/{z}/{x}/{y}.png', {tms: true, maxZoom: 17, attribution: 'For dev purpose only'});
var osm_cro = L.tileLayer('/_maps/osm_cro/{z}/{x}/{y}.png', {tms: true, maxZoom: 17, attribution: 'For dev purpose only'});
var ign_cro = L.tileLayer('/_maps/ign_cro/{z}/{x}/{y}.jpg.tile', {tms: false, maxZoom: 13, attribution: 'For dev purpose only'});
// Base layers
var baseLayers = {
"OSM France": osmfr,
"OSM Wikimedia": wikimedia,
"Crozet": crozet,
"Crozet IGN": ign_cro,
"Crozet satellite": sat_cro,
"Crozet OSM": osm_cro,
};
mymap = L.map('mapid', {
zoomControl: false,
layers: [crozet],
layers: [sat_cro],
maxBounds: [[-46.32,51.60],[-46.50,51.90]]
}).setView([-46.407, 51.766], 13);
$("#map-credits").html(crozet.getAttribution());
$("#map-credits").html(sat_cro.getAttribution());
L.control.scale({
position: "bottomleft",


+ 11
- 8
views/js/d.poi_map.js View File

@ -3,22 +3,25 @@ var poi_layer;
$( document ).ready(function() {
// Differents layers for the map
var osmfr = L.tileLayer('//{s}.tile.openstreetmap.fr/osmfr/{z}/{x}/{y}.png', {tms: true, maxZoom: 20, attribution: 'Maps © <a href="http://www.openstreetmap.fr">OpenSreetMap France</a>, Data © <a href="http://www.openstreetmap.org/copyright">OpenStreetMap contributors</a>'});
var wikimedia = L.tileLayer('//maps.wikimedia.org/osm-intl/{z}/{x}/{y}.png', {tms: true, maxZoom: 18, attribution: 'Maps © <a href="http://wikimedia.org">Wikimedia</a>, Data © <a href="http://www.openstreetmap.org/copyright">OpenStreetMap contributors</a>'});
var crozet = L.tileLayer('/_maps/sat_cro/{z}/{x}/{y}.png', {tms: true, maxZoom: 17, attribution: 'For dev purpose only'});
/* var osmfr = L.tileLayer('//{s}.tile.openstreetmap.fr/osmfr/{z}/{x}/{y}.png', {tms: true, maxZoom: 20, attribution: 'Maps © <a href="http://www.openstreetmap.fr">OpenSreetMap France</a>, Data © <a href="http://www.openstreetmap.org/copyright">OpenStreetMap contributors</a>'});
var wikimedia = L.tileLayer('//maps.wikimedia.org/osm-intl/{z}/{x}/{y}.png', {tms: true, maxZoom: 18, attribution: 'Maps © <a href="http://wikimedia.org">Wikimedia</a>, Data © <a href="http://www.openstreetmap.org/copyright">OpenStreetMap contributors</a>'});*/
var sat_cro = L.tileLayer('/_maps/sat_cro/{z}/{x}/{y}.png', {tms: true, maxZoom: 17, attribution: 'For dev purpose only'});
var osm_cro = L.tileLayer('/_maps/osm_cro/{z}/{x}/{y}.png', {tms: true, maxZoom: 17, attribution: 'For dev purpose only'});
var ign_cro = L.tileLayer('/_maps/ign_cro/{z}/{x}/{y}.jpg.tile', {tms: false, maxZoom: 13, attribution: 'For dev purpose only'});
// Base layers
var baseLayers = {
"OSM France": osmfr,
"OSM Wikimedia": wikimedia,
"Crozet": crozet,
"Crozet IGN": ign_cro,
"Crozet satellite": sat_cro,
"Crozet OSM": osm_cro,
};
mymap = L.map('mapid', {
zoomControl: false,
layers: [crozet],
layers: [sat_cro],
maxBounds: [[-46.32,51.60],[-46.50,51.90]]
}).setView([-46.407, 51.766], 13);
$("#map-credits").html(crozet.getAttribution());
$("#map-credits").html(sat_cro.getAttribution());
L.control.scale({
position: "bottomleft",


Loading…
Cancel
Save