replaced lua pages by html pages
authorJean-Philippe Orsini <jeanfi@gmail.com>
Wed, 13 Jul 2011 08:32:02 +0000 (08:32 +0000)
committerJean-Philippe Orsini <jeanfi@gmail.com>
Wed, 13 Jul 2011 08:32:02 +0000 (08:32 +0000)
www/Makefile.am
www/index.html [new file with mode: 0644]
www/index.lua [deleted file]
www/monitor.lua [deleted file]
www/style.css

index 2c7a3ab..4ad4850 100644 (file)
@@ -1,4 +1,4 @@
 defaultwwwdir = $(pkgdatadir)/www
-defaultwww_DATA = monitor.lua style.css favicon.ico index.lua monitor.html jquery.js
+defaultwww_DATA = index.html style.css favicon.ico index.lua monitor.html jquery.js
 
 EXTRA_DIST=$(defaultwww_DATA)
diff --git a/www/index.html b/www/index.html
new file mode 100644 (file)
index 0000000..b3c235b
--- /dev/null
@@ -0,0 +1,25 @@
+<html>
+  <head>
+    <title>Psensor Server</title>
+    <link type="text/css" href="style.css" rel="stylesheet" /> 
+
+  </head>
+  <body>
+
+    <div class='page'>
+      <div class='page-header'>
+       <h1>Psensor Server</h1>
+      </div>
+      
+      <div class='page-content'>
+       <p>Go to the <a href='monitor.html'>Monitoring page</a></p>
+       
+      </div>
+    </div>
+    
+    <div class='page-footer'>
+      <a href='http://wpitchoune.net/psensor'>Psensor Server</a> - (c)2011 jeanfi@gmail.com 
+    </div>    
+
+  </body>
+</html>
diff --git a/www/index.lua b/www/index.lua
deleted file mode 100644 (file)
index 817535a..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-
-function footer()
-   return "<div class='footer'>"
-      .. "<a href='http://wpitchoune.net/psensor'>psensor-server</a> v"
-      .. psensor_version 
-      .. "</div>"
-end
-
-str = "\
-<html>\
-  <head>\
-    <title>Psensor Web Server</title>\
-    <link rel='stylesheet' type='text/css' href='/style.css' />\
-  </head>\
-\
-  <body>\
-\
-  <h1>Welcome to the Psensor Web Server!</h1>\
-\
-  <p>Go to the <a href='monitor.lua'>Monitoring Page</a>.</p>\
-\
-  <hr />"
-   .. footer() 
-   .. "</body>\
-\
-</html>"
-
-return str
\ No newline at end of file
diff --git a/www/monitor.lua b/www/monitor.lua
deleted file mode 100644 (file)
index 57b7a46..0000000
+++ /dev/null
@@ -1,188 +0,0 @@
---
--- Convenient functions for HTML output
--- 
-
-function td(content)
-   return "<td>" .. content .. "</td>"
-end
-
-function th(style, content)
-   if style then
-      return "<th class='"..style.."'>"..content.."</th>"
-   else
-      return "<th>"..content.."</th>"
-   end
-end
-
-function tr(style,...)
-   if style then
-      ret = "<tr class='"..style.."'>"
-   else 
-      ret = "<tr>"
-   end
-
-   for i,s in ipairs(arg) do
-      ret = ret .. s
-   end
-
-   ret = ret .. "</tr>\n"
-
-   return ret
-end
-
-function h2(str) 
-   return "<h2>"..str.."</h2>\n"
-end
-
-
--- Formats sensor information to HTML 'tr'
-function sensor_to_tr(id,sensor)
-   return tr(nil,
-            td(sensor["name"]),
-            td(sensor["measure_last"]),
-            td(sensor["measure_min"]),
-            td(sensor["measure_max"]))
-end
-
-
--- Formats number of bytes to string
-function format_mem_size(bytes)
-   if (bytes == 0) then
-      return "0"
-   end
-
-   if (bytes < 1024) then
-      return bytes .. " o";
-   end
-
-   mo_bytes = 1024 * 1024;
-
-   if (bytes < mo_bytes) then
-      return math.ceil(bytes / 1024) .. " Ko"
-   end
-
-   go_bytes = 1024 * mo_bytes;
-
-   if (bytes < go_bytes) then
-      return math.ceil(bytes / mo_bytes) .. " Mo"
-   end
-
-   return math.ceil(bytes / go_bytes) .. " Go"
-end
-
--- Formats uptime to string
-function format_uptime(uptime)
-   uptime_s = sysinfo["uptime"]%60
-   uptime_mn = math.floor( (sysinfo["uptime"] / 60) % 60)
-   uptime_h = math.floor( (sysinfo["uptime"] / (60*60)) % 24)
-   uptime_d = math.floor(sysinfo["uptime"] / (60*60*24))
-
-   return uptime_d .. "d " ..
-      uptime_h .. "h " ..
-      string.format("%02.d",uptime_mn) .. "mn " ..
-      string.format("%02d",uptime_s) .. "s"
-end
-
-str = "<html><head><link rel='stylesheet' type='text/css' href='/style.css' /></head><body><h1>Psensor Monitoring Server</h1>"
-
-if sysinfo then
-
---
--- Uptime
---
-
-   str = str .. "<p><strong>Uptime</strong>: " .. format_uptime(sysinfo["uptime"]) .. "</p>"
-
---
--- CPU
---
-
-   str = str .. h2("CPU")
-
-   str = str .. "<table>"
-      .. "<thead>" .. tr("title",
-           th(nil,"Current usage"),
-           th(nil,"Load 1mn"),
-           th(nil,"Load 5mn"),
-           th(nil,"Load 15mn")) .. "</thead>"
-
-   str = str .. "<tbody><tr>"
-
-   if sysinfo["load"] then
-      str = str .. td(math.ceil(100*sysinfo["load"]) .. "%")
-   else
-      str = str .. td("N/A")
-   end
-
-   str = str  .. td(string.format("%.2f",sysinfo["load_1mn"])) ..
-   td(string.format("%.2f",sysinfo["load_5mn"])) ..
-   td(string.format("%.2f",sysinfo["load_15mn"])) ..
-   "</tbody></tr>" ..
-   "</table>"
-
---
--- Memory
---
-
-   totalram = format_mem_size(sysinfo["totalram"] * sysinfo["mem_unit"])
-   freeram = format_mem_size(sysinfo["freeram"] * sysinfo["mem_unit"])
-   sharedram = format_mem_size(sysinfo["sharedram"] * sysinfo["mem_unit"])
-   bufferram = format_mem_size(sysinfo["bufferram"] * sysinfo["mem_unit"])
-   usedram = format_mem_size(sysinfo["totalram"] - sysinfo["freeram"])
-
-   totalswap = format_mem_size(sysinfo["totalswap"] * sysinfo["mem_unit"])
-   freeswap = format_mem_size(sysinfo["freeswap"] * sysinfo["mem_unit"])
-   usedswap = format_mem_size(sysinfo["totalswap"] - sysinfo["freeswap"])
-
-   str = str 
-      .. h2("Memory")
-
-      .. "<table>"
-
-      .. tr("title",
-           th(nil,""),
-           th(nil,"Total"),
-           th(nil,"Used"),
-           th(nil,"Free"),
-           th(nil,"Shared"),
-           th(nil,"Buffer"))
-
-      .. tr(nil,
-           th(nil,"Memory"),
-           td(totalram),
-           td(usedram),
-           td(freeram),
-           td(sharedram),
-           td(bufferram))
-   
-       .. tr(nil,
-            th(nil,"Swap"),
-            td(totalswap),
-            td(usedswap),
-            td(freeswap))
-    
-       .. "</table>"
-                                  
-end
-
---
--- Sensors
--- 
-
-if sensors then
-
-   str = str .. "<h2>Sensors</h2>"
-      .. "<table>"
-      .. "<tr class='title'><th>Name</th><th>Value</th><th>Min</th><th>Max</th></tr>"
-
-   for i,sensor in ipairs(sensors) do 
-      str = str .. sensor_to_tr(i,sensor) 
-   end
-   
-   str = str .. "</table><hr /><a href='http://wpitchoune.net/psensor'>psensor-server</a></body></html>"
-
-end
-
-
-return str
-
index 61c0719..b42f601 100644 (file)
@@ -108,12 +108,12 @@ th, td {
     padding: 4px 4px 4px 4px;
 }
 
-a:link, a:visited, a:active {
+.page-footer a:link , .page-footer a:visited, .page-footer a:active {
     text-decoration: none;
     color: #333333;
 }
 
-a:hover {
+.page-footer a:hover {
     text-decoration: underline;
     color: #333333;
 }