# HG changeset patch # User Michiel Broek # Date 1533844321 -7200 # Node ID 1750b6cae48e9e6e684e744369edbbf5185d63d8 # Parent 37a8c7ec9d3e131e1e20adfba4e5770e71d7a6a8 Web pages nodes display works. diff -r 37a8c7ec9d3e -r 1750b6cae48e www/Makefile --- a/www/Makefile Wed Aug 08 16:35:05 2018 +0200 +++ b/www/Makefile Thu Aug 09 21:52:01 2018 +0200 @@ -3,7 +3,8 @@ include ../Makefile.global -SRC = version.php.in index.php +SRC = version.php.in index.php getfermenter.php getfermenters.php \ + getnode.php getnodes.php config.php.dist OTHER = Makefile ############################################################################# diff -r 37a8c7ec9d3e -r 1750b6cae48e www/css/style.css --- a/www/css/style.css Wed Aug 08 16:35:05 2018 +0200 +++ b/www/css/style.css Thu Aug 09 21:52:01 2018 +0200 @@ -19,10 +19,9 @@ } body { - background: #eee; + background: #ccc; color: #000; font-family: Verdana, Arial, sans-serif; - width: 1280px; font-size: 12px; margin: 0px; } @@ -30,129 +29,33 @@ #jqxWidget { width: 1280px; - height: 670px; + height: 660px; float: left; } #header { width: 1278px; - height: 48px; + height: 38px; float: left; border: 1px solid #4297d7; border-radius: 5px 5px 5px 5px; - background: #5c9ccc url(../jqwidgets/styles/images/redmond/ui-bg_gloss-wave_55_5c9ccc_500x100.png) 50% 50% repeat-x; + background: #5c9ccc url(/jqwidgets/styles/images/redmond/ui-bg_gloss-wave_55_5c9ccc_500x100.png) 50% 50% repeat-x; color: #ffffff; font-weight: bold; } #title { width: 1278px; - height: 40px; + height: 38px; float: left; - margin-top: 7px; + margin-top: 2px; font-size: 1.8em; color: #FFD700; text-align: center; font-family: comic sans ms; } -/* - -#content { - width: 978px; - height: 428px; - float: left; - border: 1px solid; - border-color: #aaa; - border-radius: 5px 5px 5px 5px; -} - -#errors { - height: 35px; - width: 978px; - float: left; - text-align: center; - font-size: 1.5em; - margin-top: 10px; - color: #ff0000; -} - -#etable { - height: 320px; - width: 978px; - float: left; - overflow: auto; -} - -#atable { - height: 60px; - width: 978px; - float: left; -} - -table.setup { - margin-left: auto; - margin-right: auto; - border-collapse: collapse; -} - -.trhead { - font-weight: bold; - background: #5c9ccc url(../jqwidgets/styles/images/redmond/ui-bg_gloss-wave_55_5c9ccc_500x100.png) 50% 50% repeat-x; -} - -tr.setup:nth-child(odd) { - background: #FFFFFF; -} - -tr.setup:nth-child(even) { - background: #CCFFFF; -} - -td.setup { - padding: 1px 3px 1px 3px; -} -*/ - -/* - * Editor screens - */ -/* -table.editor { - margin-left: auto; - margin-right: auto; - border-collapse: collapse; - background-color: #eee; -} - -tr.editor { - height: 30px; -} - -td.editname { - width: 150px; - padding: 1px 3px 1px 3px; -} - -td.editfield { - width: 300px; - padding: 1px 3px 1px 3px; -} - -td.editsub { - width: 50px; - padding: 1px 3px 1px 3px; -} - -#jqxTabs { - width: 980px; - height: 440px; - float: left; -} - -*/ - .LEDred_on { margin: 5px auto; diff -r 37a8c7ec9d3e -r 1750b6cae48e www/getfermenter.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/www/getfermenter.php Thu Aug 09 21:52:01 2018 +0200 @@ -0,0 +1,16 @@ +query($query); +//Copy result into a associative array +$resultArray = $result->fetch_array(MYSQLI_ASSOC); +echo json_encode($resultArray); diff -r 37a8c7ec9d3e -r 1750b6cae48e www/getnode.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/www/getnode.php Thu Aug 09 21:52:01 2018 +0200 @@ -0,0 +1,16 @@ +query($query); +//Copy result into a associative array +$resultArray = $result->fetch_array(MYSQLI_ASSOC); +echo json_encode($resultArray); diff -r 37a8c7ec9d3e -r 1750b6cae48e www/index.php --- a/www/index.php Wed Aug 08 16:35:05 2018 +0200 +++ b/www/index.php Thu Aug 09 21:52:01 2018 +0200 @@ -1,121 +1,184 @@ + + + ' + + Brewery Managment System v<?php echo $my_version; ?> + + + + + + + + + + + + + + '.PHP_EOL; -$outstr .= ' '.PHP_EOL; -$outstr .= ' '.PHP_EOL; -$outstr .= ' '.PHP_EOL; -$outstr .= ' '.PHP_EOL; -$outstr .= ' '.PHP_EOL; -$outstr .= ' '.PHP_EOL; -$outstr .= ' '.PHP_EOL; -$outstr .= ' '.PHP_EOL; -$outstr .= ' '.PHP_EOL; -$outstr .= ' '.PHP_EOL; -$outstr .= '
'.PHP_EOL; -$outstr .= ' '.PHP_EOL; -$outstr .= '
'.PHP_EOL; -$outstr .= '
'.PHP_EOL; -$outstr .= ' '.PHP_EOL; -$outstr .= '
'.PHP_EOL; -$outstr .= '
'.PHP_EOL; -$outstr .= '
'.PHP_EOL; -$outstr .= '
'.PHP_EOL; -$outstr .= '
'.PHP_EOL; -$outstr .= ' '.PHP_EOL; -$outstr .= ''.PHP_EOL; + $("#jqxTree").on("select", function (event) { + /* + * Process the selected id from the left panel tree and show the correct page in the right panel. + */ + var estr = event.args.element.id; + if (estr == "Root") { + $("#ContentPanel").html("
RrrR
"); + } else if (estr.indexOf("node-", 0) == 0) { + // Load and show a node. + // The parameter is: node-36d4d030-4d62-4f2f-a96b-472e643687f7 + var uuid = estr.substr(5); + var url = "getnode.php?uuid='" + uuid + "'"; + var source = { + datatype: "json", + datafields: [ + { name: 'record', type: 'int' }, + { name: 'uuid', type: 'string' }, + { name: 'node', type: 'string' }, + { name: 'online', type: 'string' }, + { name: 'group_id', type: 'string' }, + { name: 'hardwaremake', type: 'string' }, + { name: 'hardwaremodel', type: 'string' }, + { name: 'os', type: 'string' }, + { name: 'os_version', type: 'string' }, + { name: 'firmware', type: 'string' }, + { name: 'firstseen', type: 'string' }, + { name: 'lastseen', type: 'string' }, + { name: 'temperature', type: 'float' }, + { name: 'humidity', type: 'float' }, + { name: 'barometer', type: 'float' }, + { name: 'gps_latitude', type: 'float' }, + { name: 'gps_longitude', type: 'float' }, + { name: 'gps_altitude', type: 'float' }, + { name: 'net_address', type: 'string' }, + { name: 'net_ifname', type: 'string' }, + { name: 'net_rssi', type: 'int' } + ], + id: 'record', + url: url + }; + var dataAdapter = new $.jqx.dataAdapter(source, { + loadComplete: function (records) { + var record = dataAdapter.records[0]; + var html = "
"; + html += ""; + html += ""; + html += ""; + html += ""; + html += ""; + html += ""; + html += ""; + html += ""; + html += ""; + html += ""; + html += ""; + html += ""; + html += ""; + html += ""; + html += ""; + html += ""; + html += ""; + $("#ContentPanel").html(html); + } + /* Data formatteren etc. Zie https://www.jqwidgets.com/jquery-widgets-demo/demos/jqxdataadapter/index.htm#demos/jqxdataadapter/bindingtojson.htm */ + }); + dataAdapter.dataBind(); -echo $outstr; -?> + } else if (estr.indexOf("fermenter-", 0) == 0) { + var uuid = estr.substr(10); + $("#ContentPanel").html("
" + uuid + "
"); + } else if (event.args.element.id == "Nodes") { + $("#ContentPanel").html(aNode); + } else { + $("#ContentPanel").html("
" + event.args.element.id + "
"); + } + }); + }); + + + + +
+ +
+
+ +
+
+
+
+
+ +
Systeem overzicht
Uuid" + record.uuid + "
Systeem" + record.node + "
Online" + record.online + "
Type" + record.group_id + "
Hardware maker" + record.hardwaremake+ "
Hardware model" + record.harwaremodel+ "
OS" + record.os + " versie: " + record.os_version + "
Firmware" + record.firmware + "
Temperatuur" + record.temperature + "°C
Vochtigheid" + record.humidity + "%
Luchtdruk" + record.barometer + "
GPS"+ record.gps_latitude + " " + record.gps_longitude + " " + record.gps_altitude + "
Netwerk"+ record.net_ifname + " " + record.net_address + "