X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=httemplate%2Fedit%2Fradius_group.html;h=164f0a5815a7ebbf5ed350bb3368cd69e19b0bf0;hb=0e845fa6f04733d82ea8ca092c7778aef773ab5d;hp=80e17ed8381b30ed3b468f64412466d2d3d97ece;hpb=5fdd19665fb7c0ad425a99d3dbf9ad7e27fbf44a;p=freeside.git diff --git a/httemplate/edit/radius_group.html b/httemplate/edit/radius_group.html index 80e17ed83..164f0a581 100644 --- a/httemplate/edit/radius_group.html +++ b/httemplate/edit/radius_group.html @@ -1,16 +1,57 @@ <& elements/edit.html, - 'name' => 'RADIUS Group', - 'table' => 'radius_group', - 'labels' => { - 'groupnum' => 'Group', - 'groupname' => 'RADIUS Group', - 'description' => 'Description', - }, - 'viewall_dir' => 'browse', + 'name' => 'RADIUS Group', + 'table' => 'radius_group', + 'labels' => { + '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) = @_; + + 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); +};