mirror of https://github.com/aredn/aredn.git
removed lat/lon/grid from admin page (moved to setup)
This commit is contained in:
parent
d55f6de4cf
commit
779f33e8fc
|
@ -440,90 +440,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 +662,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'> ";
|
||||
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> ";
|
||||
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";
|
||||
|
|
Loading…
Reference in New Issue