Sun, 21 Jun 2015 19:51:58 +0200
In Archives, remove .log from download and view functions. Added new Save as PDF buttons.
--- a/www-thermferm/archives.php Sun Jun 14 22:48:45 2015 +0200 +++ b/www-thermferm/archives.php Sun Jun 21 19:51:58 2015 +0200 @@ -83,6 +83,7 @@ $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; @@ -119,7 +120,7 @@ $outstr .= ' { name: "CoolUse", type: "int" },'.PHP_EOL; $outstr .= ' { name: "Room", type: "float" }'.PHP_EOL; $outstr .= ' ],'.PHP_EOL; - $outstr .= ' url: \'getalog.php?name='.urlencode($name).'\''.PHP_EOL; + $outstr .= ' url: \'getalog.php?name='.urlencode($name).'.log\''.PHP_EOL; $outstr .= ' };'.PHP_EOL; $outstr .= ' var dataAdapter = new $.jqx.dataAdapter(sourceA,'.PHP_EOL; @@ -175,7 +176,6 @@ $outstr .= ' ]'.PHP_EOL; $outstr .= ' }]'.PHP_EOL; $outstr .= ' };'.PHP_EOL; - /* Direct draw for the first time */ $outstr .= ' $("#fermentor_chart").jqxChart(settings);'.PHP_EOL; $outstr .= ' $("#print").click(function () {'.PHP_EOL; @@ -200,7 +200,11 @@ $outstr .= ' $("#pngButton").click(function () {'.PHP_EOL; $outstr .= ' $("#fermentor_chart").jqxChart("saveAsPNG", "Chart_'.$name.'.png", getExportServer());'.PHP_EOL; $outstr .= ' });'.PHP_EOL; + $outstr .= ' $("#pdfButton").click(function () {'.PHP_EOL; + $outstr .= ' $("#fermentor_chart").jqxChart("saveAsPDF", "Chart_'.$name.'.pdf", getExportServer());'.PHP_EOL; + $outstr .= ' });'.PHP_EOL; $outstr .= ' $("#pngButton").jqxButton({ width: 100, height: 25, theme: "ui-redmond" });'.PHP_EOL; + $outstr .= ' $("#pdfButton").jqxButton({ width: 100, height: 25, theme: "ui-redmond" });'.PHP_EOL; $outstr .= ' });'.PHP_EOL; $outstr .= ' </script>'.PHP_EOL; @@ -208,7 +212,8 @@ $outstr .= ' <div id="fermentor_chart" style="width:720px; height:377px; float:left"></div>'.PHP_EOL; $outstr .= ' <div style="margin-top: 2px; margin-left: 10px;">'.PHP_EOL; $outstr .= ' <input style="float: left; margin-left: 15px;" id="print" type="button" value="Print Graph" />'.PHP_EOL; - $outstr .= ' <input style="float: left; margin-left: 15px;" id="pngButton" type="button" value="Save Graph" />'.PHP_EOL; + $outstr .= ' <input style="float: left; margin-left: 15px;" id="pngButton" type="button" value="Save as PNG" />'.PHP_EOL; + $outstr .= ' <input style="float: left; margin-left: 15px;" id="pdfButton" type="button" value="Save as PDF" />'.PHP_EOL; $outstr .= ' </div>'.PHP_EOL; $outstr .= ' </div> <!-- fermentor -->'.PHP_EOL; @@ -229,7 +234,7 @@ */ function archive_dl() { - $name = urldecode($_GET['name']); + $name = urldecode($_GET['name']) . ".log"; header('Content-Type: text/plain'); header('Content-Disposition: attachment; filename="'.$name.'"'); @@ -254,7 +259,7 @@ /* - * + * Show directory */ function archive_dir() { @@ -280,13 +285,14 @@ 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&name='.urlencode($f[0]).'">Download</a>'; - $outstr .= ' <a href="archives.php?action=view&name='.urlencode($f[0]).'">View</a></td>'.PHP_EOL; + $outstr .= ' <td class="setup"><a href="archives.php?action=dl&name='.$name.'">Download</a>'; + $outstr .= ' <a href="archives.php?action=view&name='.$name.'">View</a></td>'.PHP_EOL; $outstr .= ' </tr>'.PHP_EOL; $j++; }
--- a/www-thermferm/index.php Sun Jun 14 22:48:45 2015 +0200 +++ b/www-thermferm/index.php Sun Jun 21 19:51:58 2015 +0200 @@ -156,6 +156,7 @@ $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;
--- a/www-thermferm/liveview.php Sun Jun 14 22:48:45 2015 +0200 +++ b/www-thermferm/liveview.php Sun Jun 21 19:51:58 2015 +0200 @@ -201,13 +201,17 @@ $outstr .= ' document.close();'.PHP_EOL; $outstr .= ' newWindow.print();'.PHP_EOL; $outstr .= ' });'.PHP_EOL; - $outstr .= ' $("#print_'.$unr.'").jqxButton({ width: 100, height: 25, theme: "ui-redmond" });'.PHP_EOL; + $outstr .= ' $("#print_'.$unr.'").jqxButton({ width: 70, height: 25, theme: "ui-redmond" });'.PHP_EOL; $outstr .= ' $("#pngButton_'.$unr.'").click(function () {'.PHP_EOL; // call the export server to create a PNG image $outstr .= ' $("#fermentor_chart_'.$unit.'").jqxChart("saveAsPNG", "Chart_'.$name.'.png", getExportServer'.$unr.'());'.PHP_EOL; $outstr .= ' });'.PHP_EOL; - $outstr .= ' $("#pngButton_'.$unr.'").jqxButton({ width: 100, height: 25, theme: "ui-redmond" });'.PHP_EOL; + $outstr .= ' $("#pdfButton_'.$unr.'").click(function () {'.PHP_EOL; + $outstr .= ' $("#fermentor_chart_'.$unit.'").jqxChart("saveAsPDF", "Chart_'.$name.'.pdf", getExportServer'.$unr.'());'.PHP_EOL; + $outstr .= ' });'.PHP_EOL; + $outstr .= ' $("#pngButton_'.$unr.'").jqxButton({ width: 70, height: 25, theme: "ui-redmond" });'.PHP_EOL; + $outstr .= ' $("#pdfButton_'.$unr.'").jqxButton({ width: 70, height: 25, theme: "ui-redmond" });'.PHP_EOL; $outstr .= ' setInterval(function(){'.PHP_EOL; $outstr .= ' $.getJSON("getstate.php?uuid='.$unit.'", function(data) {'.PHP_EOL; @@ -409,9 +413,10 @@ $outstr .= ' </div> <!-- fermentor_panel_control -->'.PHP_EOL; $outstr .= ' <div id="fermentor_panel_buttons">'.PHP_EOL; - $outstr .= ' <div style="margin-top: 2px; margin-left: 10px;">'.PHP_EOL; - $outstr .= ' <input style="float: left;" id="print_'.$unr.'" type="button" value="Print Graph" />'.PHP_EOL; - $outstr .= ' <input style="float: left; margin-left: 15px;" id="pngButton_'.$unr.'" type="button" value="Save Graph" />'.PHP_EOL; + $outstr .= ' <div style="margin-top: 2px; margin-left: 5px;">'.PHP_EOL; + $outstr .= ' <input style="float: left;" id="print_'.$unr.'" type="button" value="Print" />'.PHP_EOL; + $outstr .= ' <input style="float: left; margin-left: 7px;" id="pngButton_'.$unr.'" type="button" value="as PNG" />'.PHP_EOL; + $outstr .= ' <input style="float: left; margin-left: 7px;" id="pdfButton_'.$unr.'" type="button" value="as PDF" />'.PHP_EOL; $outstr .= ' </div>'.PHP_EOL; $outstr .= ' </div> <!-- fermentor_panel_buttons -->'.PHP_EOL;