extensive tool tipping of phone page
authordrowe67 <drowe67@01035d8c-6547-0410-b346-abe4f91aad63>
Tue, 5 Jan 2010 23:04:29 +0000 (23:04 +0000)
committerdrowe67 <drowe67@01035d8c-6547-0410-b346-abe4f91aad63>
Tue, 5 Jan 2010 23:04:29 +0000 (23:04 +0000)
git-svn-id: https://svn.code.sf.net/p/freetel/code@96 01035d8c-6547-0410-b346-abe4f91aad63

easy-asterisk-gui/Makefile
easy-asterisk-gui/anphone.png [new file with mode: 0644]
easy-asterisk-gui/dashboard.sh
easy-asterisk-gui/phone.js
easy-asterisk-gui/phone.pl
easy-asterisk-gui/phone.png [deleted file]
easy-asterisk-gui/phone.sh
easy-asterisk-gui/tooltips.html

index 196a21e8808250f4aae568f599e4c07f74e36768..99d0e8620ee8f16491db20325aacab589b764af3 100644 (file)
@@ -9,5 +9,5 @@ TESTIP=192.168.1.150
 #      rcp index.html root@$(TESTIP):/var/lib/asterisk/static-http/
 
 test:
-       rcp voipline.jpg phone.png phoneline.jpg ipphone.png phone.pl tooltips.html phone.sh phone.js tick.png cross.png banner.html menu.html check_loggedin.sh logout.sh login.sh dashboard.sh dashboard.js network.sh network.js set_network.sh tooltip.js tooltip.css root@$(TESTIP):/www/cgi-bin
+       rcp voipline.jpg anphone.png phoneline.jpg ipphone.png phone.pl tooltips.html phone.sh phone.js tick.png cross.png banner.html menu.html check_loggedin.sh logout.sh login.sh dashboard.sh dashboard.js network.sh network.js set_network.sh tooltip.js tooltip.css root@$(TESTIP):/www/cgi-bin
        rcp sip.conf extensions.conf root@$(TESTIP):/etc/asterisk
diff --git a/easy-asterisk-gui/anphone.png b/easy-asterisk-gui/anphone.png
new file mode 100644 (file)
index 0000000..9783372
Binary files /dev/null and b/easy-asterisk-gui/anphone.png differ
index 81daa21c838642c36cece4fb545ce769b1b29054..87bfa3e847aec81ca58154b940cbffb56da2c5b8 100644 (file)
@@ -3,12 +3,16 @@
 # David Rowe 4 Jan 2010
 # CGI for Easy Asterisk dashboard GUI
 
-# See if we have Internet connectivity, unlike network.sh we don't check dns first
+# See if we have Internet connectivity, first check dns as time outs can be very slow
 
+dns=`cat /etc/resolv.conf | awk '/^nameserver/ {print $2}'`
+dns_packet_loss=`ping $dns -c 1 -q | sed -n 's/.*received, \(.*\)% packet loss/\1/p'`
 internet="no";
-packet_loss=`ping google.com -c 1 -q | sed -n 's/.*received, \(.*\)% packet loss/\1/p'`
-if [ $packet_loss == "0" ]; then
-  internet="yes";
+if [ $dns_packet_loss == "0" ]; then
+  packet_loss=`ping google.com -c 1 -q | sed -n 's/.*received, \(.*\)% packet loss/\1/p'`
+  if [ $packet_loss == "0" ]; then
+    internet="yes";
+  fi
 fi
 
 # Construct the web page -------------------------------
index 9c50ceac6f166dfcc23e90096e25db968ff022ce..74d6eaf1bb5ad05e5f1cee5bdf6f08950807d404 100644 (file)
@@ -1,3 +1,7 @@
 function localInit() {
+    if (init_internet == "yes")
+       $('internet').innerHTML = '<img src="tick.png" alt="tick" />';
+    else
+        $('internet').innerHTML = '<img src="cross.png" alt="tick" />';
 }
 
index f540360e09f9672f840bc9ed1cddbe867bbcd04f..93157bbc4e7845c09a32eb2b592c5ed3402d9ca0 100755 (executable)
@@ -74,48 +74,56 @@ close SIP;
 
 # print list of analog phones
 
-$tool_tip = "onMouseOver=\"popUp(event,'phone_phone')\" onmouseout=\"popUp(event,'phone_phone')\"";
+$tooltip_anphone = "onMouseOver=\"popUp(event,'phone_anphone')\" onmouseout=\"popUp(event,'phone_anphone')\"";
+$tooltip_ext = "onMouseOver=\"popUp(event,'phone_ext')\" onmouseout=\"popUp(event,'phone_ext')\"";
+$tooltip_port = "onMouseOver=\"popUp(event,'phone_port_phone')\" onmouseout=\"popUp(event,'phone_port_phone')\"";
 
 foreach $a (sort keys %analog) {
     if ($zap{$a} eq "fxs") {
-       $icon = "<img $tool_tip src=\"phone.png\" alt=\"Analog Phone\" />";
-       print "<tr><td>$analog{$a}</td><td>Port $a</td><td>$icon</td></tr>\n";
+       $icon = "<img src=\"anphone.png\" alt=\"Analog Phone\" />";
+       print "<tr><td $tooltip_ext>$analog{$a}</td><td $tooltip_anphone>Analog Phone</td><td $tooltip_port>Port $a</td><td>$icon</td></tr>\n";
     }
 }
 
 # print list of IP phones
 
