Commit 7f52d142 authored by Clouard Regis's avatar Clouard Regis
Browse files

Fix bug on remove course.

parent f2efe6fc
......@@ -122,8 +122,8 @@ function previewMap(data, divMap, divLeaflet, map, overlay, img) {
error.style.display = "block";
img.width = 0;
img.height = 0;
overlay.setUrl("/empty");
img.src = "/empty";
overlay.setUrl("/");
img.src = "";
}
});
......@@ -133,9 +133,9 @@ function previewMap(data, divMap, divLeaflet, map, overlay, img) {
let kml = lines.join('\n');
let parser = new DOMParser();
let kmlDoc = parser.parseFromString(kml, "text/xml");
divLeaflet.style.height = Math.floor(window.innerHeight * 0.75) + "px";
divMap.appendChild(divLeaflet);
let corner = calculateCorner(kmlDoc);
divLeaflet.style.height = Math.floor(window.innerHeight * 0.75) + "px";
overlay.reposition(L.latLng(corner[0]), L.latLng(corner[1]), L.latLng(corner[3]));
map.fitBounds([corner[0], corner[2]]);
// Add recenter button
......@@ -146,7 +146,6 @@ function previewMap(data, divMap, divLeaflet, map, overlay, img) {
map.fitBounds([corner[0], corner[2]]);
}, 'Zoom To Home');
recenterButton.addTo(map);
} catch (e) {
let error = document.createElement("p");
error.setAttribute("class", "alert alert-danger");
......
......@@ -482,8 +482,6 @@ L.GPX = L.FeatureGroup.extend({
} else if (wptIconUrls && wptIconUrls['']) {
symIcon = new L.GPXTrackIcon({iconUrl: wptIconUrls['']});
} else {
console.log('No icon or icon URL configured for symbol type "' + symKey
+ '", and no fallback configured; ignoring waypoint.');
continue;
}
......
......@@ -95,7 +95,7 @@ class CourseController extends AbstractController
);
}
}
$importTab = 0;
$openImportTab = 0;
$success = "";
$xml = $course->getXml();
$simplexml = simplexml_load_string($xml);
......@@ -107,7 +107,7 @@ class CourseController extends AbstractController
$gpxForm = $this->createForm(GpxImportType::class, $gpxImport);
$gpxForm->handleRequest($request);
if ($gpxForm->isSubmitted() && $gpxForm->isValid()) {
$importTab = 1;
$openImportTab = 1;
if ($gpxImport->checkGpx()) {
$courseRepository = $this->getDoctrine()->getRepository(Course::class);
if ($gpxImport->loadGpx()) {
......@@ -133,7 +133,7 @@ class CourseController extends AbstractController
'route_track' => $this->generateUrl('course_track', ['id' => $id]),
'form' => $gpxForm->createView(),
'error' => $gpxImport->getError(),
'importTab' => $importTab,
'openImportTab' => $openImportTab,
'success' => $success,
]
);
......
......@@ -64,11 +64,11 @@
const tableEnable = false;
let gpxDictionary = {};
const buttonDictionary = {};
let divLeaflet, map, overlay;
let divLeaflet, overlay;
let timeSheetData = [];
let displayedFormat = 0;
function showMap() {
function showMap(map) {
let xhr = new XMLHttpRequest();
xhr.open("GET", "{{ route_map }}");
xhr.onload = function () {
......@@ -89,10 +89,10 @@
window.addEventListener("load", function () {
divLeaflet = document.createElement("div");
map = generateMap(divLeaflet);
const map = generateMap(divLeaflet);
overlay = L.imageOverlay.rotated("/none", L.latLng([-5, -5]), L.latLng([5, 5]), L.latLng([-5, 5]));
overlay.addTo(map);
showMap();
showMap(map);
showTimeSheet();
let xhr = new XMLHttpRequest();
xhr.open("GET", "{{ route_track }}");
......@@ -255,19 +255,19 @@
<script>
function openTab(tabTitle, tabId) {
let i, tabContent, tabLinks;
tabContent = document.getElementsByClassName("tab-content");
let i;
let tabContent = document.getElementsByClassName("tab-content");
for (i = 0; i < tabContent.length; i++) {
tabContent[i].style.display = "none";
}
tabLinks = document.getElementsByClassName("tab-links");
let tabLinks = document.getElementsByClassName("tab-links");
for (i = 0; i < tabLinks.length; i++) {
tabLinks[i].className = tabLinks[i].className.replace(" active", "");
}
document.getElementById(tabId).style.display = "block";
document.getElementById(tabTitle).className += " active";
}
{% if importTab==1 %}
{% if openImportTab==1 %}
document.getElementById("tab3").click();
{% else %}
document.getElementById("tab1").click();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment