www-thermferm/maintenance.php

changeset 709
5b6d7b640e52
parent 708
13555c27b592
child 710
abe60578d695
equal deleted inserted replaced
708:13555c27b592 709:5b6d7b640e52
1 <?php
2 /*****************************************************************************
3 * Copyright (C) 2014-2022
4 *
5 * Michiel Broek <mbroek at mbse dot eu>
6 *
7 * This file is part of ThermFerm
8 *
9 * This is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the
11 * Free Software Foundation; either version 2, or (at your option) any
12 * later version.
13 *
14 * ThermFerm is distributed in the hope that it will be useful, but
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with ThermFerm; see the file COPYING. If not, write to the Free
21 * Software Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
22 *****************************************************************************/
23
24 require_once('utilities.php');
25 /*
26 * Look for the style names in the jqwidgets/styles directory.
27 */
28 $my_style = 'ui-redmond';
29
30 $answer = send_cmd('GLOBAL GET');
31 $arr = explode("\r\n", $answer);
32 $version = "?";
33 $simula = false;
34
35 if (startsWith($arr[0], "213")) {
36 $j = 1;
37 while (1) {
38 if (strcmp($arr[$j], ".") == 0)
39 break;
40 $f = explode(",", $arr[$j]);
41
42 if ($f[0] == "RELEASE")
43 $version = $f[1];
44 $j++;
45 }
46 }
47
48 /*
49 * See if the server supports simulators
50 */
51 if (send_cmd_check("SIMULATOR LIST") == 0)
52 $simula = true;
53
54 $outstr = '<!DOCTYPE html>'.PHP_EOL;
55 $outstr .= '<html>'.PHP_EOL;
56 $outstr .= ' <head>'.PHP_EOL;
57 $outstr .= ' <meta http-equiv="content-type" content="text/html; charset=utf-8" />'.PHP_EOL;
58 $outstr .= ' <title>ThermFerm - Maintenance Menu</title>'.PHP_EOL;
59 $outstr .= ' <link type="text/css" href="css/style.css" rel="stylesheet" media="all" />'.PHP_EOL;
60 $outstr .= ' <link type="text/css" href="jqwidgets/styles/jqx.base.css" rel="stylesheet" />'.PHP_EOL;
61 $outstr .= ' <link type="text/css" href="jqwidgets/styles/jqx.'.$my_style.'.css" rel="stylesheet" />'.PHP_EOL;
62 $outstr .= ' <script type="text/javascript" src="js/jquery-2.1.1.min.js"></script>'.PHP_EOL;
63 $outstr .= ' <script type="text/javascript" src="jqwidgets/jqxcore.js"></script>'.PHP_EOL;
64 $outstr .= ' <script type="text/javascript" src="jqwidgets/jqxwindow.js"></script>'.PHP_EOL;
65 $outstr .= ' <script type="text/javascript" src="jqwidgets/jqxbuttons.js"></script>'.PHP_EOL;
66 $outstr .= ' </head>'.PHP_EOL;
67 $outstr .= ' <body class="default">'.PHP_EOL;
68 $outstr .= ' <div id="jqxWidget">'.PHP_EOL;
69 $outstr .= ' <div id="header">'.PHP_EOL;
70 $outstr .= ' <div id="title">'.PHP_EOL;
71 $outstr .= ' ThermFerm '.$version.PHP_EOL;
72 $outstr .= ' </div>'.PHP_EOL;
73 $outstr .= ' <form action="index.php" style="margin:30px; float:right">'.PHP_EOL;
74 $outstr .= ' <input type="submit" id="maintenance" value="Dashboard" />'.PHP_EOL;
75 $outstr .= ' </form>'.PHP_EOL;
76 $outstr .= ' </div> <!-- header -->'.PHP_EOL;
77 $outstr .= ' <div id="content">'.PHP_EOL;
78 $outstr .= ' <div id="menu">'.PHP_EOL;
79 $outstr .= ' <div id="menu_header">'.PHP_EOL;
80 $outstr .= ' Maintenance Menu'.PHP_EOL;
81 $outstr .= ' </div>'.PHP_EOL;
82 $outstr .= ' <div id="menu_left">'.PHP_EOL;
83 $outstr .= ' <form action="global.php" style="margin:20px;">'.PHP_EOL;
84 $outstr .= ' <input type="submit" id="global" value="Global Setup" />'.PHP_EOL;
85 $outstr .= ' </form>'.PHP_EOL;
86 $outstr .= ' <form action="devices.php" style="margin:20px;">'.PHP_EOL;
87 $outstr .= ' <input type="submit" id="devices" value="Devices Setup" />'.PHP_EOL;
88 $outstr .= ' </form>'.PHP_EOL;
89 $outstr .= ' </div>'.PHP_EOL;
90 $outstr .= ' <div id="menu_right">'.PHP_EOL;
91 $outstr .= ' <form action="units.php" style="margin:20px;">'.PHP_EOL;
92 $outstr .= ' <input type="submit" id="units" value="Fermentation Units" />'.PHP_EOL;
93 $outstr .= ' </form>'.PHP_EOL;
94 if ($simula) {
95 $outstr .= ' <form action="simulator.php" style="margin:20px;">'.PHP_EOL;
96 $outstr .= ' <input type="submit" id="simulator" value="Simulator Setup" />'.PHP_EOL;
97 $outstr .= ' </form>'.PHP_EOL;
98 }
99 $outstr .= ' </div>'.PHP_EOL;
100 $outstr .= ' </div>'.PHP_EOL;
101 $outstr .= ' <script type="text/javascript">'.PHP_EOL;
102 $outstr .= ' $(document).ready(function () {'.PHP_EOL;
103 $outstr .= ' $("#maintenance").jqxButton({ width: 150, height: 25, theme: \'ui-redmond\' });'.PHP_EOL;
104 $outstr .= ' $("#global").jqxButton({ width: 200, height: 25, theme: \'ui-redmond\' });'.PHP_EOL;
105 $outstr .= ' $("#devices").jqxButton({ width: 200, height: 25, theme: \'ui-redmond\' });'.PHP_EOL;
106 $outstr .= ' $("#units").jqxButton({ width: 200, height: 25, theme: \'ui-redmond\' });'.PHP_EOL;
107 if ($simula)
108 $outstr .= ' $("#simulator").jqxButton({ width: 200, height: 25, theme: \'ui-redmond\' });'.PHP_EOL;
109 $outstr .= ' });'.PHP_EOL;
110 $outstr .= ' </script>'.PHP_EOL;
111 $outstr .= build_footer();
112
113 echo $outstr;
114

mercurial