-$tool_tip = "onMouseOver=\"popUp(event,'phone_ipphone')\" onmouseout=\"popUp(event,'phone_ipphone')\"";
+$tooltip_ipphone = "onMouseOver=\"popUp(event,'phone_ipphone')\" onmouseout=\"popUp(event,'phone_ipphone')\"";
+$tooltip_ipphone_ip = "onMouseOver=\"popUp(event,'phone_ipphone_ip')\" onmouseout=\"popUp(event,'phone_ipphone_ip')\"";
 
 foreach $s (sort keys %sip) {
     if ($sip{$s} eq "OK") {
-       $icon = "<img $tool_tip src=\"ipphone.png\" alt=\"IP Phone\" />";
-       print "<tr><td>$s</td><td>$ipad{$s}</td><td>$icon</td></tr>\n";
+       $icon = "<img src=\"ipphone.png\" alt=\"IP Phone\" />";
+       print "<tr><td $tooltip_ext>$s</td><td $tooltip_ipphone>IP Phone</td<td $tooltip_ipphone_ip>$ipad{$s}</td><td>$icon</td></tr>\n";
     }
 }
 
-print '<tr><td colspan="2" align="left" valign="top" ><h2>Phone Lines</h2></td></tr>
-';
+$tool_tip = "onMouseOver=\"popUp(event,'phone_lines')\" onmouseout=\"popUp(event,'phone_lines')\"";
+
+print '<tr><td>&nbsp</td></tr>';
+print "<tr $tool_tip><td colspan=\"4\" align=\"left\" valign=\"top\" ><h2>Phone Lines</h2></td></tr>
+";
 
 # print list of analog phone lines
 
-$tool_tip = "onMouseOver=\"popUp(event,'phone_phoneline')\" onmouseout=\"popUp(event,'phone_phoneline')\"";
+$tooltip_phoneline = "onMouseOver=\"popUp(event,'phone_phoneline')\" onmouseout=\"popUp(event,'phone_phoneline')\"";
+$tooltip_port = "onMouseOver=\"popUp(event,'phone_port_line')\" onmouseout=\"popUp(event,'phone_port_line')\"";
 
 foreach $a (sort keys %analog) {
     if ($zap{$a} eq "fxo") {
-       $icon = "<img $tool_tip src=\"phoneline.jpg\" alt=\"Phone Line\" />";
-       print "<tr><td>$analog{$a}</td><td>Port $a</td><td>$icon</td></tr>\n";
+       $icon = "<img src=\"phoneline.jpg\" alt=\"Phone Line\" />";
+       print "<tr><td>$analog{$a}</td><td $tooltip_phoneline>Analog</td><td $tooltip_port>Port $a</td><td>$icon</td></tr>\n";
     }
 }
 
 # print list of SIP VOIP trunks
 
-$tool_tip = "onMouseOver=\"popUp(event,'phone_voipline')\" onmouseout=\"popUp(event,'phone_voipline')\"";
+$tooltip_voipline = "onMouseOver=\"popUp(event,'phone_voipline')\" onmouseout=\"popUp(event,'phone_voipline')\"";
+$tooltip_voipline_ip = "onMouseOver=\"popUp(event,'phone_voipline_ip')\" onmouseout=\"popUp(event,'phone_voipline_ip')\"";
 
 foreach $s (sort keys %voip) {
     if ($voip{$s} eq "OK") {
-       $icon = "<img $tool_tip src=\"voipline.jpg\" alt=\"VOIP Line\" />";
-       print "<tr><td>$s</td><td>$ipad{$s}</td><td>$icon</td></tr>\n";
+       $icon = "<img src=\"voipline.jpg\" alt=\"VOIP Line\" />";
+       print "<tr><td>$s</td><td $tooltip_voipline>VOIP</td><td $tooltip_voipline_ip>$ipad{$s}</td><td>$icon</td></tr>\n";
     }
 }
 
diff --git a/easy-asterisk-gui/phone.png b/easy-asterisk-gui/phone.png
deleted file mode 100644 (file)
index 9783372..0000000
Binary files a/easy-asterisk-gui/phone.png and /dev/null differ
index dc84c546231f48a2f5894d5d0fd6123ef6aa6b93..2e014dc8d6bde043aed91b1016fea0a63fdabb16 100644 (file)
@@ -3,6 +3,20 @@
 # David Rowe 4 Jan 2010
 # CGI for Easy Asterisk phones GUI
 
