351 lines
11 KiB
HTML
351 lines
11 KiB
HTML
<html>
|
|
|
|
<head>
|
|
<title>OrderSprinter Startseite</title>
|
|
<meta http-equiv=“cache-control“ content=“no-cache“>
|
|
<meta http-equiv=“pragma“ content=“no-cache“>
|
|
<meta http-equiv=“expires“ content=“0″>
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
<meta http-equiv="content-type" content="text/html; charset=utf-8">
|
|
<meta name="author" content="Stefan Pichel">
|
|
|
|
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=1.5.17">
|
|
<link rel="stylesheet" type="text/css" href="css/numfield.css?v=1.5.17">
|
|
|
|
<link rel="stylesheet" href="php/3rdparty/orderstyle/orderstyle.min.css" />
|
|
<link rel="stylesheet" href="php/3rdparty/orderstyle/jquery.mobile.icons.min.css" />
|
|
|
|
<link rel="stylesheet" href="php/3rdparty/jquery.mobile-1.4.0.min.css" type="text/css" />
|
|
<script src="php/3rdparty/jquery-2.0.3.min.js"></script>
|
|
<script src="php/3rdparty/jquery.mobile-1.4.0.min.js"></script>
|
|
<script src="utilities.js"></script>
|
|
</head>
|
|
|
|
<body>
|
|
<script>
|
|
|
|
var I_TIMEDIFF_NO_ADMIN = ["Zeit am Server und am Endgerät unterscheiden sich. Bitte als Admin einloggen und abgleichen!",
|
|
"Time of server and end device differ. Please log in as admin and synchronize times!",
|
|
"Tiempo en el servidor y su maquina no son iguales. Log in como administrador y corregir el tiempo!"];
|
|
|
|
function fillUserList(userinfo) {
|
|
var text = '<div class="ui-field-contain">';
|
|
text += '<select name="userlistselection" id="userlistselection" data-theme="f">';
|
|
$.each(userinfo.users, function (i, aUser) {
|
|
var username = aUser.username;
|
|
var userid = aUser.id;
|
|
text += '<option value=' + userid + '>' + username + '</option>';
|
|
});
|
|
text += '</select>';
|
|
$("#userlist").html(text);
|
|
$("#passwordfield").val("");
|
|
|
|
// set preselection of view
|
|
createViewSelBox(userinfo.defaultview);
|
|
}
|
|
|
|
function createViewSelBox(preselection) {
|
|
var txt = '<select name="modus" id="modus" data-theme="e">';
|
|
if (preselection == 0) {
|
|
txt += '<option value="0" selected>Mobil</option><option value="1">Desktop</option>';
|
|
} else {
|
|
txt += '<option value="0">Mobil</option><option value="1" selected>Desktop</option>';
|
|
}
|
|
txt += '</select>';
|
|
$("#moduscell").html(txt);
|
|
$("#loginmask").trigger("create");
|
|
}
|
|
|
|
function askAndFillUserList() {
|
|
doAjax("GET","php/contenthandler.php?module=admin&command=getUserList",null,fillUserList,"no user data received");
|
|
}
|
|
|
|
function showLoggedInView(jsonContent) {
|
|
if (jsonContent == "YES") {
|
|
// no login mask!
|
|
$("#loginmask").hide();
|
|
$("#logoutarea").show();
|
|
} else {
|
|
// user needs to log in!
|
|
$("#loginmask").show();
|
|
$("#logoutarea").hide();
|
|
}
|
|
}
|
|
|
|
function isUserAlreadyLoggedIn() {
|
|
doAjax("POST","php/contenthandler.php?module=admin&command=isUserAlreadyLoggedIn",null,showLoggedInView,"login status unclear");
|
|
}
|
|
|
|
function goToView(lastPageOfUser) {
|
|
window.location.href = lastPageOfUser;
|
|
}
|
|
|
|
function tryAuthenticate(userid,password,modus) {
|
|
var date = new Date();
|
|
|
|
var data = {
|
|
userid: userid,
|
|
password: password,
|
|
modus:modus,
|
|
day: date.getDay(),
|
|
month: date.getMonth(),
|
|
year: date.getFullYear(),
|
|
minute: date.getMinutes(),
|
|
hour: date.getHours(),
|
|
time: parseInt(date.getTime() / 1000)
|
|
};
|
|
doAjax("POST", "php/contenthandler.php?module=admin&command=tryAuthenticate", data, displayLoginOrLogoutMask, "Loginstatus" );
|
|
}
|
|
|
|
function displayLoginOrLogoutMask(jsonContent) {
|
|
var status = jsonContent.status;
|
|
if (status == "YES") {
|
|
if (jsonContent.timediff == 1) {
|
|
var lang = jsonContent.lang;
|
|
if (jsonContent.isadmin == 1) {
|
|
setTimeout(function(){document.location.href = "time.html"},250);
|
|
return;
|
|
} else {
|
|
alert(I_TIMEDIFF_NO_ADMIN[lang]);
|
|
}
|
|
}
|
|
|
|
|
|
// no login mask!
|
|
$("#loginmask").hide();
|
|
$("#logoutarea").show();
|
|
|
|
// if there is a login message, show it in an alert
|
|
if (jsonContent.loginmessage != "") {
|
|
alert (jsonContent.loginmessage);
|
|
}
|
|
|
|
// forward to valid page!
|
|
doAjax("GET","php/contenthandler.php?module=admin&command=getViewAfterLogin",null,goToView,"Einstiegsseite nicht bekommen");
|
|
} else if (status == "WAIT") {
|
|
alert("Zu viele Fehlversuche - in 3 Minuten erneut versuchen");
|
|
$("#passwordfield").val("");
|
|
} else {
|
|
alert("Falsches Passwort?");
|
|
// user needs to log in!
|
|
$("#passwordfield").val("");
|
|
$("#logoutarea").hide();
|
|
}
|
|
}
|
|
|
|
function doLogout() {
|
|
doAjax("POST", "php/contenthandler.php?module=admin&command=logout", null, showLoginMask, "Logoutproblem");
|
|
}
|
|
|
|
function showLoginMask(jsonContent) {
|
|
if (jsonContent == "OK") {
|
|
// no login mask!
|
|
$("#loginmask").show();
|
|
$("#logoutarea").hide();
|
|
initializeMainMenu("#modulemenu");
|
|
}
|
|
}
|
|
|
|
function binding() {
|
|
$('#loginmask h2').off("click").on("click", function (e) {
|
|
e.stopImmediatePropagation();
|
|
e.preventDefault();
|
|
});
|
|
$('#logoutarea h2').off("click").on("click", function (e) {
|
|
e.stopImmediatePropagation();
|
|
e.preventDefault();
|
|
});
|
|
|
|
$("#loginbutton").off("click").on("click", function (e) {
|
|
e.stopImmediatePropagation();
|
|
e.preventDefault();
|
|
var userid = $("#userlistselection").find(":selected").val();
|
|
var password = $("#passwordfield").val();
|
|
var modus = $("#modus").val();
|
|
tryAuthenticate(userid,password,modus);
|
|
});
|
|
$("#logoutbutton").off("click").on("click", function (e) {
|
|
e.stopImmediatePropagation();
|
|
e.preventDefault();
|
|
doLogout();
|
|
});
|
|
|
|
|
|
$(".numfield td").off("click").on("click", function (e) {
|
|
e.stopImmediatePropagation();
|
|
e.preventDefault();
|
|
|
|
var val=$(this).html();
|
|
var classes = $(this).attr("class")
|
|
if (classes == "numnav") {
|
|
if (val == "1") {
|
|
showNumPanel();
|
|
} else if (val == "a") {
|
|
showCharPanelLower();
|
|
} else if (val == "#") {
|
|
showSpecialsPanel();
|
|
} else if (val == "abc") {
|
|
showCharPanelLower();
|
|
} else if (val == "ABC") {
|
|
showCharPanelUpper();
|
|
}
|
|
} else {
|
|
var password = String($("#passwordfield").val());
|
|
$("#passwordfield").val(password + val);
|
|
}
|
|
});
|
|
}
|
|
|
|
function showNumPanel() {
|
|
$("#numfield_num").show();
|
|
$("#numfield_char_lower").hide();
|
|
$("#numfield_char_upper").hide();
|
|
$("#numfield_specials").hide();
|
|
}
|
|
function showCharPanelLower() {
|
|
$("#numfield_num").hide();
|
|
$("#numfield_char_lower").show();
|
|
$("#numfield_char_upper").hide();
|
|
$("#numfield_specials").hide();
|
|
}
|
|
function showCharPanelUpper() {
|
|
$("#numfield_num").hide();
|
|
$("#numfield_char_lower").hide();
|
|
$("#numfield_char_upper").show();
|
|
$("#numfield_specials").hide();
|
|
}
|
|
function showSpecialsPanel() {
|
|
$("#numfield_num").hide();
|
|
$("#numfield_char_lower").hide();
|
|
$("#numfield_char_upper").hide();
|
|
$("#numfield_specials").show();
|
|
}
|
|
|
|
function startInstallationOrUseIt() {
|
|
doAjax("GET", "php/contenthandler.php?module=admin&command=isInstalled", null, handleResultOfInstallCheck, "PHP-Problem");
|
|
}
|
|
|
|
function handleResultOfInstallCheck(is_installed) {
|
|
if (is_installed == "Yes") {
|
|
useInstallation();
|
|
} else {
|
|
setTimeout(function(){document.location.href = "install.html?v=1.5.17"},500);
|
|
}
|
|
}
|
|
|
|
function useInstallation() {
|
|
initializeMainMenu("#modulemenu");
|
|
hideMenu();
|
|
askAndFillUserList();
|
|
isUserAlreadyLoggedIn();
|
|
binding();
|
|
}
|
|
|
|
$(document).on("pageinit", "#index-page", function () {
|
|
startInstallationOrUseIt();
|
|
});
|
|
|
|
</script>
|
|
|
|
<div data-role="page" id="index-page" data-theme="c">
|
|
<div data-role="panel" id="modulepanel" data-position="right" data-display="overlay">
|
|
<ul data-role="listview" id="modulemenu" data-divider-theme="a" data-inset="true">
|
|
<li data-role="list-divider" data-theme="b" data-role="heading">Hauptmenü</li>
|
|
</ul>
|
|
</div><!-- /panel -->
|
|
<div data-role="header" data-theme="b" data-position="fixed" id="theheader" style="background-color:black;">
|
|
<h1>OrderSprinter <img src="img/connection.png" class="connectionstatus" style="display:none;" /> <img src="img/printerstatus.png" class="printerstatus" style="display:none;" /></h1>
|
|
<div data-type="horizontal" style="top:0px;position:absolute;float:right;z-index:10;display:inline;" align="right" class="ui-btn-right">
|
|
<a href="#" data-role="button" data-icon="arrow-d" data-ajax="false" id="menuswitch">Hauptmenü</a>
|
|
</div>
|
|
</div>
|
|
|
|
<div data-role="content">
|
|
|
|
|
|
<div data-role="collapsible" data-content-theme="c" data-collapsed="false" data-theme="e" id="loginmask">
|
|
<H2>Logindaten</H2>
|
|
|
|
<form method="post">
|
|
<table border=0>
|
|
<tr><td>Username: <td id="userlist"></tr>
|
|
<tr><td>Modus: <td id="moduscell">
|
|
<select name="modus" id="modus" data-theme="e">
|
|
<option value="0">Mobil</option>
|
|
<option value="1">Desktop (Firefox)</option>
|
|
</select></tr>
|
|
<tr><td>Passwort: <td><input type="password" name="password" id="passwordfield" style="background:white;"/>
|
|
<!-- place for info -->
|
|
<tr />
|
|
|
|
</table>
|
|
|
|
<table class=numfield id="numfield_num">
|
|
<tr><td>1<td>2<td>3</tr>
|
|
<tr><td>4<td>5<td>6</tr>
|
|
<tr><td>7<td>8<td>9</tr>
|
|
<tr><td>0<td class=numnav>a<td class=numnav>#</tr>
|
|
</table>
|
|
|
|
<table class=numfield id="numfield_char_lower" style="display:none;">
|
|
<tr><td>a<td>b<td>c<td>d</tr>
|
|
<tr><td>e<td>f<td>g<td>h</tr>
|
|
<tr><td>i<td>j<td>k<td>l</tr>
|
|
<tr><td>m<td>n<td>o<td>p</tr>
|
|
<tr><td>q<td>r<td>s<td>t</tr>
|
|
<tr><td>u<td>v<td>w<td>x</tr>
|
|
<tr><td>y<td>z<td class=numnav>1<td class=numnav>#</tr>
|
|
<tr><td colspan=4 class=numnav>ABC</tr>
|
|
</table>
|
|
|
|
<table class=numfield id="numfield_char_upper" style="display:none;">
|
|
<tr><td>A<td>B<td>C<td>D</tr>
|
|
<tr><td>E<td>F<td>G<td>H</tr>
|
|
<tr><td>I<td>J<td>K<td>L</tr>
|
|
<tr><td>M<td>N<td>O<td>P</tr>
|
|
<tr><td>Q<td>R<td>S<td>T</tr>
|
|
<tr><td>U<td>V<td>W<td>X</tr>
|
|
<tr><td>Y<td>Z<td class=numnav>1<td class=numnav>#</tr>
|
|
<tr><td colspan=4 class=numnav>abc</tr>
|
|
</table>
|
|
|
|
<table class=numfield id="numfield_specials" style="display:none;">
|
|
<tr><td>!<td>§<td>$<td>+</tr>
|
|
<tr><td>%<td>&<td>/<td>-</tr>
|
|
<tr><td>(<td>)<td>=<td>#</tr>
|
|
<tr><td>?<td>_<td class=numnav>1<td class=numnav>a</tr>
|
|
</table>
|
|
|
|
<table border=0 style="width:280px;">
|
|
<tr><td align=center><input type="submit" value="Anmelden" id="loginbutton" data-theme="d"/></tr>
|
|
</table>
|
|
|
|
</form>
|
|
</div> <!-- Login-Maske -->
|
|
|
|
<div data-role="collapsible" data-content-theme="c" data-collapsed="false" data-theme="e" id="logoutarea">
|
|
<H2>Abmelden</H2>
|
|
<form method="post">
|
|
<a class="ui-btn ui-btn-e ui-btn-icon-right ui-icon-carat-r" href="logout.php" target="_top">Abmelden</a>
|
|
</form>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div id=demoarea></div>
|
|
|
|
<div data-role="footer" data-theme="b" id="thefooterr" style="background-color:black;">
|
|
<div class="ui-grid-a">
|
|
<div class="ui-block-a userinfo" id="loggedinuser"></div>
|
|
<div class="ui-block-b grid_right" id="versioninfo"></div>
|
|
</div><!-- /grid-a -->
|
|
</div> <!-- footer -->
|
|
|
|
</div>
|
|
|
|
</div>
|
|
</body>
|
|
|
|
</html>
|
|
|