From 822d38841a1620b8b8e8c5ac4102ad64de9ae17f Mon Sep 17 00:00:00 2001 From: Ivan Kohler Date: Wed, 23 Oct 2013 01:53:03 -0700 Subject: [PATCH] add more fields to towers and sectors, RT#16372 --- FS/FS/Schema.pm | 25 +++++++++++++++++-------- FS/FS/tower.pm | 7 +++++++ FS/FS/tower_sector.pm | 5 +++++ httemplate/browse/tower.html | 19 ++++++++++++++----- httemplate/edit/process/tower.html | 2 +- httemplate/edit/tower.html | 28 ++++++++++++++++++---------- httemplate/elements/tower_sector.html | 5 +++++ 7 files changed, 67 insertions(+), 24 deletions(-) diff --git a/FS/FS/Schema.pm b/FS/FS/Schema.pm index 3029ab579..cbb50e0bd 100644 --- a/FS/FS/Schema.pm +++ b/FS/FS/Schema.pm @@ -3103,14 +3103,17 @@ sub tables_hashref { 'tower' => { 'columns' => [ - 'towernum', 'serial', '', '', '', '', - #'agentnum', 'int', 'NULL', '', '', '', - 'towername', 'varchar', '', $char_d, '', '', - 'disabled', 'char', 'NULL', 1, '', '', - 'latitude', 'decimal', 'NULL', '10,7', '', '', - 'longitude','decimal', 'NULL', '10,7', '', '', - 'altitude', 'decimal', 'NULL', '', '', '', - 'coord_auto', 'char', 'NULL', 1, '', '', + 'towernum', 'serial', '', '', '', '', + #'agentnum', 'int', 'NULL', '', '', '', + 'towername', 'varchar', '', $char_d, '', '', + 'disabled', 'char', 'NULL', 1, '', '', + 'latitude', 'decimal', 'NULL', '10,7', '', '', + 'longitude', 'decimal', 'NULL', '10,7', '', '', + 'coord_auto', 'char', 'NULL', 1, '', '', + 'altitude', 'decimal', 'NULL', '', '', '', + 'height', 'decimal', 'NULL', '', '', '', + 'veg_height', 'decimal', 'NULL', '', '', '', + 'color', 'varchar', 'NULL', 6, '', '', ], 'primary_key' => 'towernum', 'unique' => [ [ 'towername' ] ], # , 'agentnum' ] ], @@ -3123,6 +3126,12 @@ sub tables_hashref { 'towernum', 'int', '', '', '', '', 'sectorname', 'varchar', '', $char_d, '', '', 'ip_addr', 'varchar', 'NULL', 15, '', '', + 'height', 'decimal', 'NULL', '', '', '', + 'freq_mhz', 'int', 'NULL', '', '', '', + 'direction', 'int', 'NULL', '', '', '', + 'width', 'int', 'NULL', '', '', '', + #downtilt etc? rfpath has profile files for devices/antennas you upload? + 'range', 'decimal', 'NULL', '', '', '', #? ], 'primary_key' => 'sectornum', 'unique' => [ [ 'towernum', 'sectorname' ], [ 'ip_addr' ], ], diff --git a/FS/FS/tower.pm b/FS/FS/tower.pm index 052836e27..5497c7217 100644 --- a/FS/FS/tower.pm +++ b/FS/FS/tower.pm @@ -90,6 +90,13 @@ sub check { $self->ut_numbern('towernum') || $self->ut_text('towername') || $self->ut_enum('disabled', [ '', 'Y' ]) + || $self->ut_coordn('latitude') + || $self->ut_coordn('longitude') + || $self->ut_enum('coord_auto', [ '', 'Y' ]) + || $self->ut_floatn('altitude') + || $self->ut_floatn('height') + || $self->ut_floatn('veg_height') + || $self->ut_alphan('color') ; return $error if $error; diff --git a/FS/FS/tower_sector.pm b/FS/FS/tower_sector.pm index 36051901a..70642fb18 100644 --- a/FS/FS/tower_sector.pm +++ b/FS/FS/tower_sector.pm @@ -108,6 +108,11 @@ sub check { || $self->ut_number('towernum', 'tower', 'towernum') || $self->ut_text('sectorname') || $self->ut_textn('ip_addr') + || $self->ut_floatn('height') + || $self->ut_numbern('freq_mhz') + || $self->ut_numbern('direction') + || $self->ut_numbern('width') + || $self->ut_floatn('range') ; return $error if $error; diff --git a/httemplate/browse/tower.html b/httemplate/browse/tower.html index 7f096a748..e2f9fd0bd 100644 --- a/httemplate/browse/tower.html +++ b/httemplate/browse/tower.html @@ -8,12 +8,13 @@ 'count_query' => 'SELECT COUNT(*) FROM tower', 'disableable' => 1, 'disabled_statuspos' => 1, - 'header' => [ 'Name', 'Sectors', 'Coordinates'], + 'header' => [ 'Name', 'Location', 'Sectors', ], 'fields' => [ $tower_sub, - $sector_sub, $coord_sub, + $sector_sub, ], 'links' => [ ], + 'cell_style' => [ $tagdesc_style ], ) %> <%init> @@ -21,6 +22,9 @@ 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; @@ -57,7 +61,12 @@ my $coord_sub = sub { [ [ - { 'data' => "Latitude: " . $tower->latitude . "
Longitude: " . $tower->longitude, }, + { 'data' => "Latitude: ". $tower->latitude. + "
Longitude: ". $tower->longitude. + "
Altitude: ". $tower->altitude. + "
Height: ". $tower->height. + "
Veg. height: ". $tower->veg_height, + }, { 'data' => $coords, 'link' => "Coordinates", }, ], ] @@ -70,7 +79,7 @@ my $tower_sub = sub { ); [ #rows [ - { 'data' => $tower->towername, }, + { 'data' => $tower->towername. ' ', }, { 'data' => ' (edit) ', size => '-1', 'link' => $p.'edit/tower.html?' . $tower->towernum }, ], @@ -89,7 +98,7 @@ my $sector_sub = sub { my $sectornum = $sector->sectornum; [ { - 'data' => $sector->sectorname, + 'data' => $sector->sectorname. ' ', 'link' => ( $sector->ip_addr ? 'http://'. $sector->ip_addr : '' ), }, diff --git a/httemplate/edit/process/tower.html b/httemplate/edit/process/tower.html index 7353784e5..bbfc1a670 100644 --- a/httemplate/edit/process/tower.html +++ b/httemplate/edit/process/tower.html @@ -2,6 +2,6 @@ table => 'tower', viewall_dir => 'browse', process_o2m => { 'table' => 'tower_sector', - 'fields' => [qw( sectorname ip_addr )], + 'fields' => [qw( sectorname ip_addr height freq_mhz direction width range )], }, &> diff --git a/httemplate/edit/tower.html b/httemplate/edit/tower.html index 673a2713a..00c9adde1 100644 --- a/httemplate/edit/tower.html +++ b/httemplate/edit/tower.html @@ -4,24 +4,32 @@ viewall_dir => 'browse', fields => [ 'towername', { field=>'disabled', type=>'checkbox', value=>'Y', }, - { field => 'default_ip_addr', + { field=>'color', type=>'pickcolor' }, + { field => 'default_ip_addr', curr_value_callback => $default_ip_addr_callback }, + 'latitude', + 'longitude', + 'altitude', + 'height', + 'veg_height', { field => 'sectornum', type => 'tower_sector', o2m_table => 'tower_sector', m2_label => 'Sector', m2_error_callback => $m2_error_callback, }, - 'latitude', - 'longitude', ], - labels => { 'towernum' => 'Tower', - 'towername' => 'Name', - 'sectornum' => 'Sector', - 'disabled' => 'Disabled', + labels => { 'towernum' => 'Tower', + 'towername' => 'Name', + 'sectornum' => 'Sector', + 'disabled' => 'Disabled', 'default_ip_addr' => 'Tower IP address', - 'latitude' => 'Latitude', - 'longitude' => 'Longitude', + 'latitude' => 'Latitude', + 'longitude' => 'Longitude', + 'altitude' => 'Altitude', + 'height' => 'Height', + 'veg_height' => 'Vegetation height', + 'color' => 'Color', }, &> <%init> @@ -29,7 +37,7 @@ my $m2_error_callback = sub { # reconstruct the list my ($cgi, $object) = @_; - my @fields = qw(sectorname ip_addr); + my @fields = qw( sectorname ip_addr height freq_mhz direction width range ); map { my $k = $_; new FS::tower_sector { diff --git a/httemplate/elements/tower_sector.html b/httemplate/elements/tower_sector.html index a8bbbc5d1..406895ed9 100644 --- a/httemplate/elements/tower_sector.html +++ b/httemplate/elements/tower_sector.html @@ -53,6 +53,11 @@ my %size = ( 'title' => 12 ); tie my %label, 'Tie::IxHash', 'sectorname' => 'Name', 'ip_addr' => 'IP Address', + 'height' => 'Height', + 'freq_mhz' => 'Freq. (MHz)', + 'direction' => 'Direction', # or a button to set these to 0 for omni + 'width' => 'Width', # + 'range' => 'Range', ; my @fields = keys %label; -- 2.11.0