git-svn-id: https://svn.code.sf.net/p/freetel/code@724 01035d8c-6547-0410-b346-abe4f9...
authorhorse69 <horse69@01035d8c-6547-0410-b346-abe4f91aad63>
Tue, 18 Sep 2012 06:23:34 +0000 (06:23 +0000)
committerhorse69 <horse69@01035d8c-6547-0410-b346-abe4f91aad63>
Tue, 18 Sep 2012 06:23:34 +0000 (06:23 +0000)
mini-asterisk-gui2/network.js
mini-asterisk-gui2/todo notes

index 650900a828e820bfb813a55881f258c2e22d21ca..5b49cc79747d39e0e5f297ef3be4d6807c6231a0 100644 (file)
@@ -183,40 +183,65 @@ function onClickApply() {
 
                // change network-static file variables
 
-               if (document.network.ipaddress.value != ipaddress) {
-                       var new_ipaddress = document.network.ipaddress.value;
-                       var url = '/cgi-bin/setline.cgi?file=/etc/init.d/network-static&this=IPADDRESS=&that="' + new_ipaddress + '"';
-                       downloadUrl(url,GenericReturn);
-               }
+               var new_ipaddress = document.network.ipaddress.value;
+               var url = '/cgi-bin/setline.cgi?file=/etc/init.d/network-static&this=IPADDRESS=&that="' + new_ipaddress + '"';
+               
+               # kick off cascading cgi
+               downloadUrl(url,ipaddressReturn);
 
-               if (document.network.netmask.value != netmask) {
-                       var new_netmask = document.network.netmask.value;
-                       var url = '/cgi-bin/setline.cgi?file=/etc/init.d/network-static&this=NETMASK=&that="' + new_netmask + '"';
-                       downloadUrl(url,GenericReturn);
-               }
 
-               if (document.network.gateway.value != gateway) {
-                       var new_gateway = document.network.gateway.value;
-                       var url = '/cgi-bin/setline.cgi?file=/etc/init.d/network-static&this=GATEWAY=&that="' + new_gateway + '"';
-                       downloadUrl(url,GenericReturn);
-               }
+//             if (document.network.backdoor.value != backdoor) {
+//                     var new_backdoor = document.network.backdoor.value;
+//                     var url = '/cgi-bin/setline.cgi?file=/etc/init.d/network-backup&this=BACKDOOR=&that="' + new_backdoor + '"';
+//                     downloadUrl(url,GenericReturn);
+//                     downloadUrl("/cgi-bin/setservice.cgi?action=restartbackup",GenericReturn);
+//             }
 
-               if (document.network.dns.value != dns) {
-                       var new_dns = document.network.dns.value;
-                       var url = '/cgi-bin/setline.cgi?file=/etc/init.d/network-static&this=DNS=&that="' + new_dns + '"';
-                       downloadUrl(url,GenericReturn);
-               }
 
-               if (document.network.backdoor.value != backdoor) {
-                       var new_backdoor = document.network.backdoor.value;
-                       var url = '/cgi-bin/setline.cgi?file=/etc/init.d/network-backup&this=BACKDOOR=&that="' + new_backdoor + '"';
-                       downloadUrl(url,GenericReturn);
-                       downloadUrl("/cgi-bin/setservice.cgi?action=restartbackup",GenericReturn);
-               }
+       }
+}
 
-               // finally restart network-static service with new parameters
+function ipaddressReturn(doc,status) {
+    loadHtmlTextFile(doc, function(line) {
+           //parseSipShowPeers(line);
+       }
+       );
 
-               downloadUrl("/cgi-bin/setservice.cgi?action=restartstatic",GenericReturn);
+       var new_netmask = document.network.netmask.value;
+       var url = '/cgi-bin/setline.cgi?file=/etc/init.d/network-static&this=NETMASK=&that="' + new_netmask + '"';
+       downloadUrl(url,netmaskReturn);
+}
 
-               }
+function netmaskReturn(doc,status) {
+    loadHtmlTextFile(doc, function(line) {
+           //parseSipShowPeers(line);
+       }
+       );
+
+       var new_gateway = document.network.gateway.value;
+       var url = '/cgi-bin/setline.cgi?file=/etc/init.d/network-static&this=GATEWAY=&that="' + new_gateway + '"';
+       downloadUrl(url,gatewayReturn);
+}
+
+function gatewayReturn(doc,status) {
+    loadHtmlTextFile(doc, function(line) {
+           //parseSipShowPeers(line);
+       }
+       );
+
+       var new_dns = document.network.dns.value;
+       var url = '/cgi-bin/setline.cgi?file=/etc/init.d/network-static&this=DNS=&that="' + new_dns + '"';
+       downloadUrl(url,dnsReturn);
 }
+
+function dnsReturn(doc,status) {
+    loadHtmlTextFile(doc, function(line) {
+           //parseSipShowPeers(line);
+       }
+       );
+
+       // finally restart network-static service with new parameters
+
+       downloadUrl("/cgi-bin/setservice.cgi?action=restartstatic",GenericReturn);
+}
+
index 1e0b00a735a326831564cdb9f4988ec8721ce4bf..ea49780b1e8e5b93c031b312a1e15c9fd8ad8cb3 100644 (file)
@@ -10,7 +10,7 @@ Goal is a gui2 package we can install on an ip0x
 see baps build makefile
 http://svn.astfin.org/software/baps/trunk/mini-asterisk-gui.mk
 
-1. install script fix :enable cgi 
+1. install script fix :enable cgi     Done
 ----------------------------------
        use sed on /etc/lighttpd.conf
         1. Change end bracket to comma 
@@ -20,7 +20,7 @@ http://svn.astfin.org/software/baps/trunk/mini-asterisk-gui.mk
        
        kiss. just copy the corrected conf file from the sourceforge archive.
 
-2.  install script fix :add mini_ext comments to 60xx numbers 
+2.  install script fix :add mini_ext comments Done 
 ------------------------------------------
        use sed on /etc/asterisk/extension.conf
 
@@ -49,7 +49,7 @@ http://svn.astfin.org/software/baps/trunk/mini-asterisk-gui.mk
        
        This worked.
 
-4. network page not working
+4. network page not working       Not done
 ------------------------------
    Also how fast can it detect the internet after change in gateway
    Try to break internet with dns or gateway changes.
@@ -93,6 +93,8 @@ http://svn.astfin.org/software/baps/trunk/mini-asterisk-gui.mk
        The networking functions have to have synchrous sections, esp when start/stop/enable/disable
        
        For example, u cant do a network start before a network stop has finished?
+       
+       Try to synchronise with cascading cgi flow.