# HG changeset patch # User Michiel Broek # Date 1406323628 -7200 # Node ID f05601490415d2e8e58344e6cea1028af6c3fab1 # Parent 3453077622206d42ac59fc5043e217c1f7179cb4 Redesigned the web interface, one single app is too slow. The main dashboard will be a shiny ajax driven page, the setup pages will be simple and php only. Keep It Simple, Stupid. diff -r 345307762220 -r f05601490415 www-thermferm/css/style.css --- a/www-thermferm/css/style.css Thu Jul 24 23:14:20 2014 +0200 +++ b/www-thermferm/css/style.css Fri Jul 25 23:27:08 2014 +0200 @@ -29,10 +29,6 @@ } -#header button.script-status { - margin:10px; -} - #jqxWidget { width: 980px; height: 510px; @@ -40,9 +36,54 @@ } #header { - width: 980px; - height: 80px; + width: 978px; + height: 78px; + 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; + color: #ffffff; + font-weight: bold; +} + +#content { + width: 978px; + height: 428px; + float: left; + border: 1px solid; + border-color: #aaa; + border-radius: 5px 5px 5px 5px; +} + +#errors { + height: 60px; + width: 978px; float: left; + color: #ff0000; +} + +#etable { + height: 360px; + width: 978px; + float: left; +} + +table.setup { + margin-left: auto; + margin-right: auto; + border-collapse: collapse; +} + +tr.setup:nth-child(odd) { + background: #FFFFFF; +} + +tr.setup:nth-child(even) { + background: #CCFFFF; +} + +td.setup { + padding: 1px 3px 1px 3px; } #jqxTabs { @@ -51,7 +92,6 @@ float: left; } - #fermentor { height: 382px; width: 968px; diff -r 345307762220 -r f05601490415 www-thermferm/devices.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/www-thermferm/devices.php Fri Jul 25 23:27:08 2014 +0200 @@ -0,0 +1,88 @@ + + * + * This file is part of ThermFerm + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2, or (at your option) any + * later version. + * + * ThermFerm is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with ThermFerm; see the file COPYING. If not, write to the Free + * Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. + *****************************************************************************/ + +require_once('utilities.php'); + + +$sock = open_socket(); +if ($sock == false) { + echo ""; + return; +} + +socket_write($sock, "LIST BUS", 4096); +$answer = ""; +while (1) { + $line = socket_read($sock, 4096); + if ($line === '') + break; + $answer .= $line; +} +socket_close($sock); +$arr = explode("\r\n", $answer); + + +$outstr = ''.PHP_EOL; +$outstr .= ''.PHP_EOL; +$outstr .= ' '.PHP_EOL; +$outstr .= ' '.PHP_EOL; +$outstr .= ' ThermFerm monitor'.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; + +if (startsWith($arr[0], "212")) { + $j = 1; + while (1) { + if (strcmp($arr[$j], ".") == 0) + break; + $f = explode(",", $arr[$j]); + $outstr .= ' '.PHP_EOL; + $j++; + } +} + +$outstr .= '
AddressRefcntChipDescription
'.$f[0].''.$f[1].''.$f[2].''.$f[3].'
'.PHP_EOL; +$outstr .= '
'.PHP_EOL; +$outstr .= '
'.PHP_EOL; +$outstr .= '
'.PHP_EOL; +$outstr .= ' '.PHP_EOL; +$outstr .= ''.PHP_EOL; + +echo $outstr; + diff -r 345307762220 -r f05601490415 www-thermferm/getbus.php --- a/www-thermferm/getbus.php Thu Jul 24 23:14:20 2014 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,64 +0,0 @@ - - * - * This file is part of ThermFerm - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2, or (at your option) any - * later version. - * - * ThermFerm is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with ThermFerm; see the file COPYING. If not, write to the Free - * Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - *****************************************************************************/ - -require_once('utilities.php'); - - -$sock = open_socket(); -if ($sock == false) { - echo ""; - return; -} - -socket_write($sock, "LIST BUS", 4096); -$answer = ""; -while (1) { - $line = socket_read($sock, 4096); - if ($line === '') - break; - $answer .= $line; -} -socket_close($sock); -$arr = explode("\r\n", $answer); - - -$row = '['; - -/* We don't use json_encode because it doesn't work for our purpose */ -if (startsWith($arr[0], "212")) { - $j = 1; - while (1) { - if (strcmp($arr[$j], ".") == 0) - break; - if ($j > 1) - $row .= ','; - $f = explode(",", $arr[$j]); - $row .= '{"Address":"'.$f[0].'","Refcnt":"'.$f[1].'","Chip":"'.$f[2].'","Description":"'.$f[3].'"}'; - $j++; - } -} - -$row .= ']'; -echo $row; - -?> diff -r 345307762220 -r f05601490415 www-thermferm/getprofiles.php --- a/www-thermferm/getprofiles.php Thu Jul 24 23:14:20 2014 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,90 +0,0 @@ - - * - * This file is part of ThermFerm - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2, or (at your option) any - * later version. - * - * ThermFerm is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with ThermFerm; see the file COPYING. If not, write to the Free - * Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - *****************************************************************************/ - -require_once('utilities.php'); - - - -if (isset($_GET['update'])) { - /* - * Build the update command - */ - $update_cmd = "PROFILE ".$_GET['UUID'].",".$_GET['Name']; - - $sock = open_socket(); - if ($sock != false) { - /* - * Send command and absorb the result. - */ - socket_write($sock, $update_cmd, 4096); - while (1) { - $line = socket_read($sock, 4096); - if ($line === '') - break; - } - socket_close($sock); - } -} - - - -/* - * Get current profiles - */ -$sock = open_socket(); -if ($sock == false) { - echo ""; - return; -} - -socket_write($sock, "LIST PROFILES", 4096); -$answer = ""; -while (1) { - $line = socket_read($sock, 4096); - if ($line === '') - break; - $answer .= $line; -} -socket_close($sock); -$arr = explode("\r\n", $answer); -$row = '['; - - -/* We don't use json_encode because it doesn't work for our purpose */ -if (startsWith($arr[0], "212")) { - $j = 1; - while (1) { - if (strcmp($arr[$j], ".") == 0) - break; - if ($j > 1) - $row .= ','; - $f = explode(",", $arr[$j]); - $row .= '{"UUID":"'.$f[0].'","Name":"'.$f[1].'","Steps":"'.$f[2].'"}'; - $j++; - } -} - -$row .= ']'; -echo $row; - -?> diff -r 345307762220 -r f05601490415 www-thermferm/getunits.php --- a/www-thermferm/getunits.php Thu Jul 24 23:14:20 2014 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,64 +0,0 @@ - - * - * This file is part of ThermFerm - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2, or (at your option) any - * later version. - * - * ThermFerm is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with ThermFerm; see the file COPYING. If not, write to the Free - * Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - *****************************************************************************/ - -require_once('utilities.php'); - - -$sock = open_socket(); -if ($sock == false) { - echo ""; - return; -} - -socket_write($sock, "LIST", 4096); -$answer = ""; -while (1) { - $line = socket_read($sock, 4096); - if ($line === '') - break; - $answer .= $line; -} -socket_close($sock); -$arr = explode("\r\n", $answer); - - -$row = '['; - -/* We don't use json_encode because it doesn't work for our purpose */ -if (startsWith($arr[0], "212")) { - $j = 1; - while (1) { - if (strcmp($arr[$j], ".") == 0) - break; - if ($j > 1) - $row .= ','; - $f = explode(",", $arr[$j]); - $row .= '{"UUID":"'.$f[0].'","Name":"'.$f[1].'","Mode":"'.$f[2].'"}'; - $j++; - } -} - -$row .= ']'; -echo $row; - -?> diff -r 345307762220 -r f05601490415 www-thermferm/global.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/www-thermferm/global.php Fri Jul 25 23:27:08 2014 +0200 @@ -0,0 +1,53 @@ + + * + * This file is part of ThermFerm + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2, or (at your option) any + * later version. + * + * ThermFerm is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with ThermFerm; see the file COPYING. If not, write to the Free + * Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. + *****************************************************************************/ + + +$outstr = ''.PHP_EOL; +$outstr .= ''.PHP_EOL; +$outstr .= ' '.PHP_EOL; +$outstr .= ' '.PHP_EOL; +$outstr .= ' ThermFerm monitor'.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; + +echo $outstr; + diff -r 345307762220 -r f05601490415 www-thermferm/images/add.png Binary file www-thermferm/images/add.png has changed diff -r 345307762220 -r f05601490415 www-thermferm/images/close.png Binary file www-thermferm/images/close.png has changed diff -r 345307762220 -r f05601490415 www-thermferm/images/refresh.png Binary file www-thermferm/images/refresh.png has changed diff -r 345307762220 -r f05601490415 www-thermferm/images/search.png Binary file www-thermferm/images/search.png has changed diff -r 345307762220 -r f05601490415 www-thermferm/index.php --- a/www-thermferm/index.php Thu Jul 24 23:14:20 2014 +0200 +++ b/www-thermferm/index.php Fri Jul 25 23:27:08 2014 +0200 @@ -27,7 +27,6 @@ $my_style = 'ui-redmond'; require_once('liveview.php'); -require_once('maintenance_panel.php'); $outstr = ''.PHP_EOL; @@ -48,24 +47,19 @@ $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 .= liveview(); -$outstr .= maintenance_panel(); /* Create the tabs */ -$outstr .= ' '.PHP_EOL; +$outstr .= ' '.PHP_EOL; $outstr .= '
'.PHP_EOL; $outstr .= ' '.PHP_EOL; $outstr .= ''.PHP_EOL; diff -r 345307762220 -r f05601490415 www-thermferm/js/index.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/www-thermferm/js/index.js Fri Jul 25 23:27:08 2014 +0200 @@ -0,0 +1,29 @@ +/***************************************************************************** + * Copyright (C) 2014 + * + * Michiel Broek + * + * This file is part of ThermFerm + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2, or (at your option) any + * later version. + * + * ThermFerm is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with ThermFerm; see the file COPYING. If not, write to the Free + * Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. + *****************************************************************************/ + + +$(document).ready(function () { + // Create jqxTabs. + $("#jqxTabs").jqxTabs({ width: 978, height: 428, position: 'top', theme: 'ui-redmond'}); + $("#maintenance").jqxButton({ width: 150, height: 25, theme: 'ui-redmond' }); +}); + diff -r 345307762220 -r f05601490415 www-thermferm/js/main.js --- a/www-thermferm/js/main.js Thu Jul 24 23:14:20 2014 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,49 +0,0 @@ -/***************************************************************************** - * Copyright (C) 2014 - * - * Michiel Broek - * - * This file is part of ThermFerm - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation; either version 2, or (at your option) any - * later version. - * - * ThermFerm is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with ThermFerm; see the file COPYING. If not, write to the Free - * Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. - *****************************************************************************/ - - -function addEventListeners() { - $("#maintenance").mousedown(function () { - $("#maintenance_window").jqxWindow('open'); - }); -} - -function createMaintenance() { - $("#maintenance_window").jqxWindow({ - height: 400, width: 800, autoOpen: false, theme: 'ui-redmond', - position: { x:100, y:50 }, - resizable: false, isModal: true, modalOpacity: 0.5, - okButton: $("#maintenance_ok"), - initContent: function () { - $("#maintenance_ok").jqxButton({ width: 70, height: 25, theme: 'ui-redmond' }); - } - }); - $("#maintenance").jqxButton({ width: 150, height: 25, theme: 'ui-redmond' }); -} - -$(document).ready(function () { - // Create jqxTabs. - $("#jqxTabs").jqxTabs({ width: 978, height: 428, position: 'top', theme: 'ui-redmond'}); - addEventListeners(); - createMaintenance(); -}); - diff -r 345307762220 -r f05601490415 www-thermferm/js/maintenance_panel.js --- a/www-thermferm/js/maintenance_panel.js Thu Jul 24 23:14:20 2014 +0200 +++ b/www-thermferm/js/maintenance_panel.js Fri Jul 25 23:27:08 2014 +0200 @@ -62,7 +62,40 @@ { name: 'Name', type: 'string' }, { name: 'Steps', type: 'int' } ], + id: 'UUID', url: 'getprofiles.php', + insertrow: function (rowid, commit) { + var data = "insert=true&" + $.param({Name: rowid}); + $.ajax({ + dataType: 'json', + url: 'getprofiles.php', + data: data, + cache: false, + success: function (data, status, xhr) { + // insert command is executed. + commit(true); + }, + error: function(jqXHR, textStatus, errorThrown) { + commit(false); + } + }); + }, + deleterow: function (rowid, commit) { + var data = "delete=true&" + $.param({UUID: rowid}); + $.ajax({ + dataType: 'json', + url: 'getprofiles.php', + data: data, + cache: false, + success: function (data, status, xhr) { + // insert command is executed. + commit(true); + }, + error: function(jqXHR, textStatus, errorThrown) { + commit(false); + } + }); + }, updaterow: function (rowid, rowdata, commit) { // synchronize with the server - send update command var data = "update=true&UUID=" + rowdata.UUID + "&Name=" + rowdata.Name; @@ -89,12 +122,67 @@ theme: theme, columnsresize: true, editable: true, + showstatusbar: true, + renderstatusbar: function (statusbar) { + // appends buttons to the status bar. + var container = $("
"); + var addButton = $("
Add
"); + var deleteButton = $("
Delete
"); + var reloadButton = $("
Reload
"); + container.append(addButton); + container.append(deleteButton); + container.append(reloadButton); + statusbar.append(container); + addButton.jqxButton({ width: 60, height: 20 }); + deleteButton.jqxButton({ width: 65, height: 20 }); + reloadButton.jqxButton({ width: 65, height: 20 }); + // add new row. + addButton.click(function (event) { + /* + * Ask a new profile name using a popup window. + * Send "ADD PROFILE name" to the server using the getprofiles.php script. + * Refresh the data + */ + $("#jqxwindow_addprofile").jqxWindow('open'); + $("#jqxgrid_profiles").jqxGrid({ source: dataAdapter_profiles }); + }); + // delete selected row. + deleteButton.click(function (event) { + var selectedrowindex = $("#jqxgrid_profiles").jqxGrid('getselectedrowindex'); + var rowscount = $("#jqxgrid_profiles").jqxGrid('getdatainformation').rowscount; + var id = $("#jqxgrid_profiles").jqxGrid('getrowid', selectedrowindex); + $("#jqxgrid_profiles").jqxGrid('deleterow', id); + }); + // reload grid data. + reloadButton.click(function (event) { + $("#jqxgrid_profiles").jqxGrid({ source: dataAdapter_profiles }); + }); + }, columns: [ { text: 'UUID', editable: false, datafield: 'UUID', width: 280 }, { text: 'Name', datafield: 'Name', minwidth: 120 }, { text: 'Steps', editable: false, datafield: 'Steps', width: 50 } ] }); + $("#jqxwindow_addprofile").jqxWindow({ + theme: theme, + resizable: false, + isModal: true, + modalOpacity: 0.5, + autoOpen: false, + width: 210, + height: 180, + cancelButton: $("#profile_cancelButton"), + initContent: function () { + $("#profile_addButton").jqxButton({ width: 70, height: 25, theme: theme }); + $("#profile_cancelButton").jqxButton({ width: 70, height: 25, theme: theme }); + $("#profile_addButton").click(function () { + var id = $("#profile_inputField").val(); + $("#jqxgrid_profiles").jqxGrid('insertrow', id); + $("#jqxwindow_addprofile").jqxWindow('hide'); + }); + } + }); /* * Units diff -r 345307762220 -r f05601490415 www-thermferm/liveview.php --- a/www-thermferm/liveview.php Thu Jul 24 23:14:20 2014 +0200 +++ b/www-thermferm/liveview.php Fri Jul 25 23:27:08 2014 +0200 @@ -213,47 +213,7 @@ $outstr .= ' Fan'.PHP_EOL; $outstr .= ' '.PHP_EOL; $outstr .= ' '.PHP_EOL; - $outstr .= '
'.PHP_EOL; - $outstr .= ' '.PHP_EOL; - $outstr .= '
'.PHP_EOL; $outstr .= ' '.PHP_EOL; - - /* Fermentor maintenance window */ - $outstr .= ' '.PHP_EOL; - $outstr .= '
'.PHP_EOL; - $outstr .= '
'.PHP_EOL; - $outstr .= ' Fermentor Unit '.$unr.' Maintenance'.PHP_EOL; - $outstr .= '
'.PHP_EOL; - $outstr .= '
'.PHP_EOL; - $outstr .= ' Content'.PHP_EOL; - $outstr .= ' '.PHP_EOL; - $outstr .= ' '.PHP_EOL; - $outstr .= '
'.PHP_EOL; - $outstr .= '
'.PHP_EOL; - $outstr .= ' '.PHP_EOL; } @@ -314,5 +274,4 @@ } - ?> diff -r 345307762220 -r f05601490415 www-thermferm/maintenance.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/www-thermferm/maintenance.php Fri Jul 25 23:27:08 2014 +0200 @@ -0,0 +1,63 @@ + + * + * This file is part of ThermFerm + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2, or (at your option) any + * later version. + * + * ThermFerm is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with ThermFerm; see the file COPYING. If not, write to the Free + * Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. + *****************************************************************************/ + +/* + * Look for the style names in the jqwidgets/styles directory. + */ +$my_style = 'ui-redmond'; + +$outstr = ''.PHP_EOL; +$outstr .= ''.PHP_EOL; +$outstr .= ' '.PHP_EOL; +$outstr .= ' '.PHP_EOL; +$outstr .= ' ThermFerm monitor'.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 .= ' Content'.PHP_EOL; +$outstr .= ' '.PHP_EOL; +$outstr .= '
'.PHP_EOL; +$outstr .= '
'.PHP_EOL; +$outstr .= ' '.PHP_EOL; +$outstr .= ''.PHP_EOL; + +echo $outstr; + diff -r 345307762220 -r f05601490415 www-thermferm/maintenance_panel.php --- a/www-thermferm/maintenance_panel.php Thu Jul 24 23:14:20 2014 +0200 +++ b/www-thermferm/maintenance_panel.php Fri Jul 25 23:27:08 2014 +0200 @@ -55,6 +55,21 @@ $outstr .= ' '.PHP_EOL; $outstr .= '
'.PHP_EOL; $outstr .= '
'.PHP_EOL; + $outstr .= '
'.PHP_EOL; + $outstr .= '
'.PHP_EOL; + $outstr .= ' Add Profile
'.PHP_EOL; + $outstr .= '
'.PHP_EOL; + $outstr .= '
'.PHP_EOL; + $outstr .= ' Profile Name:
'.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; diff -r 345307762220 -r f05601490415 www-thermferm/profiles.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/www-thermferm/profiles.php Fri Jul 25 23:27:08 2014 +0200 @@ -0,0 +1,133 @@ + + * + * This file is part of ThermFerm + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2, or (at your option) any + * later version. + * + * ThermFerm is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with ThermFerm; see the file COPYING. If not, write to the Free + * Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. + *****************************************************************************/ + +require_once('utilities.php'); + +profile_admin(); +exit; + + +function profile_admin() { + if (isset($_GET['action'])) { + switch ($_GET['action']) { + default: break; + } + } elseif (isset($_POST['action'])) { + switch ($_POST['action']) { + default: break; + } + } else { + profile_list(); + } +} + + + +function profile_add() { + $cmd = "ADD PROFILE ".$_GET['Name']; + + $sock = open_socket(); + if ($sock != false) { + /* + * Send command and absorb the result. + */ + socket_write($sock, $update_cmd, 4096); + while (1) { + $line = socket_read($sock, 4096); + if ($line === '') + break; + } + socket_close($sock); + } +} + + + +function profile_update() { + /* + * Build the update command + */ + $update_cmd = "PROFILE ".$_GET['UUID'].",".$_GET['Name']; + + $sock = open_socket(); + if ($sock != false) { + /* + * Send command and absorb the result. + */ + socket_write($sock, $update_cmd, 4096); + while (1) { + $line = socket_read($sock, 4096); + if ($line === '') + break; + } + socket_close($sock); + } +} + + + +function profile_list() { + + $sock = open_socket(); + if ($sock == false) { + echo ""; + return; + } + + socket_write($sock, "LIST PROFILES", 4096); + $answer = ""; + while (1) { + $line = socket_read($sock, 4096); + if ($line === '') + break; + $answer .= $line; + } + socket_close($sock); + $arr = explode("\r\n", $answer); + + $outstr = build_header(); + + $outstr .= '
'.PHP_EOL; + $outstr .= '
'.PHP_EOL; + + $outstr .= '
'.PHP_EOL; + $outstr .= ' '.PHP_EOL; + $outstr .= ' '.PHP_EOL; + + if (startsWith($arr[0], "212")) { + $j = 1; + while (1) { + if (strcmp($arr[$j], ".") == 0) + break; + $f = explode(",", $arr[$j]); + $outstr .= ' '.PHP_EOL; + $j++; + } + } + + $outstr .= '
UUIDNameStepsspare
'.$f[0].''.$f[1].''.$f[2].'bla
'.PHP_EOL; + $outstr .= '
'.PHP_EOL; + $outstr .= build_footer(); + echo $outstr; +} + diff -r 345307762220 -r f05601490415 www-thermferm/units.php --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/www-thermferm/units.php Fri Jul 25 23:27:08 2014 +0200 @@ -0,0 +1,69 @@ + + * + * This file is part of ThermFerm + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2, or (at your option) any + * later version. + * + * ThermFerm is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with ThermFerm; see the file COPYING. If not, write to the Free + * Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. + *****************************************************************************/ + +require_once('utilities.php'); + + +$sock = open_socket(); +if ($sock == false) { + echo ""; + return; +} + +socket_write($sock, "LIST", 4096); +$answer = ""; +while (1) { + $line = socket_read($sock, 4096); + if ($line === '') + break; + $answer .= $line; +} +socket_close($sock); +$arr = explode("\r\n", $answer); + + +$outstr = build_header(); +$outstr .= '
'.PHP_EOL; +$outstr .= '
'.PHP_EOL; +$outstr .= '
'.PHP_EOL; + +$outstr .= ' '.PHP_EOL; +$outstr .= ' '.PHP_EOL; + +if (startsWith($arr[0], "212")) { + $j = 1; + while (1) { + if (strcmp($arr[$j], ".") == 0) + break; + $f = explode(",", $arr[$j]); + $outstr .= ' '.PHP_EOL; + $j++; + } +} + +$outstr .= '
UUIDNameMode
'.$f[0].''.$f[1].''.$f[2].'
'.PHP_EOL; +$outstr .= '
'.PHP_EOL; +$outstr .= build_footer(); + +echo $outstr; + diff -r 345307762220 -r f05601490415 www-thermferm/utilities.php --- a/www-thermferm/utilities.php Thu Jul 24 23:14:20 2014 +0200 +++ b/www-thermferm/utilities.php Fri Jul 25 23:27:08 2014 +0200 @@ -45,3 +45,38 @@ } + +function build_header() +{ + $outstr = ''.PHP_EOL; + $outstr .= ''.PHP_EOL; + $outstr .= ' '.PHP_EOL; + $outstr .= ' '.PHP_EOL; + $outstr .= ' ThermFerm monitor'.PHP_EOL; + $outstr .= ' '.PHP_EOL; + $outstr .= ' '.PHP_EOL; + $outstr .= ' '.PHP_EOL; + $outstr .= '
'.PHP_EOL; + $outstr .= ' '.PHP_EOL; + $outstr .= '
'.PHP_EOL; + + return $outstr; +} + + + +function build_footer() +{ + $outstr = '
'.PHP_EOL; + $outstr .= '
'.PHP_EOL; + $outstr .= ' '.PHP_EOL; + $outstr .= ''.PHP_EOL; + + return $outstr; +} + +