git-svn-id: https://svn.code.sf.net/p/freetel/code@419 01035d8c-6547-0410-b346-abe4f9...
authorhorse69 <horse69@01035d8c-6547-0410-b346-abe4f91aad63>
Fri, 11 May 2012 21:37:56 +0000 (21:37 +0000)
committerhorse69 <horse69@01035d8c-6547-0410-b346-abe4f91aad63>
Fri, 11 May 2012 21:37:56 +0000 (21:37 +0000)
mini-asterisk-gui2/cgi-bin/ipkg.cgi [new file with mode: 0755]
mini-asterisk-gui2/cgi-bin/uptime.cgi [new file with mode: 0755]
mini-asterisk-gui2/system.js

diff --git a/mini-asterisk-gui2/cgi-bin/ipkg.cgi b/mini-asterisk-gui2/cgi-bin/ipkg.cgi
new file mode 100755 (executable)
index 0000000..4a14727
--- /dev/null
@@ -0,0 +1,28 @@
+#!/bin/sh
+# ipkg.cgi
+#  Ian Roberts
+#  May 12 2012
+# CGI to execute ipkg <argument>
+# script expects only one argument
+# valid arguments are list_installed, list etc
+
+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
+
+arg=`echo "$QUERY_STRING" | sed -n "s/.*arg=//p" | sed "s/,/ /g"`
+#Todo : Test for one argument
+#Todo : Test for valid argument
+ipkg $arg
+
+cat <<EOF
+</body>
+</html>
+EOF
diff --git a/mini-asterisk-gui2/cgi-bin/uptime.cgi b/mini-asterisk-gui2/cgi-bin/uptime.cgi
new file mode 100755 (executable)
index 0000000..2073e2d
--- /dev/null
@@ -0,0 +1,25 @@
+#!/bin/sh
+# uptime.cgi
+#  Ian Roberts
+#  May 12 2012
+# CGI to execute uptime
+# no arguments
+
+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
+
+#arg=`echo "$QUERY_STRING" | sed -n "s/.*arg=//p" | sed "s/,/ /g"`
+uptime
+
+cat <<EOF
+</body>
+</html>
+EOF
index fb128420622e8b3e9d27aa833745c0f6845edff4..db29ef40a5db9979dd4ff3f2df7d16ef3967391d 100644 (file)
@@ -46,12 +46,16 @@ function initialisePage() {
     html += '<tr><td div id="mtd"></div></td></tr>';
 
     html += '<tr><td colspan="2">cat /proc/meminfo</td></tr>';
+    html += '<tr><td div id="meminfo"></div></td></tr>';
 
     html += '<tr><td colspan="2">cat /proc/yaffs</td></tr>';
+    html += '<tr><td div id="yaffs"></div></td></tr>';
 
     html += '<tr><td colspan="2">uptime</td></tr>';
+    html += '<tr><td div id="uptime"></div></td></tr>';
 
     html += '<tr><td colspan="2">ipkg list_installed</td></tr>';
+    html += '<tr><td div id="installed"></div></td></tr>';
 
     html += '<tr><td>&nbsp</td></tr>';
  
@@ -82,14 +86,17 @@ function loadLoadavg(doc, status) {
 }
 
 function loadCPUinfo(doc, status) {
-       cpuinfo = "";
-
-//     cpuinfo = doc.substr(0, doc.length);
-    if (doc.indexOf("processor") != -1) {
-       ip = doc.substr(doc.indexOf("processor"), doc.length);
-//     ip = ip.substr(10, ip.length);
-       ip = ip.substr(0, ip.indexOf("power manage"));
-    }
+       ip = "";
+
+       ip = doc.substr(0, doc.length);
+        if (doc.indexOf("CPU") != -1) {
+
+               // Blackfin hardware is ADSP-BF533
+               ip = doc.substr(doc.indexOf("CPU"), doc.length);
+//             ip = ip.substr(10, ip.length);
+//             ip = ip.substr(0, ip.indexOf("power manage"));
+       }
+
        document.getElementById('cpuinfo').innerHTML = ip;
 
        downloadUrl("/cgi-bin/catproc.cgi?arg=mtd", loadmtd);
@@ -99,8 +106,35 @@ function loadmtd(doc, status) {
 
        document.getElementById('mtd').innerHTML = doc.substr(0, doc.length);
 
-//     downloadUrl("/cgi-bin/catproc.cgi?arg=cpuinfo", loadCPUinfo);
+       downloadUrl("/cgi-bin/catproc.cgi?arg=meminfo", loadmeminfo);
+}
+
+function loadmeminfo(doc, status) {
+
+       document.getElementById('meminfo').innerHTML = doc.substr(0, doc.length);
+
+       downloadUrl("/cgi-bin/catproc.cgi?arg=yaffs", loadyaffs);
+}
+
+function loadyaffs(doc, status) {
+
+       document.getElementById('yaffs').innerHTML = doc.substr(0, doc.length);
+
+       downloadUrl("/cgi-bin/uptime.cgi?arg=nothing", loaduptime);
+}
+
+function loaduptime(doc, status) {
+
+       document.getElementById('uptime').innerHTML = doc.substr(0, doc.length);
+
+       downloadUrl("/cgi-bin/ipkg.cgi?arg=list_installed", loadinstalled);
 }
 
+function loadinstalled(doc, status) {
+
+       document.getElementById('installed').innerHTML = doc.substr(0, doc.length);
+
+//     downloadUrl("/cgi-bin/catproc.cgi?arg=cpuinfo", loadCPUinfo);
+}