aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Rude <[email protected]>2011-06-22 22:10:28 -0500
committerMatt Rude <[email protected]>2011-06-22 22:10:28 -0500
commitd11479ea97aabc2e5bc82b8b11edc3be61254019 (patch)
tree17ae11d333aa2c6497a4fb21a57dbe70df252a33
parent7ea45fab6cc3664e09323b0f5b09ff71642d1992 (diff)
downloadtime.mattrude.com-d11479ea97aabc2e5bc82b8b11edc3be61254019.tar.gz
time.mattrude.com-d11479ea97aabc2e5bc82b8b11edc3be61254019.tar.bz2
time.mattrude.com-d11479ea97aabc2e5bc82b8b11edc3be61254019.zip
Revert "Revert "Adding a quick dojo csv export page""
This reverts commit 8ad1aeca76af5838425dd4c5591d25e5e2d78f68.
-rw-r--r--csv.php32
-rw-r--r--play.html95
2 files changed, 127 insertions, 0 deletions
diff --git a/csv.php b/csv.php
new file mode 100644
index 0000000..0b75627
--- /dev/null
+++ b/csv.php
@@ -0,0 +1,32 @@
+<?php
+
+if (!isset($_REQUEST['host']))
+ {
+ $_REQUEST['host'] = '%';
+ }
+$host = $_REQUEST['host'];
+
+try{
+$dbHandle = new PDO("sqlite:rrd/ntpstatus.sqlite");
+}catch( PDOException $exception ){
+ echo "Can NOT connect to sqlite3 database ntpstatus.sqlite";
+ die($exception->getMessage());
+}
+
+$sqlShowLog = "SELECT * FROM status WHERE host LIKE '${host}';";
+$result = $dbHandle->query($sqlShowLog);
+echo nl2br("date,host,offset,freq,sjit,cjit,wander,disp,jitter\n");
+while ($entry = $result->fetch()) {
+ $date = $entry['date'];
+ $host = $entry['host'];
+ $offset = $entry['offset'];
+ $freq = $entry['freq'];
+ $sjit = $entry['sjit'];
+ $cjit = $entry['cjit'];
+ $wander = $entry['wander'];
+ $disp = $entry['disp'];
+ $output = "$date, $host, $offset, $freq, $sjit, $cjit, $wander, $disp, 0\n";
+ echo nl2br($output);
+}
+
+?>
diff --git a/play.html b/play.html
new file mode 100644
index 0000000..51aa341
--- /dev/null
+++ b/play.html
@@ -0,0 +1,95 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html dir="ltr">
+
+ <head>
+ <style type="text/css">
+ body, html { font-family:helvetica,arial,sans-serif; font-size:90%; }
+ </style>
+ <script src="http://ajax.googleapis.com/ajax/libs/dojo/1.6/dojo/dojo.xd.js"
+ djConfig="parseOnLoad: true">
+ </script>
+ <script type="text/javascript">
+ dojo.require("dojox.grid.DataGrid");
+ dojo.require("dojox.data.CsvStore");
+
+ dojo.addOnLoad(function() {
+ // our test data store for this example:
+ var store4 = new dojox.data.CsvStore({
+ url: 'http://time.mattrude.com/csv.php?host=kirby.mattrude.com'
+ });
+
+ // set the layout structure:
+ var layout4 = [{
+ field: 'date',
+ name: 'Date',
+ width: '200px'
+ },
+ {
+ field: 'host',
+ name: 'Host',
+ width: '200px'
+ },
+ {
+ field: 'offset',
+ name: 'Offset',
+ width: '50px'
+ },
+ {
+ field: 'freq',
+ name: 'Freq',
+ width: '50px'
+ },
+ {
+ field: 'sjit',
+ name: 'System Jitter',
+ width: '100px'
+ },
+ {
+ field: 'cjit',
+ name: 'Jitter',
+ width: '50px'
+ },
+ {
+ field: 'wander',
+ name: 'Wander',
+ width: '75px'
+ },
+ {
+ field: 'disp',
+ name: 'Display',
+ width: '75px'
+ }];
+
+ // create a new grid:
+ var grid4 = new dojox.grid.DataGrid({
+ query: {
+ host: '*'
+ },
+ store: store4,
+ clientSort: true,
+ rowSelector: '20px',
+ structure: layout4
+ },
+ document.createElement('div'));
+
+ // append the new grid to the div "gridContainer4":
+ dojo.byId("gridContainer4").appendChild(grid4.domNode);
+
+ // Call startup, in order to render the grid:
+ grid4.startup();
+ });
+ </script>
+ <link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/dojo/1.6/dijit/themes/claro/claro.css" />
+ <style type="text/css">
+ @import "http://ajax.googleapis.com/ajax/libs/dojo/1.6/dojox/grid/resources/Grid.css";
+ @import "http://ajax.googleapis.com/ajax/libs/dojo/1.6/dojox/grid/enhanced/resources/claro/EnhancedGrid.css";
+ .dojoxGrid table { margin: 0; } html, body { width: 100%; height: 100%;
+ margin: 0; }
+ </style>
+ </head>
+
+ <body class=" claro ">
+ <div id="gridContainer4" style="width: 842px; height: 500px;"></div>
+ </body>
+
+</html>