Added fermentor maintenance windows

Tue, 22 Jul 2014 20:15:09 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Tue, 22 Jul 2014 20:15:09 +0200
changeset 122
e57043423e72
parent 121
03306c3bfd60
child 123
597688feda2f

Added fermentor maintenance windows

www-thermferm/css/style.css file | annotate | diff | comparison | revisions
www-thermferm/liveview.php file | annotate | diff | comparison | revisions
--- a/www-thermferm/css/style.css	Tue Jul 22 17:56:56 2014 +0200
+++ b/www-thermferm/css/style.css	Tue Jul 22 20:15:09 2014 +0200
@@ -60,16 +60,10 @@
     float: left;
 }
 
-#fermentor_pict {
-    width: 220px;
-    height: 382px;
-    float: left;
-}
-
 #fermentor_panel {
     width: 240px;
-    height: 380px;
-    float: left;
+    height: 377px;
+    float: right;
     background-color: #f0f0f0;
 }
 
--- a/www-thermferm/liveview.php	Tue Jul 22 17:56:56 2014 +0200
+++ b/www-thermferm/liveview.php	Tue Jul 22 20:15:09 2014 +0200
@@ -70,17 +70,17 @@
 	$outstr .= '     $(document).ready(function () {'.PHP_EOL;
 
 	$outstr .= '       var sampleData'.$unr.' = ['.PHP_EOL;
-	$outstr .= '         { Date:\'2014-07-15 20:44\',Mode:\'NONE\',Air:20.625,Beer:\'23.687\' },'.PHP_EOL;
-	$outstr .= '         { Date:\'2014-07-15 21:00\',Mode:\'NONE\',Air:20.250,Beer:\'23.437\' },'.PHP_EOL;
-	$outstr .= '         { Date:\'2014-07-15 22:00\',Mode:\'NONE\',Air:20.375,Beer:\'22.812\' },'.PHP_EOL;
-	$outstr .= '         { Date:\'2014-07-15 23:00\',Mode:\'NONE\',Air:20.500,Beer:\'22.437\' },'.PHP_EOL;
-	$outstr .= '         { Date:\'2014-07-16 00:00\',Mode:\'NONE\',Air:20.437,Beer:\'22.250\' },'.PHP_EOL;
-	$outstr .= '         { Date:\'2014-07-16 01:00\',Mode:\'NONE\',Air:20.375,Beer:\'22.000\' },'.PHP_EOL;
-	$outstr .= '         { Date:\'2014-07-16 02:00\',Mode:\'NONE\',Air:20.312,Beer:\'21.750\' },'.PHP_EOL;
-	$outstr .= '         { Date:\'2014-07-16 03:00\',Mode:\'NONE\',Air:20.375,Beer:\'21.687\' },'.PHP_EOL;
-	$outstr .= '         { Date:\'2014-07-16 04:00\',Mode:\'NONE\',Air:20.312,Beer:\'21.562\' },'.PHP_EOL;
-	$outstr .= '         { Date:\'2014-07-16 05:00\',Mode:\'NONE\',Air:20.187,Beer:\'21.500\' },'.PHP_EOL;
-	$outstr .= '         { Date:\'2014-07-16 06:00\',Mode:\'NONE\',Air:20.125,Beer:\'21.500\' }'.PHP_EOL;
+	$outstr .= '         { Date:\'2014-07-15 20:44\',Mode:\'NONE\',Air:20.625,Beer:23.687},'.PHP_EOL;
+	$outstr .= '         { Date:\'2014-07-15 21:00\',Mode:\'NONE\',Air:20.250,Beer:23.437},'.PHP_EOL;
+	$outstr .= '         { Date:\'2014-07-15 22:00\',Mode:\'NONE\',Air:20.375,Beer:22.812},'.PHP_EOL;
+	$outstr .= '         { Date:\'2014-07-15 23:00\',Mode:\'NONE\',Air:20.500,Beer:22.437},'.PHP_EOL;
+	$outstr .= '         { Date:\'2014-07-16 00:00\',Mode:\'NONE\',Air:20.437,Beer:22.250},'.PHP_EOL;
+	$outstr .= '         { Date:\'2014-07-16 01:00\',Mode:\'NONE\',Air:20.375,Beer:22.000},'.PHP_EOL;
+	$outstr .= '         { Date:\'2014-07-16 02:00\',Mode:\'NONE\',Air:20.312,Beer:21.750},'.PHP_EOL;
+	$outstr .= '         { Date:\'2014-07-16 03:00\',Mode:\'NONE\',Air:20.375,Beer:21.687},'.PHP_EOL;
+	$outstr .= '         { Date:\'2014-07-16 04:00\',Mode:\'NONE\',Air:20.312,Beer:21.562},'.PHP_EOL;
+	$outstr .= '         { Date:\'2014-07-16 05:00\',Mode:\'NONE\',Air:20.187,Beer:21.500},'.PHP_EOL;
+	$outstr .= '         { Date:\'2014-07-16 06:00\',Mode:\'NONE\',Air:20.125,Beer:21.500}'.PHP_EOL;
 	$outstr .= '       ];'.PHP_EOL;
 
 	$outstr .= '       var settings'.$unr.' = {'.PHP_EOL;
