Merge branch 'develop' into ntp

This commit is contained in:
Trevor Paskett - K7FPV 2016-01-08 11:11:13 -07:00
commit 7653acc333
8 changed files with 29 additions and 145 deletions

View File

@ -15,7 +15,6 @@ hr {
body table {
font-size: 12px;
border-collapse: collapse;
}
.dist-alert {

View File

@ -15,7 +15,6 @@ hr {
body table {
font-size: 12px;
border-collapse: collapse;
}
.dist-alert {

View File

@ -84,8 +84,6 @@ $patch_install = 0;
"http://downloads.aredn.org/firmware/ubnt"
);
#$mapserverurl="http://52.23.166.98:8080/sysinfo";
# refresh fw
if($parms{button_refresh_fw})
{
@ -440,90 +438,6 @@ foreach(`zcat /etc/opkg.list.gz 2>/dev/null`)
$dlpkgver{$pkg} = $ver;
}
#
# update location info
#
if($parms{button_location})
{
if($parms{gridsquare})
{
# validate values
if($parms{gridsquare} =~ /^[A-Z][A-Z]\d\d[a-z][a-z]$/)
{
# delete/define file
unlink("/etc/gridsquare") if(-f "/etc/gridsquare");
$rcgood=open(my $gs, ">", "/etc/gridsquare");
push @loc_output, "Cannot open gridsquare file" unless $rcgood;
print $gs "$parms{gridsquare}\n";
close($gs);
push @loc_output, "Gridsquare updated.\n";
} else {
push @loc_output, "ERROR: Gridsquare format is: 2-uppercase letters, 2-digits, 2-lowercase letters. (AB12cd)\n";
}
} else {
unlink("/etc/gridsquare") if(-f "/etc/gridsquare");
push @loc_output, "Gridsquare purged.\n";
}
if($parms{latitude} and $parms{longitude})
{
# validate values
if($parms{latitude} =~ /^([-+]?\d{1,2}([.]\d+)?)$/ and $parms{longitude} =~ /^([-+]?\d{1,3}([.]\d+)?)$/) {
# delete/define file
unlink("/etc/latlon") if(-f "/etc/latlon");
$rcgood=open(my $ll, ">", "/etc/latlon");
push @loc_output, "Cannot open lat/lon file" unless $rcgood;
print $ll "$parms{latitude}\n";
print $ll "$parms{longitude}\n";
close($ll);
push @loc_output, "Lat/lon updated.\n";
} else {
push @loc_output, "ERROR: Lat/lon format is decimal: (ex. 30.121456 or -95.911154)\n";
}
} else {
unlink("/etc/latlon") if(-f "/etc/latlon");
push @loc_output, "Lat/lon purged.\n";
}
}
#
# retrieve location data
#
if(-f "/etc/latlon")
{
$rcgood=open(FILE, "/etc/latlon");
push @loc_output, "ERROR: reading lat/lon data\n" unless $rcgood;
while(<FILE>){
chomp;
push @lines,$_;
}
close(FILE);
$lat=$lines[0];
$lon=$lines[1];
}
@lines=();
if(-f "/etc/gridsquare")
{
$rcgood=open(FILE, "/etc/gridsquare");
push @loc_output, "ERROR: reading gridsquare data\n" unless $rcgood;
while(<FILE>){
chomp;
push @lines,$_;
}
close(FILE);
$gridsquare=$lines[0];
}
if($parms{button_updatemap})
{
system("wget -q -O- http://localnode:8080/cgi-bin/sysinfo.json|curl -H 'Accept: application/json' -X PUT -T - http://52.90.125.187:8080/sysinfo");
if($? == 0) {
push @loc_output, "AREDN online map updated";
} else {
push @loc_output, "ERROR: Cannot update online map. Please ensure this node has access to the internet.";
}
}
#
# handle ssh key actions
#
@ -746,40 +660,6 @@ print "<tr><td colspan=3 align=center><a href=/cgi-bin/supporttool>Download Supp
print "<tr><td colspan=3><hr></td></tr>\n";
# LOCATION DATA
print "<table><tr><th colspan=3>Location Data</th></tr>\n";
print "<tr>\n";
print "<td align=left>Latitude</td>";
print "<td align=left>Longitude</td>";
print "<td align=left>Grid Square</td>";
print "</tr>\n";
print "<tr>\n";
print "<td><input type=text name=latitude size=10 value='$lat' title='Latitude value (in decimal) (ie. 30.312354)'></td>\n";
print "<td><input type=text name=longitude size=10 value='$lon' title='Longitude value (in decimal) (ie. -95.334454)'></td>\n";
print "<td><input type=text name=gridsquare maxlength=6 size=6 value='$gridsquare' title='Gridsquare value (ie. AB12cd)'></td>\n";
print "</tr>\n";
print "<tr><td colspan=3 align=center>";
print "<input type=submit name=button_location value='Update Location' title='Update Location Information'>&nbsp;";
if (-f "/usr/bin/curl")
{
$rc=`ping -c2 8.8.8.8`;
if($? eq 0)
{
$mapbuttonvisible="";
} else {
$mapbuttonvisible=" disabled ";
}
}
print "<input type=submit name=button_updatemap value='Update Map' title='Update Online Map' $mapbuttonvisible>&nbsp;";
print "</td></tr>\n";
if(@loc_output)
{
print "<tr><td colspan=3 align=center><table><tr><td><b><pre>\n";
print word_wrap(80, @loc_output);
print "</pre></b></td></tr>";
}
print "</table>\n";
print "</td></tr>\n";
print "</table>\n";

View File

@ -1450,11 +1450,12 @@ sub css_options
sub is_online()
{
# test for web connectivity
my $pingOk=0;
my $rc=system("ping -c2 -W1 8.8.8.8 > /dev/null 2>&1");
$pingOk=1 if($rc==0);
return $pingOk;
my $online=0;
if(get_default_gw() ne "none")
{
$online=1;
}
return $online;
}
sub tz_names_hash {

View File

@ -46,9 +46,8 @@ use channelmaps;
#
# test for web connectivity (for maps)
my $pingOk=0;
my $rc=system("ping -c2 -W1 8.8.8.8 > /dev/null 2>&1");
$pingOk=1 if($rc==0);
$pingOk=is_online();
@output = ();
@errors = ();
@ -167,11 +166,17 @@ $parms{wifi_txpower} = $wifi_txpower;
if($parms{button_apply} or $parms{button_save})
{
my $wifiintf = get_interface("wifi");
$cmd = "";
$cmd .= "iw phy phy0 set distance $wifi_distance >/dev/null 2>&1;";
$cmd .= "iw dev $wifiintf set txpower fixed ${wifi_txpower}00 >/dev/null 2>&1;";
system $cmd;
if($wifi_distance < 1 or $wifi_distance =~ /\D/)
{
push (@errors, "invalid distance value");
} else {
my $wifiintf = get_interface("wifi");
$cmd = "";
$cmd .= "iw phy phy0 set distance $wifi_distance >/dev/null 2>&1;";
$cmd .= "iw dev $wifiintf set txpower fixed ${wifi_txpower}00 >/dev/null 2>&1;";
system $cmd;
}
}
@ -287,8 +292,6 @@ if($parms{button_save})
$wifi_chanbw = 20;
}
push (@errors, "invalid WiFi distance") if $wifi_distance < 0 or $wifi_distance =~ /\D/;
$wifi_country_validated=0;
foreach my $testcountry (split(',',"00,HX,AD,AE,AL,AM,AN,AR,AT,AU,AW,AZ,BA,BB,BD,BE,BG,BH,BL,BN,BO,BR,BY,BZ,CA,CH,CL,CN,CO,CR,CY,CZ,DE,DK,DO,DZ,EC,EE,EG,ES,FI,FR,GE,GB,GD,GR,GL,GT,GU,HN,HK,HR,HT,HU,ID,IE,IL,IN,IS,IR,IT,JM,JP,JO,KE,KH,KP,KR,KW,KZ,LB,LI,LK,LT,LU,LV,MC,MA,MO,MK,MT,MY,MX,NL,NO,NP,NZ,OM,PA,PE,PG,PH,PK,PL,PT,PR,QA,RO,RS,RU,RW,SA,SE,SG,SI,SK,SV,SY,TW,TH,TT,TN,TR,UA,US,UY,UZ,VE,VN,YE,ZA,ZW")) {
if ( $testcountry eq $wifi_country ) {
@ -463,7 +466,7 @@ function updDist(x) {
document.getElementsByName('wifi_distance_disp')[0].value = x;
dist_hidden.value = xc;
// if default, then ALERT!
if(dist_hidden.value==100000) {
if(dist_hidden.value==0) {
distBox.className = 'dist-alert';
} else {
distBox.className = 'dist-norm';
@ -602,7 +605,12 @@ print "</select></td>
print "<tr><td colspan='4'><hr /></td></tr>";
print "<tr><td align=left>Latitude</td><td><input type=text name=latitude size=10 value='$lat' title='Latitude value (in decimal) (ie. 30.312354)' /></td>";
print "<td align='right' colspan='2'>";
print "<button type='button' id='hideshowmap' value='show' onClick='toggleMap(this);'>Show Map</button>&nbsp;" if($pingOk);
if($pingOk)
{
print "<button type='button' id='hideshowmap' value='show' onClick='toggleMap(this);'>Show Map</button>&nbsp;";
} else {
print "<button disabled type='button' title='The map is only available if this node has internet access'>Show Map</button>&nbsp;";
}
print "<input type=submit name='button_updatelocation' value='Apply Location Settings' title='Immediately use these location settings'>";
print "</td>\n";
print "<tr><td align=left>Longitude</td><td><input type=text name=longitude size=10 value='$lon' title='Longitude value (in decimal) (ie. -95.334454)' /></td>";
@ -640,7 +648,7 @@ print "<table cellpadding=5 border=1 width=100%><tr><td valign=top width=33%>\n"
# WiFi settings
#
print "<table width=100%>
print "<table width=100% style='border-collapse: collapse;'>
<tr><th colspan=2>WiFi</th></tr>
<tr><td>Protocol</td>
<td>";
@ -767,10 +775,10 @@ if($wifi_proto ne "disabled")
for($i = wifi_maxpower($wifi_channel); $i >= 1; --$i) { selopt($i+$txpoweroffset ." dBm", $i, $wifi_txpower) }
print "</select>&nbsp;&nbsp;<a href=\"/help.html\#power\" target=\"_blank\"><img src=\"/qmark.png\"></a></td></tr>\n";
print "<tr id='dist' class='dist-norm'><td>Distance to<br />FARTHEST Node</td>\n";
print "<tr id='dist' class='dist-norm'><td>Distance to<br />FARTHEST Neighbor</td>\n";
$wifi_distance_disp=int($wifi_distance/1000);
print "<td><input readonly type=text size=8 name='wifi_distance_disp' value='$wifi_distance_disp' title='Distance to the farthest neighbor'>&nbsp;<span id='distance_unit_text'>kilometers</span><br />";
print "<td><input readonly type=text size=4 name='wifi_distance_disp' value='$wifi_distance_disp' title='Distance to the farthest neighbor'>&nbsp;<span id='distance_unit_text'>kilometers</span><br />";
print "<input id='distance_slider' type='range' min='0' max='150' step='1' value='$wifi_distance_disp' oninput='updDist(this.value)' onchange='updDist(this.value)' /><br />";
print "<input type='radio' name='distance_unit' value='miles' onchange='updDistUnit(this.value)'>Miles&nbsp;";

View File

@ -15,7 +15,6 @@ hr {
body table {
font-size: 12px;
border-collapse: collapse;
}
.dist-alert {

View File

@ -15,7 +15,6 @@ hr {
body table {
font-size: 12px;
border-collapse: collapse;
}
.dist-alert {

View File

@ -15,7 +15,6 @@ hr {
body table {
font-size: 12px;
border-collapse: collapse;
}
.dist-alert {