Extract strings to lang files
This commit is contained in:
parent
43fc46a9fc
commit
a3eed0d758
18
js/admin.js
18
js/admin.js
@ -30,11 +30,11 @@ function editUser() {
|
|||||||
var userForm = document.getElementsByName('user')[0];
|
var userForm = document.getElementsByName('user')[0];
|
||||||
var userLogin = userForm.options[userForm.selectedIndex].text;
|
var userLogin = userForm.options[userForm.selectedIndex].text;
|
||||||
if (userLogin == auth) {
|
if (userLogin == auth) {
|
||||||
alert('Your can\'t edit your own user with this tool');
|
alert(lang['selfeditwarn']);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var message = '<div style="float:left">You are editing user <b>' + userLogin + '</b></div>';
|
var message = '<div style="float:left">' + sprintf(lang['editinguser'], '<b>' + userLogin + '</b>') + '</div>';
|
||||||
message += '<div class="red-button"><b><a href="javascript:void(0);" onclick="submitUser(\'delete\'); return false">Delete user</a></b></div>';
|
message += '<div class="red-button"><b><a href="javascript:void(0);" onclick="submitUser(\'delete\'); return false">' + lang['deluser'] + '</a></b></div>';
|
||||||
message += '<div style="clear: both; padding-bottom: 1em;"></div>';
|
message += '<div style="clear: both; padding-bottom: 1em;"></div>';
|
||||||
|
|
||||||
var form = '<form id="userForm" method="post" onsubmit="submitUser(\'update\'); return false">';
|
var form = '<form id="userForm" method="post" onsubmit="submitUser(\'update\'); return false">';
|
||||||
@ -47,14 +47,14 @@ function editUser() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function confirmedDelete(login) {
|
function confirmedDelete(login) {
|
||||||
return confirm('Warning!\n\nYou are going to permanently delete user "' + login + '", together with all their routes and positions.\n\nAre you sure?');
|
return confirm(sprintf(lang['deletewarn'], '"' + login + '"'));
|
||||||
}
|
}
|
||||||
|
|
||||||
function submitUser(action) {
|
function submitUser(action) {
|
||||||
var form = document.getElementById('userForm');
|
var form = document.getElementById('userForm');
|
||||||
var login = form.elements['login'].value;
|
var login = form.elements['login'].value;
|
||||||
if (!login) {
|
if (!login) {
|
||||||
alert("All fields are required");
|
alert(lang['allrequired']);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var pass = null;
|
var pass = null;
|
||||||
@ -63,11 +63,11 @@ function submitUser(action) {
|
|||||||
pass = form.elements['pass'].value;
|
pass = form.elements['pass'].value;
|
||||||
pass2 = form.elements['pass2'].value;
|
pass2 = form.elements['pass2'].value;
|
||||||
if (!pass || !pass2) {
|
if (!pass || !pass2) {
|
||||||
alert("All fields are required");
|
alert(lang['allrequired']);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (pass != pass2) {
|
if (pass != pass2) {
|
||||||
alert("Passwords don't match");
|
alert(lang['passnotmatch']);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -84,7 +84,7 @@ function submitUser(action) {
|
|||||||
var root = xml.getElementsByTagName('root');
|
var root = xml.getElementsByTagName('root');
|
||||||
if (root.length && getNode(root[0], 'error') == 0) {
|
if (root.length && getNode(root[0], 'error') == 0) {
|
||||||
removeModal();
|
removeModal();
|
||||||
alert("Action completed successfully");
|
alert(lang['actionsuccess']);
|
||||||
if (action == 'delete') {
|
if (action == 'delete') {
|
||||||
// select current user in users form
|
// select current user in users form
|
||||||
var f = document.getElementsByName('user')[0];
|
var f = document.getElementsByName('user')[0];
|
||||||
@ -96,7 +96,7 @@ function submitUser(action) {
|
|||||||
errorMsg = getNode(root[0], 'message');
|
errorMsg = getNode(root[0], 'message');
|
||||||
if (errorMsg) { message = errorMsg; }
|
if (errorMsg) { message = errorMsg; }
|
||||||
}
|
}
|
||||||
alert("Something went wrong\n" + message);
|
alert(lang['actionfailure'] + '\n' + message);
|
||||||
xhr = null;
|
xhr = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -384,7 +384,7 @@ function loadMapAPI(api) {
|
|||||||
var loadTime = 0;
|
var loadTime = 0;
|
||||||
function waitAndLoad(api, url) {
|
function waitAndLoad(api, url) {
|
||||||
// wait till first script loaded
|
// wait till first script loaded
|
||||||
if (loadTime > 5000) { loadTime = 0; alert('Sorry, can\'t load ' + api + ' API'); return; }
|
if (loadTime > 5000) { loadTime = 0; alert(sprintf(lang['apifailure'], api)); return; }
|
||||||
if (loadedAPI !== api) {
|
if (loadedAPI !== api) {
|
||||||
setTimeout(function () { loadTime += 50; waitAndLoad(api, url); }, 50);
|
setTimeout(function () { loadTime += 50; waitAndLoad(api, url); }, 50);
|
||||||
return;
|
return;
|
||||||
@ -398,7 +398,7 @@ function waitAndLoad(api, url) {
|
|||||||
|
|
||||||
function waitAndInit(api) {
|
function waitAndInit(api) {
|
||||||
// wait till main api loads
|
// wait till main api loads
|
||||||
if (loadTime > 10000) { loadTime = 0; alert('Sorry, can\'t load ' + api + ' API'); return; }
|
if (loadTime > 10000) { loadTime = 0; alert(sprintf(lang['apifailure'], api)); return; }
|
||||||
try {
|
try {
|
||||||
init();
|
init();
|
||||||
}
|
}
|
||||||
|
@ -32,11 +32,11 @@ function submitPass() {
|
|||||||
var pass = form.elements['pass'].value;
|
var pass = form.elements['pass'].value;
|
||||||
var pass2 = form.elements['pass2'].value;
|
var pass2 = form.elements['pass2'].value;
|
||||||
if (!oldpass || !pass || !pass2) {
|
if (!oldpass || !pass || !pass2) {
|
||||||
alert("All fields are required");
|
alert(lang['allrequired']);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (pass != pass2) {
|
if (pass != pass2) {
|
||||||
alert("Passwords don't match");
|
alert(lang['passnotmatch']);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var xhr = getXHR();
|
var xhr = getXHR();
|
||||||
@ -48,13 +48,13 @@ function submitPass() {
|
|||||||
var root = xml.getElementsByTagName('root');
|
var root = xml.getElementsByTagName('root');
|
||||||
if (root.length && getNode(root[0], 'error') == 0) {
|
if (root.length && getNode(root[0], 'error') == 0) {
|
||||||
removeModal();
|
removeModal();
|
||||||
alert("Password successfully changed");
|
alert(lang["actionsuccess"]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
errorMsg = getNode(root[0], 'message');
|
errorMsg = getNode(root[0], 'message');
|
||||||
if (errorMsg) { message = errorMsg; }
|
if (errorMsg) { message = errorMsg; }
|
||||||
}
|
}
|
||||||
alert("Something went wrong\n" + message);
|
alert(lang['actionfailure'] + '\n' + message);
|
||||||
xhr = null;
|
xhr = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -67,5 +67,14 @@ $lang["gps"] = "GPS";
|
|||||||
$lang["network"] = "Network";
|
$lang["network"] = "Network";
|
||||||
$lang["deluser"] = "Remove user";
|
$lang["deluser"] = "Remove user";
|
||||||
$lang["edituser"] = "Edit user";
|
$lang["edituser"] = "Edit user";
|
||||||
|
$lang["servererror"] = "Server error";
|
||||||
|
$lang["allrequired"] = "All fields are required";
|
||||||
|
$lang["passnotmatch"] = "Passwords don't match";
|
||||||
|
$lang["actionsuccess"] = "Action completed successfully";
|
||||||
|
$lang["actionfailure"] = "Something went wrong";
|
||||||
|
$lang["deletewarn"] = "Warning!\n\nYou are going to permanently delete user %s, together with all their routes and positions.\n\nAre you sure?"; // substitutes user login
|
||||||
|
$lang["editinguser"] = "You are editing user %s"; // substitutes user login
|
||||||
|
$lang["selfeditwarn"] = "Your can't edit your own user with this tool";
|
||||||
|
$lang["apifailure"] = "Sorry, can't load %s API"; // substitures api name (gmaps or openlayers)
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
@ -65,5 +65,14 @@ $lang["gps"] = "GPS";
|
|||||||
$lang["network"] = "Sieć";
|
$lang["network"] = "Sieć";
|
||||||
$lang["deluser"] = "Usuń użytkownika";
|
$lang["deluser"] = "Usuń użytkownika";
|
||||||
$lang["edituser"] = "Edytuj użytkownika";
|
$lang["edituser"] = "Edytuj użytkownika";
|
||||||
|
$lang["servererror"] = "Błąd serwera";
|
||||||
|
$lang["allrequired"] = "Wszystkie pola są wymagane";
|
||||||
|
$lang["passnotmatch"] = "Hasła nie pasują do siebie";
|
||||||
|
$lang["actionsuccess"] = "Operacja zakończona pomyślnie";
|
||||||
|
$lang["actionfailure"] = "Wystąpił błąd";
|
||||||
|
$lang["deletewarn"] = "Uwaga!\n\nZamierzasz całkowicie usunąć użytkownika %s, razem ze wszystkimi jego trasami i pozycjami.\n\nCzy na pewno?";
|
||||||
|
$lang["editinguser"] = "Edytujesz użytkownika %s";
|
||||||
|
$lang["selfeditwarn"] = "Nie można edytować własnego użytkownika za pomocą tego narzędzia";
|
||||||
|
$lang["apifailure"] = "Niestety ładowanie API %s nie powiodło się";
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
@ -45,7 +45,7 @@
|
|||||||
$login = isset($_REQUEST['login']) ? trim($_REQUEST['login']) : NULL;
|
$login = isset($_REQUEST['login']) ? trim($_REQUEST['login']) : NULL;
|
||||||
$hash = isset($_REQUEST['pass']) ? password_hash($_REQUEST['pass'], PASSWORD_DEFAULT) : NULL;
|
$hash = isset($_REQUEST['pass']) ? password_hash($_REQUEST['pass'], PASSWORD_DEFAULT) : NULL;
|
||||||
if (!$user->isAdmin || empty($action) || empty($login) || $user->login == $login) {
|
if (!$user->isAdmin || empty($action) || empty($login) || $user->login == $login) {
|
||||||
exitWithStatus(true, "Server error");
|
exitWithStatus(true, $lang["servererror"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
$aUser = new uUser($login);
|
$aUser = new uUser($login);
|
||||||
@ -53,7 +53,7 @@
|
|||||||
switch ($action) {
|
switch ($action) {
|
||||||
case 'add':
|
case 'add':
|
||||||
if (empty($hash)) {
|
if (empty($hash)) {
|
||||||
exitWithStatus(true, "Server error");
|
exitWithStatus(true, $lang["servererror"]);
|
||||||
}
|
}
|
||||||
if ($aUser->isValid) {
|
if ($aUser->isValid) {
|
||||||
exitWithStatus(true, $lang["userexists"]);
|
exitWithStatus(true, $lang["userexists"]);
|
||||||
@ -66,7 +66,7 @@
|
|||||||
case 'update':
|
case 'update':
|
||||||
// update password
|
// update password
|
||||||
if (empty($hash)) {
|
if (empty($hash)) {
|
||||||
exitWithStatus(true, "Server error");
|
exitWithStatus(true, $lang["servererror"]);
|
||||||
}
|
}
|
||||||
if ($aUser->setPass($hash) === false) {
|
if ($aUser->setPass($hash) === false) {
|
||||||
exitWithStatus(true, $mysqli->error);
|
exitWithStatus(true, $mysqli->error);
|
||||||
@ -80,7 +80,7 @@
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
exitWithStatus(true, "Server error");
|
exitWithStatus(true, $lang["servererror"]);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user