@@ -88,7 +88,6 @@
 	$outstr .= '         description: "",'.PHP_EOL;
 	$outstr .= '         padding: { left: 5, top: 5, right: 5, bottom: 5 },'.PHP_EOL;
 	$outstr .= '         titlePadding: { left: 90, top: 0, right: 0, bottom: 10 },'.PHP_EOL;
-	$outstr .= '         enabled: true,'.PHP_EOL;
 	$outstr .= '         source: sampleData'.$unr.','.PHP_EOL;
 	$outstr .= '         categoryAxis:'.PHP_EOL;
 	$outstr .= '           {'.PHP_EOL;
@@ -104,9 +103,6 @@
 	$outstr .= '             seriesGapPercent: 0,'.PHP_EOL;
 	$outstr .= '             valueAxis:'.PHP_EOL;
 	$outstr .= '             {'.PHP_EOL;
-//	$outstr .= '               minValue: 0,'.PHP_EOL;
-//	$outstr .= '               maxValue: 35,'.PHP_EOL;
-//	$outstr .= '               unitInterval: 5,'.PHP_EOL;
 	$outstr .= '               description: \'Degrees C\''.PHP_EOL;
 	$outstr .= '             },'.PHP_EOL;
 	$outstr .= '             series: ['.PHP_EOL;
@@ -116,16 +112,10 @@
 	$outstr .= '           }]'.PHP_EOL;
 	$outstr .= '       };'.PHP_EOL;
 	$outstr .= '       $("#fermentor_chart_'.$unr.'").jqxChart(settings'.$unr.');'.PHP_EOL;
-
-	$outstr .= '       var initChart'.$unr.' = function() {'.PHP_EOL;
-	$outstr .= '         $("#fermentor_chart_'.$unr.'").jqxChart(\'refresh\');'.PHP_EOL;
-	$outstr .= '       }'.PHP_EOL;
-
-	$outstr .= '       $("#fermentor_setup_'.$unr.'").jqxButton({ width: \'150\', height: \'25\', theme: \''.$my_style.'\'});'.PHP_EOL;
 	$outstr .= '     });'.PHP_EOL;
 	$outstr .= '    </script>'.PHP_EOL;
 	$outstr .= '    <div id="fermentor">'.PHP_EOL;
-	$outstr .= '     <div id="fermentor_chart_'.$unr.'" style="width:600px; height:377px; float:left"></div>'.PHP_EOL;
+	$outstr .= '     <div id="fermentor_chart_'.$unr.'" style="width:720px; height:377px; float:left"></div>'.PHP_EOL;
 
 	$set_temperature = "N/A";
 	$air_temperature = "N/A";
@@ -212,10 +202,47 @@
 	$outstr .= '       </form>'.PHP_EOL;
 	$outstr .= '      </div>'.PHP_EOL;
 	$outstr .= '      <div id="fermentor_control">'.PHP_EOL;
