Started user control

This commit is contained in:
TheGreyDiamond
2021-05-25 23:50:46 +02:00
parent 1fc78a3b44
commit 6e3104eef3
175 changed files with 121801 additions and 214 deletions

View File

@@ -13,10 +13,6 @@
-->
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- FONT
-->
<link href="//fonts.googleapis.com/css?family=Raleway:400,300,600" rel="stylesheet" type="text/css">
<!-- CSS
-->
<link rel="stylesheet" href="css/normalize.css">

View File

@@ -0,0 +1,60 @@
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Basic Page Needs
-->
<meta charset="utf-8">
<title><%= it.siteTitel %></title>
<meta name="description" content="<%= it.desc %>">
<meta name="author" content="<%= it.author %>">
<!-- Mobile Specific Metas
-->
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- CSS
-->
<link rel="stylesheet" href="css/normalize.css">
<link rel="stylesheet" href="css/barebones.css">
<!-- Favicon
-->
<link rel="icon" type="image/png" href="images/favicon-16.png">
<script async defer src="/js/site.js"></script>
<script src="https://kit.fontawesome.com/<%= it.fontawesomeKey %>.js" crossorigin="anonymous"></script>
</head>
<body>
<!-- Primary Page Layout
-->
<div class="grid-container thirds" style="margin-top: 5%;">
<div></div>
<div>
<h1><i style="color: red;" class="fas fa-exclamation-triangle"></i></h1>
</div>
</div>
</div>
<div class="grid-container thirds" style="margin-top: 5%;">
<div></div>
<div>
<h1>Oh no!</h1>
<%= it.displayText %>
<br>
<a href="/"><button class="button-primary">
Return to the startpage
</button>
</a>
</p>
</div>
</div>
</div>
<!-- End Document
-->
</body>
</html>

View File

@@ -15,7 +15,7 @@
<!-- FONT
-->
<link href="//fonts.googleapis.com/css?family=Raleway:400,300,600" rel="stylesheet" type="text/css">
<!--<link href="//fonts.googleapis.com/css?family=Raleway:400,300,600" rel="stylesheet" type="text/css">-->
<!-- CSS
-->

101
templates/login.html Normal file
View File

@@ -0,0 +1,101 @@
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Basic Page Needs
-->
<meta charset="utf-8">
<title><%= it.siteTitel %></title>
<meta name="description" content="<%= it.desc %>">
<meta name="author" content="<%= it.author %>">
<!-- Mobile Specific Metas
-->
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- CSS
-->
<link rel="stylesheet" type="text/css" href="vendor/bootstrap/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="vendor/animate/animate.css">
<link rel="stylesheet" type="text/css" href="vendor/css-hamburgers/hamburgers.min.css">
<link rel="stylesheet" type="text/css" href="vendor/animsition/css/animsition.min.css">
<link rel="stylesheet" type="text/css" href="vendor/select2/select2.min.css">
<link rel="stylesheet" type="text/css" href="css/util.css">
<link rel="stylesheet" type="text/css" href="css/main.css">
<!-- Favicon
-->
<link rel="icon" type="image/png" href="images/favicon-16.png">
<script src="https://kit.fontawesome.com/<%= it.fontawesomeKey %>.js" crossorigin="anonymous"></script>
</head>
<body>
<div class="limiter">
<div class="container-login100">
<div class="wrap-login100">
<div>
<a href="/"><i class="fas fa-arrow-left"></i> Back</a>
</div>
<form class="login100-form validate-form" method="post">
<span class="login100-form-title p-b-26">
Welcome
</span>
<span class="login100-form-title p-b-48">
<i class="zmdi zmdi-font"></i>
</span>
<div class="wrap-input100 validate-input" data-validate = "Valid email is: john@test.com">
<input class="input100" type="text" name="email">
<span class="focus-input100" data-placeholder="Email"></span>
</div>
<div class="wrap-input100 validate-input" data-validate="Enter password">
<span class="btn-show-pass">
<i class="zmdi zmdi-eye"></i>
</span>
<input class="input100" type="password" name="pass">
<span class="focus-input100" data-placeholder="Password"></span>
</div>
<div class="container-login100-form-btn">
<div class="wrap-login100-form-btn">
<div class="login100-form-bgbtn"></div>
<button class="login100-form-btn">
Login
</button>
</div>
</div>
<div class="text-center p-t-115">
<span class="txt1">
Dont have an account?
</span>
<a class="txt2" href="#">
Sign Up
</a>
</div>
</form>
</div>
</div>
</div>
<div id="dropDownSelect1"></div>
<script src="vendor/jquery/jquery-3.2.1.min.js"></script>
<script src="vendor/animsition/js/animsition.min.js"></script>
<script src="vendor/bootstrap/js/popper.js"></script>
<script src="vendor/bootstrap/js/bootstrap.min.js"></script>
<script src="vendor/select2/select2.min.js"></script>
<script src="vendor/daterangepicker/moment.min.js"></script>
<script src="js/main.js"></script>
<!-- End Document
-->
</body>
</html>

