ordersprinter/index.html

183 lines
5.8 KiB
HTML

<html>
<head>
<head>
<title>Ansicht Startseite</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" href="css/bestformat.css">
<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>
function fillUserList(userinfo) {
var text = '<div class="ui-field-contain">';
text += '<select name="userlistselection" id="userlistselection" data-theme="f">';
$.each(userinfo, function (i, aUser) {
var username = aUser.username;
text += '<option>' + username + '</option>';
});
text += '</select>';
$("#userlist").html(text);
$("#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(username,password) {
var data = {
username: username,
password: password
};
doAjax("POST", "php/contenthandler.php?module=admin&command=tryAuthenticate", data, displayLoginOrLogoutMask, "Loginstatus" );
}
function displayLoginOrLogoutMask(jsonContent) {
if (jsonContent == "YES") {
// no login mask!
$("#loginmask").hide();
$("#logoutarea").show();
// forward to valid page!
doAjax("GET","php/contenthandler.php?module=admin&command=getViewAfterLogin",null,goToView,"Einstiegsseite nicht bekommen");
} else {
// user needs to log in!
$("#logoutarea").hide();
$("#invalidusercredentials").popup( "open", {transition: 'flip'} );
}
}
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() {
$("#loginbutton").off("click").on("click", function (e) {
e.stopImmediatePropagation();
e.preventDefault();
var username = $("#userlistselection").find(":selected").text();
var password = $("#passwordfield").val();
tryAuthenticate(username,password);
});
$("#logoutbutton").off("click").on("click", function (e) {
e.stopImmediatePropagation();
e.preventDefault();
doLogout();
});
}
//pageinit event for first page
//triggers only once
//write all your on-load functions and event handlers pertaining to page1
$(document).on("pageinit", "#index-page", function () {
initializeMainMenu("#modulemenu");
hideMenu();
askAndFillUserList();
isUserAlreadyLoggedIn();
binding();
});
</script>
<div data-role="page" id="index-page">
<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">Module</li>
</ul>
</div><!-- /panel -->
<div data-role="header" data-theme="b" data-position="fixed" id="theheader">
<h1>Info</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">Module</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>Passwort: <td><input type="password" name="password" id="passwordfield"/><tr />
<tr><td colspan=2 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">
<input type="submit" value="Abmelden" id="logoutbutton" data-theme="d"/>
</form>
</div>
</div>
<div data-role="footer" data-theme="b" id="thefooterr">
<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 data-role="popup" id="invalidusercredentials" name="invalidusercredentials" data-overlay-theme="a" style="max-width:70%;" class="ui-corner-all">
<div data-role="header" class="ui-corner-top">
<h1>Ungültiges Passwort</h1>
</div>
<a href="#" data-rel="back" data-role="button" data-theme="a" data-icon="delete" data-iconpos="notext" class="ui-btn-right"></a>
<div data-role="content" class="ui-corner-bottom ui-content">
<p>Bitte prüfen Sie, ob Sie den richtigen Benutzer ausgewählt und das Passwort korrekt eingegeben haben.</p>
</div>
</div> <!-- popup for failed password change -->
</div>
</body>
</html>