-	$outstr .= '       <button id="fermentor_setup_'.$unr.'">Edit fermentor</button>'.PHP_EOL;
+	$outstr .= '       <input type="button" id="fermentor_setup_'.$unr.'" value="Edit fermentor" />'.PHP_EOL;
 	$outstr .= '      </div>'.PHP_EOL;
 	$outstr .= '     </div> <!-- fermentor_panel -->'.PHP_EOL;
-    	$outstr .= '    </div> <!-- fermentor -->'.PHP_EOL;
+
+	/* Fermentor maintenance window */
+        $outstr .= '     <script type="text/javascript">'.PHP_EOL;
+	$outstr .= '      function addEventListeners'.$unr.'() {'.PHP_EOL;
+	$outstr .= '        $("#fermentor_setup_'.$unr.'").mousedown(function () {'.PHP_EOL;
+	$outstr .= '          $("#fermmaint_window'.$unr.'").jqxWindow(\'open\');'.PHP_EOL;
+	$outstr .= '        });'.PHP_EOL;
+	$outstr .= '      }'.PHP_EOL;
+	$outstr .= '      function createMaintenance'.$unr.'() {'.PHP_EOL;
+	$outstr .= '        $("#fermmaint_window'.$unr.'").jqxWindow({'.PHP_EOL;
+	$outstr .= '          height: 400, width: 800, autoOpen: false, theme: \''.$my_style.'\', '.PHP_EOL;
+	$outstr .= '          position: { x:100, y:50 }, '.PHP_EOL;
+	$outstr .= '          resizable: false, isModal: true, modalOpacity: 0.5, '.PHP_EOL;
+	$outstr .= '          okButton: $("#fermmaint_ok'.$unr.'"), cancelButton: $("#fermmaint_cancel'.$unr.'"),'.PHP_EOL;
+	$outstr .= '          initContent: function () {'.PHP_EOL;
+	$outstr .= '            $("#fermmaint_ok'.$unr.'").jqxButton({ width: 65, height: 25, theme: \''.$my_style.'\' });'.PHP_EOL;
+	$outstr .= '            $("#fermmaint_cancel'.$unr.'").jqxButton({ width: 65, height: 25, theme: \''.$my_style.'\' });'.PHP_EOL;
+	$outstr .= '          }'.PHP_EOL;
+	$outstr .= '        });'.PHP_EOL;
+	$outstr .= '        $("#fermentor_setup_'.$unr.'").jqxButton({ width: 150, height: 25, theme: \''.$my_style.'\'});'.PHP_EOL;
+	$outstr .= '      }'.PHP_EOL;
+	$outstr .= '      $(document).ready(function () {'.PHP_EOL;
+	$outstr .= '        addEventListeners'.$unr.'();'.PHP_EOL;
+	$outstr .= '        createMaintenance'.$unr.'();'.PHP_EOL;
+	$outstr .= '      });'.PHP_EOL;
+	$outstr .= '     </script>'.PHP_EOL;
+	$outstr .= '     <div id="fermmaint_window'.$unr.'">'.PHP_EOL;
+	$outstr .= '      <div id="fermmaint_header'.$unr.'">'.PHP_EOL;
+	$outstr .= '       Fermentor Unit '.$unr.' Maintenance'.PHP_EOL;
+	$outstr .= '      </div>'.PHP_EOL;
+	$outstr .= '      <div id="fermmaint_content'.$unr.'">'.PHP_EOL;
+	$outstr .= '       Content'.PHP_EOL;
+	$outstr .= '       <input type="button" id="fermmaint_ok'.$unr.'" value="OK" style="margin-right: 10px" />'.PHP_EOL;
+	$outstr .= '       <input type="button" id="fermmaint_cancel'.$unr.'" value="Cancel" />'.PHP_EOL;
+	$outstr .= '      </div>'.PHP_EOL;
+	$outstr .= '     </div> <!-- fermmaint_window -->'.PHP_EOL;
+ 
+	$outstr .= '    </div> <!-- fermentor -->'.PHP_EOL;
     }
 
     return $outstr;

mercurial