From a50aca561a8123e5db830ae350fbd486ce726e76 Mon Sep 17 00:00:00 2001 From: horse69 Date: Tue, 8 May 2012 03:04:40 +0000 Subject: [PATCH] system info page work git-svn-id: https://svn.code.sf.net/p/freetel/code@403 01035d8c-6547-0410-b346-abe4f91aad63 --- mini-asterisk-gui2/cgi-bin/catproc.cgi | 24 ++++++++++++++++ mini-asterisk-gui2/minicommon.js | 9 ++++-- mini-asterisk-gui2/system.html | 2 +- mini-asterisk-gui2/system.js | 39 +++++++++++++++++++++++--- 4 files changed, 67 insertions(+), 7 deletions(-) create mode 100755 mini-asterisk-gui2/cgi-bin/catproc.cgi diff --git a/mini-asterisk-gui2/cgi-bin/catproc.cgi b/mini-asterisk-gui2/cgi-bin/catproc.cgi new file mode 100755 index 00000000..1e5b764c --- /dev/null +++ b/mini-asterisk-gui2/cgi-bin/catproc.cgi @@ -0,0 +1,24 @@ +#!/bin/sh +# catprocversion.cgi +# Ian Roberts +# May 7 2012 +# CGI to cat /proc/(argument) + +cat < + + + + + +EOF + +what=`echo "$QUERY_STRING" | sed -n "s/.*arg=//p" | sed "s/,/ /g"` +cat /proc/$what + +cat < + +EOF diff --git a/mini-asterisk-gui2/minicommon.js b/mini-asterisk-gui2/minicommon.js index 81c92a20..80792ac1 100644 --- a/mini-asterisk-gui2/minicommon.js +++ b/mini-asterisk-gui2/minicommon.js @@ -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); } -}; + +} + + diff --git a/mini-asterisk-gui2/system.html b/mini-asterisk-gui2/system.html index 56fb537a..19fb279a 100644 --- a/mini-asterisk-gui2/system.html +++ b/mini-asterisk-gui2/system.html @@ -2,7 +2,7 @@ -About +System diff --git a/mini-asterisk-gui2/system.js b/mini-asterisk-gui2/system.js index be203bde..01f599f1 100644 --- a/mini-asterisk-gui2/system.js +++ b/mini-asterisk-gui2/system.js @@ -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 += '

System

'; html += 'Display results of the following shell commands'; - html += 'cat /proc/version'; - html += 'ipkg list_installed'; + + html += 'cat /proc/version' ; + html += ''; + html += 'cat /proc/loadavg'; - html += 'uptime'; + html += ''; + html += 'cat /proc/cpuinfo'; + html += 'cat /proc/mtd'; + html += 'cat /proc/yaffs'; + + html += 'uptime'; + + html += 'ipkg list_installed'; + html += ' '; html += ''; @@ -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); +} -- 2.25.1