Removed ARCHIVER commands and web pages.

Thu, 09 May 2019 17:01:56 +0200

author
Michiel Broek <mbroek@mbse.eu>
date
Thu, 09 May 2019 17:01:56 +0200
changeset 592
ff30227c0903
parent 591
95cf33f8021f
child 593
55b849fc2d20

Removed ARCHIVER commands and web pages.

thermferm/server.c file | annotate | diff | comparison | revisions
www-thermferm/archives.php file | annotate | diff | comparison | revisions
www-thermferm/maintenance.php file | annotate | diff | comparison | revisions
--- a/thermferm/server.c	Thu May 09 16:40:17 2019 +0200
+++ b/thermferm/server.c	Thu May 09 17:01:56 2019 +0200
@@ -255,299 +255,6 @@
 
 
 
-/*
- * ARCHIVE DIR
- * ARCHIVE GET filename
- * ARCHIVE LOG filename
- * ARCHIVE HELP
- */
-int cmd_archive(char *buf)
-{
-    char		*opt, *param, *name = NULL, *filename = NULL, *logname = NULL, mbits[11], tstr[24];
-    DIR			*dd;
-    FILE		*fp;
-    struct dirent	*result;
-    ls_list		*lsx = NULL, *tmp;
-    struct stat		sbuf;
-    struct tm		*tbuf;
-    time_t		ftime;
-    int			found;
-    units_list		*unit;
-
-
-    opt = strtok(buf, " \0");
-    opt = strtok(NULL, " \0");
-
-    if (opt == NULL) {
-	srv_send((char *)"501 Subcommand missing");
-	return 0;
-    }
-    param = strtok(NULL, "\0");
-
-    if (strcmp(opt, (char *)"HELP") == 0) {
-	srv_send((char *)"100 Help text follows:");
-	srv_send((char *)"Recognized commands:");
-	srv_send((char *)"ARCHIVE DIR                   Archived logfiles directory");
-	srv_send((char *)"ARCHIVE GET filename          Archived logfile download");
-	srv_send((char *)"ARCHIVE LOG filename          Archived logfile data in graphsteps");
-	srv_send((char *)".");
-	return 0;
-    }
-
-    if (strcmp(opt, (char *)"DIR") == 0) {
-
-	if (getenv((char *)"USER") == NULL) {
-	    name = xstrcpy((char *)"/root");
-	} else {
-	    name = xstrcpy(getenv((char *)"HOME"));
-	}
-	name = xstrcat(name, (char *)"/.thermferm/log/");
-
-	if ((dd = opendir(name))) {
-	    for (;;) {
-		if  (! (result = readdir(dd))) {
-		    syslog(LOG_NOTICE, "readdir: error=%d", errno);
-		    break;
-		}
-		if (result->d_name[0] != '.') {
-		    filename = xstrcpy(name);
-		    filename = xstrcat(filename, result->d_name);
-		    /*
-		     * Remove files from the list when they are in use
-		     */
-		    found = 0;
-		    for (unit = Config.units; unit; unit = unit->next) {
-			if (unit->mode != UNITMODE_OFF) {
-			    logname = xstrcpy(unit->product_code);
-			    logname = xstrcat(logname, (char *)" ");
-			    logname = xstrcat(logname, unit->product_name);
-			    logname = xstrcat(logname, (char *)".log");
-			    if (! strcmp(result->d_name, logname))
-				found = 1;
-			    free(logname);
-			    logname = NULL;
-			}
-		    }
-		    if ((found == 0) && ((stat(filename, &sbuf)) == 0)) {
-		        fill_list(&lsx, result->d_name, sbuf.st_mode, sbuf.st_size, sbuf.st_mtime);
-		    }
-		    free(filename);
-		    filename = NULL;
-		}
-	    }
-	    closedir(dd);
-	} else {
-	    syslog(LOG_NOTICE, "opendir: \"%s\" error=%d", name, errno);    
-	}
-
-	sort_list(&lsx);
-
-	srv_send((char *)"212 Archive directory follows:");
-	for (tmp = lsx; tmp; tmp = tmp->next) {
-	    sprintf(mbits, "----------");
-	    if (tmp->mode & S_IRUSR)
-		mbits[1] = 'r';
-	    if (tmp->mode & S_IWUSR)
-		mbits[2] = 'w';
-	    if (tmp->mode & S_IXUSR)
-		mbits[3] = 'x';
-	    if (tmp->mode & S_IRGRP)
-		mbits[4] = 'r';
-	    if (tmp->mode & S_IWGRP)
-		mbits[5] = 'w';
-	    if (tmp->mode & S_IXGRP)
-		mbits[6] = 'x';
-	    if (tmp->mode & S_IROTH)
-		mbits[7] = 'r';
-	    if (tmp->mode & S_IWOTH)
-		mbits[8] = 'w';
-	    if (tmp->mode & S_IXOTH)
-		mbits[9] = 'x';
-	    ftime = tmp->mtime;
-	    tbuf = localtime(&ftime);
-	    sprintf(tstr, "%02d %s %04d %02d:%02d", tbuf->tm_mday, MONTH[tbuf->tm_mon], tbuf->tm_year+1900, tbuf->tm_hour, tbuf->tm_min);
-	    srv_send((char *)"%s,%s,%d,%s", tmp->d_name, mbits, tmp->size, tstr);
-	}
-	srv_send((char *)".");
-	tidy_lslist(&lsx);
-
-	free(name);
-	name = NULL;
-	return 0;
-    }
-
-    if (param == NULL) {
-	srv_send((char *)"502 Parameter missing");
-	return 0;
-    }
-
-    if (strcmp(opt, (char *)"GET") == 0) {
-	if (getenv((char *)"USER") == NULL) {
-	    name = xstrcpy((char *)"/root");
-	} else {
-	    name = xstrcpy(getenv((char *)"HOME"));
-	}
-	name = xstrcat(name, (char *)"/.thermferm/log/");
-	name = xstrcat(name, param);
-
-	if ((fp = fopen(name, "r"))) {
-	    char	buffer[256];
-
-	    srv_send((char *)"212 Archive file follows:");
-	    while (fgets(buffer, sizeof(buffer)-1, fp) != NULL) {
-		int	i;
-
-		for (i = 0; i < strlen(buffer); i++) {
-		    if (buffer[i] == '\n')
-			buffer[i] = '\0';
-		    if (buffer[i] == '\r')
-			buffer[i] = '\0';
-		}
-		srv_send(buffer);
-	    }
-	    srv_send((char *)".");
-	    fclose(fp);
-	} else {
-	    srv_send((char *)"440 No such file");
-	}
-
-	free(name);
-	name = NULL;
-	return 0;
-    }
-
-    if (strcmp(opt, (char *)"LOG") == 0) {
-	if (getenv((char *)"USER") == NULL) {
-	    name = xstrcpy((char *)"/root");
-	} else {
-	    name = xstrcpy(getenv((char *)"HOME"));
-	}
-	name = xstrcat(name, (char *)"/.thermferm/log/");
-	name = xstrcat(name, param);
-
-	if ((fp = fopen(name, "r"))) {
-	    char        buffer[256], outbuf[256], q[5], hr[3];
-	    char	*date_n, *mode_n, *air_n, *beer_n, *target_lo_n, *target_hi_n, *heater_n, *cooler_n, *room_n, *chiller_n;
-	    char	*heater_u, *cooler_u;
-	    int		lines = 0, heater_l = 0, cooler_l = 0, h = 0, c = 0, heat_used = 0, cool_used = 0, graphstep = 0;
-	    float	room_t = 0.0;
-
-	    srv_send((char *)"212 Logfile list follows:");
-	    while (fgets(buffer, sizeof(buffer)-1, fp) != NULL) {
-		lines++;
-	    }
-	    fseek(fp, 0L, SEEK_SET);
-	    /*
-	     * We have counted the lines in the logfile including the header lines.
-	     * The header lines should be ignored but there are so few of them, we
-	     * just include them in the total.
-	     * Now find a reasonable interval of lines to sent to the client.
-	     */
-	    for (graphstep = 1; graphstep <= MAX_INTERVALS; graphstep++) {
-		if (lines < GRAPH_DATALINES[graphstep]) {
-		    break;
-		}
-	    }
-	    if (graphstep > MAX_INTERVALS)
-		graphstep = MAX_INTERVALS;
-	    syslog(LOG_NOTICE, "ARCHIVE LOG %s: lines=%d, interval=%d, graphstep=%d", param, lines, GRAPH_INTERVAL[graphstep], graphstep);
-
-	    while (fgets(buffer, sizeof(buffer)-1, fp) != NULL) {
-		/*
-		 * 2014-11-15 18:39,BEER,20.312,19.750,20.0,0,NA,NA,NA,78105,NA,NA,18.000,20.1,5.312
-		 *       |           |     |      |     |   | |  |  |    |   |  |    |     |    |
-		 *  date_n           |     |      |     |   | |  |  |    |   |  |    |     |    |
-		 *  mode_n ----------+     |      |     |   | |  |  |    |   |  |    |     |    |
-		 *  air_n -----------------+      |     |   | |  |  |    |   |  |    |     |    |
-		 *  beer_n -----------------------+     |   | |  |  |    |   |  |    |     |    |
-		 *  target_lo_n ------------------------+   | |  |  |    |   |  |    |     |    |
-		 *  heater_n -------------------------------+ |  |  |    |   |  |    |     |    |
-		 *  cooler_n ---------------------------------+  |  |    |   |  |    |     |    |
-		 *  not used ------------------------------------+  |    |   |  |    |     |    |
-		 *  not used ---------------------------------------+    |   |  |    |     |    |
-		 *  heater_u --------------------------------------------+   |  |    |     |    |
-		 *  cooler_u ------------------------------------------------+  |    |     |    |
-		 *  not used ---------------------------------------------------+    |     |    |
-		 *  room_n ----------------------------------------------------------+     |    |
-		 *  target_hi_n -----------------------------------------------------------+    |
-		 *  chiller_n ------------------------------------------------------------------+
-		 */
-		hr[0] = q[0] = buffer[11];
-		hr[1] = q[1] = buffer[12];
-		q[2] = buffer[14];
-		q[3] = buffer[15];
-		hr[2] = '\0';
-		buffer[strlen(buffer) -1] = '\0';
-		date_n = strtok(buffer, ",\0"); 	/* timestamp            */
-		mode_n = strtok(NULL, ",\0");   	/* unit mode            */
-		air_n = strtok(NULL, ",\0");    	/* air temp             */
-		beer_n = strtok(NULL, ",\0");   	/* beer temp            */
-		target_lo_n = strtok(NULL, ",\0");	/* target low temp	*/
-		heater_n = strtok(NULL, ",\0"); 	/* current heater state */
-		cooler_n = strtok(NULL, ",\0"); 	/* current cooler state */
-		heater_u = strtok(NULL, ",\0"); 	/* current fan state    */
-		heater_u = strtok(NULL, ",\0"); 	/* current door state   */
-		heater_u = strtok(NULL, ",\0"); 	/* heater use counter   */
-		cooler_u = strtok(NULL, ",\0"); 	/* cooler use counter   */
-		room_n = strtok(NULL, ",\0");		/* fan use counter	*/
-		room_n = strtok(NULL, ",\0");		/* room temperature	*/
-		target_hi_n = strtok(NULL, ",\0");	/* target high temp	*/
-		chiller_n = strtok(NULL, ",\0");	/* chiller temp		*/
-
-		if (strncmp(mode_n, (char *)"Mode", 4)) {
-		    /*
-		     * Output a line at the right intervals
-		     */
-		    int hour = atoi(hr);
-		    if (((graphstep == 1)) ||
-			((graphstep == 2) && (q[3] == '0' || q[3] == '5')) ||
-			((graphstep == 3) && ((q[2] == '0' && q[3] == '0') || (q[2] == '1' && q[3] == '5') || (q[2] == '3' && q[3] == '0') || (q[2] == '4' && q[3] == '5'))) ||
-			((graphstep == 4) && ((q[2] == '0' && q[3] == '0') || (q[2] == '3' && q[3] == '0'))) ||
-			((graphstep == 5) && (q[2] == '0' && q[3] == '0')) ||
-			((graphstep == 6) && (hour % 2 == 0) && (q[2] == '0' && q[3] == '0')) ||	/* 120 minutes	*/
-			((graphstep == 7) && (hour % 4 == 0) && (q[2] == '0' && q[3] == '0')) ||	/* 240 minutes	*/
-			((graphstep >= 8) && (hour % 8 == 0) && (q[2] == '0' && q[3] == '0')) ) {	/* 480 minutes	*/
-			heat_used = cool_used = 0;
-			if (heater_u && strcmp(heater_u, "NA") && (sscanf(heater_u, "%d", &h) == 1)) {
-			    if (h && heater_l) {
-				heat_used = ((h - heater_l) * 100) / (GRAPH_INTERVAL[graphstep] * 60);
-			    }
-			}
-			if (cooler_u && strcmp(cooler_u, "NA") && (sscanf(cooler_u, "%d", &c) == 1)) {
-			    if (c && cooler_l) {
-				cool_used = ((c - cooler_l) * 100) / (GRAPH_INTERVAL[graphstep] * 60);
-			    }
-			}
-			if (room_n)
-			    sscanf(room_n, "%f", &room_t);
-			if (target_hi_n == NULL)
-			    target_hi_n = target_lo_n;
-			snprintf(outbuf, 255, "%s,%s,%s,%s,%s,%s,%s,%d,%d,%.1f,%s,%s", 
-				date_n, mode_n, air_n, beer_n, target_lo_n, heater_n, cooler_n, heat_used, cool_used, room_t,target_hi_n, chiller_n);
-			srv_send(outbuf);
-			if (heater_u && h && strcmp(heater_u, "NA"))
-			    heater_l = h;
-			if (cooler_u && c & strcmp(cooler_u, "NA"))
-			    cooler_l = c;
-		    }
-		}
-	    }
-
-	    srv_send((char *)".");
-	    fclose(fp);
-	} else {
-	    srv_send((char *)"440 No such file");
-	}
-
-	free(name);
-	name = NULL;
-    }
-
-    return 0;
-}
-
-
-
 int delete_Device(char *uuid)
 {
     devices_list	*current = Config.devices;
@@ -2419,10 +2126,7 @@
 	    /*
 	     * Process commands from the client
 	     */
-	    if (strncmp(buf, "ARCHIVE", 7) == 0) {
-		cmd_archive(buf);
-
-	    } else if (strncmp(buf, "DEVICE", 6) == 0) {
+	    if (strncmp(buf, "DEVICE", 6) == 0) {
 		if (cmd_device(buf))
 		    wrconfig();
 
@@ -2435,8 +2139,6 @@
 		srv_send((char *)"Recognized commands:");
 		srv_send((char *)"");
 //                                12345678901234567890123456789012345678901234567890123456789012345678901234567890
-		srv_send((char *)"ARCHIVE <CMD> [parameters]    Archive commands");
-		srv_send((char *)"ARCHIVE HELP                  Archive help screen");
 		srv_send((char *)"DEVICE <CMD> [parameters]     Device commands");
 		srv_send((char *)"DEVICE HELP                   Device help screen");
 		srv_send((char *)"GLOBAL <CMD> [parameters]     Global commands");
--- a/www-thermferm/archives.php	Thu May 09 16:40:17 2019 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,328 +0,0 @@
-<?php
-/**
- * @file archives.php
- * @brief Display as chart or download a fermentation logfile.
- * @author Michiel Broek <mbroek at mbse dot eu>
- *
- * Copyright (C) 2015-2018
- *   
- * 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');
-$my_style = 'ui-redmond';
-
-if (isset($_GET['action'])) {
-    switch ($_GET['action']) {
-	case 'dl':              archive_dl();
-				break;
-	case 'view':		archive_view();
-				break;
-	default:                break;
-    }
-} else {
-    archive_dir();
-}
-
-exit;
-
-/****************************************************************************
- *
- */
-
-/*
- * View an archived file in graph format
- */
-function archive_view() {
-
-    global	$my_style;
-
-    $name = urldecode($_GET['name']);
-    $return = urldecode($_GET['return']);
-
-    $answer = send_cmd('GLOBAL GET');
-    $arr = explode("\r\n", $answer);
-    $version = "?";
-
-    if (startsWith($arr[0], "213")) {
-	$j = 1;
-	while (1) {
-	    if (strcmp($arr[$j], ".") == 0)
-		break;
-	    $f = explode(",", $arr[$j]);
-
-	    if ($f[0] == "RELEASE")
-		$version = $f[1];
-	    $j++;
-	}
-    }
-
-    $outstr  = '<!DOCTYPE html>'.PHP_EOL;
-    $outstr .= '<html>'.PHP_EOL;
-    $outstr .= ' <head>'.PHP_EOL;
-    $outstr .= '  <meta http-equiv="content-type" content="text/html; charset=utf-8" />'.PHP_EOL;
-    $outstr .= '  <title>Archive View '.$name.'</title>'.PHP_EOL;
-    $outstr .= '  <link type="text/css" href="css/style.css" rel="stylesheet" media="all" />'.PHP_EOL;
-    $outstr .= '  <link type="text/css" href="jqwidgets/styles/jqx.base.css" rel="stylesheet" />'.PHP_EOL;
-    $outstr .= '  <link type="text/css" href="jqwidgets/styles/jqx.'.$my_style.'.css" rel="stylesheet" />'.PHP_EOL;
-    $outstr .= '  <script type="text/javascript" src="js/jquery-2.1.1.min.js"></script>'.PHP_EOL;
-    $outstr .= '  <script type="text/javascript" src="jqwidgets/jqxcore.js"></script>'.PHP_EOL;
-    $outstr .= '  <script type="text/javascript" src="jqwidgets/jqxwindow.js"></script>'.PHP_EOL;
-    $outstr .= '  <script type="text/javascript" src="jqwidgets/jqxbuttons.js"></script>'.PHP_EOL;
-    $outstr .= '  <script type="text/javascript" src="jqwidgets/jqxchart.core.js"></script>'.PHP_EOL;
-    $outstr .= '  <script type="text/javascript" src="jqwidgets/jqxdraw.js"></script>'.PHP_EOL;
-    $outstr .= '  <script type="text/javascript" src="jqwidgets/jqxdata.js"></script>'.PHP_EOL;
-    $outstr .= '  <script type="text/javascript" src="jqwidgets/jqxdata.export.js"></script>'.PHP_EOL;
-    $outstr .= ' </head>'.PHP_EOL;
-
-    $outstr .= ' <body class="default">'.PHP_EOL;
-    $outstr .= '  <div id="jqxWidget">'.PHP_EOL;
-    $outstr .= '   <div id="header">'.PHP_EOL;
-    $outstr .= '    <div id="title">'.PHP_EOL;
-    $outstr .= '     ThermFerm '.$version.PHP_EOL;
-    $outstr .= '    </div>'.PHP_EOL;
-    if ("$return" == "archives") {
-    	$outstr .= '    <form action="archives.php" style="margin:30px; float:right">'.PHP_EOL;
-    	$outstr .= '     <input type="submit" id="archives" value="Archives directory" />'.PHP_EOL;
-    } else {
-	$outstr .= '    <form action="index.php" style="margin:30px; float:right">'.PHP_EOL;
-	$outstr .= '     <input type="submit" id="archives" value="Dashboard" />'.PHP_EOL;
-    }
-    $outstr .= '    </form>'.PHP_EOL;
-    $outstr .= '   </div> <!-- header -->'.PHP_EOL;
-    $outstr .= '   <div id="content">'.PHP_EOL;
-
-    $outstr .= '    <script type="text/javascript">'.PHP_EOL;
-    $outstr .= '     $(document).ready(function () {'.PHP_EOL;
-
-    $outstr .= '       function getExportServer() {'.PHP_EOL;
-    $outstr .= '         return "https://www.jqwidgets.com/export_server/export.php";'.PHP_EOL;
-    $outstr .= '       }'.PHP_EOL;
-
-    $outstr .= '       var sourceA ='.PHP_EOL;
-    $outstr .= '       {'.PHP_EOL;
-    $outstr .= '          datatype: "json",'.PHP_EOL;
-    $outstr .= '          datafields: ['.PHP_EOL;
-    $outstr .= '             { name: "Date", type: "date", format: "yyyy-MM-dd HH:mm" },'.PHP_EOL;
-    $outstr .= '             { name: "Mode" },'.PHP_EOL;
-    $outstr .= '             { name: "Air", type: "float" },'.PHP_EOL;
-    $outstr .= '             { name: "Beer", type: "float" },'.PHP_EOL;
-    $outstr .= '             { name: "Target_lo", type: "float" },'.PHP_EOL;
-    $outstr .= '             { name: "Target_hi", type: "float" },'.PHP_EOL;
-    $outstr .= '             { name: "Heater", type: "int" },'.PHP_EOL;
-    $outstr .= '             { name: "Cooler", type: "int" },'.PHP_EOL;
-    $outstr .= '             { name: "HeatUse", type: "int" },'.PHP_EOL;
-    $outstr .= '             { name: "CoolUse", type: "int" },'.PHP_EOL;
-    $outstr .= '             { name: "Room", type: "float" },'.PHP_EOL;
-    $outstr .= '             { name: "Chiller", type: "float" }'.PHP_EOL;
-    $outstr .= '          ],'.PHP_EOL;
-    $outstr .= '          url: \'getalog.php?name='.urlencode($name).'.log\''.PHP_EOL;
-    $outstr .= '       };'.PHP_EOL;
-
-    $outstr .= '       var dataAdapter = new $.jqx.dataAdapter(sourceA,'.PHP_EOL;
-    $outstr .= '       {'.PHP_EOL;
-    $outstr .= '          autoBind: true,'.PHP_EOL;
-    $outstr .= '          async: false,'.PHP_EOL;
-    $outstr .= '          downloadComplete: function () { },'.PHP_EOL;
-    $outstr .= '          loadComplete: function () { },'.PHP_EOL;
-    $outstr .= '          loadError: function () { }'.PHP_EOL;
-    $outstr .= '       });'.PHP_EOL;
-
-    $outstr .= '       var settings = {'.PHP_EOL;
-    $outstr .= '         title: "'.$name.'",'.PHP_EOL;
-    $outstr .= '         description: "",'.PHP_EOL;
-    $outstr .= '         padding: { left: 5, top: 5, right: 5, bottom: 5 },'.PHP_EOL;
-    $outstr .= '         titlePadding: { left: 0, top: 0, right: 0, bottom: 10 },'.PHP_EOL;
-    $outstr .= '         source: dataAdapter,'.PHP_EOL;
-    $outstr .= '         xAxis:'.PHP_EOL;
-    $outstr .= '           {'.PHP_EOL;
-    $outstr .= '             dataField: \'Date\','.PHP_EOL;
-    $outstr .= '             type: \'date\','.PHP_EOL;
-    $outstr .= '             formatFunction: function (value) {'.PHP_EOL;
-    $outstr .= '                return value.getDate() + \'-\' + (value.getMonth() + 1) + \'-\' + value.getFullYear()'.PHP_EOL;
-    $outstr .= '             },'.PHP_EOL;
-    $outstr .= '             toolTipFormatFunction: function (value) {'.PHP_EOL;
-    $outstr .= '                var h = value.getHours();'.PHP_EOL;
-    $outstr .= '                var m = value.getMinutes();'.PHP_EOL;
-    $outstr .= '                return value.getDate() + \'-\' + (value.getMonth() + 1) + \'-\' + value.getFullYear()'; 
-    $outstr .= ' + \' \' + (h < 10 ? \'0\' + h : h) + \':\' + (m < 10 ? \'0\' + m : m);'.PHP_EOL;
-    $outstr .= '             },'.PHP_EOL;
-    $outstr .= '             textRotationAngle: 45,'.PHP_EOL;
-    $outstr .= '             showGridLines: false'.PHP_EOL;
-    $outstr .= '           },'.PHP_EOL;
-    $outstr .= '         colorScheme: \'scheme01\','.PHP_EOL;
-    $outstr .= '         seriesGroups:'.PHP_EOL;
-    $outstr .= '           [{'.PHP_EOL;
-    $outstr .= '             type: "line",'.PHP_EOL;
-    $outstr .= '             valueAxis:'.PHP_EOL;
-    $outstr .= '             {'.PHP_EOL;
-    $outstr .= '               minValue: 0,'.PHP_EOL;
-    $outstr .= '               maxValue: 100,'.PHP_EOL;
-    $outstr .= '               displayValueAxis: false,'.PHP_EOL;
-    $outstr .= '               description: "Heat/Cool %"'.PHP_EOL;
-    $outstr .= '             },'.PHP_EOL;
-    $outstr .= '             series: ['.PHP_EOL;
-    $outstr .= '               { dataField: "CoolUse", lineWidth: 1, displayText: "Cool %", opacity: 0.3 },'.PHP_EOL;
-    $outstr .= '               { dataField: "HeatUse", lineWidth: 1, displayText: "Heat %", opacity: 0.3 }'.PHP_EOL;
-    $outstr .= '             ]'.PHP_EOL;
-    $outstr .= '            },'.PHP_EOL;
-    $outstr .= '            {'.PHP_EOL;
-    $outstr .= '             type: \'spline\','.PHP_EOL;
-    $outstr .= '             valueAxis:'.PHP_EOL;
-    $outstr .= '             {'.PHP_EOL;
-    $outstr .= '               minValue: 0,'.PHP_EOL;
-    $outstr .= '               description: \'Degrees C\''.PHP_EOL;
-    $outstr .= '             },'.PHP_EOL;
-    $outstr .= '             series: ['.PHP_EOL;
-    $outstr .= '               { dataField: "Air", lineWidth: 1, displayText: "Air" },'.PHP_EOL;
-    $outstr .= '               { dataField: "Beer", lineWidth: 2, displayText: "Beer" },'.PHP_EOL;
-    $outstr .= '               { dataField: "Target_lo", lineWidth: 1, displayText: "Target Lo", opacity: 0.7 },'.PHP_EOL;
-    $outstr .= '               { dataField: "Target_hi", lineWidth: 1, displayText: "Target Hi", opacity: 0.7 },'.PHP_EOL;
-    $outstr .= '               { dataField: "Room", lineWidth: 1, displayText: "Room", opacity: 0.5 },'.PHP_EOL;
-    $outstr .= '               { dataField: "Chiller", lineWidth: 1, displayText: "Chiller", color: \'#0000bb\' }'.PHP_EOL;
-    $outstr .= '             ]'.PHP_EOL;
-    $outstr .= '           }]'.PHP_EOL;
-    $outstr .= '       };'.PHP_EOL;
-    $outstr .= '       $("#fermentor_chart").jqxChart(settings);'.PHP_EOL;
-
-    $outstr .= '       $("#print").click(function () {'.PHP_EOL;
-    $outstr .= '         var content = $("#fermentor_chart")[0].outerHTML;'.PHP_EOL;
-    $outstr .= '         var newWindow = window.open("", "", "width=865, height=425"),'.PHP_EOL;
-    $outstr .= '         document = newWindow.document.open(),'.PHP_EOL;
-    $outstr .= '         pageContent ='.PHP_EOL;
-    $outstr .= '         \'<!DOCTYPE html>\' +'.PHP_EOL;
-    $outstr .= '         \'<html>\' +'.PHP_EOL;
-    $outstr .= '         \'<head>\' +'.PHP_EOL;
-    $outstr .= '         \'<link rel="stylesheet" href="jqwidgets/styles/jqx.base.css" type="text/css" />\' +'.PHP_EOL;
-    $outstr .= '         \'<meta charset="utf-8" />\' +'.PHP_EOL;
-    $outstr .= '         \'<title>jQWidgets Chart</title>\' +'.PHP_EOL;
-    $outstr .= '         \'</head>\' +'.PHP_EOL;
-    $outstr .= '         \'<body>\' + content + \'</body></html>\';'.PHP_EOL;
-    $outstr .= '         document.write(pageContent);'.PHP_EOL;
-    $outstr .= '         document.close();'.PHP_EOL;
-    $outstr .= '         newWindow.print();'.PHP_EOL;
-    $outstr .= '       });'.PHP_EOL;
-    $outstr .= '       $("#print").jqxButton({ width: 100, height: 25, theme: "ui-redmond" });'.PHP_EOL;
-
-    $outstr .= '       $("#pdfButton").click(function () {'.PHP_EOL;
-    $outstr .= '            $("#fermentor_chart").jqxChart("saveAsPDF", "Chart_'.$name.'.pdf", getExportServer());'.PHP_EOL;
-    $outstr .= '       });'.PHP_EOL;
-    $outstr .= '       $("#pdfButton").jqxButton({ width: 100, height: 25, theme: "ui-redmond" });'.PHP_EOL;
-
-    $outstr .= '     });'.PHP_EOL;
-    $outstr .= '    </script>'.PHP_EOL;
-    $outstr .= '    <div id="fermentor">'.PHP_EOL;
-    $outstr .= '     <div id="fermentor_chart" style="width:850px; height:410px; float:left"></div>'.PHP_EOL;
-    $outstr .= '     <div style="margin-top: 2px; margin-left: 10px;">'.PHP_EOL;
-    $outstr .= '      <input style="float: left; margin-left: 10px;" id="print" type="button" value="Print Graph" />'.PHP_EOL;
-    $outstr .= '      <input style="float: left; margin-left: 10px; margin-top: 10px;" id="pdfButton" type="button" value="Save as PDF" />'.PHP_EOL;
-    $outstr .= '     </div>'.PHP_EOL;
-    $outstr .= '    </div> <!-- fermentor -->'.PHP_EOL;
-
-    $outstr .= '    <script type="text/javascript">'.PHP_EOL;
-    $outstr .= '     $(document).ready(function () {'.PHP_EOL;
-    $outstr .= '      $("#archives").jqxButton({ width: 150, height: 25, theme: \'ui-redmond\' });'.PHP_EOL;
-    $outstr .= '     });'.PHP_EOL;
-    $outstr .= '    </script>'.PHP_EOL;
-    $outstr .= build_footer();
-    echo $outstr;
-}
-
-
-
-/*
- * Download popup. The file contents is dynamic generated from
- * the thermferm server.
- */
-function archive_dl() {
-
-    $name = urldecode($_GET['name']) . ".log";
-
-    header('Content-Type: text/plain');
-    header('Content-Disposition: attachment; filename="'.$name.'"');
-
-    $answer = send_cmd('ARCHIVE GET '.$name);
-    $arr = explode("\r\n", $answer);
-
-    $outstr  = '';
-    if (startsWith($arr[0], "212")) {
-	$j = 1;
-	while (1) {
-	    if (strcmp($arr[$j], ".") == 0)
-		break;
-	    $outstr .= $arr[$j].PHP_EOL;
-	    $j++;
-	}
-    }
-    echo $outstr;
-    exit();
-}
-
-
-
-/*
- * Show directory
- */
-function archive_dir() {
-
-    $answer = send_cmd("ARCHIVE DIR");
-    $reply = explode("\r\n", $answer);
-
-    $outstr  = build_header("Archived logfiles");
-    $outstr .= '    <div id="errors">'.PHP_EOL;
-    $outstr .= '    </div> <!-- errors -->'.PHP_EOL;
-    $outstr .= '    <div id="etable">'.PHP_EOL;
-    $outstr .= '     <table class="setup">'.PHP_EOL;
-    $outstr .= '      <tr class="trhead">'.PHP_EOL;
-    $outstr .= '       <td class="setup" style="width: 340px;">File name</td>'.PHP_EOL;
-    $outstr .= '       <td class="setup" style="width:  90px;">Mode</td>'.PHP_EOL;
-    $outstr .= '       <td class="setup" style="width: 100px;">Size</td>'.PHP_EOL;
-    $outstr .= '       <td class="setup" style="width: 140px;">Date</td>'.PHP_EOL;
-    $outstr .= '       <td class="setup" style="width: 110px;">Action</td>'.PHP_EOL;
-    $outstr .= '      </tr>'.PHP_EOL;
-
-    if (startsWith($reply[0], "212")) {
-	$j = 1;
-	while (1) {
-	    if (strcmp($reply[$j], ".") == 0)
-		break;
-	    $f = explode(",", $reply[$j]);
-	    $name = urlencode(basename($f[0], ".log"));
-	    $outstr .= '      <tr class="setup">'.PHP_EOL;
-	    $outstr .= '       <td class="setup">'.$f[0].'</td>'.PHP_EOL;
-	    $outstr .= '       <td class="setup">'.$f[1].'</td>'.PHP_EOL;
-	    $outstr .= '       <td class="setup">'.$f[2].'</td>'.PHP_EOL;
-	    $outstr .= '       <td class="setup">'.$f[3].'</td>'.PHP_EOL;
-	    $outstr .= '       <td class="setup"><a href="archives.php?action=dl&amp;name='.$name.'">Download</a>';
-	    $outstr .= ' <a href="archives.php?action=view&amp;return=archives&amp;name='.$name.'">View</a></td>'.PHP_EOL;
-	    $outstr .= '      </tr>'.PHP_EOL;
-	    $j++;
-	}
-    }
-
-    $outstr .= '     </table>'.PHP_EOL;
-    $outstr .= '    </div> <!-- etable -->'.PHP_EOL;
-    $outstr .= '    <script type="text/javascript">'.PHP_EOL;
-    $outstr .= '     $(document).ready(function () {'.PHP_EOL;
-    $outstr .= '      $("#maintenance").jqxButton({ width: 150, height: 25, theme: \'ui-redmond\' });'.PHP_EOL;
-    $outstr .= '     });'.PHP_EOL;
-    $outstr .= '    </script>'.PHP_EOL;
-    $outstr .= build_footer();
-    echo $outstr;
-}
-
-
-
--- a/www-thermferm/maintenance.php	Thu May 09 16:40:17 2019 +0200
+++ b/www-thermferm/maintenance.php	Thu May 09 17:01:56 2019 +0200
@@ -79,9 +79,6 @@
 $outstr .= '      <form action="devices.php" style="margin:20px;">'.PHP_EOL;
 $outstr .= '       <input type="submit" id="devices" value="Devices Setup" />'.PHP_EOL;
 $outstr .= '      </form>'.PHP_EOL;
-$outstr .= '      <form action="archives.php" style="margin:20px;">'.PHP_EOL;
-$outstr .= '       <input type="submit" id="archives" value="Archives" />'.PHP_EOL;
-$outstr .= '      </form>'.PHP_EOL;
 $outstr .= '     </div>'.PHP_EOL;
 $outstr .= '     <div id="menu_right">'.PHP_EOL;
 $outstr .= '      <form action="units.php" style="margin:20px;">'.PHP_EOL;
@@ -101,7 +98,6 @@
 $outstr .= '     $(document).ready(function () {'.PHP_EOL;
 $outstr .= '      $("#maintenance").jqxButton({ width: 150, height: 25, theme: \'ui-redmond\' });'.PHP_EOL;
 $outstr .= '      $("#global").jqxButton({ width: 200, height: 25, theme: \'ui-redmond\' });'.PHP_EOL;
-$outstr .= '      $("#archives").jqxButton({ width: 200, height: 25, theme: \'ui-redmond\' });'.PHP_EOL;
 $outstr .= '      $("#devices").jqxButton({ width: 200, height: 25, theme: \'ui-redmond\' });'.PHP_EOL;
 $outstr .= '      $("#units").jqxButton({ width: 200, height: 25, theme: \'ui-redmond\' });'.PHP_EOL;
 $outstr .= '     });'.PHP_EOL;

mercurial