X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=httemplate%2Fbrowse%2Ftower.html;h=c8812e57b512b5e0188e736340a496a91ec8c93e;hp=0de3b324cdb444600409e868373d8bbb2795821a;hb=46fe3dbcb3ca97d1f3c70d49351846cf0ab6461d;hpb=fb4ab1073f0d15d660c6cdc4e07afebf68ef3924 diff --git a/httemplate/browse/tower.html b/httemplate/browse/tower.html index 0de3b324c..c8812e57b 100644 --- a/httemplate/browse/tower.html +++ b/httemplate/browse/tower.html @@ -1,27 +1,34 @@ -<% 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', 'Sectors', ], - 'fields' => [ $tower_sub, - $sector_sub, - ], - 'links' => [ ], - ) -%> +<& 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" unless $FS::CurrentUser::CurrentUser->access_right('Configuration'); +#false laziness w/ browse/part_tag.html +my $tagdesc_style = sub { 'background-color:#'.shift->color }; + my $num_svc_links = sub { my ($query_string, $sectors) = @_; + return if !$sectors; my $num_svc_broadband = FS::svc_broadband->count("sectornum IN($sectors)"); my $num_svc_acct = FS::svc_acct->count("sectornum IN($sectors)"); @@ -48,12 +55,32 @@ my $num_svc_links = sub { }, }; +my $coord_sub = sub { + my $tower = shift; + + my $coords = $m->scomp("/elements/coord-links.html", $tower->latitude, $tower->longitude, $tower->towername); + + [ + [ + { 'data' => "Latitude: ". $tower->latitude. + "
Longitude: ". $tower->longitude. + "
Altitude: ". $tower->altitude. + "
Height: ". $tower->height. + "
Veg. height: ". $tower->veg_height, + }, + { 'data' => $coords, 'link' => "Coordinates", }, + ], + ] +}; + my $tower_sub = sub { my $tower = shift; - my $sectors = join(',', map { $_->sectornum } $tower->tower_sector); + my $sectors = join(',', + map { $_->sectornum } $tower->tower_sector, $tower->default_sector + ); [ #rows [ - { 'data' => $tower->towername, }, + { 'data' => $tower->towername. ' ', }, { 'data' => ' (edit) ', size => '-1', 'link' => $p.'edit/tower.html?' . $tower->towernum }, ], @@ -72,7 +99,7 @@ my $sector_sub = sub { my $sectornum = $sector->sectornum; [ { - 'data' => $sector->sectorname, + 'data' => $sector->sectorname. ' ', 'link' => ( $sector->ip_addr ? 'http://'. $sector->ip_addr : '' ), },