summaryrefslogtreecommitdiff
path: root/httemplate/elements
diff options
context:
space:
mode:
authormark <mark>2011-11-10 21:40:05 +0000
committermark <mark>2011-11-10 21:40:05 +0000
commit307a7d85568a15f5eb0d97c648507484108fcc56 (patch)
tree22e4da31ad00e299cea5dbf983234f839f17225b /httemplate/elements
parentcfbfa38f73888ee2c073ad7500c1fe147cde1c81 (diff)
RADIUS groups for svc_broadband, #14695
Diffstat (limited to 'httemplate/elements')
-rw-r--r--httemplate/elements/select-radius_group.html23
-rw-r--r--httemplate/elements/tr-fixed.html12
-rw-r--r--httemplate/elements/tr-select-radius_group.html11
3 files changed, 28 insertions, 18 deletions
diff --git a/httemplate/elements/select-radius_group.html b/httemplate/elements/select-radius_group.html
index e1e3c59..06972b5 100644
--- a/httemplate/elements/select-radius_group.html
+++ b/httemplate/elements/select-radius_group.html
@@ -1,17 +1,6 @@
-<SELECT MULTIPLE NAME = "<% $opt{'element_name'} || $opt{'field'} || 'usergroup' %>"
- <% $opt{'element_etc'} %>
->
-% foreach my $selopt ( keys %groups ) {
-% my $selected = (grep{ $_ eq $selopt } @sel_groups) ? 'SELECTED' : '';
- <OPTION VALUE="<%$selopt%>" <% $selected %>><% $groups{$selopt} %></OPTION>
-% }
-</SELECT>
-<%init>
-
-my %opt = @_;
-
-my %groups = map { $_->groupnum => $_->long_description }
- qsearch('radius_group', {});
-my @sel_groups = split(/,/,$opt{'curr_value'});
-
-</%init>
+<& /elements/select-table.html,
+ table => 'radius_group',
+ name_col => 'long_description',
+ order_by => 'groupname', # better idea?
+ @_
+&>
diff --git a/httemplate/elements/tr-fixed.html b/httemplate/elements/tr-fixed.html
index 095e1bc..f358343 100644
--- a/httemplate/elements/tr-fixed.html
+++ b/httemplate/elements/tr-fixed.html
@@ -1,6 +1,6 @@
<% include('tr-td-label.html', @_ ) %>
- <TD BGCOLOR="#dddddd" <% $style %>><% $opt{'formatted_value'} || $opt{'curr_value'} || $opt{'value'} |h %></TD>
+ <TD BGCOLOR="#dddddd" <% $style %>><% $value %></TD>
</TR>
@@ -12,4 +12,14 @@ my %opt = @_;
my $style = $opt{'cell_style'} ? 'STYLE="'. $opt{'cell_style'}. '"' : '';
+my $value = $opt{'formatted_value'} || $opt{'curr_value'} || $opt{'value'};
+#compatibility with select-table and friends
+if ( $opt{'multiple'} ) {
+ $value = [ split(/\s*,\s*/, $value) ] if !ref $value;
+ $value = join('<BR>', map {encode_entities($_)} @$value);
+}
+else {
+ $value = encode_entities($value)
+}
+
</%init>
diff --git a/httemplate/elements/tr-select-radius_group.html b/httemplate/elements/tr-select-radius_group.html
new file mode 100644
index 0000000..2992527
--- /dev/null
+++ b/httemplate/elements/tr-select-radius_group.html
@@ -0,0 +1,11 @@
+<% include('tr-td-label.html', label => emt('RADIUS groups'), %opt ) %>
+ <TD <% $style %>>
+ <% include( '/elements/select-radius_group.html', %opt ) %>
+ </TD>
+</TR>
+<%init>
+
+my( %opt ) = @_;
+my $style = $opt{'cell_style'} ? 'STYLE="'. $opt{'cell_style'}. '"' : '';
+
+</%init>