git-svn-id: https://svn.code.sf.net/p/freetel/code@654 01035d8c-6547-0410-b346-abe4f9...
authorhorse69 <horse69@01035d8c-6547-0410-b346-abe4f91aad63>
Sun, 2 Sep 2012 05:07:23 +0000 (05:07 +0000)
committerhorse69 <horse69@01035d8c-6547-0410-b346-abe4f91aad63>
Sun, 2 Sep 2012 05:07:23 +0000 (05:07 +0000)
mini-asterisk-gui2/cgi-bin/setring.cgi
mini-asterisk-gui2/minicommon.js
mini-asterisk-gui2/phones.js

index 98f1be83b728f9ea18516fc0c555e4a37fac5188..adacc8f21fc256b34e7491e07d41e1e362128748 100755 (executable)
@@ -1,6 +1,7 @@
 #!/bin/sh
 # setring.cgi
-# David Rowe 9 March 2011
+# 
+# Ian Roberts 30 August 2012
 #
 # CGI to set extension to ring on an incoming call
 #
@@ -17,7 +18,9 @@ Content-type: text/html
 EOF
 
 
-# extract extensions to ring
+# extract extensions to ring 
+# must replace underscores with forward slash
+
 #echo "Input $QUERY_STRING\n"
 
 a=`echo "$QUERY_STRING" | sed -n "s/=on*//pg" | sed -n 's,_,/,pg'`
index 0dd5e6418a597968c261b283e22e461c3b3245d2..e3fb4366c6287944cb29cdcecceff7492d817a60 100644 (file)
@@ -20,9 +20,18 @@ var ip_ext = [];
 
 var network = "no";
 
-// incomming calls are routed to these extensions
+// incomming calls are routed to these extensions ie (6003, ZAP/3)
+var number='';
+var code='';
 
-var reception  = [];
+
+var reception[]  =  {number, code};
+
+
+
+// these are the selections for the new reception numbers
+
+var selected = [];
 
 function loadExtensions() {
 
@@ -138,16 +147,20 @@ function loadExtensionsConf(doc,status) {
            if(line.indexOf("exten => s,1,Dial") != -1) {
                i=0;
 
-               // for each Zap/ read in a single digit and convert to extension 
-               while((ret = line.indexOf("Zap/"))!=-1) {               
-                    reception [i++] = analog_ext[line.substr(ret+4,1)];
+               // for each Zap/ read in a single digit and convert to extension
+               while((ret = line.indexOf("Zap/"))!=-1) {
+                    reception[i].code = line.substr(ret,5);
+                    reception[i].number = analog_ext[line.substr(ret+4,1)];
                     line = line.substr(ret+6,line.length);
+                   i++;
                }
 
                // for each SIP/ read in four digits
                while ((ret = line.indexOf("SIP/")) != -1) {
-                   reception [i++] = line.substr(ret+4,4);
+                    reception[i].code = line.substr(ret,8);
+                    reception[i].number = line.substr(ret+4,4);
                     line = line.substr(ret+9,line.length);
+                   i++;
                }
 
            }
index f5b0b8df6ad911503930d8d3aff9f5abc34389b1..6a8b094f047b0b8528d8e296446a676e3078b66c 100644 (file)
@@ -51,7 +51,7 @@ function initialisePage() {
            //html += "<td>(Reception)</td>";
 
             // the reception checkbox code
-           html += "<td>" + '<input type="checkbox" name="ZAP_' + i ;     
+           html += "<td>" + '<input name="selected[]" type="checkbox" ' ;     
                // Underscore used instead of forward slash to pass thru html request
 
             if (reception.indexOf(analog_ext[i]) != -1) {
@@ -79,7 +79,7 @@ function initialisePage() {
            html += "<td>" + ip_ext[j] + "</td>";
 
             // the reception checkbox code
-           html += "<td>" + '<input type="checkbox" name="SIP_' + ip_ext[j] ;
+           html += "<td>" + '<input name="selected[]" type="checkbox" ' ;
                // Underscore used instead of forward slash to pass thru html request
  
 
@@ -167,10 +167,16 @@ function processIfconfig(doc, status) {
 
 function onClickApply(e) {
 
-//     firmwareurl=document.firmwareurl.value;
-       // get the arguments from the form
-       arg1=document.phones.submit();
-//     downloadUrl("/cgi-bin/setring.cgi?"+arg1,null);
-
+       // get the arguments from the form  selected[]
+///document.myform.elements['fav[]'].checked
+var arg ='';
+var total = document.getElementByName('selected[]');
+       for (i=0;i<total; i++) {
+// in document.phones.elements['selected[]'] {
+               if (selected[x]<6010)
+               arg = arg + 'ZAP_'+i;
+        // construct new arg from selected
+       //downloadUrl("/cgi-bin/setring.cgi?"+arg1,null);
+       }
 
 }