From d83698336cb39d9898b262c23dffc65bdf55158d Mon Sep 17 00:00:00 2001 From: Daniel Schick Date: Thu, 4 Feb 2021 13:41:34 +0100 Subject: [PATCH 1/3] erster primitiver Test ohne DB Anbindung --- test/config.php | 7 +++++++ test/onsen_ui/favicon.ico | Bin 1406 -> 0 bytes test/onsen_ui/index.html | 20 ++++++++++++++++++- test/onsen_ui/manifest.json | 17 +++++++++++++++++ test/onsen_ui/sw.js | 37 ++++++++++++++++++++++++++++++++++++ 5 files changed, 80 insertions(+), 1 deletion(-) create mode 100644 test/config.php delete mode 100644 test/onsen_ui/favicon.ico create mode 100644 test/onsen_ui/manifest.json create mode 100644 test/onsen_ui/sw.js diff --git a/test/config.php b/test/config.php new file mode 100644 index 0000000..087aeb0 --- /dev/null +++ b/test/config.php @@ -0,0 +1,7 @@ + \ No newline at end of file diff --git a/test/onsen_ui/favicon.ico b/test/onsen_ui/favicon.ico deleted file mode 100644 index 3bf118981d4a105f895ec8b556c53e1effb02a4d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1406 zcmb7^Sx{4F0EG_^o#~@beeRREMK&Yu;=X_yKqxN7EhfM)HY9{p>gY(6l$%>Zazjjj zvPNVl0*w(eAs`@Rs6<3sD5aD-ZKqE6b!unm!MBc2{qLOr{L8)Pd`}mM;Im@I5|)SZ zHQ){UDryDwCKZ9#IRgn1FYT2nGV&l+txCk|)k#>h<|x*#Rbbt^6v$-9v3`9Tm5!*W z3`9qtL`=+S#Kyi&Wm0FcVZ*Y{LoQch%L&U*GWu*;2o`>s<(*uTFB2M*k%igEB@G5vjd2@W4F!J$I} zT|i>u2S`dP#gQXrICe~;>^OSV0fnNRav(X`iIfxYO0rA_xO&7?|5+LOc&QZTzi@4W8Qt{^)j!IclUYcr!OmjvuC@hdpLjIi*x6E zbRYM9xNxBtN@X9{exCX10eU~r{J3~A0F|nr`yls0sMX6p$g@GNhme&uKs`Wq_7HM% zmNkOh+!0*5GzyI-1f6ai`T650D44+I%V882KE{VP+MDzy1F{l*Vm(=p#g5U8@F%YMq^_m?%cV9 zrluw|H#eiDr3J06t!Qg&LwkEWIyySw@p#bH)rFp(9(cW8__ahJp;QIBa zFdCmJBMn^{x3WYE}K8{C^9${i)0^x8NlarH}nwrA&^fYE> zW-vQDi@CWu%+JqbVBiIFUNGk$Jbbu>v9Tp)Eb;p#EG#TwadGkGf57_RVG(RL(IVMI zqp`?n;$+epP5L5(-Y7_VeUV9Uxg=GVV6rEc{>GUQ+Gz$j3miK~Qo1<1Lv-Kv6MU + + + Onsen UI Test + - Click this + + + +
Home
+
+ Hallo wach + Click this +
\ No newline at end of file diff --git a/test/onsen_ui/manifest.json b/test/onsen_ui/manifest.json new file mode 100644 index 0000000..dc85d50 --- /dev/null +++ b/test/onsen_ui/manifest.json @@ -0,0 +1,17 @@ +{ + "name": "AST Kanister App", + "short_name": "AST App", + "start_url": "/", + "display": "standalone", + "theme_color": "#ef4e2a", + "background_color": "#fff", + "icons": [{ + "src": "https://via.placeholder.com/192x192", + "sizes": "192x192", + "type": "image/png" + },{ + "src": "https://via.placeholder.com/512x512", + "sizes": "512x512", + "type": "image/png" + }] + } \ No newline at end of file diff --git a/test/onsen_ui/sw.js b/test/onsen_ui/sw.js new file mode 100644 index 0000000..a11a40b --- /dev/null +++ b/test/onsen_ui/sw.js @@ -0,0 +1,37 @@ +// Service Worker +// hier wird alles lokal gespeichert +// der "install" event wird beim ServiceWorker Startup aufgerufen + +self.addEventListener('install', function(e) { + console.log('install'); + + // waitUntil tells the browser that the install event is not finished until we have + // cached all of our files + e.waitUntil( + // Here we call our cache "myonsenuipwa", but you can name it anything unique + caches.open('myonsenuipwa').then(cache => { + // If the request for any of these resources fails, _none_ of the resources will be + // added to the cache. + return cache.addAll([ + '/', + '/index.html', + '/manifest.json', + 'https://unpkg.com/onsenui/css/onsenui.min.css', + 'https://unpkg.com/onsenui/css/onsen-css-components.min.css', + 'https://unpkg.com/onsenui/js/onsenui.min.js' + ]); + }) + ); + +}); + + +// der fetch event wird abgefangen und stattdessen die lokale Datei geliefert + +self.addEventListener('fetch', function(e) { + console.log('fetch'); + e.respondWith( + caches.match(e.request) + .then(response => response || fetch(e.request)) + ); +}); \ No newline at end of file From b5b623afcb90bf7c1c8a656ed2a418146d1a06d7 Mon Sep 17 00:00:00 2001 From: Daniel Schick Date: Thu, 4 Feb 2021 14:59:33 +0100 Subject: [PATCH 2/3] Added Test-code: Table loading --- ReadMe.md | 3 +++ test/config.php | 8 ++++--- test/onsen_ui/employee.php | 44 ++++++++++++++++++++++++++++++++++++++ test/onsen_ui/index.html | 14 ++++++++++++ test/onsen_ui/test.php | 5 +++++ 5 files changed, 71 insertions(+), 3 deletions(-) create mode 100644 test/onsen_ui/employee.php create mode 100644 test/onsen_ui/test.php diff --git a/ReadMe.md b/ReadMe.md index 971a8e0..44d42e0 100644 --- a/ReadMe.md +++ b/ReadMe.md @@ -1 +1,4 @@ # Projekt Datenerfassung für AST Kanister + +Onsen UI Tutorial: https://onsen.io/v2/guide/pwa/tutorial.html#onsen-ui-pwa-tutorial + diff --git a/test/config.php b/test/config.php index 087aeb0..0fa2dbf 100644 --- a/test/config.php +++ b/test/config.php @@ -1,7 +1,9 @@ \ No newline at end of file diff --git a/test/onsen_ui/employee.php b/test/onsen_ui/employee.php new file mode 100644 index 0000000..d0fb8f3 --- /dev/null +++ b/test/onsen_ui/employee.php @@ -0,0 +1,44 @@ +"; + echo "IdFirst nameLast nameFunctionAuthE-MailPhoneMobile"; + echo "" . PHP_EOL; + + while($row = mysqli_fetch_array($result)) { + echo ""; + echo "" . $row['id'] . "" . PHP_EOL; + echo "" . $row['first_name'] . "" . PHP_EOL; + echo "" . $row['last_name'] . "" . PHP_EOL; + echo "" . $row['function'] . "" . PHP_EOL; + echo "" . $row['authorization'] . "" . PHP_EOL; + echo "" . $row['email'] . "" . PHP_EOL; + echo "" . $row['phone'] . "" . PHP_EOL; + echo "" . $row['mobile'] . "" . PHP_EOL; + echo ""; + } + + mysqli_close($con); + + break; + default: + echo "no cmd"; + break; + } + +?> \ No newline at end of file diff --git a/test/onsen_ui/index.html b/test/onsen_ui/index.html index 665247a..96d6a25 100644 --- a/test/onsen_ui/index.html +++ b/test/onsen_ui/index.html @@ -15,6 +15,18 @@ .then(() => console.log('Service worker registered')) .catch(e => console.log(e)); } + + function loadData() { + var xmlhttp = new XMLHttpRequest(); + xmlhttp.onreadystatechange = function() { + if(this.readyState == 4 && this.status == 200) { + document.getElementById("employeeList").innerHTML = this.responseText; + } + }; + xmlhttp.open("GET", "employee.php?op=load", true); + xmlhttp.send(); + } + @@ -25,6 +37,8 @@ Hallo wach Click this + Load data +
list of employees will be loaded here
\ No newline at end of file diff --git a/test/onsen_ui/test.php b/test/onsen_ui/test.php new file mode 100644 index 0000000..c880668 --- /dev/null +++ b/test/onsen_ui/test.php @@ -0,0 +1,5 @@ + \ No newline at end of file From 1e38404160291899eca244c98370e95ee9c803bc Mon Sep 17 00:00:00 2001 From: Daniel Schick Date: Thu, 4 Feb 2021 15:54:26 +0100 Subject: [PATCH 3/3] etwas weiter verfeinert --- test/onsen_ui/employee.php | 10 +++++----- test/onsen_ui/index.html | 12 +++++++++++- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/test/onsen_ui/employee.php b/test/onsen_ui/employee.php index d0fb8f3..16790aa 100644 --- a/test/onsen_ui/employee.php +++ b/test/onsen_ui/employee.php @@ -15,13 +15,13 @@ } $sql = "SELECT * FROM employee ORDER BY id"; $result = mysqli_query($con, $sql); - - echo ""; + + echo ""; echo "IdFirst nameLast nameFunctionAuthE-MailPhoneMobile"; - echo "" . PHP_EOL; + echo "" . PHP_EOL; while($row = mysqli_fetch_array($result)) { - echo ""; + echo ""; echo "" . $row['id'] . "" . PHP_EOL; echo "" . $row['first_name'] . "" . PHP_EOL; echo "" . $row['last_name'] . "" . PHP_EOL; @@ -30,7 +30,7 @@ echo "" . $row['email'] . "" . PHP_EOL; echo "" . $row['phone'] . "" . PHP_EOL; echo "" . $row['mobile'] . "" . PHP_EOL; - echo ""; + echo ""; } mysqli_close($con); diff --git a/test/onsen_ui/index.html b/test/onsen_ui/index.html index 96d6a25..f446845 100644 --- a/test/onsen_ui/index.html +++ b/test/onsen_ui/index.html @@ -27,6 +27,10 @@ xmlhttp.send(); } + function addEmployee() { + + } + @@ -34,11 +38,17 @@
Home
+
+ +
Hallo wach Click this Load data -
list of employees will be loaded here
+ + Employees +
list of employees will be loaded here
+
\ No newline at end of file