[freeside-commits] freeside/httemplate/edit radius_group.html, 1.1, 1.2

Mark Wells mark at wavetail.420.am
Wed Nov 23 10:39:08 PST 2011


Update of /home/cvs/cvsroot/freeside/httemplate/edit
In directory wavetail.420.am:/tmp/cvs-serv14549/httemplate/edit

Modified Files:
	radius_group.html 
Log Message:
RADIUS group attributes, #15017

Index: radius_group.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/edit/radius_group.html,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -w -d -r1.1 -r1.2
--- radius_group.html	21 Jun 2011 01:04:55 -0000	1.1
+++ radius_group.html	23 Nov 2011 18:39:06 -0000	1.2
@@ -5,12 +5,54 @@
                                'groupnum'  => 'Group',
                                'groupname' => 'RADIUS Group',
                                'description' => 'Description',
+    'attrnum'   => 'Attribute',
+    'priority'  => 'Priority',
                              },
                  'viewall_dir' => 'browse',
+  'fields' => [
+    { 'field'     => 'groupname',
+      'type'      => 'text',
+      'size'      => 20,
+      'colspan'   => 6, # just to not interfere with radius_attr columns
+    },
+    { 'field'     => 'description',
+      'type'      => 'text',
+      'size'      => 40,
+      'colspan'   => 6,
+    },
+    { 'field'     => 'priority',
+      'type'      => 'text',
+      'size'      => 2,
+      'colspan'   => 6, # just to not interfere with radius_attr columns
+    },
+    {
+      'field'     => 'attrnum',
+      'type'      => 'radius_attr',
+      'o2m_table' => 'radius_attr',
+      'm2_label'  => 'Attribute',
+      'm2_error_callback' => $m2_error_callback,
+    },
+  ],
+  #debug => 1
 &>
 <%init>
 
 die "access denied"
   unless $FS::CurrentUser::CurrentUser->access_right('Configuration');
 
+my $m2_error_callback = sub { # reconstruct the list
+  my ($cgi, $object) = @_;
+
+  warn Dumper({$cgi->Vars});
+  my @fields = qw(attrname attrtype op value);
+  map {
+    my $k = $_;
+    next if !length($cgi->param($k.'_attrname'));
+    new FS::radius_attr {
+      'groupnum' => $object->groupnum,
+      'attrnum'  => scalar( $cgi->param($k) ),
+      map {  $_  => scalar( $cgi->param($k.'_'.$_) ) } @fields,
+    };
+  } grep /^attrnum\d+$/, ($cgi->param);
+};
 </%init>



More information about the freeside-commits mailing list