Merge branch 'master' of ssh://lager/mnt/ext/git/git_ast into master
This commit is contained in:
commit
f11926f725
@ -1 +1,4 @@
|
||||
# Projekt Datenerfassung für AST Kanister
|
||||
|
||||
Onsen UI Tutorial: https://onsen.io/v2/guide/pwa/tutorial.html#onsen-ui-pwa-tutorial
|
||||
|
||||
|
||||
9
test/config.php
Normal file
9
test/config.php
Normal file
@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
// define database connection params
|
||||
$host = 'totmann';
|
||||
$user = 'astUser';
|
||||
$pw = "astPasswd";
|
||||
$database = "ast";
|
||||
|
||||
?>
|
||||
44
test/onsen_ui/employee.php
Normal file
44
test/onsen_ui/employee.php
Normal file
@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
require_once('../config.php');
|
||||
// Controller for employee table
|
||||
|
||||
$op = $_GET['op'];
|
||||
|
||||
switch($op) {
|
||||
|
||||
case 'load':
|
||||
// load all employees from table
|
||||
$con = mysqli_connect($host, $user, $pw, $database);
|
||||
if(!$con) {
|
||||
die('Could not connect: ' . mysqli_error($con));
|
||||
}
|
||||
$sql = "SELECT * FROM employee ORDER BY id";
|
||||
$result = mysqli_query($con, $sql);
|
||||
|
||||
echo "<ons-list-item><ons-row>";
|
||||
echo "<ons-col>Id</ons-col><ons-col>First name</ons-col><ons-col>Last name</ons-col><ons-col>Function</ons-col><ons-col>Auth</ons-col><ons-col>E-Mail</ons-col><ons-col>Phone</ons-col><ons-col>Mobile</ons-col>";
|
||||
echo "</ons-row></ons-list-item>" . PHP_EOL;
|
||||
|
||||
while($row = mysqli_fetch_array($result)) {
|
||||
echo "<ons-list-item><ons-row>";
|
||||
echo "<ons-col>" . $row['id'] . "</ons-col>" . PHP_EOL;
|
||||
echo "<ons-col>" . $row['first_name'] . "</ons-col>" . PHP_EOL;
|
||||
echo "<ons-col>" . $row['last_name'] . "</ons-col>" . PHP_EOL;
|
||||
echo "<ons-col>" . $row['function'] . "</ons-col>" . PHP_EOL;
|
||||
echo "<ons-col>" . $row['authorization'] . "</ons-col>" . PHP_EOL;
|
||||
echo "<ons-col>" . $row['email'] . "</ons-col>" . PHP_EOL;
|
||||
echo "<ons-col>" . $row['phone'] . "</ons-col>" . PHP_EOL;
|
||||
echo "<ons-col>" . $row['mobile'] . "</ons-col>" . PHP_EOL;
|
||||
echo "</ons-row></ons-list-item>";
|
||||
}
|
||||
|
||||
mysqli_close($con);
|
||||
|
||||
break;
|
||||
default:
|
||||
echo "no cmd";
|
||||
break;
|
||||
}
|
||||
|
||||
?>
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 1.4 KiB |
@ -1,12 +1,54 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<link rel="stylesheet" href="https://unpkg.com/onsenui/css/onsenui.min.css">
|
||||
<link rel="stylesheet" href="https://unpkg.com/onsenui/css/onsen-css-components.min.css">
|
||||
<link rel="manifest" href="/manifest.json">
|
||||
<link rel="shortcut icon" href="#">
|
||||
<script src="https://unpkg.com/onsenui/js/onsenui.min.js"></script>
|
||||
<title>Onsen UI Test</title>
|
||||
<script>
|
||||
// das hier funktioniert nur wenn die Seite mit https:// ausgeliefert wird
|
||||
if('serviceWorker' in navigator) {
|
||||
navigator.serviceWorker.register('/sw.js')
|
||||
.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();
|
||||
}
|
||||
|
||||
function addEmployee() {
|
||||
|
||||
}
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<ons-page id="home">
|
||||
<ons-toolbar id="home-toolbar">
|
||||
<ons-icon icon="ion-navicon, material:md-menu"></ons-icon>
|
||||
<div class="center">Home</div>
|
||||
<div class="right">
|
||||
<ons-toolbar-button icon="plus" onclick="addEmployee()"></ons-toolbar-button>
|
||||
</div>
|
||||
</ons-toolbar>
|
||||
Hallo wach
|
||||
<ons-button onclick="alert('clickerick a ding dong')">Click this</ons-button>
|
||||
<ons-button onclick="loadData()">Load data</ons-button>
|
||||
<ons-list>
|
||||
<ons-list-header>Employees</ons-list-header>
|
||||
<div id="employeeList"><b>list of employees will be loaded here</b></div>
|
||||
</ons-list>
|
||||
</ons-page>
|
||||
</body>
|
||||
</html>
|
||||
17
test/onsen_ui/manifest.json
Normal file
17
test/onsen_ui/manifest.json
Normal file
@ -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"
|
||||
}]
|
||||
}
|
||||
37
test/onsen_ui/sw.js
Normal file
37
test/onsen_ui/sw.js
Normal file
@ -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))
|
||||
);
|
||||
});
|
||||
5
test/onsen_ui/test.php
Normal file
5
test/onsen_ui/test.php
Normal file
@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
phpinfo();
|
||||
|
||||
?>
|
||||
Loading…
Reference in New Issue
Block a user