git-svn-id: https://svn.code.sf.net/p/freetel/code@704 01035d8c-6547-0410-b346-abe4f9...
authorhorse69 <horse69@01035d8c-6547-0410-b346-abe4f91aad63>
Fri, 14 Sep 2012 22:15:50 +0000 (22:15 +0000)
committerhorse69 <horse69@01035d8c-6547-0410-b346-abe4f91aad63>
Fri, 14 Sep 2012 22:15:50 +0000 (22:15 +0000)
mini-asterisk-gui2/cgi-bin/network-backdoor.cgi [new file with mode: 0644]
mini-asterisk-gui2/cgi-bin/network-static.cgi [new file with mode: 0644]
mini-asterisk-gui2/cgi-bin/network.cgi [new file with mode: 0644]
mini-asterisk-gui2/network.js

diff --git a/mini-asterisk-gui2/cgi-bin/network-backdoor.cgi b/mini-asterisk-gui2/cgi-bin/network-backdoor.cgi
new file mode 100644 (file)
index 0000000..1f5e83c
--- /dev/null
@@ -0,0 +1,27 @@
+#!/bin/sh
+# network-backdoor.cgi
+# Ian Roberts 15 Sept 2012
+#
+# CGI to return the output from an /etc/init.d/network-backdoor command 
+#
+# valid action are start, stop, enable, disable
+#
+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>
+<body>
+EOF
+
+ARG=`echo "$QUERY_STRING" | sed -n "s/.*action=//p" | sed -n "s/%20/ /pg"`
+echo "$ARG"
+/etc/init.d/network-backdoor "$ARG"
+cat <<EOF
+</body>
+</html>
+EOF
diff --git a/mini-asterisk-gui2/cgi-bin/network-static.cgi b/mini-asterisk-gui2/cgi-bin/network-static.cgi
new file mode 100644 (file)
index 0000000..8aaeb24
--- /dev/null
@@ -0,0 +1,27 @@
+#!/bin/sh
+# network-static.cgi
+# Ian Roberts 15 Sept 2012
+#
+# CGI to return the output from an /etc/init.d/network-static command 
+#
+# valid action are start, stop, enable, disable
+#
+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>
+<body>
+EOF
+
+ARG=`echo "$QUERY_STRING" | sed -n "s/.*action=//p" | sed -n "s/%20/ /pg"`
+echo "$ARG"
+/etc/init.d/network-static "$ARG"
+cat <<EOF
+</body>
+</html>
+EOF
diff --git a/mini-asterisk-gui2/cgi-bin/network.cgi b/mini-asterisk-gui2/cgi-bin/network.cgi
new file mode 100644 (file)
index 0000000..3d7624a
--- /dev/null
@@ -0,0 +1,27 @@
+#!/bin/sh
+# network.cgi
+# Ian Roberts 15 Sept 2012
+#
+# CGI to return the output from an /etc/init.d/network command 
+#
+# valid actions are start, stop, enable, disable
+#
+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>
+<body>
+EOF
+
+ARG=`echo "$QUERY_STRING" | sed -n "s/.*action=//p" | sed -n "s/%20/ /pg"`
+echo "$ARG"
+/etc/init.d/network "$ARG"
+cat <<EOF
+</body>
+</html>
+EOF
index 9558f083b27fd6e55b7c66b56d70bc9ba376c5b6..7e7b8b0532e27eda41d1ba3f55204e3d80eff49e 100644 (file)
@@ -167,18 +167,25 @@ function onClickApply() {
 
        if (dhcp = "no") {
            // disable network-state service and endable network service
-           downloadUrl("/cgi-bin/setservice.cgi?action=enabledhcp",null);
+           downloadUrl("/cgi-bin/network-static.cgi?action=disable",GenericReturn);
+           downloadUrl("/cgi-bin/network-static.cgi?action=stop",GenericReturn);
+
+           downloadUrl("/cgi-bin/network.cgi?action=enable",GenericReturn);
+           downloadUrl("/cgi-bin/network.cgi?action=start",GenericReturn);
        }
        else {
            // dhcp already running, restart service
-           downloadUrl("/cgi-bin/setservice.cgi?action=restartdhcp",null);
+           downloadUrl("/cgi-bin/network.cgi?action=stop",GenericReturn);
+           downloadUrl("/cgi-bin/network.cgi?action=start",GenericReturn);
        }
     }
     else {
 
        if (dhcp = "yes") {
            // disable network service and enable network-static service
-           downloadUrl("/cgi-bin/setservice.cgi?action=enablestatic",null);
+           downloadUrl("/cgi-bin/network.cgi?action=stop",GenericReturn);
+           downloadUrl("/cgi-bin/network.cgi?action=disable",GenericReturn);
+           downloadUrl("/cgi-bin/network-static.cgi?action=enable",GenericReturn);
        }
 
        // change network-static file variables
@@ -211,11 +218,13 @@ function onClickApply() {
            var new_ = document.network.backdoor.value;
            var url = '/cgi-bin/setline.cgi?file=/etc/init.d/network-backup&this=BACKDOOR=&that="' + new_backdoor + '"';
            downloadUrl(url,null);
-           downloadUrl("/cgi-bin/setservice.cgi?action=restartbackup",null);
+       downloadUrl("/cgi-bin/network-backdoor.cgi?action=stop",null);
+       downloadUrl("/cgi-bin/network-backdoor.cgi?action=start",null);
        }
 
        // finally restart network-static service with new parameters
 
-       downloadUrl("/cgi-bin/setservice.cgi?action=restartstatic",null);
+    downloadUrl("/cgi-bin/network-static.cgi?action=stop",GenericReturn);
+    downloadUrl("/cgi-bin/network-static.cgi?action=start",GenericReturn);
     }
 }