Sun, 28 Apr 2019 11:38:30 +0200
Changed 1-wire DS18B20 sensor error check.
333 | 1 | <?php |
537
4eebab50993e
Style fixes for the log chart. Removed png export button that doesn't work anymore.
Michiel Broek <mbroek@mbse.eu>
parents:
536
diff
changeset
|
2 | /** |
4eebab50993e
Style fixes for the log chart. Removed png export button that doesn't work anymore.
Michiel Broek <mbroek@mbse.eu>
parents:
536
diff
changeset
|
3 | * @file archives.php |
4eebab50993e
Style fixes for the log chart. Removed png export button that doesn't work anymore.
Michiel Broek <mbroek@mbse.eu>
parents:
536
diff
changeset
|
4 | * @brief Display as chart or download a fermentation logfile. |
4eebab50993e
Style fixes for the log chart. Removed png export button that doesn't work anymore.
Michiel Broek <mbroek@mbse.eu>
parents:
536
diff
changeset
|
5 | * @author Michiel Broek <mbroek at mbse dot eu> |
4eebab50993e
Style fixes for the log chart. Removed png export button that doesn't work anymore.
Michiel Broek <mbroek@mbse.eu>
parents:
536
diff
changeset
|
6 | * |
536
e833bbd5e733
Versie 0.6.5. LIST LOG <unit> commando verwijderd, alleen ARCHIVE LOG <unit> is nog in gebruik. De chiller temperatuur zit nu ook in de log en grafiek.
Michiel Broek <mbroek@mbse.eu>
parents:
517
diff
changeset
|
7 | * Copyright (C) 2015-2018 |
333 | 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. | |
537
4eebab50993e
Style fixes for the log chart. Removed png export button that doesn't work anymore.
Michiel Broek <mbroek@mbse.eu>
parents:
536
diff
changeset
|
22 | */ |
4eebab50993e
Style fixes for the log chart. Removed png export button that doesn't work anymore.
Michiel Broek <mbroek@mbse.eu>
parents:
536
diff
changeset
|
23 | |
333 | 24 | |
25 | require_once('utilities.php'); | |
357 | 26 | $my_style = 'ui-redmond'; |
333 | 27 | |
28 | if (isset($_GET['action'])) { | |
29 | switch ($_GET['action']) { | |
30 | case 'dl': archive_dl(); | |
31 | break; | |
32 | case 'view': archive_view(); | |
33 | break; | |
34 | default: break; | |
35 | } | |
36 | } else { | |
37 | archive_dir(); | |
38 | } | |
39 | ||
40 | exit; | |
41 | ||
42 | /**************************************************************************** | |
43 | * | |
44 | */ | |
45 | ||
357 | 46 | /* |
47 | * View an archived file in graph format | |
48 | */ | |
49 | function archive_view() { | |
50 | ||
51 | global $my_style; | |
52 | ||
53 | $name = urldecode($_GET['name']); | |
517
5fd12d9f3f84
Changed livescreen, now displays thermometers. The chart is loaded on request. This speeds up loading the application.
Michiel Broek <mbroek@mbse.eu>
parents:
397
diff
changeset
|
54 | $return = urldecode($_GET['return']); |
357 | 55 | |
56 | $answer = send_cmd('GLOBAL GET'); | |
57 | $arr = explode("\r\n", $answer); | |
58 | $version = "?"; | |
59 | ||
60 | if (startsWith($arr[0], "213")) { | |
61 | $j = 1; | |
62 | while (1) { | |
63 | if (strcmp($arr[$j], ".") == 0) | |
64 | break; | |
65 | $f = explode(",", $arr[$j]); | |
66 | ||
67 | if ($f[0] == "RELEASE") | |
68 | $version = $f[1]; | |
69 | $j++; | |
70 | } | |
71 | } | |
72 | ||
73 | $outstr = '<!DOCTYPE html>'.PHP_EOL; | |
74 | $outstr .= '<html>'.PHP_EOL; | |
75 | $outstr .= ' <head>'.PHP_EOL; | |
76 | $outstr .= ' <meta http-equiv="content-type" content="text/html; charset=utf-8" />'.PHP_EOL; | |
77 | $outstr .= ' <title>Archive View '.$name.'</title>'.PHP_EOL; | |
78 | $outstr .= ' <link type="text/css" href="css/style.css" rel="stylesheet" media="all" />'.PHP_EOL; | |
79 | $outstr .= ' <link type="text/css" href="jqwidgets/styles/jqx.base.css" rel="stylesheet" />'.PHP_EOL; | |
80 | $outstr .= ' <link type="text/css" href="jqwidgets/styles/jqx.'.$my_style.'.css" rel="stylesheet" />'.PHP_EOL; | |
81 | $outstr .= ' <script type="text/javascript" src="js/jquery-2.1.1.min.js"></script>'.PHP_EOL; | |
82 | $outstr .= ' <script type="text/javascript" src="jqwidgets/jqxcore.js"></script>'.PHP_EOL; | |
83 | $outstr .= ' <script type="text/javascript" src="jqwidgets/jqxwindow.js"></script>'.PHP_EOL; | |
84 | $outstr .= ' <script type="text/javascript" src="jqwidgets/jqxbuttons.js"></script>'.PHP_EOL; | |
85 | $outstr .= ' <script type="text/javascript" src="jqwidgets/jqxchart.core.js"></script>'.PHP_EOL; | |
86 | $outstr .= ' <script type="text/javascript" src="jqwidgets/jqxdraw.js"></script>'.PHP_EOL; | |
87 | $outstr .= ' <script type="text/javascript" src="jqwidgets/jqxdata.js"></script>'.PHP_EOL; | |
375
f707d22c72f8
In Archives, remove .log from download and view functions. Added new Save as PDF buttons.
Michiel Broek <mbroek@mbse.eu>
parents:
374
diff
changeset
|
88 | $outstr .= ' <script type="text/javascript" src="jqwidgets/jqxdata.export.js"></script>'.PHP_EOL; |
357 | 89 | $outstr .= ' </head>'.PHP_EOL; |
90 | ||
91 | $outstr .= ' <body class="default">'.PHP_EOL; | |
92 | $outstr .= ' <div id="jqxWidget">'.PHP_EOL; | |
93 | $outstr .= ' <div id="header">'.PHP_EOL; | |
94 | $outstr .= ' <div id="title">'.PHP_EOL; | |
95 | $outstr .= ' ThermFerm '.$version.PHP_EOL; | |
96 | $outstr .= ' </div>'.PHP_EOL; | |
517
5fd12d9f3f84
Changed livescreen, now displays thermometers. The chart is loaded on request. This speeds up loading the application.
Michiel Broek <mbroek@mbse.eu>
parents:
397
diff
changeset
|
97 | if ("$return" == "archives") { |
5fd12d9f3f84
Changed livescreen, now displays thermometers. The chart is loaded on request. This speeds up loading the application.
Michiel Broek <mbroek@mbse.eu>
parents:
397
diff
changeset
|
98 | $outstr .= ' <form action="archives.php" style="margin:30px; float:right">'.PHP_EOL; |
5fd12d9f3f84
Changed livescreen, now displays thermometers. The chart is loaded on request. This speeds up loading the application.
Michiel Broek <mbroek@mbse.eu>
parents:
397
diff
changeset
|
99 | $outstr .= ' <input type="submit" id="archives" value="Archives directory" />'.PHP_EOL; |
5fd12d9f3f84
Changed livescreen, now displays thermometers. The chart is loaded on request. This speeds up loading the application.
Michiel Broek <mbroek@mbse.eu>
parents:
397
diff
changeset
|
100 | } else { |
5fd12d9f3f84
Changed livescreen, now displays thermometers. The chart is loaded on request. This speeds up loading the application.
Michiel Broek <mbroek@mbse.eu>
parents:
397
diff
changeset
|
101 | $outstr .= ' <form action="index.php" style="margin:30px; float:right">'.PHP_EOL; |
5fd12d9f3f84
Changed livescreen, now displays thermometers. The chart is loaded on request. This speeds up loading the application.
Michiel Broek <mbroek@mbse.eu>
parents:
397
diff
changeset
|
102 | $outstr .= ' <input type="submit" id="archives" value="Dashboard" />'.PHP_EOL; |
5fd12d9f3f84
Changed livescreen, now displays thermometers. The chart is loaded on request. This speeds up loading the application.
Michiel Broek <mbroek@mbse.eu>
parents:
397
diff
changeset
|
103 | } |
357 | 104 | $outstr .= ' </form>'.PHP_EOL; |
105 | $outstr .= ' </div> <!-- header -->'.PHP_EOL; | |
106 | $outstr .= ' <div id="content">'.PHP_EOL; | |
107 | ||
108 | $outstr .= ' <script type="text/javascript">'.PHP_EOL; | |
109 | $outstr .= ' $(document).ready(function () {'.PHP_EOL; | |
110 | ||
111 | $outstr .= ' function getExportServer() {'.PHP_EOL; | |
568
eee0f52170e8
Switched export server to https
Michiel Broek <mbroek@mbse.eu>
parents:
539
diff
changeset
|
112 | $outstr .= ' return "https://www.jqwidgets.com/export_server/export.php";'.PHP_EOL; |
357 | 113 | $outstr .= ' }'.PHP_EOL; |
114 | ||
115 | $outstr .= ' var sourceA ='.PHP_EOL; | |
116 | $outstr .= ' {'.PHP_EOL; | |
117 | $outstr .= ' datatype: "json",'.PHP_EOL; | |
118 | $outstr .= ' datafields: ['.PHP_EOL; | |
374
20999ef6d487
Fixed php scripts for jqwidgets version 3.8.0
Michiel Broek <mbroek@mbse.eu>
parents:
359
diff
changeset
|
119 | $outstr .= ' { name: "Date", type: "date", format: "yyyy-MM-dd HH:mm" },'.PHP_EOL; |
357 | 120 | $outstr .= ' { name: "Mode" },'.PHP_EOL; |
121 | $outstr .= ' { name: "Air", type: "float" },'.PHP_EOL; | |
122 | $outstr .= ' { name: "Beer", type: "float" },'.PHP_EOL; | |
397
00ca08f5a6f8
Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents:
385
diff
changeset
|
123 | $outstr .= ' { name: "Target_lo", type: "float" },'.PHP_EOL; |
00ca08f5a6f8
Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents:
385
diff
changeset
|
124 | $outstr .= ' { name: "Target_hi", type: "float" },'.PHP_EOL; |
357 | 125 | $outstr .= ' { name: "Heater", type: "int" },'.PHP_EOL; |
126 | $outstr .= ' { name: "Cooler", type: "int" },'.PHP_EOL; | |
127 | $outstr .= ' { name: "HeatUse", type: "int" },'.PHP_EOL; | |
128 | $outstr .= ' { name: "CoolUse", type: "int" },'.PHP_EOL; | |
536
e833bbd5e733
Versie 0.6.5. LIST LOG <unit> commando verwijderd, alleen ARCHIVE LOG <unit> is nog in gebruik. De chiller temperatuur zit nu ook in de log en grafiek.
Michiel Broek <mbroek@mbse.eu>
parents:
517
diff
changeset
|
129 | $outstr .= ' { name: "Room", type: "float" },'.PHP_EOL; |
e833bbd5e733
Versie 0.6.5. LIST LOG <unit> commando verwijderd, alleen ARCHIVE LOG <unit> is nog in gebruik. De chiller temperatuur zit nu ook in de log en grafiek.
Michiel Broek <mbroek@mbse.eu>
parents:
517
diff
changeset
|
130 | $outstr .= ' { name: "Chiller", type: "float" }'.PHP_EOL; |
357 | 131 | $outstr .= ' ],'.PHP_EOL; |
375
f707d22c72f8
In Archives, remove .log from download and view functions. Added new Save as PDF buttons.
Michiel Broek <mbroek@mbse.eu>
parents:
374
diff
changeset
|
132 | $outstr .= ' url: \'getalog.php?name='.urlencode($name).'.log\''.PHP_EOL; |
357 | 133 | $outstr .= ' };'.PHP_EOL; |
134 | ||
135 | $outstr .= ' var dataAdapter = new $.jqx.dataAdapter(sourceA,'.PHP_EOL; | |
136 | $outstr .= ' {'.PHP_EOL; | |
137 | $outstr .= ' autoBind: true,'.PHP_EOL; | |
138 | $outstr .= ' async: false,'.PHP_EOL; | |
139 | $outstr .= ' downloadComplete: function () { },'.PHP_EOL; | |
140 | $outstr .= ' loadComplete: function () { },'.PHP_EOL; | |
141 | $outstr .= ' loadError: function () { }'.PHP_EOL; | |
142 | $outstr .= ' });'.PHP_EOL; | |
143 | ||
144 | $outstr .= ' var settings = {'.PHP_EOL; | |
145 | $outstr .= ' title: "'.$name.'",'.PHP_EOL; | |
146 | $outstr .= ' description: "",'.PHP_EOL; | |
147 | $outstr .= ' padding: { left: 5, top: 5, right: 5, bottom: 5 },'.PHP_EOL; | |
148 | $outstr .= ' titlePadding: { left: 0, top: 0, right: 0, bottom: 10 },'.PHP_EOL; | |
149 | $outstr .= ' source: dataAdapter,'.PHP_EOL; | |
374
20999ef6d487
Fixed php scripts for jqwidgets version 3.8.0
Michiel Broek <mbroek@mbse.eu>
parents:
359
diff
changeset
|
150 | $outstr .= ' xAxis:'.PHP_EOL; |
357 | 151 | $outstr .= ' {'.PHP_EOL; |
152 | $outstr .= ' dataField: \'Date\','.PHP_EOL; | |
374
20999ef6d487
Fixed php scripts for jqwidgets version 3.8.0
Michiel Broek <mbroek@mbse.eu>
parents:
359
diff
changeset
|
153 | $outstr .= ' type: \'date\','.PHP_EOL; |
384
5db8186fe803
Fixed date display formatting on the web pages. Tooltips display date and time, the normal X-axis only the date.
Michiel Broek <mbroek@mbse.eu>
parents:
376
diff
changeset
|
154 | $outstr .= ' formatFunction: function (value) {'.PHP_EOL; |
385
260e92f0f998
Fixed month display in live view and archive view. Bumped to version 0.3.7.
Michiel Broek <mbroek@mbse.eu>
parents:
384
diff
changeset
|
155 | $outstr .= ' return value.getDate() + \'-\' + (value.getMonth() + 1) + \'-\' + value.getFullYear()'.PHP_EOL; |
384
5db8186fe803
Fixed date display formatting on the web pages. Tooltips display date and time, the normal X-axis only the date.
Michiel Broek <mbroek@mbse.eu>
parents:
376
diff
changeset
|
156 | $outstr .= ' },'.PHP_EOL; |
5db8186fe803
Fixed date display formatting on the web pages. Tooltips display date and time, the normal X-axis only the date.
Michiel Broek <mbroek@mbse.eu>
parents:
376
diff
changeset
|
157 | $outstr .= ' toolTipFormatFunction: function (value) {'.PHP_EOL; |
5db8186fe803
Fixed date display formatting on the web pages. Tooltips display date and time, the normal X-axis only the date.
Michiel Broek <mbroek@mbse.eu>
parents:
376
diff
changeset
|
158 | $outstr .= ' var h = value.getHours();'.PHP_EOL; |
5db8186fe803
Fixed date display formatting on the web pages. Tooltips display date and time, the normal X-axis only the date.
Michiel Broek <mbroek@mbse.eu>
parents:
376
diff
changeset
|
159 | $outstr .= ' var m = value.getMinutes();'.PHP_EOL; |
385
260e92f0f998
Fixed month display in live view and archive view. Bumped to version 0.3.7.
Michiel Broek <mbroek@mbse.eu>
parents:
384
diff
changeset
|
160 | $outstr .= ' return value.getDate() + \'-\' + (value.getMonth() + 1) + \'-\' + value.getFullYear()'; |
384
5db8186fe803
Fixed date display formatting on the web pages. Tooltips display date and time, the normal X-axis only the date.
Michiel Broek <mbroek@mbse.eu>
parents:
376
diff
changeset
|
161 | $outstr .= ' + \' \' + (h < 10 ? \'0\' + h : h) + \':\' + (m < 10 ? \'0\' + m : m);'.PHP_EOL; |
5db8186fe803
Fixed date display formatting on the web pages. Tooltips display date and time, the normal X-axis only the date.
Michiel Broek <mbroek@mbse.eu>
parents:
376
diff
changeset
|
162 | $outstr .= ' },'.PHP_EOL; |
357 | 163 | $outstr .= ' textRotationAngle: 45,'.PHP_EOL; |
164 | $outstr .= ' showGridLines: false'.PHP_EOL; | |
165 | $outstr .= ' },'.PHP_EOL; | |
166 | $outstr .= ' colorScheme: \'scheme01\','.PHP_EOL; | |
167 | $outstr .= ' seriesGroups:'.PHP_EOL; | |
168 | $outstr .= ' [{'.PHP_EOL; | |
169 | $outstr .= ' type: "line",'.PHP_EOL; | |
170 | $outstr .= ' valueAxis:'.PHP_EOL; | |
171 | $outstr .= ' {'.PHP_EOL; | |
172 | $outstr .= ' minValue: 0,'.PHP_EOL; | |
173 | $outstr .= ' maxValue: 100,'.PHP_EOL; | |
174 | $outstr .= ' displayValueAxis: false,'.PHP_EOL; | |
175 | $outstr .= ' description: "Heat/Cool %"'.PHP_EOL; | |
176 | $outstr .= ' },'.PHP_EOL; | |
177 | $outstr .= ' series: ['.PHP_EOL; | |
539
300b5c4cd977
Changed opacity of heater and cooler lines
Michiel Broek <mbroek@mbse.eu>
parents:
537
diff
changeset
|
178 | $outstr .= ' { dataField: "CoolUse", lineWidth: 1, displayText: "Cool %", opacity: 0.3 },'.PHP_EOL; |
300b5c4cd977
Changed opacity of heater and cooler lines
Michiel Broek <mbroek@mbse.eu>
parents:
537
diff
changeset
|
179 | $outstr .= ' { dataField: "HeatUse", lineWidth: 1, displayText: "Heat %", opacity: 0.3 }'.PHP_EOL; |
357 | 180 | $outstr .= ' ]'.PHP_EOL; |
181 | $outstr .= ' },'.PHP_EOL; | |
182 | $outstr .= ' {'.PHP_EOL; | |
183 | $outstr .= ' type: \'spline\','.PHP_EOL; | |
184 | $outstr .= ' valueAxis:'.PHP_EOL; | |
185 | $outstr .= ' {'.PHP_EOL; | |
186 | $outstr .= ' minValue: 0,'.PHP_EOL; | |
187 | $outstr .= ' description: \'Degrees C\''.PHP_EOL; | |
188 | $outstr .= ' },'.PHP_EOL; | |
189 | $outstr .= ' series: ['.PHP_EOL; | |
190 | $outstr .= ' { dataField: "Air", lineWidth: 1, displayText: "Air" },'.PHP_EOL; | |
191 | $outstr .= ' { dataField: "Beer", lineWidth: 2, displayText: "Beer" },'.PHP_EOL; | |
397
00ca08f5a6f8
Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents:
385
diff
changeset
|
192 | $outstr .= ' { dataField: "Target_lo", lineWidth: 1, displayText: "Target Lo", opacity: 0.7 },'.PHP_EOL; |
00ca08f5a6f8
Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents:
385
diff
changeset
|
193 | $outstr .= ' { dataField: "Target_hi", lineWidth: 1, displayText: "Target Hi", opacity: 0.7 },'.PHP_EOL; |
536
e833bbd5e733
Versie 0.6.5. LIST LOG <unit> commando verwijderd, alleen ARCHIVE LOG <unit> is nog in gebruik. De chiller temperatuur zit nu ook in de log en grafiek.
Michiel Broek <mbroek@mbse.eu>
parents:
517
diff
changeset
|
194 | $outstr .= ' { dataField: "Room", lineWidth: 1, displayText: "Room", opacity: 0.5 },'.PHP_EOL; |
537
4eebab50993e
Style fixes for the log chart. Removed png export button that doesn't work anymore.
Michiel Broek <mbroek@mbse.eu>
parents:
536
diff
changeset
|
195 | $outstr .= ' { dataField: "Chiller", lineWidth: 1, displayText: "Chiller", color: \'#0000bb\' }'.PHP_EOL; |
357 | 196 | $outstr .= ' ]'.PHP_EOL; |
197 | $outstr .= ' }]'.PHP_EOL; | |
198 | $outstr .= ' };'.PHP_EOL; | |
199 | $outstr .= ' $("#fermentor_chart").jqxChart(settings);'.PHP_EOL; | |
200 | ||
201 | $outstr .= ' $("#print").click(function () {'.PHP_EOL; | |
202 | $outstr .= ' var content = $("#fermentor_chart")[0].outerHTML;'.PHP_EOL; | |
376
a5d215531f55
Improved Archives View layout.
Michiel Broek <mbroek@mbse.eu>
parents:
375
diff
changeset
|
203 | $outstr .= ' var newWindow = window.open("", "", "width=865, height=425"),'.PHP_EOL; |
357 | 204 | $outstr .= ' document = newWindow.document.open(),'.PHP_EOL; |
205 | $outstr .= ' pageContent ='.PHP_EOL; | |
206 | $outstr .= ' \'<!DOCTYPE html>\' +'.PHP_EOL; | |
207 | $outstr .= ' \'<html>\' +'.PHP_EOL; | |
208 | $outstr .= ' \'<head>\' +'.PHP_EOL; | |
209 | $outstr .= ' \'<link rel="stylesheet" href="jqwidgets/styles/jqx.base.css" type="text/css" />\' +'.PHP_EOL; | |
210 | $outstr .= ' \'<meta charset="utf-8" />\' +'.PHP_EOL; | |
211 | $outstr .= ' \'<title>jQWidgets Chart</title>\' +'.PHP_EOL; | |
212 | $outstr .= ' \'</head>\' +'.PHP_EOL; | |
213 | $outstr .= ' \'<body>\' + content + \'</body></html>\';'.PHP_EOL; | |
214 | $outstr .= ' document.write(pageContent);'.PHP_EOL; | |
215 | $outstr .= ' document.close();'.PHP_EOL; | |
216 | $outstr .= ' newWindow.print();'.PHP_EOL; | |
217 | $outstr .= ' });'.PHP_EOL; | |
218 | $outstr .= ' $("#print").jqxButton({ width: 100, height: 25, theme: "ui-redmond" });'.PHP_EOL; | |
219 | ||
375
f707d22c72f8
In Archives, remove .log from download and view functions. Added new Save as PDF buttons.
Michiel Broek <mbroek@mbse.eu>
parents:
374
diff
changeset
|
220 | $outstr .= ' $("#pdfButton").click(function () {'.PHP_EOL; |
f707d22c72f8
In Archives, remove .log from download and view functions. Added new Save as PDF buttons.
Michiel Broek <mbroek@mbse.eu>
parents:
374
diff
changeset
|
221 | $outstr .= ' $("#fermentor_chart").jqxChart("saveAsPDF", "Chart_'.$name.'.pdf", getExportServer());'.PHP_EOL; |
f707d22c72f8
In Archives, remove .log from download and view functions. Added new Save as PDF buttons.
Michiel Broek <mbroek@mbse.eu>
parents:
374
diff
changeset
|
222 | $outstr .= ' });'.PHP_EOL; |
f707d22c72f8
In Archives, remove .log from download and view functions. Added new Save as PDF buttons.
Michiel Broek <mbroek@mbse.eu>
parents:
374
diff
changeset
|
223 | $outstr .= ' $("#pdfButton").jqxButton({ width: 100, height: 25, theme: "ui-redmond" });'.PHP_EOL; |
357 | 224 | |
225 | $outstr .= ' });'.PHP_EOL; | |
226 | $outstr .= ' </script>'.PHP_EOL; | |
227 | $outstr .= ' <div id="fermentor">'.PHP_EOL; | |
376
a5d215531f55
Improved Archives View layout.
Michiel Broek <mbroek@mbse.eu>
parents:
375
diff
changeset
|
228 | $outstr .= ' <div id="fermentor_chart" style="width:850px; height:410px; float:left"></div>'.PHP_EOL; |
357 | 229 | $outstr .= ' <div style="margin-top: 2px; margin-left: 10px;">'.PHP_EOL; |
376
a5d215531f55
Improved Archives View layout.
Michiel Broek <mbroek@mbse.eu>
parents:
375
diff
changeset
|
230 | $outstr .= ' <input style="float: left; margin-left: 10px;" id="print" type="button" value="Print Graph" />'.PHP_EOL; |
a5d215531f55
Improved Archives View layout.
Michiel Broek <mbroek@mbse.eu>
parents:
375
diff
changeset
|
231 | $outstr .= ' <input style="float: left; margin-left: 10px; margin-top: 10px;" id="pdfButton" type="button" value="Save as PDF" />'.PHP_EOL; |
357 | 232 | $outstr .= ' </div>'.PHP_EOL; |
233 | $outstr .= ' </div> <!-- fermentor -->'.PHP_EOL; | |
234 | ||
235 | $outstr .= ' <script type="text/javascript">'.PHP_EOL; | |
236 | $outstr .= ' $(document).ready(function () {'.PHP_EOL; | |
237 | $outstr .= ' $("#archives").jqxButton({ width: 150, height: 25, theme: \'ui-redmond\' });'.PHP_EOL; | |
238 | $outstr .= ' });'.PHP_EOL; | |
239 | $outstr .= ' </script>'.PHP_EOL; | |
240 | $outstr .= build_footer(); | |
241 | echo $outstr; | |
242 | } | |
333 | 243 | |
244 | ||
245 | ||
246 | /* | |
359
12734a3774e8
Added ARCHIVE GET file download command.
Michiel Broek <mbroek@mbse.eu>
parents:
357
diff
changeset
|
247 | * Download popup. The file contents is dynamic generated from |
12734a3774e8
Added ARCHIVE GET file download command.
Michiel Broek <mbroek@mbse.eu>
parents:
357
diff
changeset
|
248 | * the thermferm server. |
12734a3774e8
Added ARCHIVE GET file download command.
Michiel Broek <mbroek@mbse.eu>
parents:
357
diff
changeset
|
249 | */ |
12734a3774e8
Added ARCHIVE GET file download command.
Michiel Broek <mbroek@mbse.eu>
parents:
357
diff
changeset
|
250 | function archive_dl() { |
12734a3774e8
Added ARCHIVE GET file download command.
Michiel Broek <mbroek@mbse.eu>
parents:
357
diff
changeset
|
251 | |
375
f707d22c72f8
In Archives, remove .log from download and view functions. Added new Save as PDF buttons.
Michiel Broek <mbroek@mbse.eu>
parents:
374
diff
changeset
|
252 | $name = urldecode($_GET['name']) . ".log"; |
359
12734a3774e8
Added ARCHIVE GET file download command.
Michiel Broek <mbroek@mbse.eu>
parents:
357
diff
changeset
|
253 | |
12734a3774e8
Added ARCHIVE GET file download command.
Michiel Broek <mbroek@mbse.eu>
parents:
357
diff
changeset
|
254 | header('Content-Type: text/plain'); |
12734a3774e8
Added ARCHIVE GET file download command.
Michiel Broek <mbroek@mbse.eu>
parents:
357
diff
changeset
|
255 | header('Content-Disposition: attachment; filename="'.$name.'"'); |
12734a3774e8
Added ARCHIVE GET file download command.
Michiel Broek <mbroek@mbse.eu>
parents:
357
diff
changeset
|
256 | |
12734a3774e8
Added ARCHIVE GET file download command.
Michiel Broek <mbroek@mbse.eu>
parents:
357
diff
changeset
|
257 | $answer = send_cmd('ARCHIVE GET '.$name); |
12734a3774e8
Added ARCHIVE GET file download command.
Michiel Broek <mbroek@mbse.eu>
parents:
357
diff
changeset
|
258 | $arr = explode("\r\n", $answer); |
12734a3774e8
Added ARCHIVE GET file download command.
Michiel Broek <mbroek@mbse.eu>
parents:
357
diff
changeset
|
259 | |
12734a3774e8
Added ARCHIVE GET file download command.
Michiel Broek <mbroek@mbse.eu>
parents:
357
diff
changeset
|
260 | $outstr = ''; |
12734a3774e8
Added ARCHIVE GET file download command.
Michiel Broek <mbroek@mbse.eu>
parents:
357
diff
changeset
|
261 | if (startsWith($arr[0], "212")) { |
12734a3774e8
Added ARCHIVE GET file download command.
Michiel Broek <mbroek@mbse.eu>
parents:
357
diff
changeset
|
262 | $j = 1; |
12734a3774e8
Added ARCHIVE GET file download command.
Michiel Broek <mbroek@mbse.eu>
parents:
357
diff
changeset
|
263 | while (1) { |
12734a3774e8
Added ARCHIVE GET file download command.
Michiel Broek <mbroek@mbse.eu>
parents:
357
diff
changeset
|
264 | if (strcmp($arr[$j], ".") == 0) |
12734a3774e8
Added ARCHIVE GET file download command.
Michiel Broek <mbroek@mbse.eu>
parents:
357
diff
changeset
|
265 | break; |
12734a3774e8
Added ARCHIVE GET file download command.
Michiel Broek <mbroek@mbse.eu>
parents:
357
diff
changeset
|
266 | $outstr .= $arr[$j].PHP_EOL; |
12734a3774e8
Added ARCHIVE GET file download command.
Michiel Broek <mbroek@mbse.eu>
parents:
357
diff
changeset
|
267 | $j++; |
12734a3774e8
Added ARCHIVE GET file download command.
Michiel Broek <mbroek@mbse.eu>
parents:
357
diff
changeset
|
268 | } |
12734a3774e8
Added ARCHIVE GET file download command.
Michiel Broek <mbroek@mbse.eu>
parents:
357
diff
changeset
|
269 | } |
12734a3774e8
Added ARCHIVE GET file download command.
Michiel Broek <mbroek@mbse.eu>
parents:
357
diff
changeset
|
270 | echo $outstr; |
12734a3774e8
Added ARCHIVE GET file download command.
Michiel Broek <mbroek@mbse.eu>
parents:
357
diff
changeset
|
271 | exit(); |
12734a3774e8
Added ARCHIVE GET file download command.
Michiel Broek <mbroek@mbse.eu>
parents:
357
diff
changeset
|
272 | } |
12734a3774e8
Added ARCHIVE GET file download command.
Michiel Broek <mbroek@mbse.eu>
parents:
357
diff
changeset
|
273 | |
12734a3774e8
Added ARCHIVE GET file download command.
Michiel Broek <mbroek@mbse.eu>
parents:
357
diff
changeset
|
274 | |
12734a3774e8
Added ARCHIVE GET file download command.
Michiel Broek <mbroek@mbse.eu>
parents:
357
diff
changeset
|
275 | |
12734a3774e8
Added ARCHIVE GET file download command.
Michiel Broek <mbroek@mbse.eu>
parents:
357
diff
changeset
|
276 | /* |
375
f707d22c72f8
In Archives, remove .log from download and view functions. Added new Save as PDF buttons.
Michiel Broek <mbroek@mbse.eu>
parents:
374
diff
changeset
|
277 | * Show directory |
333 | 278 | */ |
279 | function archive_dir() { | |
280 | ||
281 | $answer = send_cmd("ARCHIVE DIR"); | |
282 | $reply = explode("\r\n", $answer); | |
283 | ||
284 | $outstr = build_header("Archived logfiles"); | |
285 | $outstr .= ' <div id="errors">'.PHP_EOL; | |
286 | $outstr .= ' </div> <!-- errors -->'.PHP_EOL; | |
287 | $outstr .= ' <div id="etable">'.PHP_EOL; | |
288 | $outstr .= ' <table class="setup">'.PHP_EOL; | |
289 | $outstr .= ' <tr class="trhead">'.PHP_EOL; | |
290 | $outstr .= ' <td class="setup" style="width: 340px;">File name</td>'.PHP_EOL; | |
291 | $outstr .= ' <td class="setup" style="width: 90px;">Mode</td>'.PHP_EOL; | |
292 | $outstr .= ' <td class="setup" style="width: 100px;">Size</td>'.PHP_EOL; | |
293 | $outstr .= ' <td class="setup" style="width: 140px;">Date</td>'.PHP_EOL; | |
294 | $outstr .= ' <td class="setup" style="width: 110px;">Action</td>'.PHP_EOL; | |
295 | $outstr .= ' </tr>'.PHP_EOL; | |
296 | ||
297 | if (startsWith($reply[0], "212")) { | |
298 | $j = 1; | |
299 | while (1) { | |
300 | if (strcmp($reply[$j], ".") == 0) | |
301 | break; | |
302 | $f = explode(",", $reply[$j]); | |
375
f707d22c72f8
In Archives, remove .log from download and view functions. Added new Save as PDF buttons.
Michiel Broek <mbroek@mbse.eu>
parents:
374
diff
changeset
|
303 | $name = urlencode(basename($f[0], ".log")); |
333 | 304 | $outstr .= ' <tr class="setup">'.PHP_EOL; |
305 | $outstr .= ' <td class="setup">'.$f[0].'</td>'.PHP_EOL; | |
306 | $outstr .= ' <td class="setup">'.$f[1].'</td>'.PHP_EOL; | |
307 | $outstr .= ' <td class="setup">'.$f[2].'</td>'.PHP_EOL; | |
308 | $outstr .= ' <td class="setup">'.$f[3].'</td>'.PHP_EOL; | |
375
f707d22c72f8
In Archives, remove .log from download and view functions. Added new Save as PDF buttons.
Michiel Broek <mbroek@mbse.eu>
parents:
374
diff
changeset
|
309 | $outstr .= ' <td class="setup"><a href="archives.php?action=dl&name='.$name.'">Download</a>'; |
517
5fd12d9f3f84
Changed livescreen, now displays thermometers. The chart is loaded on request. This speeds up loading the application.
Michiel Broek <mbroek@mbse.eu>
parents:
397
diff
changeset
|
310 | $outstr .= ' <a href="archives.php?action=view&return=archives&name='.$name.'">View</a></td>'.PHP_EOL; |
333 | 311 | $outstr .= ' </tr>'.PHP_EOL; |
312 | $j++; | |
313 | } | |
314 | } | |
315 | ||
316 | $outstr .= ' </table>'.PHP_EOL; | |
317 | $outstr .= ' </div> <!-- etable -->'.PHP_EOL; | |
397
00ca08f5a6f8
Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents:
385
diff
changeset
|
318 | $outstr .= ' <script type="text/javascript">'.PHP_EOL; |
00ca08f5a6f8
Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents:
385
diff
changeset
|
319 | $outstr .= ' $(document).ready(function () {'.PHP_EOL; |
00ca08f5a6f8
Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents:
385
diff
changeset
|
320 | $outstr .= ' $("#maintenance").jqxButton({ width: 150, height: 25, theme: \'ui-redmond\' });'.PHP_EOL; |
00ca08f5a6f8
Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents:
385
diff
changeset
|
321 | $outstr .= ' });'.PHP_EOL; |
00ca08f5a6f8
Fermentation profiles now have a low and high temperature setting so that you can use a temperture window. Each profile step can now set for beer or air temperature reference. The logfiles have an extra temperature field for this. Bumped to version 0.4.2.
Michiel Broek <mbroek@mbse.eu>
parents:
385
diff
changeset
|
322 | $outstr .= ' </script>'.PHP_EOL; |
333 | 323 | $outstr .= build_footer(); |
324 | echo $outstr; | |
325 | } | |
326 | ||
327 | ||
328 |