From: drowe67 Date: Mon, 18 Jan 2010 03:29:43 +0000 (+0000) Subject: fixed bug in network IP checking javascript X-Git-Url: http://git.whiteaudio.com/gitweb/?a=commitdiff_plain;h=b8d974ab7001034c2511f75b7c0770438287118f;p=freetel-svn-tracking.git fixed bug in network IP checking javascript git-svn-id: https://svn.code.sf.net/p/freetel/code@132 01035d8c-6547-0410-b346-abe4f91aad63 --- diff --git a/mini-asterisk-gui/Makefile b/mini-asterisk-gui/Makefile index 400f535e..e3edc860 100644 --- a/mini-asterisk-gui/Makefile +++ b/mini-asterisk-gui/Makefile @@ -1,7 +1,7 @@ # Makefile # David Rowe 1 Jan 2010 # -# Makefile for Easy Asterisk GUI +# Makefile for Mini Asterisk GUI # # 1/ Download files to development box for testing: # @@ -30,5 +30,6 @@ static: sed -i "s,http://$(HOST)/set_network.sh,network.sh.html," static/$(HOST)/network.sh.html sed -i "s,http://$(HOST)/set_ring.sh,phones.sh.html," static/$(HOST)/phones.sh.html sed -i "s,http://$(HOST)/set_voiplines.sh,voiplines.sh.html," static/$(HOST)/voiplines.sh.html + sed -i "s,url=login.sh,url=phones.sh.html," static/$(HOST)/logout.sh.html diff --git a/mini-asterisk-gui/cgi-bin/network.js b/mini-asterisk-gui/cgi-bin/network.js index 108bf01b..a1b7f436 100644 --- a/mini-asterisk-gui/cgi-bin/network.js +++ b/mini-asterisk-gui/cgi-bin/network.js @@ -20,12 +20,13 @@ function isIP(obj) { var ary = obj.value.split("."); var ip = true; - for (var i=0; i<4; i++) { - ip = (!ary[i].match(/^\d{1,3}$/) || (Number(ary[i]) > 255)) ? false : ip; - } - - if (ip) - ip = (ary.length == 4); + ip = (ary.length == 4); + + if (ip) { + for (var i=0; i<4; i++) { + ip = (!ary[i].match(/^\d{1,3}$/) || (Number(ary[i]) > 255)) ? false : ip; + } + } if (!ip) { // the value is NOT a valid IP address