+# See if we have Internet connectivity, first check dns as time outs can be very slow
+
+dns=`cat /etc/resolv.conf | awk '/^nameserver/ {print $2}'`
+dns_packet_loss=`ping $dns -c 1 -q | sed -n 's/.*received, \(.*\)% packet loss/\1/p'`
+internet="no";
+if [ $dns_packet_loss == "0" ]; then
+  packet_loss=`ping google.com -c 1 -q | sed -n 's/.*received, \(.*\)% packet loss/\1/p'`
+  if [ $packet_loss == "0" ]; then
+    internet="yes";
+  fi
+fi
+
+ipaddress=`ifconfig eth0 | sed -n 's/.*inet addr:\(.*\)  Bcast.*/\1/p'`
+
 # Construct the web page -------------------------------
 
 sh check_loggedin.sh
@@ -35,7 +49,23 @@ cat <<EOF
     <td valign="top">
 
     <table align="right" width=600>
-      <tr><td colspan="2" align="left" valign="top" ><h2>Phones</h2></td></tr>
+      <tr onMouseOver="popUp(event,'phone_system')" onmouseout="popUp(event,'phone_system')">
+          <td colspan="4" align="left" valign="top" ><h2>Phone System</h2></td>
+      </tr>
+      <tr onMouseOver="popUp(event,'network_internet')" onmouseout="popUp(event,'network_internet')">
+         <td colspan="3">Internet Connection:</td>
+         <td><div id="internet" >&nbsp;</div></td>
+      </tr>
+      <tr onMouseOver="popUp(event,'phone_ipaddress')" onmouseout="popUp(event,'phone_ipaddress')">
+         <td colspan="3">Phone System IP Address:</td>
+EOF
+echo "<td>$ipaddress</td>"
+cat <<EOF
+      </tr>
+      <tr><td>&nbsp</td></tr>
+      <tr onMouseOver="popUp(event,'phone_phones')" onmouseout="popUp(event,'phone_phones')">
+          <td colspan="4" align="left" valign="top" ><h2>Phones</h2></td>
+      </tr>
 EOF
 
 # use perl to construct list of phones and phone lines for us
index 9e0795d057117a93a9796c3de51daebd0b2da4f7..e652ae0ca00997b9df27af27264f770a8e52600a 100644 (file)
@@ -9,11 +9,11 @@
                          example due to DHCP problems on your network or a configuration mistake.  
                          Write this number down somewhere!</div>
 
-<div id="phone_phone" class="tip">
-                         Analog Phone extension: Normal telephone plugged into a port on your phone system.
+<div id="phone_anphone" class="tip">
+                         Analog Phone: Normal telephone plugged into a port on your phone system.
                          </div>
 <div id="phone_ipphone" class="tip">
-                         IP Phone extension: IP Phone plugged into your network.
+                         IP Phone plugged into your network.
                          </div>
 <div id="phone_line" class="tip">
                          Analog Phone Line: Analog telephone line plugged into a port on your phone system.
 <div id="phone_voipline" class="tip">
                          VOIP  Phone Line: Make and receive phone calls over the Internet.
                          </div>
+
+<div id="phone_system" class="tip">
+                         Important information about your Phone System.</div>
+
+<div id="phone_ipaddress" class="tip">
+                         The address of your Phone System
+                         on your network.  Use this address to connect
+                         IP Phones to your Phone System.  </div>
+
+<div id="phone_phones" class="tip">
+                         List of phones connected to your Phone
+                         System.  You can connect Analog or IP Phones
+                         to your system.  When IP Phones are
+                         configured correctly, they appear on this
+                         list.  If an IP phone is not configured
+                         correctly, it will not appear on this list.
+                         Analog phones require hardware to be
+                         installed in your Phone system.</div>
+
+<div id="phone_lines" class="tip">
+                         List of phone lines available.  Phone lines
+                         are used to make and receive outside calls.
+                         You can use regular Analog phone lines or
+                         VOIP.  VOIP Phone lines require an account
+                         with an Internet Telephone Service provider.
+                         Analog phone lines require hardware to be
+                         installed in your Phone System.</div>
+
+<div id="phone_ext" class="tip">
+                        Dial this number to call this phone</div>
+
+<div id="phone_port_phone" class="tip">
+                        Port on the rear of your Phone System for this
+                        phone.  Plug the phone into this Port.</div>
+
+<div id="phone_port_line" class="tip">
+                        Port on the rear of your Phone System for this
+                        phone line.  Plug the phone line into this Port.</div>
+
+<div id="phone_ipphone_ip" class="tip">
+                        IP Address of this phone on your network</div>
+
+<div id="phone_voipline_ip" class="tip">
+                        IP Address of the VOIP Internet Service Telephone Provider</div>