View File

@@ -12,14 +12,6 @@
-->
<meta name="viewport" content="width=device-width, initial-scale=1" />
<!-- FONT
-->
<link
href="//fonts.googleapis.com/css?family=Raleway:400,300,600"
rel="stylesheet"
type="text/css"
/>
<!-- CSS
-->
<link rel="stylesheet" href="css/normalize.css" />
@@ -50,6 +42,14 @@
integrity="sha512-XQoYMqMTK8LvdxXYG3nZ448hOEQiglfqkJs1NOQV44cWnUrBc8PkAOcXy20w0vlaXaVUearIOBhiXZ5V3ynxwA=="
crossorigin=""
></script>
<link rel="stylesheet" href="./leafletCluster/dist/MarkerCluster.css" />
<link
rel="stylesheet"
href="./leafletCluster/dist/MarkerCluster.Default.css"
/>
<script src="./leafletCluster/dist/leaflet.markercluster.js"></script>
</head>
<body>
<!-- Primary Page Layout
@@ -58,11 +58,11 @@
<div class="map" id="map"></div>
<div class="inspector" id="inspector">
<br><br><br><br>
<br /><br /><br /><br />
<center>
Select an elevator on the map and information about it will be displayed here.
Select an elevator on the map and information about it will be
displayed here.
</center>
</div>
</div>
@@ -77,8 +77,8 @@
<!-- End Document
-->
<script type="text/javascript">
var amountOfImages = 0;
var markers = L.markerClusterGroup();
slideIndex = 1;
var mymap = L.map("map").setView([51.505, -0.09], 50);
@@ -96,12 +96,11 @@
}
).addTo(mymap);
theMarker = L.Marker.extend({
options: {
id: '-1'
}
});
options: {
id: "-1",
},
});
function showPosition(position) {
console.log(position.coords);
@@ -113,60 +112,85 @@
// mymap.setView(new L.LatLng(10.737, -73.923), 8);
}
function onClick(e) {
slideIndex = 1;
document.getElementById("inspector").innerHTML = "<br><br><center><div class=\"lds-ripple\"><div></div><div></div></div></center>"
res = JSON.parse(httpGet("/api/getElevatorById?id=" + this.options.id))
if(res.state == "Ok"){
visitStates = ["Test elevator", "Public", "On private property", "Public but locked"]
typeStates = ["Hydraulic", "Wiredriven, motor in shaft", "Wiredriven, motor in motorroom"]
document.getElementById("inspector").innerHTML =
'<br><br><center><div class="lds-ripple"><div></div><div></div></div></center>';
res = JSON.parse(httpGet("/api/getElevatorById?id=" + this.options.id));
if (res.state == "Ok") {
visitStates = [
"Test elevator",
"Public",
"On private property",
"Public but locked",
];
typeStates = [
"Hydraulic",
"Wiredriven, motor in shaft",
"Wiredriven, motor in motorroom",
];
// Prepare the template
inspector = httpGet("/templates/inspectorContent.html")
inspector = inspector.replace("#MODELL", res.results[0].modell)
inspector = inspector.replace("#MANUF", res.results[0].manufacturer)
inspector = inspector.replace("#DESC", res.results[0].info)
inspector = inspector.replace("#TYPE", typeStates[res.results[0].technology])
inspector = inspector.replace("#MAXPASS", res.results[0].maxPassangers)
inspector = inspector.replace("#MASSWEIGH", res.results[0].maxWeight)
inspector = inspector.replace("#VISIT", visitStates[res.results[0].visitabilty])
document.getElementById("inspector").innerHTML = inspector
inspector = httpGet("/templates/inspectorContent.html");
inspector = inspector.replace("#MODELL", res.results[0].modell);
inspector = inspector.replace("#MANUF", res.results[0].manufacturer);
inspector = inspector.replace("#DESC", res.results[0].info);
inspector = inspector.replace(
"#TYPE",
typeStates[res.results[0].technology]
);
inspector = inspector.replace(
"#MAXPASS",
res.results[0].maxPassangers
);
inspector = inspector.replace("#MASSWEIGH", res.results[0].maxWeight);
inspector = inspector.replace(
"#VISIT",
visitStates[res.results[0].visitabilty]
);
document.getElementById("inspector").innerHTML = inspector;
// Make gallery
document.getElementById("imageGallery").innerHTML = "<div class='slideshow-container'>";
imgs = JSON.parse(res.results[0].images)
document.getElementById("imageGallery").innerHTML =
"<div class='slideshow-container'>";
imgs = JSON.parse(res.results[0].images);
amountOfImages = imgs.images.length;
console.log(imgs)
console.log(imgs);
var iH = 0;
while(amountOfImages > iH){
newBox = "<center><div class='mySlides fade'><div class='numbertext'>";
newBox += iH+1;
newBox += "/";
newBox += amountOfImages;
newBox += "</div><img src='";
newBox += imgs.images[iH].path;
newBox += "' alt='" + imgs.images[iH].alt + "' class=\"elevatorPhoto\"><div class='text'> </div></div></center>";
document.getElementById("imageGallery").innerHTML += newBox
while (amountOfImages > iH) {
newBox =
"<center><div class='mySlides fade'><div class='numbertext'>";
newBox += iH + 1;
newBox += "/";
newBox += amountOfImages;
newBox += "</div><img src='";
newBox += imgs.images[iH].path;
newBox +=
"' alt='" +
imgs.images[iH].alt +
"' class=\"elevatorPhoto\"><div class='text'> </div></div></center>";
document.getElementById("imageGallery").innerHTML += newBox;
iH++;
}
document.getElementById("imageGallery").innerHTML += "<br><a class='prev' onclick='plusSlides(-1)''>&#10094;</a><a class='next' onclick='plusSlides(1)'>&#10095;</a></div><br><div style='text-align:center'></div><br><br><br>";
showSlides(1)
}else{
document.getElementById("inspector").innerHTML = ' \
document.getElementById("imageGallery").innerHTML +=
"<br><a class='prev' onclick='plusSlides(-1)''>&#10094;</a><a class='next' onclick='plusSlides(1)'>&#10095;</a></div><br><div style='text-align:center'></div><br><br><br>";
showSlides(1);
} else {
document.getElementById("inspector").innerHTML =
' \
<center> \
<h1><i style="color: red;" class="fas fa-exclamation-triangle"></i></h1> \
<h1>Oh no!</h1> \
The website failed to fetch the information about this elevator. It responded with the error code: \
<br><code> \
' + res.message + "</code><center>"
' +
res.message +
"</code><center>";
}
console.log(res)
}
console.log(res);
}
function httpGet(theUrl) {
var xmlHttp = new XMLHttpRequest();
@@ -187,54 +211,68 @@
home();
function addPin(item, index){
var marker = new theMarker([item.lat, item.lng], {
id: item.id
});
// var marker = new L.Marker()
marker.addTo(mymap).on('click', onClick);;
function addPin(item, index) {
var marker = new theMarker([item.lat, item.lng], {
id: item.id,
}).on("click", onClick);
// var marker = new L.Marker()
//marker.addTo(mymap).on('click', onClick);
markers.on("clusterclick", function (a) {
//alert('cluster ' + a.layer.getAllChildMarkers().length);
});
markers.addLayer(marker);
}
// Start getting the elevators
response = httpGet("/api/getElevatorLocation?lan=" + mymap.getCenter.lng + "&lat=" + mymap.getCenter.lat + "&radius=" + mymap.getZoom())
response = JSON.parse(response)
response = httpGet(
"/api/getElevatorLocation?lan=" +
mymap.getCenter.lng +
"&lat=" +
mymap.getCenter.lat +
"&radius=" +
mymap.getZoom()
);
response = JSON.parse(response);
if(response.state == "Ok"){
response.results.forEach(addPin)
}else{
if (response.state == "Ok") {
response.results.forEach(addPin);
mymap.addLayer(markers);
} else {
// DONT FORGET TO SHOW POPUP OR SOMETHING
console.log("Request failed with " + response.message)
console.log(response)
alert("Loading of the map pins failed")
console.log("Request failed with " + response.message);
console.log(response);
alert("Loading of the map pins failed");
}
// Next/previous controls
function plusSlides(n) {
showSlides(slideIndex += n);
}
function plusSlides(n) {
showSlides((slideIndex += n));
}
// Thumbnail image controls
function currentSlide(n) {
showSlides(slideIndex = n);
}
// Thumbnail image controls
function currentSlide(n) {
showSlides((slideIndex = n));
}
function showSlides(n) {
var i;
var slides = document.getElementsByClassName("mySlides");
var dots = document.getElementsByClassName("dot");
if (n > slides.length) {slideIndex = 1}
if (n < 1) {slideIndex = slides.length}
for (i = 0; i < slides.length; i++) {
slides[i].style.display = "none";
}
for (i = 0; i < dots.length; i++) {
dots[i].className = dots[i].className.replace(" active", "");
}
slides[slideIndex-1].style.display = "block";
dots[slideIndex-1].className += " active";
}
function showSlides(n) {
var i;
var slides = document.getElementsByClassName("mySlides");
var dots = document.getElementsByClassName("dot");
if (n > slides.length) {
slideIndex = 1;
}
if (n < 1) {
slideIndex = slides.length;
}
for (i = 0; i < slides.length; i++) {
slides[i].style.display = "none";
}
for (i = 0; i < dots.length; i++) {
dots[i].className = dots[i].className.replace(" active", "");
}
slides[slideIndex - 1].style.display = "block";
dots[slideIndex - 1].className += " active";
}
</script>
</body>
</html>

110
templates/register.html Normal file
View File

@@ -0,0 +1,110 @@
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Basic Page Needs
-->
<meta charset="utf-8">
<title><%= it.siteTitel %></title>
<meta name="description" content="<%= it.desc %>">
<meta name="author" content="<%= it.author %>">
<!-- Mobile Specific Metas
-->
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- CSS
-->
<link rel="stylesheet" type="text/css" href="vendor/bootstrap/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="vendor/animate/animate.css">
<link rel="stylesheet" type="text/css" href="vendor/css-hamburgers/hamburgers.min.css">
<link rel="stylesheet" type="text/css" href="vendor/animsition/css/animsition.min.css">
<link rel="stylesheet" type="text/css" href="vendor/select2/select2.min.css">
<link rel="stylesheet" type="text/css" href="css/util.css">
<link rel="stylesheet" type="text/css" href="css/main.css">
<!-- Favicon
-->
<link rel="icon" type="image/png" href="images/favicon-16.png">
<script src="https://kit.fontawesome.com/<%= it.fontawesomeKey %>.js" crossorigin="anonymous"></script>
</head>
<body>
<div class="limiter">
<div class="container-login100">
<div class="wrap-login100">
<div>
<a href="/"><i class="fas fa-arrow-left"></i> Back</a>
</div>
<form class="login100-form validate-form" method="post">
<span class="login100-form-title p-b-26">
Welcome
</span>
<span class="login100-form-title p-b-48">
<i class="zmdi zmdi-font"></i>
</span>
<div class="wrap-input100">
<input class="input100" type="text" name="username">
<span class="focus-input100" data-placeholder="Username"></span>
</div>
<div class="wrap-input100 validate-input" data-validate = "Valid email is: john@test.com">
<input class="input100" type="text" name="email">
<span class="focus-input100" data-placeholder="Email"></span>
</div>
<div class="wrap-input100 validate-input" data-validate="Enter password">
<span class="btn-show-pass">
<i class="zmdi zmdi-eye"></i>
</span>
<input class="input100" type="password" name="pass">
<span class="focus-input100" data-placeholder="Password"></span>
</div>
<div class="wrap-input100 validate-input" data-validate="Repeat password">
<span class="btn-show-pass">
<i class="zmdi zmdi-eye"></i>
</span>
<input class="input100" type="password" name="pass2">
<span class="focus-input100" data-placeholder="Repeat Password"></span>
</div>
<div class="h-captcha" data-sitekey="<%= it.sitekey %>"></div>
<script src="https://hcaptcha.com/1/api.js" async defer unsafe-eval></script>
<div class="container-login100-form-btn">
<div class="wrap-login100-form-btn">
<div class="login100-form-bgbtn"></div>
<button class="login100-form-btn">
Create a new account
</button>
</div>
</div>
</form>
</div>
</div>
</div>
<div id="dropDownSelect1"></div>
<script src="vendor/jquery/jquery-3.2.1.min.js"></script>
<script src="vendor/animsition/js/animsition.min.js"></script>
<script src="vendor/bootstrap/js/popper.js"></script>
<script src="vendor/bootstrap/js/bootstrap.min.js"></script>
<script src="vendor/select2/select2.min.js"></script>
<script src="vendor/daterangepicker/moment.min.js"></script>
<script src="js/main.js"></script>
<!-- End Document
-->
</body>
</html>