From d838063ab25f047e88c3e5ae16f77fc4f3481ce9 Mon Sep 17 00:00:00 2001 From: mark Date: Wed, 23 Nov 2011 18:42:50 +0000 Subject: RADIUS group attributes, #15017 --- httemplate/elements/radius_attr.html | 89 ++++++++++++++++++++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 httemplate/elements/radius_attr.html (limited to 'httemplate/elements/radius_attr.html') diff --git a/httemplate/elements/radius_attr.html b/httemplate/elements/radius_attr.html new file mode 100644 index 000000000..2ebf346a9 --- /dev/null +++ b/httemplate/elements/radius_attr.html @@ -0,0 +1,89 @@ +% if ( $first_row ) { +% $first_row = ''; + +% } #if $first_row + +<& select.html, + field => $name.'_attrtype', + id => $name.'_attrtype', + options => ['C','R'], + labels => { 'C' => 'Check', 'R' => 'Reply' }, + curr_value => $radius_attr->attrtype, + onchange => 'change_attrtype(this)', +&> +<& input-text.html, + field => $name.'_attrname', + curr_value => $radius_attr->attrname, + onchange => $onchange, + size => 40, #longest attribute name in freeradius dict = 46 +&> +<& select.html, + field => $name.'_op', + id => $name.'_op', + options => [ FS::radius_attr->ops($radius_attr->attrtype) ], + curr_value => $radius_attr->op, + onchange => $onchange, +&> +<& input-text.html, + field => $name.'_value', + curr_value => $radius_attr->value, + onchange => $onchange, + size => 20, #tend to be shorter than attribute names +&> +<%shared> +my $first_row = 1; + +<%init> + +my( %opt ) = @_; + +# for an 'onchange' option that will work in both select.html and +# input-text.html: +# - don't start with "onchange=" +# - don't end with (what) or (this) +# - don't end with a semicolon +# - don't have quotes +my $onchange = $opt{'onchange'} || ''; +$onchange =~ s/\((what|this)\);?$//; + +my $name = $opt{'element_name'} || $opt{'field'} || 'attrnum'; +my $id = $opt{'id'} || 'attrnum'; + +my $curr_value = $opt{'curr_value'} || $opt{'value'}; +my $radius_attr; + +if ( $curr_value ) { + $radius_attr = qsearchs('radius_attr', { 'attrnum' => $curr_value }) + or die "attrnum $curr_value not found"; +} +else { + $radius_attr = new FS::radius_attr { + 'attrtype' => 'C', + 'op' => '==', + }; +} + + -- cgit v1.2.1