Minor demo cleanups
authorMark Spencer <markster@digium.com>
Mon, 3 Apr 2006 01:48:59 +0000 (01:48 +0000)
committerMark Spencer <markster@digium.com>
Mon, 3 Apr 2006 01:48:59 +0000 (01:48 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@17009 65c4cc65-6c06-0410-ace0-fbb531ad65f3

static-http/ajamdemo.html
static-http/astman.js

index 687b590..f6b690e 100644 (file)
                        selectedchan = null;
                }
                if (loggedon) {
                        selectedchan = null;
                }
                if (loggedon) {
+                       $('username').disabled = 1;
+                       $('secret').disabled = 1;
                        $('logoff').disabled = 0;
                        $('login').disabled = 1;
                        $('refresh').disabled = 0;
                } else {
                        $('logoff').disabled = 0;
                        $('login').disabled = 1;
                        $('refresh').disabled = 0;
                } else {
+                       $('username').disabled = 0;
+                       $('secret').disabled = 0;
                        $('logoff').disabled = 1;
                        $('login').disabled = 0;
                        $('refresh').disabled = 1;
                        $('logoff').disabled = 1;
                        $('login').disabled = 0;
                        $('refresh').disabled = 1;
index 1a69272..81f896c 100644 (file)
@@ -121,6 +121,7 @@ function Astman() {
                var s, x;
                var cclass, count=0;
                var found = 0;
                var s, x;
                var cclass, count=0;
                var found = 0;
+               var foundactive = 0;
                var fieldlist = new Array("channel", "callerid", "calleridname", "context", "extension", "priority");
 
                me.chancallback = callback;
                var fieldlist = new Array("channel", "callerid", "calleridname", "context", "extension", "priority");
 
                me.chancallback = callback;
@@ -133,8 +134,10 @@ function Astman() {
                                        cclass = "chanlistodd";
                                else
                                        cclass = "chanlisteven";
                                        cclass = "chanlistodd";
                                else
                                        cclass = "chanlisteven";
-                               if (me.selecttarget && (me.selecttarget == x))
+                               if (me.selecttarget && (me.selecttarget == x)) {
                                        cclass = "chanlistselected";
                                        cclass = "chanlistselected";
+                                       foundactive = 1;
+                               }
                                count++;
                                s = s + "\t<tr class='" + cclass + "' id='" + channels[x].channel + "' onClick='astmanEngine.clickChannel(event)'>";
                                s = s + "<td>" + channels[x].channel + "</td>";
                                count++;
                                s = s + "\t<tr class='" + cclass + "' id='" + channels[x].channel + "' onClick='astmanEngine.clickChannel(event)'>";
                                s = s + "<td>" + channels[x].channel + "</td>";
@@ -169,6 +172,9 @@ function Astman() {
                if (!found)
                        s += "<tr><td colspan=" + fieldlist.length + "><i class='light'>No active channels</i></td>\n";
                s += "</table>\n";
                if (!found)
                        s += "<tr><td colspan=" + fieldlist.length + "><i class='light'>No active channels</i></td>\n";
                s += "</table>\n";
+               if (!foundactive) {
+                       me.selecttarget = null;
+               }
                return s;
        };
        this.parseResponse = function(t, callback) {
                return s;
        };
        this.parseResponse = function(t, callback) {