[freeside-commits] branch master updated. 822d38841a1620b8b8e8c5ac4102ad64de9ae17f

Ivan ivan at 420.am
Wed Oct 23 01:53:06 PDT 2013


The branch, master has been updated
       via  822d38841a1620b8b8e8c5ac4102ad64de9ae17f (commit)
      from  cc58d576f8c2da6d01751ca3234b6a1ec11db358 (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 822d38841a1620b8b8e8c5ac4102ad64de9ae17f
Author: Ivan Kohler <ivan at freeside.biz>
Date:   Wed Oct 23 01:53:03 2013 -0700

    add more fields to towers and sectors, RT#16372

diff --git a/FS/FS/Schema.pm b/FS/FS/Schema.pm
index 3029ab5..cbb50e0 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 052836e..5497c72 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 3605190..70642fb 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 7f096a7..e2f9fd0 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 . "<br>Longitude: " . $tower->longitude, },
+      { 'data' => "Latitude: ".              $tower->latitude.
+                  "<br>Longitude: ".         $tower->longitude.
+                  "<br>Altitude: ".          $tower->altitude.
+                  "<br>Height: ".            $tower->height.
+                  "<br>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 7353784..bbfc1a6 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 673a271..00c9add 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 a8bbbc5..406895e 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;

-----------------------------------------------------------------------

Summary of changes:
 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(-)




More information about the freeside-commits mailing list