Preparing for the transition to REST API
This commit is contained in:
@ -17,6 +17,7 @@
|
||||
|
||||
<link rel="stylesheet" href="../resources/engine/openlayers/ol.css" type="text/css">
|
||||
|
||||
<!--script src="https://cdn.tailwindcss.com"></script-->
|
||||
<script type="text/javascript" src="../resources/metadata/jquery.js"></script>
|
||||
<script type="text/javascript" src="../resources/metadata/sprintf.js"></script>
|
||||
<script type="text/javascript" src="../resources/metadata/qrcode.js"></script>
|
||||
@ -26,7 +27,7 @@
|
||||
<!--link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
|
||||
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script-->
|
||||
|
||||
<script type="text/javascript" src="../translation?v=9"></script>
|
||||
<script type="text/javascript" src="/api/translation/v01/array"></script>
|
||||
<link rel="stylesheet" type="text/css" href="../resources/metadata/dbms/dbms.css?v=14"/>
|
||||
<script type="text/javascript" src="../resources/metadata/dbms/BrowserDetect.js?v=14"></script>
|
||||
<script type="text/javascript" src="../resources/metadata/dbms/tools.js?v=14"></script>
|
||||
@ -40,7 +41,7 @@
|
||||
|
||||
<script type="text/javascript" src="../resources/engine/popup.js?v=14"></script>
|
||||
<script type="text/javascript" src="../resources/engine/index.js?v=21"></script>
|
||||
<script type="text/javascript" src="../resources/engine/user.js?v=14"></script>
|
||||
<script type="text/javascript" src="../resources/engine/user.js?v=16"></script>
|
||||
|
||||
<style>
|
||||
html,
|
||||
@ -144,7 +145,7 @@ select{
|
||||
|
||||
</style>
|
||||
|
||||
<script>
|
||||
<script type="application/javascript">
|
||||
|
||||
if(window.location.host.indexOf('locust.kz')>=0){
|
||||
window.location.href = "https://ccalm.org";
|
||||
@ -354,6 +355,8 @@ function onLoadPage()
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
@ -373,6 +376,7 @@ function onLoadPage()
|
||||
<td style="width:80%;padding-left:5px;color: rgb(100, 100, 100);" id="user_name">{{name}} {{patronymic}} {{surname}} (<span>{{ roles.join(', ') }}</span>)</td>
|
||||
<td style="padding-left:5px;" th:text="${Language}">Language</td>
|
||||
<td style="padding-left:5px; width:200px;position: relative;">
|
||||
<!--select id="lang" onchange="setCookie('lng',this.value,365,'/'); location.reload();" style="width: 95%; position: absolute; transform: translate(0%, -52%); z-index: 10000;"-->
|
||||
<select id="lang" onchange="setCookie('lng',this.value,365,'/'); location.reload();" style="width: 95%; position: absolute; transform: translate(0%, -52%); z-index: 10000;">
|
||||
<option value="3">English</option>
|
||||
<option value="1">Russian Русский</option>
|
||||
@ -1412,8 +1416,6 @@ new Calendar({
|
||||
|
||||
<div id="tab_admin" style="position: absolute; width:100px; height:100px; padding:3px; overflow:scroll;">
|
||||
|
||||
<button id="btnChangePassword" class="main" style="width:100%;margin-top:1px;" onclick="g_user.changePassword();" th:text="${Change_login_password}">Change_login_password</button>
|
||||
|
||||
<div id="lblReports" th:text="${Reports}">Reports</div>
|
||||
<button class="main" style="width:100%;margin-top:1px;" onclick="showReportCountries();" th:text="${Filling_forms_by_countries}">Filling_forms_by_countries</button>
|
||||
<button class="main" style="width:100%;margin-top:1px;" onclick="showReportInspectors();" th:text="${Completed_forms_by_tablets}">Completed_forms_by_tablets</button>
|
||||
@ -1654,6 +1656,9 @@ var vectorSourceV = new ol.source.Vector({});
|
||||
var vectorSourceDel = new ol.source.Vector({});
|
||||
var vectorSourceDelV = new ol.source.Vector({});
|
||||
|
||||
var vectorSourceHealth = new ol.source.Vector({});
|
||||
var vectorSourceHealthV = new ol.source.Vector({});
|
||||
|
||||
var vectorSourceArea = new ol.source.Vector({});
|
||||
|
||||
var vectorSourceCheckpoint = new ol.source.Vector({});
|
||||
@ -1759,6 +1764,14 @@ map = new ol.Map({
|
||||
source: vectorSourceDelV,
|
||||
zIndex: 50
|
||||
}),
|
||||
new ol.layer.Vector({
|
||||
source: vectorSourceHealth,
|
||||
zIndex: 100
|
||||
}),
|
||||
new ol.layer.Vector({
|
||||
source: vectorSourceHealthV,
|
||||
zIndex: 50
|
||||
}),
|
||||
new ol.layer.Vector({
|
||||
source: vectorSourceArea,
|
||||
zIndex: 50
|
||||
@ -1884,8 +1897,13 @@ map.on('singleclick', function(evt){ //map.on('click', function(evt){
|
||||
if(feature.userType=="FrmCheckpoint")
|
||||
{
|
||||
let coordinates = feature.getGeometry().getCoordinates();
|
||||
content.innerHTML = '<b>'+trt('Title')+'</b>: '+feature.userTitle+'<br><b>'+trt('Creator')+'</b>: '+feature.userName+'<br><b>'+trt('Radius')+'</b>: '+feature.userRadius+'m.'+'<br><b>'+trt('Want_temperature')+'</b>: '+feature.userTemperature+'°C';
|
||||
content.innerHTML += '<table><tr><td><button class="main" onclick="g_density_larval.callData('+feature.userID+');">'+trt('Hopper_density')+'</button></td><td><button class="main" onclick="g_density_imago.callData('+feature.userID+');">'+trt('Adult_density')+'</button></td></tr></table>';
|
||||
content.innerHTML =
|
||||
'<span style="white-space: nowrap;"><b>' + trt('Title') + '</b>: ' + feature.userTitle + '</span><br>' +
|
||||
'<span style="white-space: nowrap;"><b>' + trt('Creator') + '</b>: ' + feature.userName + '</span><br>' +
|
||||
'<span style="white-space: nowrap;"><b>' + trt('Radius') + '</b>: ' + feature.userRadius + 'm.</span><br>' +
|
||||
'<span style="white-space: nowrap;"><b>' + trt('Want_air_temperature') + '</b>: ' + feature.userTemperature_air + '°C</span><br>' +
|
||||
'<span style="white-space: nowrap;"><b>' + trt('Want_soil_temperature') + '</b>: ' + feature.userTemperature_air + '°C</span>';
|
||||
content.innerHTML += '<table style="width: 100%;border-spacing: 2px; border-collapse: separate;"><tr><td><button class="main" style="width: 100%;" onclick="g_density_larval.callData('+feature.userID+');">'+trt('Hopper_density')+'</button></td><td><button class="main" style="width: 100%;" onclick="g_density_imago.callData('+feature.userID+');">'+trt('Adult_density')+'</button></td></tr></table>';
|
||||
overlay.setPosition(coordinates);
|
||||
}else{
|
||||
overlay.setPosition(undefined);
|
||||
@ -1994,7 +2012,6 @@ window.onresize = function()
|
||||
}
|
||||
onresize();
|
||||
|
||||
|
||||
onLoadPage();
|
||||
|
||||
</script>
|
||||
|
||||
@ -1,391 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html xmlns:th="http://www.thymeleaf.org" lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title th:text="${Authorization}">Authorization</title>
|
||||
<link rel="icon" href="../resources/favicon.ico" type="image/x-icon">
|
||||
<link rel="stylesheet" href="../resources/engine/css/buttons.css?v=8">
|
||||
<link rel="stylesheet" href="../resources/engine/normalize.css?v=8">
|
||||
<link rel="stylesheet" type="text/css" href="../resources/engine/index.css?v=14"/>
|
||||
<link rel="stylesheet" type="text/css" href="../resources/metadata/dbms/dbms.css?v=14"/>
|
||||
<script type="text/javascript" src="../translation?v=9"></script>
|
||||
<script type="text/javascript" src="../resources/metadata/dbms/tools.js?v=14"></script>
|
||||
<script type="text/javascript" src="../resources/metadata/dbms/window.js?v=14"></script>
|
||||
<style>
|
||||
body {
|
||||
font-family: Arial, sans-serif;
|
||||
background-color: #f4f4f4;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
display: flex;
|
||||
flex-direction: column; /* Вертикальная ориентация */
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
height: 100vh;
|
||||
}
|
||||
|
||||
.login-container {
|
||||
background-color: #ffffff;
|
||||
padding: 20px;
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
|
||||
width: 300px;
|
||||
}
|
||||
|
||||
.login-container h2 {
|
||||
text-align: center;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.form-group {
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
.form-group label {
|
||||
font-weight: bold;
|
||||
display: block;
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
|
||||
.form-group input {
|
||||
width: 100%;
|
||||
padding: 8px;
|
||||
border-radius: 4px;
|
||||
border: 1px solid #ccc;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.form-group a {
|
||||
font-size: 12px;
|
||||
color: #007bff;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.form-group a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.form-group .button {
|
||||
width: 100%;
|
||||
padding: 10px;
|
||||
background-color: #007bff;
|
||||
color: white;
|
||||
border: none;
|
||||
border-radius: 4px;
|
||||
font-size: 16px;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.form-group .button:hover {
|
||||
background-color: #0056b3;
|
||||
}
|
||||
|
||||
.progress-bar {
|
||||
display: none;
|
||||
margin-top: 10px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
/* Custom style for checkbox */
|
||||
.checkbox-group {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.checkbox-group input {
|
||||
margin-right: 8px;
|
||||
}
|
||||
|
||||
.centered-text {
|
||||
text-align: center;
|
||||
font-size: 14px;
|
||||
color: #333;
|
||||
margin-top: auto; /* Этот стиль заставит блок с .centered-text быть внизу */
|
||||
}
|
||||
|
||||
.centered-text a {
|
||||
color: #007bff;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.centered-text a:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
/* Header styles */
|
||||
.header {
|
||||
width: 100%;
|
||||
background-color: var(--back-color2);
|
||||
color: white;
|
||||
padding: 10px;
|
||||
text-align: center;
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
z-index: 100;
|
||||
}
|
||||
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="header">
|
||||
<span>Username</span>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- Блок ниже должен быть по центру вертикали и горизонтали -->
|
||||
<div>
|
||||
|
||||
<div class="login-container" id="loginForm">
|
||||
<h2 th:text="${Authorization}">Authorization</h2>
|
||||
<div>
|
||||
<div class="form-group">
|
||||
<label for="1_login"><span th:text="${Login}">Login</span> (E-mail):</label>
|
||||
<input type="text" id="1_login" name="1_login" maxlength="50" th:placeholder="${Enter_login_or_email}">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="1_password" th:text="${Password}">Password:</label>
|
||||
<input type="password" id="1_password" name="password" maxlength="33" th:placeholder="${Enter_password}">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<button id="loginBtn" class="button" th:text="${Log_in}" onclick="authorizeUser()">Log in</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="login-container" style="display: none;" id="registrationForm">
|
||||
<h2 th:text="${Registration}">Registration</h2>
|
||||
<div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="3_country_id"><span th:text="${Country}">Country</span> *</label>
|
||||
<input type="text" id="3_country_id" name="country" maxlength="50" placeholder="Country">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="3_lastname"><span th:text="${Surname}">Surname</span></label>
|
||||
<input type="text" id="3_lastname" name="lastname" maxlength="50" placeholder="Surname">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="3_firstname"><span th:text="${Name}">Name</span> *</label>
|
||||
<input type="text" id="3_firstname" name="firstname" maxlength="50" placeholder="Name">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="3_company"><span th:text="${Company}">Company</span></label>
|
||||
<input type="text" id="3_company" name="company" maxlength="50" placeholder="Company">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="3_position"><span th:text="${Position}">Position</span></label>
|
||||
<input type="text" id="3_position" name="position" maxlength="50" placeholder="Position">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="3_phone"><span th:text="${Phone}">Phone</span></label>
|
||||
<input type="text" id="3_phone" name="phone" maxlength="50" placeholder="Phone">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="3_email"><span th:text="${E_mail}">Email</span> *</label>
|
||||
<input type="text" id="3_email" name="email" maxlength="50" placeholder="E-mail">
|
||||
</div>
|
||||
|
||||
<div class="form-group checkbox-group">
|
||||
<input type="checkbox" id="privacyPolicy" onclick="toggleRegisterButton()">
|
||||
<label for="privacyPolicy">
|
||||
Я согласен с <a href="#">политикой конфиденциальности</a>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<button id="registerBtn" class="button" th:text="${Registration}" disabled onclick="registrationUser()">Registration</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="login-container" style="display: none;" id="recoveryForm">
|
||||
<h2 th:text="${Password_recovery}">Password_recovery</h2>
|
||||
<div>
|
||||
<div class="form-group">
|
||||
<label for="3_email"><span th:text="${E_mail}">Email</span> *</label>
|
||||
<input type="text" id="3_email" name="email" maxlength="50" placeholder="E-mail">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<button id="nextBtn" class="button" th:text="${Next}">Next</button>
|
||||
</div>
|
||||
|
||||
<div class="progress-bar" id="progressBar2">
|
||||
<span>Загрузка...</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="login-container" style="display: none;" id="changeForm">
|
||||
<h2 th:text="${Password_recovery}">Password_recovery</h2>
|
||||
<div>
|
||||
<div class="form-group">
|
||||
<label for="3_email"><span th:text="${Login}">Login</span> <span th:text="${E_mail}">Email</span></label>
|
||||
<input type="text" id="3_email" name="email" maxlength="50" placeholder="E-mail">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="4_oldPassword"><span th:text="${Old_password}">Old_password</span></label>
|
||||
<input type="text" id="4_oldPassword" name="old_password" maxlength="50" placeholder="E-mail">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="4_newPassword"><span th:text="${New_password}">New_password</span></label>
|
||||
<input type="text" id="4_newPassword" name="new_password" maxlength="50" placeholder="E-mail">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="4_repeatPassword"><span th:text="${Repeat_password}">New_password</span></label>
|
||||
<input type="text" id="4_repeatPassword" name="repeat_password" maxlength="50" placeholder="Password">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<button id="4_btn" class="button" th:text="${Change_password}" onclick="changePassword()">Change_password</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="login-container" style="display: none;" id="totpForm">
|
||||
<h2 th:text="${New_totp_key}">New_totp_key</h2>
|
||||
<div>
|
||||
<div class="form-group">
|
||||
<label for="5_email"><span th:text="${Login}">Login</span> (E-mail)</label>
|
||||
<input type="text" id="5_email" name="email" maxlength="50" placeholder="E-mail">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="5_password"><span th:text="${Password}">Password</span></label>
|
||||
<input type="text" id="5_password" name="password" maxlength="50" placeholder="E-mail">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="5_oldTotp"><span th:text="${Old_totp}">Old_totp</span></label>
|
||||
<input type="text" id="5_oldTotp" name="Old_totp" maxlength="50" placeholder="E-mail">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="5_repeatPassword"><span th:text="${New_totp_code}">New_password</span></label>
|
||||
<input type="text" id="5_repeatPassword" name="repeat_password" maxlength="50" placeholder="Password">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<button id="5_btn" class="button" th:text="${New_totp_key}" onclick="newTotp()">New_totp_key</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="centered-text">
|
||||
<p><a href="#" onclick="showForm(1);" th:text="${Authorization}">Authorization</a></p>
|
||||
<p><a href="#" onclick="showForm(2);" th:text="${Create_a_new_user}">Create a new user</a></p>
|
||||
<p><a href="#" onclick="showForm(3);" th:text="${Password_recovery}">Password recovery</a></p>
|
||||
<p><a href="#" onclick="showForm(4);" th:text="${Change_password}">Change password</a></p>
|
||||
<p><a href="#" onclick="showForm(5);" th:text="${Get_new_TOTP_key}">Get new TOTP key</a></p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
// Функция для отображения формы авторизации
|
||||
function showForm(num) {
|
||||
document.getElementById('loginForm').style.display = num === 1 ? 'block' : 'none';
|
||||
document.getElementById('registrationForm').style.display = num === 2 ? 'block' : 'none';
|
||||
document.getElementById('recoveryForm').style.display = num === 3 ? 'block' : 'none';
|
||||
document.getElementById('changeForm').style.display = num === 4 ? 'block' : 'none';
|
||||
document.getElementById('totpForm').style.display = num === 5 ? 'block' : 'none';
|
||||
}
|
||||
|
||||
// Функция для включения/выключения кнопки регистрации в зависимости от состояния галочки
|
||||
function toggleRegisterButton() {
|
||||
const checkbox = document.getElementById('privacyPolicy');
|
||||
const registerBtn = document.getElementById('registerBtn');
|
||||
registerBtn.disabled = !checkbox.checked;
|
||||
}
|
||||
|
||||
// Функция для обработки авторизации
|
||||
function authorizeUser() {
|
||||
const login = document.getElementById('1_login').value;
|
||||
const password = document.getElementById('1_password').value;
|
||||
const obj = {login, password, appid: 'ccalm'};
|
||||
postJsonData('/api/authorization/v02/login', obj, (ok, data) => {
|
||||
if (ok) {
|
||||
if (data.error_code == 0) {
|
||||
window.location.href = "/engine";
|
||||
} else {
|
||||
errorDialog(data)
|
||||
}
|
||||
} else {
|
||||
alert2(trt('Alert'), trt('Error: Unable to authorize.'));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function registrationUser() {
|
||||
const login = document.getElementById('1_login').value;
|
||||
const password = document.getElementById('1_password').value;
|
||||
const obj = {login, password, appid: 'ccalm'};
|
||||
postJsonData('/api/authorization/v02/login', obj, (ok, data) => {
|
||||
if (ok) {
|
||||
if (data.error_code == 0) {
|
||||
window.location.href = "/engine";
|
||||
} else {
|
||||
errorDialog(data)
|
||||
}
|
||||
} else {
|
||||
alert2(trt('Alert'), trt('Error: Unable to authorize.'));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function changePassword() {
|
||||
const login = document.getElementById('1_login').value;
|
||||
const password = document.getElementById('1_password').value;
|
||||
const obj = {login, password, appid: 'ccalm'};
|
||||
postJsonData('/api/authorization/v02/login', obj, (ok, data) => {
|
||||
if (ok) {
|
||||
if (data.error_code == 0) {
|
||||
window.location.href = "/engine";
|
||||
} else {
|
||||
errorDialog(data)
|
||||
}
|
||||
} else {
|
||||
alert2(trt('Alert'), trt('Error: Unable to authorize.'));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function newTotp() {
|
||||
const login = document.getElementById('1_login').value;
|
||||
const password = document.getElementById('1_password').value;
|
||||
const obj = {login, password, appid: 'ccalm'};
|
||||
postJsonData('/api/authorization/v02/login', obj, (ok, data) => {
|
||||
if (ok) {
|
||||
if (data.error_code == 0) {
|
||||
window.location.href = "/engine";
|
||||
} else {
|
||||
errorDialog(data)
|
||||
}
|
||||
} else {
|
||||
alert2(trt('Alert'), trt('Error: Unable to authorize.'));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
// Изначально показываем форму авторизации
|
||||
//showLoginForm();
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@ -8,7 +8,7 @@
|
||||
<meta name="yandex-verification" content="2cb5374be0668fe9" />
|
||||
<script type="text/javascript" src="./resources/metadata/jquery.js"></script>
|
||||
|
||||
<script type="text/javascript" src="./translation?v=7"></script>
|
||||
<script type="text/javascript" src="/api/translation/v01/array"></script>
|
||||
|
||||
<script src="./resources/metadata/dbms/tools.js?v=9"></script>
|
||||
<script src="./resources/metadata/dbms/window.js?v=10"></script>
|
||||
|
||||
Reference in New Issue
Block a user