9 changed files with 497 additions and 25 deletions
-
164controllers/d.poi.php
-
1includes/routes.php
-
2views/css/d.index.css
-
38views/css/d.map.css
-
207views/css/d.poi.css
-
20views/d.community.html
-
34views/d.poi.edit.html
-
4views/js/d.map.js
-
52views/js/d.poi_map.js
@ -0,0 +1,164 @@ |
|||
<? |
|||
|
|||
require_once($config['models_folder']."d.poi.php"); |
|||
require_once($config['models_folder']."d.users.php"); |
|||
|
|||
$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; |
|||
if(!$blogArticle->checkPermalink($_POST['permalink'],1)) { |
|||
$blogArticle->permalink = $_POST['permalink']; |
|||
$blogArticle->insert(); |
|||
header('Location: '.$config['rel_root_folder']."blog/".$blogArticle->permalink); |
|||
} |
|||
else { |
|||
$head['title'] = $blogArticle->name; |
|||
$error = "permalink"; |
|||
} |
|||
} |
|||
else { |
|||
$head['title'] = "Nouvel hébergement"; |
|||
} |
|||
|
|||
$locales = new Kabano\Locales(); |
|||
$locales->getAll(); |
|||
|
|||
$head['third'] = "leaflet/leaflet.js;leaflet-fullscreen/Leaflet.fullscreen.min.js;leaflet-easybutton/easy-button.js"; |
|||
$head['css'] .= ";../third/leaflet/leaflet.css;../third/leaflet-fullscreen/leaflet.fullscreen.css;../third/leaflet-easybutton/easy-button.css"; |
|||
$head['js'] = "d.poi_map.js"; |
|||
|
|||
$new = 1; |
|||
include ($config['views_folder']."d.poi.edit.html"); |
|||
break; |
|||
} |
|||
else { |
|||
$notfound = 1; |
|||
} |
|||
default: |
|||
// // If the page exists
|
|||
// if ($blogArticle->checkPermalink($controller->splitted_url[1],$user->rankIsHigher("premium"))) {
|
|||
// if (isset($controller->splitted_url[2]) && $controller->splitted_url[2] == "delete" && $user->rankIsHigher("moderator")) {
|
|||
// $blogArticle->delete();
|
|||
// header('Location: '.$config['rel_root_folder']."blog/".$blogArticle->permalink);
|
|||
// }
|
|||
// else if (isset($controller->splitted_url[2]) && $controller->splitted_url[2] == "restore" && $user->rankIsHigher("moderator")) {
|
|||
// $blogArticle->restore();
|
|||
// header('Location: '.$config['rel_root_folder']."blog/".$blogArticle->permalink);
|
|||
// }
|
|||
// else if (isset($controller->splitted_url[2]) && $controller->splitted_url[2] == "edit" && $user->rankIsHigher("moderator")) {
|
|||
// 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;
|
|||
// $blogArticle->update();
|
|||
// header('Location: '.$config['rel_root_folder']."blog/".$blogArticle->permalink);
|
|||
// }
|
|||
// else {
|
|||
// $locales = new Kabano\Locales();
|
|||
// $locales->getAll();
|
|||
|
|||
// $head['title'] = $blogArticle->name;
|
|||
// include ($config['views_folder']."d.blog.edit.html");
|
|||
// }
|
|||
// }
|
|||
// else {
|
|||
// // Manage history of an article
|
|||
// if($user->rankIsHigher("premium")) {
|
|||
// $blogHistory = new Kabano\BlogArticles();
|
|||
// $blogHistory->getHistory($controller->splitted_url[1]);
|
|||
// }
|
|||
// if (isset($controller->splitted_url[2]) && is_numeric($controller->splitted_url[2]))
|
|||
// $blogArticle->checkPermalink($controller->splitted_url[1],$user->rankIsHigher("premium"),$controller->splitted_url[2]);
|
|||
|
|||
// // Manage comment creation
|
|||
// if (isset($controller->splitted_url[2]) && $controller->splitted_url[2]=="new_comment") {
|
|||
// if (isset($_POST['submit']) && $user->rankIsHigher("registered")) {
|
|||
// $blogComment = new Kabano\BlogComment();
|
|||
// $blogComment->locale = $user->locale;
|
|||
// $blogComment->author = $user->id;
|
|||
// $blogComment->content = $blogArticle->content_id;
|
|||
// $blogComment->comment = $_POST['comment'];
|
|||
// $blogComment->insert();
|
|||
// }
|
|||
// }
|
|||
|
|||
// // Manage comment deletion
|
|||
// if (isset($controller->splitted_url[2]) && $controller->splitted_url[2]=="delete_comment") {
|
|||
// if (isset($controller->splitted_url[3]) && is_numeric($controller->splitted_url[3])) {
|
|||
// $blogComment = new Kabano\BlogComment();
|
|||
// if($blogComment->checkId($controller->splitted_url[3]))
|
|||
// if ($user->rankIsHigher("moderator") || $user->id == $blogComment->author)
|
|||
// $blogComment->delete();
|
|||
// }
|
|||
// }
|
|||
|
|||
// // Manage comment restoration
|
|||
// if (isset($controller->splitted_url[2]) && $controller->splitted_url[2]=="restore_comment") {
|
|||
// if (isset($controller->splitted_url[3]) && is_numeric($controller->splitted_url[3])) {
|
|||
// $blogComment = new Kabano\BlogComment();
|
|||
// if($blogComment->checkId($controller->splitted_url[3]))
|
|||
// if ($user->rankIsHigher("moderator") || $user->id == $blogComment->author)
|
|||
// $blogComment->restore();
|
|||
// }
|
|||
// }
|
|||
|
|||
// $blogArticle->md2html();
|
|||
|
|||
// // Manage comments
|
|||
// if ($blogArticle->is_commentable == "t") {
|
|||
// $blogArticles_comments = new Kabano\BlogComments();
|
|||
// $blogArticles_comments->listComments($blogArticle->content_id, ($user->rankIsHigher("premium")));
|
|||
|
|||
// $i = 0;
|
|||
// foreach ($blogArticles_comments->objs as $comment) {
|
|||
// $comment->md2html();
|
|||
// $comment->author_obj = new Kabano\User();
|
|||
// $comment->author_obj->checkId($comment->author);
|
|||
// }
|
|||
// }
|
|||
|
|||
|
|||
// $tempUser = new Kabano\User();
|
|||
// $tempUser->checkId($blogArticle->author);
|
|||
// $blogArticle->author_name = $tempUser->name;
|
|||
// unset($tempUser);
|
|||
|
|||
// $head['title'] = $blogArticle->name;
|
|||
// include ($config['views_folder']."d.blog.view.html");
|
|||
// }
|
|||
// }
|
|||
// else {
|
|||
// $notfound = 1;
|
|||
// }
|
|||
// break;
|
|||
} |
|||
|
|||
?>
|
@ -0,0 +1,207 @@ |
|||
/*********************************/ |
|||
/** Common **/ |
|||
/*********************************/ |
|||
|
|||
html, body { |
|||
height: 100%; |
|||
} |
|||
|
|||
#sticky { |
|||
position: relative; |
|||
min-height: 0; |
|||
top: 65%; |
|||
z-index: 10; |
|||
} |
|||
|
|||
@keyframes fadeinfadeout { |
|||
0% {color: #444;} |
|||
50% {color: #999;} |
|||
100% {color: #444;} |
|||
} |
|||
#slide-icon { |
|||
position: absolute; |
|||
left: 400px; |
|||
top: -35px; |
|||
color: #000; |
|||
font-size: 60px; |
|||
color: #555; |
|||
animation-name: fadeinfadeout; |
|||
animation-duration: 2s; |
|||
animation-iteration-count: infinite; |
|||
} |
|||
|
|||
#mapid { |
|||
position: fixed; |
|||
height: 100%; |
|||
width: 100%; |
|||
top: 0; |
|||
} |
|||
|
|||
/*********************************/ |
|||
/** Editor page **/ |
|||
/*********************************/ |
|||
|
|||
form.form input, form.form textarea, #locale { |
|||
background: #ddd; |
|||
border-bottom: 2px solid #ccc; |
|||
display: block; |
|||
padding: 10px; |
|||
} |
|||
|
|||
form.form textarea { |
|||
font-size: 14px; |
|||
margin: 10px 0 10px 0px; |
|||
width: calc(100% - 20px); |
|||
} |
|||
form.form input { |
|||
width: 58%; |
|||
margin: 10px 0 10px 0px; |
|||
font-size: 18px; |
|||
} |
|||
#locale { |
|||
width: 38%; |
|||
float: right; |
|||
font-size: 17px; |
|||
} |
|||
|
|||
form.form input[type=submit] { |
|||
width: auto; |
|||
margin: auto; |
|||
border-bottom: 2px solid blue; |
|||
} |
|||
|
|||
|
|||
/***************************************** |
|||
Controls of the map |
|||
*****************************************/ |
|||
|
|||
/* General */ |
|||
|
|||
.leaflet-control-container { |
|||
position: absolute !important; |
|||
width: 850px !important; |
|||
height: 100%; |
|||
left: calc(50% - 425px) !important; |
|||
font-family: "Fira Sans", "Open Sans",Helvetica,Arial,sans-serif !important; |
|||
} |
|||
.leaflet-fullscreen-on .leaflet-control-container { |
|||
position: absolute !important; |
|||
width: 100% !important; |
|||
left: 0 !important; |
|||
} |
|||
|
|||
.leaflet-bottom.leaflet-left { |
|||
bottom: 35% !important; |
|||
margin-bottom: -50px !important; |
|||
} |
|||
.leaflet-fullscreen-on .leaflet-bottom.leaflet-left { |
|||
margin-bottom: 15px !important; |
|||
margin-left: 15px !important; |
|||
bottom: 0 !important; |
|||
} |
|||
|
|||
.leaflet-bottom.leaflet-right { |
|||
bottom: 35% !important; |
|||
margin-bottom: -50px !important; |
|||
} |
|||
.leaflet-fullscreen-on .leaflet-bottom.leaflet-right { |
|||
margin-bottom: 15px !important; |
|||
margin-right: 15px !important; |
|||
bottom: 0 !important; |
|||
} |
|||
|
|||
.leaflet-control { |
|||
clear: none !important; |
|||
padding: 0 !important; |
|||
border-radius: 0 !important; |
|||
box-shadow: none !important; |
|||
color: #c1c1c1 !important; |
|||
} |
|||
.leaflet-right .leaflet-control { |
|||
margin: 0 0 0 15px !important; |
|||
} |
|||
.leaflet-left .leaflet-control { |
|||
margin: 0 15px 0 0 !important; |
|||
} |
|||
|
|||
.leaflet-control a, .leaflet-control button { |
|||
display: inline-block !important; |
|||
float: none !important; |
|||
border: none !important; |
|||
background-color: #212121 !important; |
|||
border-radius: 0 !important; |
|||
color: #c1c1c1 !important; |
|||
border-right: 1px #3e3e3e solid !important; |
|||
} |
|||
.leaflet-control a:last-child, .leaflet-control button:last-child { |
|||
border-right: none !important; |
|||
} |
|||
|
|||
/* Zoom */ |
|||
|
|||
.leaflet-control-zoom-in, .leaflet-control-zoom-out { |
|||
font-size: 10px !important; |
|||
} |
|||
.leaflet-disabled { |
|||
background-color: rgba(33, 33, 33, 0.8) !important; |
|||
opacity: 0.8 !important; |
|||
} |
|||
|
|||
/* Fullscreen */ |
|||
|
|||
.leaflet-control-fullscreen a { |
|||
background: #212121 !important; |
|||
} |
|||
.leaflet-control-fullscreen a:before { |
|||
content: "\f065"; |
|||
font-family: "Font Awesome 5 Free"; |
|||
font-weight: 900; |
|||
background: none !important; |
|||
} |
|||
.leaflet-fullscreen-on .leaflet-control-fullscreen a:before { |
|||
content: "\f066"; |
|||
font-family: "Font Awesome 5 Free"; |
|||
font-weight: 900; |
|||
} |
|||
|
|||
/* Baselayers */ |
|||
|
|||
.leaflet-control-layers a { |
|||
background: #212121 !important; |
|||
width: 26px !important; |
|||
height: 26px !important; |
|||
line-height: 26px !important; |
|||
text-align: center !important; |
|||
border-right: none !important; |
|||
} |
|||
.leaflet-control-layers a:before { |
|||
content: "\f5fd"; |
|||
font-family: "Font Awesome 5 Free"; |
|||
font-weight: 900; |
|||
background: none !important; |
|||
} |
|||
.leaflet-control-layers-expanded a { |
|||
display: none !important; |
|||
} |
|||
.leaflet-control-layers-list { |
|||
padding: 3px 8px !important; |
|||
color: white !important; |
|||
background: #212121 !important; |
|||
} |
|||
|
|||
/* Scale */ |
|||
|
|||
.leaflet-control-scale-line { |
|||
height: 30px !important; |
|||
top: 2px !important; |
|||
position: relative !important; |
|||
background: #212121 !important; |
|||
color: #c1c1c1 !important; |
|||
text-align: center !important; |
|||
border: none !important; |
|||
font-size: 12px !important; |
|||
line-height: 30px !important; |
|||
} |
|||
.leaflet-control-scale { |
|||
opacity: 0.8 !important; |
|||
} |
@ -0,0 +1,34 @@ |
|||
<!DOCTYPE html> |
|||
<html lang="fr"> |
|||
|
|||
<? include('blocks/d.head.html'); ?> |
|||
|
|||
<body> |
|||
|
|||
<? include('blocks/d.nav.html'); ?> |
|||
|
|||
<div id="mapid"></div> |
|||
|
|||
<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> |
|||
<select name="locale" id="locale"> |
|||
<? foreach($locales->objs as $locale) { ?> |
|||
<option <?=$poi->locale==$locale->name?'selected':''?> value="<?=$locale->name?>"><?=$locale->display_name?></option> |
|||
<? } ?> |
|||
</select> |
|||
<input type="text" value="<?=$poi->name?>" name="name" id="name" placeholder="Titre"> |
|||
</h1> |
|||
|
|||
<textarea rows="30" name="content" id="content" placeholder="Contenu de la page"><?=$poi->content?></textarea> |
|||
|
|||
<input name="submit" id="submit" type="submit" value="Envoyer"> |
|||
</form> |
|||
</section> |
|||
|
|||
<? include('blocks/d.footer.html'); ?> |
|||
</div> |
|||
</body> |
|||
</html> |
@ -0,0 +1,52 @@ |
|||
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: 18, attribution: 'For dev purpose only'}); |
|||
|
|||
// Base layers
|
|||
var baseLayers = { |
|||
"OSM France": osmfr, |
|||
"OSM Wikimedia": wikimedia, |
|||
"Crozet": crozet, |
|||
}; |
|||
|
|||
mymap = L.map('mapid', { |
|||
zoomControl: false, |
|||
layers: [crozet], |
|||
}).setView([-46.407, 51.766], 13); |
|||
$("#map-credits").html(crozet.getAttribution()); |
|||
|
|||
L.control.scale({ |
|||
position: "bottomleft", |
|||
imperial: false |
|||
}).addTo(mymap); |
|||
|
|||
L.control.fullscreen({ |
|||
position: "bottomleft" |
|||
}).addTo(mymap); |
|||
|
|||
L.control.zoom({ |
|||
zoomOutText: "<i class=\"fa fa-minus\" aria-hidden=\"true\"></i>", |
|||
zoomInText: "<i class=\"fa fa-plus\" aria-hidden=\"true\"></i>", |
|||
position: "bottomleft" |
|||
}).addTo(mymap); |
|||
|
|||
L.control.layers(baseLayers,null,{ |
|||
position: "bottomright" |
|||
}).addTo(mymap); |
|||
|
|||
mymap.removeControl(mymap.attributionControl); |
|||
|
|||
$(".close-link").click(function() { |
|||
$("footer").show(); |
|||
$("#footer-credits").hide(); |
|||
$("#footer-legend").hide(); |
|||
}); |
|||
|
|||
mymap.on('baselayerchange', function(e) { |
|||
$("#map-credits").html(e.layer.getAttribution()); |
|||
}); |
|||
}); |
Write
Preview
Loading…
Cancel
Save
Reference in new issue