From c6a3d987043838c29f76b67af865a2373e103bed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20Ca=C3=B1as=20Vargas?= Date: Wed, 18 Dec 2019 00:48:55 +0100 Subject: [PATCH] Version19.95 --- css/{swad19.90.1.css => swad19.95.css} | 7 +++++ swad_centre.c | 40 ++++++++++++++++++++++++++ swad_changelog.h | 6 ++-- 3 files changed, 50 insertions(+), 3 deletions(-) rename css/{swad19.90.1.css => swad19.95.css} (99%) diff --git a/css/swad19.90.1.css b/css/swad19.95.css similarity index 99% rename from css/swad19.90.1.css rename to css/swad19.95.css index d100a6a4b..5665b36a9 100644 --- a/css/swad19.90.1.css +++ b/css/swad19.95.css @@ -2008,6 +2008,13 @@ a:hover img.CENTRE_PHOTO_SHOW border:solid 1px #EEE; box-shadow:1px 1px 6px #999; } + +#centre_mapid + { + width:480px; + height:360px; + margin:0 auto; + } /**************** Attribution (author and license) of images *****************/ #AttributionArea diff --git a/swad_centre.c b/swad_centre.c index 319c08c43..459636617 100644 --- a/swad_centre.c +++ b/swad_centre.c @@ -447,6 +447,46 @@ static void Ctr_ConfigTitle (bool PutLink) static void Ctr_ConfigMap (void) { + /***** Leaflet CSS *****/ + HTM_Txt (""); + + /***** Leaflet script *****/ + /* Put this AFTER Leaflet's CSS */ + HTM_Txt (""); + + /***** Container for the map *****/ + HTM_DIV_Begin ("id=\"centre_mapid\""); + HTM_DIV_End (); + + /***** Script to draw the map *****/ + HTM_SCRIPT_Begin (NULL,NULL); + + /* Let's create a map of the center of London with pretty Mapbox Streets tiles */ + HTM_Txt ("\tvar mymap = L.map('centre_mapid').setView([37.19704, -3.62451], 18);"); + + /* Next we'll add a tile layer to add to our map, + in this case it's a Mapbox Streets tile layer. + Creating a tile layer usually involves + setting the URL template for the tile images, + the attribution text and the maximum zoom level of the layer. + In this example we'll use the mapbox/streets-v11 tiles + from Mapbox's Static Tiles API + (in order to use tiles from Mapbox, + you must also request an access token).*/ + HTM_Txt ("L.tileLayer('https://api.mapbox.com/styles/v1/{id}/tiles/{z}/{x}/{y}?access_token={accessToken}', {" + "attribution: 'Map data © OpenStreetMap contributors, CC-BY-SA, Imagery © Mapbox'," + "maxZoom: 20," + "id: 'mapbox/streets-v11'," + "accessToken: 'pk.eyJ1IjoiYWNhbmFzIiwiYSI6ImNrNGFoNXFxOTAzdHozcnA4d3Y0M3BwOGkifQ.uSg754Lv2iZEJg0W2pjiOQ'" + "}).addTo(mymap);"); + + HTM_SCRIPT_End (); } /*****************************************************************************/ diff --git a/swad_changelog.h b/swad_changelog.h index b9048540f..06799dcd6 100644 --- a/swad_changelog.h +++ b/swad_changelog.h @@ -490,14 +490,14 @@ enscript -2 --landscape --color --file-align=2 --highlight --line-numbers -o - * En OpenSWAD: ps2pdf source.ps destination.pdf */ -#define Log_PLATFORM_VERSION "SWAD 19.94.3 (2019-12-17)" -#define CSS_FILE "swad19.90.1.css" +#define Log_PLATFORM_VERSION "SWAD 19.95 (2019-12-17)" +#define CSS_FILE "swad19.95.css" #define JS_FILE "swad19.91.1.js" /* // TODO: Hacer un nuevo rol en los TFG: tutor externo (profesor de áreas no vinculadas con el centro, profesionales de empresas, etc.) // TODO: Impedir la creación y edición de proyectos si no son editables. -// Version 19.95: Dec 17, 2019 Trying Leaflet (open-source JavaScript library for mobile-friendly interactive maps). (? lines) + Version 19.95: Dec 17, 2019 Trying Leaflet (open-source JavaScript library for mobile-friendly interactive maps). (249323 lines) Version 19.94.3: Dec 17, 2019 Code refactoring in centre information. (249282 lines) Version 19.94.2: Dec 17, 2019 Code refactoring in centre information. (249178 lines) Version 19.94.1: Dec 17, 2019 Fixed bug in listing of degrees. (249168 lines)