From: horse69 Date: Thu, 31 May 2012 06:13:10 +0000 (+0000) Subject: git-svn-id: https://svn.code.sf.net/p/freetel/code@523 01035d8c-6547-0410-b346-abe4f9... X-Git-Url: http://git.whiteaudio.com/gitweb/?a=commitdiff_plain;h=a891532d490df6b5e072b94ad8a9773c27daba30;p=freetel-svn-tracking.git git-svn-id: https://svn.code.sf.net/p/freetel/code@523 01035d8c-6547-0410-b346-abe4f91aad63 --- diff --git a/mini-asterisk-gui2/admin.js b/mini-asterisk-gui2/admin.js index 02d26fac..76a8ccad 100644 --- a/mini-asterisk-gui2/admin.js +++ b/mini-asterisk-gui2/admin.js @@ -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 index 00000000..a2a357d2 --- /dev/null +++ b/mini-asterisk-gui2/cgi-bin/restart.cgi @@ -0,0 +1,56 @@ +#!/bin/sh +# restart.cgi +# Ian Roberts 31 May 2012 +# +# CGI to reboot ipox + +cat < + + + + + +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 "Sorry, only supported on the IP0X" + exit +fi + +# kill cookie to log out. This ensures hitting refresh wont run +# the restart process again + +cat < +Mini Asterisk - Restart + + +

Restarting...come back in 1 minute

+ +EOF +#reboot + + +cat < + +EOF diff --git a/mini-asterisk-gui2/minicommon.js b/mini-asterisk-gui2/minicommon.js index 730d7f05..5a65e849 100644 --- a/mini-asterisk-gui2/minicommon.js +++ b/mini-asterisk-gui2/minicommon.js @@ -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