diff options
| -rw-r--r-- | css/index.css | 10 | ||||
| -rw-r--r-- | index.html | 38 | ||||
| -rw-r--r-- | js/index.js | 24 |
3 files changed, 61 insertions, 11 deletions
diff --git a/css/index.css b/css/index.css index d1fce0d..627220e 100644 --- a/css/index.css +++ b/css/index.css @@ -29,10 +29,20 @@ body { /* Portrait layout (default) */ .app { + position: fixed; + top: 0; + bottom: 0; + left: 0; + right: 0; } /* Landscape layout (with min-width) */ @media screen and (min-aspect-ratio: 1/1) and (min-width:400px) { .app { + position: fixed; + top: 0; + bottom: 0; + left: 0; + right: 0; } } @@ -28,17 +28,33 @@ </head> <body> <div class="app"> - <figure class="Login"> - <x-appbar> - <h1>WvS VPlan | Login</h1> - <button>=</button> - </x-appbar> - <x-layout> - <section> - Hallo Welt - </section> - </x-layout> - </figure> + <x-flipbox id="viewFlipBox"> + <div> + <x-appbar> + <h1>WvS VPlan | Login</h1> + <button>=</button> + </x-appbar> + <x-layout> + <form action="javascript:document.getElementById('viewFlipBox').toggle();" onsubmit="login()"> + <section> + <input type="text" id="username" hint="Benutzername" autofocus required> + <input type="password" id="password" hint="Passwort" required> + <input type="submit" value="Einloggen" > + </section> + </form> + </x-layout> + </div> + <div> + <x-appbar> + <button onclick="javascript:document.getElementById('viewFlipBox').toggle();">←</button> + <h1>WvS VPlan | Vertretungsplan</h1> + <button>=</button> + </x-appbar> + <x-layout> + Hier steht der V-Plan. + </x-layout> + </div> + </x-flipbox> </div> <script type="text/javascript" src="phonegap.js"></script> <script type="text/javascript" src="js/index.js"></script> diff --git a/js/index.js b/js/index.js index 1f239e8..ab4d48e 100644 --- a/js/index.js +++ b/js/index.js @@ -16,6 +16,30 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ +function login(){ + var req = new XMLHttpRequest(); + + var username = encodeURIComponent(document.getElementById('username').value); + var password = encodeURIComponent(document.getElementById('password').value); + var params = "username=" + username + "&password=" + password; + + req.onreadystatechange = function(){ + if(req.readyState == 4){ + if(req.status == 0){ + console.log("Es fehlt die Berechtigung, um auf den Server zuzugreifen."); + }else if(req.status != 200 || window.location.href.indexOf("http") != -1){ + console.log("Etwas ist schiefgelaufen :("); + }else{ + console.log('Request erfolgreich'); + } + } + } + + req.open("POST", "https://***REMOVED***/moodle/login/index.php", true); + req.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); + req.send(params); +} + var app = { // Application Constructor initialize: function() { |
