DMA Radius Manager export, #18456
authorMark Wells <mark@freeside.biz>
Tue, 2 Oct 2012 21:27:38 +0000 (14:27 -0700)
committerMark Wells <mark@freeside.biz>
Tue, 2 Oct 2012 21:27:38 +0000 (14:27 -0700)
FS/FS/Schema.pm
FS/FS/radius_group.pm
httemplate/browse/radius_group.html
httemplate/edit/radius_group.html

index c932d7f..4e13951 100644 (file)
@@ -2454,6 +2454,8 @@ sub tables_hashref {
         'groupname',    'varchar', '', $char_d, '', '', 
         'description',  'varchar', 'NULL', $char_d, '', '', 
         'priority', 'int', '', '', '1', '',
+        'speed_up', 'int', 'NULL', '', '', '',
+        'speed_down', 'int', 'NULL', '', '', '',
       ],
       'primary_key' => 'groupnum',
       'unique'      => [ ['groupname'] ],
index 37aa0f3..f1a4efe 100644 (file)
@@ -47,6 +47,8 @@ description
 
 priority - for export
 
+=item speed_up, speed_down - connection speeds in bits per second.  Some 
+exports may use this to generate appropriate RADIUS attributes.
 
 =back
 
@@ -176,6 +178,8 @@ sub check {
     || $self->ut_text('groupname')
     || $self->ut_textn('description')
     || $self->ut_numbern('priority')
+    || $self->ut_numbern('speed_up')
+    || $self->ut_numbern('speed_down')
   ;
   return $error if $error;
 
index fbf6d37..98e81ab 100644 (file)
@@ -5,15 +5,26 @@
   'query'       => { 'table' => 'radius_group' },
   'count_query' => 'SELECT COUNT(*) FROM radius_group',
   'header'      => [ '#', 'RADIUS Group', 'Description', 'Priority',
-                     'Check', 'Reply' ],
+                     'Check', 'Reply', 'Speed' ],
   'fields'      => [ 'groupnum',
                      'groupname',
                      'description',
                      'priority',
-                     $check_attr, $reply_attr
+                     $check_attr, $reply_attr,
+                     sub { 
+                      my $group = shift;
+                      if ($group->speed_down and $group->speed_up) {
+                        return join (' / ', $group->speed_down, $group->speed_up);
+                      } elsif ( $group->speed_down ) {
+                        return $group->speed_down . ' down';
+                      } elsif ( $group->speed_up ) {
+                        return $group->speed_up . ' up';
+                      }
+                      '';
+                     },
                    ],
-  'align'       => 'lllcll',
-  'links'       => [ $link, $link, '', '', '', '',
+  'align'       => 'lllcllc',
+  'links'       => [ $link, $link, '', '', '', '', ''
                    ],
 &>
 <%init>
index 0255611..2324a5e 100644 (file)
@@ -7,6 +7,8 @@
     'description' => 'Description',
     'attrnum'   => 'Attribute',
     'priority'  => 'Priority',
+    'speed_down'  => 'Download speed',
+    'speed_up'    => 'Upload speed',
   },
   'menubar' => \@menubar,
   'edit_callback' => $edit_callback,
       'size'      => 2,
       'colspan'   => 6, # just to not interfere with radius_attr columns
     },
+    { 'field'     => 'speed_down',
+      'type'      => 'text',
+      'size'      => 8,
+      'colspan'   => 6,
+    },
+    { 'field'     => 'speed_up',
+      'type'      => 'text',
+      'size'      => 8,
+      'colspan'   => 6,
+    },
     {
       'field'     => 'attrnum',
       'type'      => 'radius_attr',