system info page work
authorhorse69 <horse69@01035d8c-6547-0410-b346-abe4f91aad63>
Tue, 8 May 2012 03:04:40 +0000 (03:04 +0000)
committerhorse69 <horse69@01035d8c-6547-0410-b346-abe4f91aad63>
Tue, 8 May 2012 03:04:40 +0000 (03:04 +0000)
git-svn-id: https://svn.code.sf.net/p/freetel/code@403 01035d8c-6547-0410-b346-abe4f91aad63

mini-asterisk-gui2/cgi-bin/catproc.cgi [new file with mode: 0755]
mini-asterisk-gui2/minicommon.js
mini-asterisk-gui2/system.html
mini-asterisk-gui2/system.js

diff --git a/mini-asterisk-gui2/cgi-bin/catproc.cgi b/mini-asterisk-gui2/cgi-bin/catproc.cgi
new file mode 100755 (executable)
index 0000000..1e5b764
--- /dev/null
@@ -0,0 +1,24 @@
+#!/bin/sh
+# catprocversion.cgi
+#  Ian Roberts
+#  May 7 2012
+# CGI to cat /proc/(argument)
+
+cat <<EOF
+Content-type: text/html
+
+<html>
+<head>
+<meta http-equiv="cache-control" content="no-cache">
+<meta http-equiv="pragma" content="no-cache">
+<meta http-equiv="expires" content="-1"></head></head>
+<body>
+EOF
+
+what=`echo "$QUERY_STRING" | sed -n "s/.*arg=//p" | sed "s/,/ /g"`
+cat /proc/$what
+
+cat <<EOF
+</body>
+</html>
+EOF
index 81c92a20ecd67432e204513badd282139a594c81..80792ac139f750daf52a8a80ce19608277977eda 100644 (file)
@@ -20,6 +20,8 @@ var ip_ext = [];
 
 var network = "no";
 
+
+
 function loadExtensions() {
 
     /* 
@@ -242,7 +244,7 @@ function createXmlHttpRequest() {
        changeStatus(e);
     }
     return null;
-};
+}
 
 
 /**
@@ -278,4 +280,7 @@ function downloadUrl(url, callback) {
     } catch (e) {
        changeStatus(e);
     }
-};
+
+}
+
+
index 56fb537acd7780b6160034fba305b0191cc7fda7..19fb279a994656640208727c0973c3d38d5d8290 100644 (file)
@@ -2,7 +2,7 @@
 <html>
 <head>
 <meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
-<title>About</title>
+<title>System</title>
 
 <link rel="stylesheet" type="text/css" href="ministyle.css">
 <link rel="stylesheet" href="tooltip.css" type="text/css" />
index be203bde3c91c9e44ec05faa8edb83fd32032882..01f599f18a164316b6eb4831232c242bea3403ac 100644 (file)
@@ -1,5 +1,5 @@
 /*
-  about.js
+  system.js
   Ian Roberts
   May 7 2012
 
@@ -8,12 +8,14 @@
 
 var update_time = 10;
 
+var version = "Linux ....";
 
 // Called when we load page
 
 function initialise() {
     mainMenu();
 
+    loadSystemInfo();   // Kick off cgi scripts
     initialisePage();
 }
 
@@ -30,13 +32,23 @@ function initialisePage() {
 
     html += '<tr><td colspan="3" align="left" valign="top"><h2>System</h2></td></tr>';
     html += '<tr><td colspan="2">Display results of the following shell commands</td></tr>';
-    html += '<tr><td colspan="2">cat /proc/version</td></tr>';
-    html += '<tr><td colspan="2">ipkg list_installed</td></tr>';
+
+    html += '<tr><td colspan="2">cat /proc/version</td></tr>' ;
+    html += '<tr><td div id="version"></div></td></tr>';
+
     html += '<tr><td colspan="2">cat /proc/loadavg</td></tr>';
-    html += '<tr><td colspan="2">uptime</td></tr>';
+    html += '<tr><td div id="loadavg"></div></td></tr>';
+
     html += '<tr><td colspan="2">cat /proc/cpuinfo</td></tr>';
+
     html += '<tr><td colspan="2">cat /proc/mtd</td></tr>';
+
     html += '<tr><td colspan="2">cat /proc/yaffs</td></tr>';
+
+    html += '<tr><td colspan="2">uptime</td></tr>';
+
+    html += '<tr><td colspan="2">ipkg list_installed</td></tr>';
+
     html += '<tr><td>&nbsp</td></tr>';
  
     html += '</table>';
@@ -45,5 +57,24 @@ function initialisePage() {
 
 }
 
+function loadSystemInfo() {
+
+       downloadUrl("/cgi-bin/catproc.cgi?arg=version", loadVersion);
+
+}
+
+function loadVersion(doc, status) {
+
+       document.getElementById('version').innerHTML = doc.substr(doc.indexOf("Linux"), doc.length);
+
+       downloadUrl("/cgi-bin/catproc.cgi?arg=loadavg", loadLoadavg);
+}
+
+function loadLoadavg(doc, status) {
+
+       document.getElementById('loadavg').innerHTML = doc.substr(0, doc.length);
+
+       //downloadUrl("/cgi-bin/catproc.cgi?arg=XXX, loadXXX);
+}