From 660488e5b6997b1920366dd778710defde3872f5 Mon Sep 17 00:00:00 2001 From: leosw Date: Sat, 16 May 2020 20:42:19 +0400 Subject: [PATCH] First draft of poi edit page --- controllers/d.poi.php | 164 ++++++++++++++++++++++++++++++++ includes/routes.php | 1 + views/css/d.index.css | 2 + views/css/d.map.css | 38 ++++---- views/css/d.poi.css | 207 +++++++++++++++++++++++++++++++++++++++++ views/d.community.html | 20 +++- views/d.poi.edit.html | 34 +++++++ views/js/d.map.js | 4 +- views/js/d.poi_map.js | 52 +++++++++++ 9 files changed, 497 insertions(+), 25 deletions(-) create mode 100755 controllers/d.poi.php create mode 100755 views/css/d.poi.css create mode 100755 views/d.poi.edit.html create mode 100755 views/js/d.poi_map.js diff --git a/controllers/d.poi.php b/controllers/d.poi.php new file mode 100755 index 0000000..9637960 --- /dev/null +++ b/controllers/d.poi.php @@ -0,0 +1,164 @@ +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; +} + +?> \ No newline at end of file diff --git a/includes/routes.php b/includes/routes.php index 812eca3..65a325b 100755 --- a/includes/routes.php +++ b/includes/routes.php @@ -38,6 +38,7 @@ switch ($controller->splitted_url[0]) case "wiki" : case "blog" : case "map" : + case "poi" : case "admin" : $controller->name=$controller->splitted_url[0]; $view->name=""; diff --git a/views/css/d.index.css b/views/css/d.index.css index 3735e79..a8ce0b1 100755 --- a/views/css/d.index.css +++ b/views/css/d.index.css @@ -279,6 +279,8 @@ footer { color: #c1c1c1; text-align: left; } +footer { +} footer #footernav { float: right; diff --git a/views/css/d.map.css b/views/css/d.map.css index 661e869..af019e8 100755 --- a/views/css/d.map.css +++ b/views/css/d.map.css @@ -33,7 +33,7 @@ footer { } .leaflet-bottom.leaflet-left { - margin-bottom: 60px !important; + margin-bottom: 60px; } .leaflet-fullscreen-on .leaflet-bottom.leaflet-left { margin-bottom: 15px !important; @@ -41,7 +41,7 @@ footer { } .leaflet-bottom.leaflet-right { - margin-bottom: 60px !important; + margin-bottom: 60px; } .leaflet-fullscreen-on .leaflet-bottom.leaflet-right { margin-bottom: 15px !important; @@ -127,6 +127,23 @@ footer { 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; +} + /* Credit / Legend */ .leaflet-control button { @@ -162,21 +179,4 @@ footer { .leaflet-fullscreen-on .easy-button-container { display: none; -} - -/* 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; } \ No newline at end of file diff --git a/views/css/d.poi.css b/views/css/d.poi.css new file mode 100755 index 0000000..b6687c0 --- /dev/null +++ b/views/css/d.poi.css @@ -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; +} \ No newline at end of file diff --git a/views/d.community.html b/views/d.community.html index 2788bae..972e78e 100755 --- a/views/d.community.html +++ b/views/d.community.html @@ -13,25 +13,34 @@
+ rankIsHigher("registered")) { ?> + +
+

Ajouter un hébergement de montagne

+
+
+

Vous devez être connecté pour pouvoir ajouter un hébergement. Ça nous permet de laisser les robots à la porte.

+
+
-
+

Ajouter un commentaire sur un hébergement

-
+

Rendez-vous sur la page hébergement où vous souhaitez laisser un commentaire, puis ajoutez un commentaire en bas de page.

-
+

Faire une demande de travaux

-
+

Cette fonctionnalité n'est pas encore disponible, mais n'hésitez pas à laisser un commentaire pour faire savoir le besoin d'entretien.

@@ -44,6 +53,9 @@ $( "#js_open_1" ).click(function() { }); $( "#js_open_2" ).click(function() { $( "#js_openned_2" ).show(400); +}); +$( "#js_open_3" ).click(function() { + $( "#js_openned_3" ).show(400); }); diff --git a/views/d.poi.edit.html b/views/d.poi.edit.html new file mode 100755 index 0000000..86ba1fe --- /dev/null +++ b/views/d.poi.edit.html @@ -0,0 +1,34 @@ + + + + + + + + + +
+ +
+
+ +
+

+ + +

+ + + + +
+
+ + +
+ + \ No newline at end of file diff --git a/views/js/d.map.js b/views/js/d.map.js index 9c96ae3..eee4988 100755 --- a/views/js/d.map.js +++ b/views/js/d.map.js @@ -4,7 +4,7 @@ $( 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 © OpenSreetMap France, Data © OpenStreetMap contributors'}); var wikimedia = L.tileLayer('//maps.wikimedia.org/osm-intl/{z}/{x}/{y}.png', {tms: true, maxZoom: 18, attribution: 'Maps © Wikimedia, Data © OpenStreetMap contributors'}); - var crozet = L.tileLayer('/_maps/osm_cro/{z}/{x}/{y}.png', {tms: true, maxZoom: 18, attribution: 'For dev purpose only'}); + var crozet = L.tileLayer('/_maps/sat_cro/{z}/{x}/{y}.png', {tms: true, maxZoom: 18, attribution: 'For dev purpose only'}); // Base layers var baseLayers = { @@ -16,7 +16,7 @@ $( document ).ready(function() { mymap = L.map('mapid', { zoomControl: false, layers: [crozet], - }).setView([-46.407, 51.766], 12); + }).setView([-46.407, 51.766], 13); $("#map-credits").html(crozet.getAttribution()); L.control.scale({ diff --git a/views/js/d.poi_map.js b/views/js/d.poi_map.js new file mode 100755 index 0000000..dd05747 --- /dev/null +++ b/views/js/d.poi_map.js @@ -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 © OpenSreetMap France, Data © OpenStreetMap contributors'}); + var wikimedia = L.tileLayer('//maps.wikimedia.org/osm-intl/{z}/{x}/{y}.png', {tms: true, maxZoom: 18, attribution: 'Maps © Wikimedia, Data © OpenStreetMap contributors'}); + 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: "", + zoomInText: "", + 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()); + }); +});