ordersprinter/webapp/index.html

389 lines
13 KiB
HTML
Raw Normal View History

2020-11-19 22:44:19 +01:00
<html>
2020-11-19 23:10:06 +01:00
<head>
<title>OrderSprinter Startseite</title>
2020-11-19 23:12:30 +01:00
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="expires" content="0">
2020-11-19 23:10:06 +01:00
<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">
2020-11-19 23:14:21 +01:00
<link rel="manifest" href="manifest.webmanifest">
2020-11-19 23:10:06 +01:00
2020-11-19 23:14:58 +01:00
<link rel="stylesheet" type="text/css" href="css/bestformat.css?v=2.0.3">
<link rel="stylesheet" type="text/css" href="css/numfield.css?v=2.0.3">
2020-11-19 23:10:06 +01:00
2020-11-19 23:14:51 +01:00
<link rel="stylesheet" href="php/3rdparty/orderstyle/orderstyle-brightenergy.min.css" />
2020-11-19 23:10:06 +01:00
<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>
2020-11-19 23:14:58 +01:00
<script src="utilities.js?v=2.0.3"></script>
2020-11-19 23:10:06 +01:00
</head>
2020-11-19 22:44:19 +01:00
<body>
<script>
2020-11-19 22:47:44 +01:00
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!"];
2020-11-19 23:12:30 +01:00
var companyInfo = "";
2020-11-19 22:44:19 +01:00
function fillUserList(userinfo) {
var text = '<div class="ui-field-contain">';
text += '<select name="userlistselection" id="userlistselection" data-theme="f">';
2020-11-19 23:03:48 +01:00
$.each(userinfo.users, function (i, aUser) {
2020-11-19 22:44:19 +01:00
var username = aUser.username;
2020-11-19 22:47:44 +01:00
var userid = aUser.id;
text += '<option value=' + userid + '>' + username + '</option>';
2020-11-19 22:44:19 +01:00
});
text += '</select>';
$("#userlist").html(text);
2020-11-19 22:52:43 +01:00
$("#passwordfield").val("");
2020-11-19 23:11:29 +01:00
// set preselection of view
createViewSelBox(userinfo.defaultview);
}
function createViewSelBox(preselection) {
var txt = '<select name="modus" id="modus" data-theme="e">';
if (preselection == 0) {
2020-11-19 23:12:16 +01:00
txt += '<option value="0" selected>Mobil</option><option value="1">Desktop</option>';
2020-11-19 23:11:29 +01:00
} else {
2020-11-19 23:12:16 +01:00
txt += '<option value="0">Mobil</option><option value="1" selected>Desktop</option>';
2020-11-19 23:11:29 +01:00
}
txt += '</select>';
$("#moduscell").html(txt);
2020-11-19 22:44:19 +01:00
$("#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;
}
2020-11-19 23:00:09 +01:00
function tryAuthenticate(userid,password,modus) {
2020-11-19 22:47:44 +01:00
var date = new Date();
2020-11-19 22:44:19 +01:00
var data = {
2020-11-19 22:47:44 +01:00
userid: userid,
password: password,
2020-11-19 23:00:09 +01:00
modus:modus,
2020-11-19 22:47:44 +01:00
day: date.getDay(),
month: date.getMonth(),
year: date.getFullYear(),
minute: date.getMinutes(),
hour: date.getHours(),
time: parseInt(date.getTime() / 1000)
2020-11-19 22:44:19 +01:00
};
doAjax("POST", "php/contenthandler.php?module=admin&command=tryAuthenticate", data, displayLoginOrLogoutMask, "Loginstatus" );
}
function displayLoginOrLogoutMask(jsonContent) {
2020-11-19 22:47:44 +01:00
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]);
}
}
2020-11-19 22:44:19 +01:00
// no login mask!
$("#loginmask").hide();
$("#logoutarea").show();
2020-11-19 22:47:44 +01:00
// if there is a login message, show it in an alert
if (jsonContent.loginmessage != "") {
alert (jsonContent.loginmessage);
}
2020-11-19 22:44:19 +01:00
// forward to valid page!
doAjax("GET","php/contenthandler.php?module=admin&command=getViewAfterLogin",null,goToView,"Einstiegsseite nicht bekommen");
2020-11-19 23:02:49 +01:00
} else if (status == "WAIT") {
alert("Zu viele Fehlversuche - in 3 Minuten erneut versuchen");
$("#passwordfield").val("");
2020-11-19 22:44:19 +01:00
} else {
2020-11-19 22:47:44 +01:00
alert("Falsches Passwort?");
2020-11-19 22:44:19 +01:00
// user needs to log in!
2020-11-19 22:52:43 +01:00
$("#passwordfield").val("");
2020-11-19 22:44:19 +01:00
$("#logoutarea").hide();
2020-11-19 23:14:58 +01:00
setTimeout(function(){document.location.href = "index.html?v=2.0.3"},250);
2020-11-19 22:44:19 +01:00
}
}
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() {
2020-11-19 23:03:35 +01:00
$('#loginmask h2').off("click").on("click", function (e) {
e.stopImmediatePropagation();
e.preventDefault();
2020-11-19 23:12:30 +01:00
alert(companyInfo);
2020-11-19 23:03:35 +01:00
});
$('#logoutarea h2').off("click").on("click", function (e) {
e.stopImmediatePropagation();
e.preventDefault();
});
2020-11-19 22:44:19 +01:00
$("#loginbutton").off("click").on("click", function (e) {
e.stopImmediatePropagation();
e.preventDefault();
2020-11-19 22:47:44 +01:00
var userid = $("#userlistselection").find(":selected").val();
2020-11-19 22:44:19 +01:00
var password = $("#passwordfield").val();
2020-11-19 23:00:09 +01:00
var modus = $("#modus").val();
tryAuthenticate(userid,password,modus);
2020-11-19 22:44:19 +01:00
});
$("#logoutbutton").off("click").on("click", function (e) {
e.stopImmediatePropagation();
e.preventDefault();
doLogout();
});
2020-11-19 23:12:30 +01:00
2020-11-19 22:52:43 +01:00
$(".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();
2020-11-19 22:44:19 +01:00
}
2020-11-19 22:47:44 +01:00
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 {
2020-11-19 23:14:58 +01:00
setTimeout(function(){document.location.href = "install.html?v=2.0.3"},500);
2020-11-19 23:12:30 +01:00
}
}
function askForCompanyInfo() {
doAjax("GET", "php/contenthandler.php?module=admin&command=askforcompanyinfo", null, handleCompanyInfo, null);
}
function handleCompanyInfo(answer) {
if (answer.status == "OK") {
2020-11-19 23:12:39 +01:00
companyInfo = answer.msg.companyinfo;
var logolocation = answer.msg.logolocation;
if (logolocation == 0) {
$("#toplogolocation").hide();
$("#middlelogolocation").hide();
} else if (logolocation == 1) {
$("#toplogolocation").show();
$("#middlelogolocation").hide();
} else if (logolocation == 2) {
$("#toplogolocation").hide();
$("#middlelogolocation").show();
}
2020-11-19 22:47:44 +01:00
}
}
function useInstallation() {
2020-11-19 23:14:02 +01:00
var urlsuffix = urlsuffix = location.search;
if (urlsuffix.indexOf('a=') >= 0) {
var authInfo = getUrlGetParameter(urlsuffix,"a=");
var parts = authInfo.split("_");
var hash = parts[0];
var userid = parts[1];
tryAuthenticate(userid,hash,2);
} else {
initializeMainMenu("#modulemenu");
hideMenu();
askAndFillUserList();
isUserAlreadyLoggedIn();
binding();
askForCompanyInfo();
}
2020-11-19 22:47:44 +01:00
}
$(document).on("pageinit", "#index-page", function () {
startInstallationOrUseIt();
2020-11-19 22:44:19 +01:00
});
</script>
2020-11-19 23:11:29 +01:00
<div data-role="page" id="index-page" data-theme="c">
2020-11-19 22:44:19 +01:00
<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">
2020-11-19 23:02:16 +01:00
<li data-role="list-divider" data-theme="b" data-role="heading">Hauptmenü</li>
2020-11-19 22:44:19 +01:00
</ul>
</div><!-- /panel -->
2020-11-19 23:11:29 +01:00
<div data-role="header" data-theme="b" data-position="fixed" id="theheader" style="background-color:black;">
2020-11-19 23:14:48 +01:00
<h1>OrderSprinter <img src="img/connection.png" class="connectionstatus" style="display:none;" /> <img src="img/printerstatus.png" class="printerstatus" style="display:none;" /> <img src="img/tsestatus.png" class="tsestatus" style="display:none;" /> </h1>
2020-11-19 22:44:19 +01:00
<div data-type="horizontal" style="top:0px;position:absolute;float:right;z-index:10;display:inline;" align="right" class="ui-btn-right">
2020-11-19 23:02:16 +01:00
<a href="#" data-role="button" data-icon="arrow-d" data-ajax="false" id="menuswitch">Hauptmenü</a>
2020-11-19 22:44:19 +01:00
</div>
</div>
<div data-role="content">
2020-11-19 23:14:58 +01:00
<p><div id="toplogolocation" style="text-align: center;display:none;"><img src="php/contenthandler.php?module=printqueue&command=getLogoAsPngWithAlphaChannel&v=2.0.3&style=always" style="max-height:150px;"/></div>
2020-11-19 22:44:19 +01:00
<div data-role="collapsible" data-content-theme="c" data-collapsed="false" data-theme="e" id="loginmask">
2020-11-19 23:12:30 +01:00
<H2>Anmelden</H2>
2020-11-19 23:12:39 +01:00
2020-11-19 23:14:58 +01:00
<p><div id="middlelogolocation" style="text-align: left;padding-left: 80px;padding-right:80px;display:none;"><img src="php/contenthandler.php?module=printqueue&command=getLogoAsPngWithAlphaChannel&v=2.0.3&style=always" style="max-height:150px;"/></div>
2020-11-19 22:44:19 +01:00
2020-11-19 23:14:48 +01:00
<div class="loginarea">
2020-11-19 22:44:19 +01:00
<form method="post">
2020-11-19 23:14:48 +01:00
<table class="logintable">
<tr><td class="formlabel">Name: <td id="userlist"></tr>
<tr><td class="formlabel">Modus: <td id="moduscell">
2020-11-19 23:00:09 +01:00
<select name="modus" id="modus" data-theme="e">
<option value="0">Mobil</option>
2020-11-19 23:12:00 +01:00
<option value="1">Desktop (Firefox)</option>
2020-11-19 23:00:09 +01:00
</select></tr>
2020-11-19 23:14:48 +01:00
<tr><td class="formlabel">Passwort: <td><input type="password" name="password" id="passwordfield" style="background:white;"/>
2020-11-19 22:54:12 +01:00
<!-- place for info -->
2020-11-19 23:14:48 +01:00
</tr>
2020-11-19 22:52:43 +01:00
</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>
2020-11-19 23:14:48 +01:00
<table border=0 style="width:100%;">
<tr><td align=center><input type="submit" value="Anmelden" id="loginbutton" data-theme="e"/></tr>
2020-11-19 22:44:19 +01:00
</table>
2020-11-19 22:52:43 +01:00
2020-11-19 22:44:19 +01:00
</form>
2020-11-19 23:14:48 +01:00
</div> <!-- loginarea -->
2020-11-19 22:44:19 +01:00
</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">
2020-11-19 23:00:09 +01:00
<a class="ui-btn ui-btn-e ui-btn-icon-right ui-icon-carat-r" href="logout.php" target="_top">Abmelden</a>
2020-11-19 22:44:19 +01:00
</form>
</div>
</div>
2020-11-19 22:54:12 +01:00
<div id=demoarea></div>
2020-11-19 23:11:29 +01:00
<div data-role="footer" data-theme="b" id="thefooterr" style="background-color:black;">
2020-11-19 22:44:19 +01:00
<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>