[freeside-commits] branch master updated. ccd822eb8751deae96b57df4ce6abc56a195b9c4
Mark Wells
mark at 420.am
Wed Apr 13 21:55:26 PDT 2016
The branch, master has been updated
via ccd822eb8751deae96b57df4ce6abc56a195b9c4 (commit)
from 916c7d12076875cfc090ffaebde8f5add436430e (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit ccd822eb8751deae96b57df4ce6abc56a195b9c4
Author: Mark Wells <mark at freeside.biz>
Date: Wed Apr 13 19:18:34 2016 -0700
tower location CSV download, #39776
diff --git a/httemplate/browse/tower.html b/httemplate/browse/tower.html
index e2f9fd0..c8812e5 100644
--- a/httemplate/browse/tower.html
+++ b/httemplate/browse/tower.html
@@ -1,22 +1,23 @@
-<% include( 'elements/browse.html',
- 'title' => 'Towers',
- 'name' => 'towers',
- 'menubar' => [ 'Add a new tower' =>
- $p.'edit/tower.html',
- ],
- 'query' => { 'table' => 'tower', },
- 'count_query' => 'SELECT COUNT(*) FROM tower',
- 'disableable' => 1,
- 'disabled_statuspos' => 1,
- 'header' => [ 'Name', 'Location', 'Sectors', ],
- 'fields' => [ $tower_sub,
- $coord_sub,
- $sector_sub,
- ],
- 'links' => [ ],
- 'cell_style' => [ $tagdesc_style ],
- )
-%>
+<& elements/browse.html,
+ 'title' => 'Towers',
+ 'name' => 'towers',
+ 'menubar' => [ 'Add a new tower' =>
+ $p.'edit/tower.html',
+ 'Download CSV for towercoverage.com' =>
+ $p.'misc/tower-export.html?format=tc'
+ ],
+ 'query' => { 'table' => 'tower', },
+ 'count_query' => 'SELECT COUNT(*) FROM tower',
+ 'disableable' => 1,
+ 'disabled_statuspos' => 1,
+ 'header' => [ 'Name', 'Location', 'Sectors', ],
+ 'fields' => [ $tower_sub,
+ $coord_sub,
+ $sector_sub,
+ ],
+ 'links' => [ ],
+ 'cell_style' => [ $tagdesc_style ],
+&>
<%init>
die "access denied"
diff --git a/httemplate/edit/tower.html b/httemplate/edit/tower.html
index fa3838d..4d8ad1e 100644
--- a/httemplate/edit/tower.html
+++ b/httemplate/edit/tower.html
@@ -26,9 +26,9 @@
'default_ip_addr' => 'Tower IP address',
'latitude' => 'Latitude',
'longitude' => 'Longitude',
- 'altitude' => 'Altitude',
- 'height' => 'Height',
- 'veg_height' => 'Vegetation height',
+ 'altitude' => 'Altitude (feet)',
+ 'height' => 'Height (feet)',
+ 'veg_height' => 'Vegetation height (feet)',
'color' => 'Color',
},
&>
diff --git a/httemplate/misc/tower-export.html b/httemplate/misc/tower-export.html
new file mode 100644
index 0000000..d359a97
--- /dev/null
+++ b/httemplate/misc/tower-export.html
@@ -0,0 +1,36 @@
+<%init>
+# currently, browse/tower just shows all towers, so do the same here
+my @towers = qsearch({ table => 'tower' });
+http_header('Content-Type' => 'text/csv');
+http_header('Content-Disposition' => 'attachment;filename=towers.csv');
+if ( $cgi->param('format') eq 'tc' ) {
+ # towercoverage.com format: not a true CSV, no quoting (so no way to include
+ # commas in any field, so we strip them)
+
+ # lat/long are signed decimals, northeast positive
+ # height is in meters
+ # Description/Group are not necessary
+ # sector/antenna information (orientation, beamwidth, gain, frequency,
+ # etc.) is in what TC calls a "Coverage", which can't be edited this way.
+ my $text = "SiteName,Latitude,Longitude,Description,Group,Height\n";
+
+ foreach my $tower (@towers) {
+ next if ( !$tower->latitude or !$tower->longitude );
+
+ my $name = $tower->towername;
+ my $height = ( ($tower->altitude || 0 ) + ($tower->height || 0) ) / 3.28;
+ $name =~ s(,)( )g;
+ $text .= join(',',
+ $name,
+ $tower->latitude,
+ $tower->longitude,
+ '',
+ '',
+ $height,
+ ) . "\n";
+ }
+ $m->print($text);
+} else {
+ die('unknown format '.$cgi->param('format'));
+}
+</%init>
-----------------------------------------------------------------------
Summary of changes:
httemplate/browse/tower.html | 39 +++++++++++++++++++------------------
httemplate/edit/tower.html | 6 +++---
httemplate/misc/tower-export.html | 36 ++++++++++++++++++++++++++++++++++
3 files changed, 59 insertions(+), 22 deletions(-)
create mode 100644 httemplate/misc/tower-export.html
More information about the freeside-commits
mailing list