git-svn-id: https://svn.code.sf.net/p/freetel/code@523 01035d8c-6547-0410-b346-abe4f9...
authorhorse69 <horse69@01035d8c-6547-0410-b346-abe4f91aad63>
Thu, 31 May 2012 06:13:10 +0000 (06:13 +0000)
committerhorse69 <horse69@01035d8c-6547-0410-b346-abe4f91aad63>
Thu, 31 May 2012 06:13:10 +0000 (06:13 +0000)
mini-asterisk-gui2/admin.js
mini-asterisk-gui2/cgi-bin/restart.cgi [new file with mode: 0755]
mini-asterisk-gui2/minicommon.js

index 02d26fac317083cfd16882ddcbfb6525631da83e..76a8ccad705d1b7681d1d1e2de602cbfd68b6155 100644 (file)
@@ -28,7 +28,7 @@ function initialisePage() {
 function onClickSetPassword() {
 
         newpassword= document.pass.value;
-        downloadUrl("/cgi-bin/setpassword.cgi?newpassword="+newpassword,null);
+        downloadUrl("/cgi-bin/setpassword.cgi?newpassword="+newpassword,OnSetPasswordReturn);
 
 //      if not x86 (developement environment)
 //         pass=`echo "$QUERY_STRING" | grep -oe "pass=[^&?]*" | sed -n "s/pass=//p"`
@@ -40,7 +40,7 @@ function onClickSetPassword() {
 function onClickInstall() {
 
        firmwareurl=document.firmwareurl.value;
-       downloadUrl("/cgi-bin/install.cgi?file="+firmwareurl,null);
+       downloadUrl("/cgi-bin/install.cgi?file="+firmwareurl,OnInstallReturn);
 
 //      if not x86 (developement environment)
 //    firmwareurl=`echo "$QUERY_STRING" | grep -oe "firmwareurl=[^&?]*" | sed -n "s/firmwareurl=//p"`
@@ -56,7 +56,7 @@ function onClickInstall() {
 
 function onClickUpgrade() {
 
-       downloadUrl("/cgi-bin/upgrade.cgi?arg=",null);
+       downloadUrl("/cgi-bin/upgrade.cgi?arg=",OnUpgradeReturn);
 
 //      if not x86 (developement environment)
 //    rev_before=`grep -oe "Revision: [0-9]*" /www/about.sh`
@@ -73,7 +73,7 @@ function onClickUpgrade() {
 
 function onClickReset() {
 
-       downloadUrl("/cgi-bin/reset.cgi",null);
+       downloadUrl("/cgi-bin/reset.cgi",OnResetReturn);
 
 //      if not x86 (developement environment)
 //     cp /etc/asterisk/extensions.conf.def /etc/asterisk/extensions.conf
@@ -86,7 +86,7 @@ function onClickReset() {
 
 function onClickRestart() {
 
-       downloadUrl("/cgi-bin/restart.cgi",null);
+       downloadUrl("/cgi-bin/restart.cgi",OnRestartReturn);
 
 //      if not x86 (developement environment)
 //          reboot
diff --git a/mini-asterisk-gui2/cgi-bin/restart.cgi b/mini-asterisk-gui2/cgi-bin/restart.cgi
new file mode 100755 (executable)
index 0000000..a2a357d
--- /dev/null
@@ -0,0 +1,56 @@
+#!/bin/sh
+# restart.cgi
+# Ian Roberts 31 May 2012
+#
+# CGI to reboot ipox
+
+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
+
+
+# check what sort of machine we are running on.  Many operations
+# outlawed for x86
+
+cat /proc/cpuinfo | grep "CPU:.*ADSP" > /dev/null
+if [ $? -eq 0 ]; then
+    mach="ip0x"
+else
+    mach="x86"
+fi
+
+
+
+if [ $mach != "ip0x" ] ; then
+       echo "<html>Sorry, only supported on the IP0X</html>"
+       exit
+fi
+
+# kill cookie to log out.  This ensures hitting refresh wont run
+# the restart process again
+
+cat <<EOF
+Content-type: text/html
+Set-Cookie: loggedin=1; expires=Thursday, 01-Jan-98 12:00:00 GMT
+
+<head>
+<title>Mini Asterisk - Restart</title>
+</head>
+<body>
+<h2>Restarting...come back in 1 minute</h2>
+</body>
+EOF
+#reboot
+
+
+cat <<EOF
+</body>
+</html>
+EOF
index 730d7f054572e7aa79d295f18449aa06ac62cf1f..5a65e849ac093c33579891f7a3a2071a0f2a817d 100644 (file)
@@ -162,6 +162,50 @@ function loadIpExtensions(doc,status) {
       initialisePage();
 }
 
+function OnResetReturn(doc,status) {
+    loadHtmlTextFile(doc, function(line) {
+           //parseSipShowPeers(line);
+       }
+       );
+
+      initialisePage();
+}
+
+function OnRestartReturn(doc,status) {
+    loadHtmlTextFile(doc, function(line) {
+           //parseSipShowPeers(line);
+       }
+       );
+
+      initialisePage();
+}
+
+function OnUpgradeReturn(doc,status) {
+    loadHtmlTextFile(doc, function(line) {
+           //parseSipShowPeers(line);
+       }
+       );
+
+      initialisePage();
+}
+
+function OnInstallReturn(doc,status) {
+    loadHtmlTextFile(doc, function(line) {
+           //parseSipShowPeers(line);
+       }
+       );
+
+      initialisePage();
+}
+
+function OnSetPasswordReturn(doc,status) {
+    loadHtmlTextFile(doc, function(line) {
+           //parseSipShowPeers(line);
+       }
+       );
+
+      initialisePage();
+}
 
 // Load a html encoded text file, strips off the HTML tags
 // and calls textLineProcessing() for every line