diff options
author | ivan <ivan> | 2010-02-21 07:32:20 +0000 |
---|---|---|
committer | ivan <ivan> | 2010-02-21 07:32:20 +0000 |
commit | f696f5c9b8ec55b83285a6d159711889cc796619 (patch) | |
tree | ca4455c3ed6b21a6431889a20db3113827e82c58 /httemplate | |
parent | 259eacca8b815b2bf159e7ee14385e2ac28ed9ee (diff) |
communigate, RT#7083
Diffstat (limited to 'httemplate')
-rwxr-xr-x | httemplate/edit/svc_acct.cgi | 41 | ||||
-rw-r--r-- | httemplate/view/elements/svc_export_settings.html | 8 | ||||
-rw-r--r-- | httemplate/view/svc_acct/basics.html | 179 | ||||
-rw-r--r-- | httemplate/view/svc_acct/tr.html | 9 |
4 files changed, 104 insertions, 133 deletions
diff --git a/httemplate/edit/svc_acct.cgi b/httemplate/edit/svc_acct.cgi index 0254ec186..f44147ff4 100755 --- a/httemplate/edit/svc_acct.cgi +++ b/httemplate/edit/svc_acct.cgi @@ -54,7 +54,7 @@ Service # <% $svcnum ? "<B>$svcnum</B>" : " (NEW)" %><BR> %}else{ <INPUT TYPE="hidden" NAME="clear_password" VALUE="<% $password %>"> %} -<INPUT TYPE="hidden" NAME="_password_encoding" VALUE="<% $password_encoding %>"> +<INPUT TYPE="hidden" NAME="_password_encoding" VALUE="<% $svc_acct->_password_encoding %>"> % %my $sec_phrase = $svc_acct->sec_phrase; %if ( $conf->exists('security_phrase') @@ -123,6 +123,19 @@ Service # <% $svcnum ? "<B>$svcnum</B>" : " (NEW)" %><BR> </TR> % } + +% if ( $communigate ) { + + <TR> + <TD ALIGN="right">Aliases</TD> + <TD><INPUT TYPE="text" NAME="cgp_aliases" VALUE="<% $svc_acct->cgp_aliases %>"></TD> + </TR> + +% } else { + <INPUT TYPE="text" NAME="cgp_aliases" VALUE="<% $svc_acct->cgp_aliases %>"> +% } + + <% include('/elements/tr-select-svc_pbx.html', 'curr_value' => $svc_acct->pbxsvc, 'part_svc' => $part_svc, @@ -251,7 +264,8 @@ Service # <% $svcnum ? "<B>$svcnum</B>" : " (NEW)" %><BR> <TD ALIGN="right">Mailbox type</TD> <TD> <SELECT NAME="cgp_type"> -% foreach my $option (qw( MultiMailbox TextMailbox MailDirMailbox )) { +% foreach my $option (qw( MultiMailbox TextMailbox MailDirMailbox +% AGrade BGrade CGrade )) { <OPTION VALUE="<% $option %>" <% $option eq $svc_acct->cgp_type() ? 'SELECTED' : '' %> ><% $option %> @@ -508,22 +522,17 @@ my $svc = $part_svc->getfield('svc'); my $otaker = getotaker; my $username = $svc_acct->username; -my $password; -my $password_encryption = $svc_acct->_password_encryption; -my $password_encoding = $svc_acct->_password_encoding; - -if($svcnum) { - if($password = $svc_acct->get_cleartext_password) { - if (! $conf->exists('showpasswords')) { - $password = '*HIDDEN*'; - } - } - elsif($svc_acct->_password and $password_encryption ne 'plain') { + +my $password = ''; +if ( $cgi->param('error') ) { + $password = $cgi->param('clear_password'); +} elsif ( $svcnum ) { + my $password_encryption = $svc_acct->_password_encryption; + if ( $password = $svc_acct->get_cleartext_password ) { + $password = '*HIDDEN*' unless $conf->exists('showpasswords'); + } elsif( $svc_acct->_password and $password_encryption ne 'plain' ) { $password = "(".uc($password_encryption)." encrypted)"; } - else { - $password = ''; - } } my $ulen = diff --git a/httemplate/view/elements/svc_export_settings.html b/httemplate/view/elements/svc_export_settings.html index a3c09110f..c5f2555bd 100644 --- a/httemplate/view/elements/svc_export_settings.html +++ b/httemplate/view/elements/svc_export_settings.html @@ -3,11 +3,15 @@ % my ( $settings, $defaults ) = $svc_x->export_getsettings; % if ( keys %$settings ) { -%# XXX a way to label this "Communigate pro settings".. just a config maybe +%# a way to label this "Communigate pro settings".. just a config maybe... eh, +%# its just for devel External settings <% ntable('#cccccc',2) %> -% foreach my $key ( keys %$settings ) { +% foreach my $key ( sort {$defaults->{$a} <=> $defaults->{$b} or $a cmp $b} +% keys %$settings +% ) +% { <TR> <TD ALIGN="right"><% $key |h %></TD> <TD BGCOLOR="<% $defaults->{$key} ? '#eeeeee' : '#ffffff' %>"> diff --git a/httemplate/view/svc_acct/basics.html b/httemplate/view/svc_acct/basics.html index 6eddd492d..2b05e78a6 100644 --- a/httemplate/view/svc_acct/basics.html +++ b/httemplate/view/svc_acct/basics.html @@ -1,149 +1,100 @@ <% &ntable("#cccccc") %><TR><TD><% &ntable("#cccccc",2) %> -<TR> - <TD ALIGN="right">Service</TD> - <TD BGCOLOR="#ffffff"><% $part_svc->svc %></TD> -</TR> +<% include('tr.html', label=>'Service', value=>$part_svc->svc) %> +<% include('tr.html', label=>'Username', value=>$svc_acct->username) %> +<% include('tr.html', label=>'Domain', value=>$domain) %> -<TR> - <TD ALIGN="right">Username</TD> - <TD BGCOLOR="#ffffff"><% $svc_acct->username %></TD> -</TR> - -<TR> - <TD ALIGN="right">Domain</TD> - <TD BGCOLOR="#ffffff"><% $domain %></TD> -</TR> +% if ( $opt{'communigate'} ) { + <% include('tr.html', label=>'Aliases', value=>$svc_acct->cgp_aliases) %> +%} % if ( $svc_acct->pbxsvc ) { - <TR> - <TD ALIGN="right">PBX</TD> - <TD BGCOLOR="#ffffff"><% $svc_acct->pbx_title %></TD> - </TR> + <% include('tr.html', label=>'PBX', value=>$svc_acct->pbx_title) %> %} -<TR> - <TD ALIGN="right">Password</TD> - <TD BGCOLOR="#ffffff"> +% my $show_pw = ''; % my $password = $svc_acct->get_cleartext_password; % if ( $password =~ /^\*\w+\* (.*)$/ ) { -% $password = $1; - <I>(login disabled)</I> +% $password = $1; +% $show_pw .= '<I>(login disabled)</I> '; % } -% if ( !$password and -% $svc_acct->_password_encryption ne 'plain' and -% $svc_acct->_password ) { - <I>(<% uc($svc_acct->_password_encryption) %> encrypted)</I> +% if ( ! $password +% && $svc_acct->_password_encryption ne 'plain' +% && $svc_acct->_password +% ) +% { +% $show_pw .= '<I>('. uc($svc_acct->_password_encryption). ' encrypted)</I>'; % } elsif ( $conf->exists('showpasswords') ) { - <PRE><% encode_entities($password) %></PRE> +% $show_pw .= '<PRE>'. encode_entities($password). '</PRE>'; % } else { - <I>(hidden)</I> +% $show_pw .= '<I>(hidden)</I>'; % } - </TD> -</TR> % $password = ''; +<% include('tr.html', label=>'Password', value=>$show_pw) %> + % if ( $conf->exists('security_phrase') ) { -% my $sec_phrase = $svc_acct->sec_phrase; -% - <TR> - <TD ALIGN="right">Security phrase</TD> - <TD BGCOLOR="#ffffff"><% $svc_acct->sec_phrase %></TD> - </TR> + <%include('tr.html', label=>'Security phrase', value=>$svc_acct->sec_phrase)%> % } % if ( $svc_acct->popnum ) { -% my $svc_acct_pop = qsearchs('svc_acct_pop',{'popnum'=>$svc_acct->popnum}); - <TR> - <TD ALIGN="right">Access number</TD> - <TD BGCOLOR="#ffffff"><% $svc_acct_pop->text %></TD> - </TR> +% my $svc_acct_pop = qsearchs('svc_acct_pop',{'popnum'=>$svc_acct->popnum}); + <% include('tr.html', label=>'Access number', value=>$svc_acct_pop->text) %> % } % if ($svc_acct->uid ne '') { - <TR> - <TD ALIGN="right">UID</TD> - <TD BGCOLOR="#ffffff"><% $svc_acct->uid %></TD> - </TR> + <% include('tr.html', label=>'UID', value=>$svc_acct->uid) %> % } % if ($svc_acct->gid ne '') { - <TR> - <TD ALIGN="right">GID</TD> - <TD BGCOLOR="#ffffff"><% $svc_acct->gid %></TD> - </TR> + <% include('tr.html', label=>'GID', value=>$svc_acct->gid) %> % } % if ($svc_acct->finger ne '') { - <TR> - <TD ALIGN="right">Real Name</TD> - <TD BGCOLOR="#ffffff"><% $svc_acct->finger %></TD> - </TR> + <% include('tr.html', label=>'Real Name', value=>$svc_acct->finger) %> % } % if ($svc_acct->dir ne '') { - <TR> - <TD ALIGN="right">Home directory</TD> - <TD BGCOLOR="#ffffff"><% $svc_acct->dir %></TD> - </TR> + <% include('tr.html', label=>'Home directory', value=>$svc_acct->dir) %> % } % if ($svc_acct->shell ne '') { - <TR> - <TD ALIGN="right">Shell</TD> - <TD BGCOLOR="#ffffff"><% $svc_acct->shell %></TD> - </TR> + <% include('tr.html', label=>'Shell', value=>$svc_acct->shell) %> % } % if ($svc_acct->quota ne '' && ! $opt{'communigate'} ) { - <TR> - <TD ALIGN="right">Quota</TD> - <TD BGCOLOR="#ffffff"><% $svc_acct->quota %></TD> - </TR> + + <% include('tr.html', label=>'Quota', value=>$svc_acct->quota) %> + % } elsif ( $opt{'communigate'} ) { - <TR> - <TD ALIGN="right">Mailbox type</TD> - <TD BGCOLOR="#ffffff"><% $svc_acct->cgp_type %></TD> - </TR> + <% include('tr.html', label=>'Mailbox type', value=>$svc_acct->cgp_type) %> - <TR> - <TD ALIGN="right">Enabled services</TD> - <TD BGCOLOR="#ffffff"><% $svc_acct->cgp_accessmodes |h %></TD> - </TR> + <% include('tr.html', label=>'Enabled services', + value=>$svc_acct->cgp_accessmodes ) %> - <TR> - <TD ALIGN="right">Mail storage limit</TD> - <TD BGCOLOR="#ffffff"><% $svc_acct->quota %></TD> - </TR> + <% include('tr.html', label=>'Mail storage limit', + value=>$svc_acct->quota ) %> - <TR> - <TD ALIGN="right">File storage limit</TD> - <TD BGCOLOR="#ffffff"><% $svc_acct->file_quota %></TD> - </TR> + <% include('tr.html', label=>'File storage limit', + value=>$svc_acct->file_quota ) %> - <TR> - <TD ALIGN="right">Number of files limit</TD> - <TD BGCOLOR="#ffffff"><% $svc_acct->file_maxnum %></TD> - </TR> + <% include('tr.html', label=>'Number of files limit', + value=>$svc_acct->file_maxnum ) %> - <TR> - <TD ALIGN="right">File size limit</TD> - <TD BGCOLOR="#ffffff"><% $svc_acct->file_maxsize %></TD> - </TR> + <% include('tr.html', label=>'File size limit', + value=>$svc_acct->file_maxsize ) %> % } % if ($svc_acct->slipip) { - <TR> - <TD ALIGN="right">IP address</TD> - <TD BGCOLOR="#ffffff"> - <% ( $svc_acct->slipip eq "0.0.0.0" || $svc_acct->slipip eq '0e0' ) - ? "<I>(Dynamic)</I>" - : $svc_acct->slipip - %> - </TD> - </TR> + <% include('tr.html', + label=>'IP address', + value=> ( $svc_acct->slipip eq "0.0.0.0" || $svc_acct->slipip eq '0e0' ) + ? "<I>(Dynamic)</I>" + : $svc_acct->slipip + ) + %> % } <% include('usage.html', @@ -152,27 +103,25 @@ %> % foreach my $attribute ( grep /^radius_/, $svc_acct->fields ) { -% $attribute =~ /^radius_(.*)$/; -% my $pattribute = $FS::raddb::attrib{$1}; - <TR> - <TD ALIGN="right">Radius (reply) <% $pattribute %></TD> - <TD BGCOLOR="#ffffff"><% $svc_acct->getfield($attribute) %></TD> - </TR> - +% $attribute =~ /^radius_(.*)$/; +% my $pattribute = $FS::raddb::attrib{$1}; + <% include('tr.html', label=>"Radius (reply) $pattribute", + value=>$svc_acct->getfield($attribute) + ) + %> % } + % foreach my $attribute ( grep /^rc_/, $svc_acct->fields ) { -% $attribute =~ /^rc_(.*)$/; -% my $pattribute = $FS::raddb::attrib{$1}; - <TR> - <TD ALIGN="right">Radius (check) <% $pattribute %></TD> - <TD BGCOLOR="#ffffff"><% $svc_acct->getfield($attribute) %></TD> - </TR> +% $attribute =~ /^rc_(.*)$/; +% my $pattribute = $FS::raddb::attrib{$1}; + <% include('tr.html', label=>"Radius (check) $pattribute", + value=>$svc_acct->getfield($attribute) + ) + %> % } -<TR> - <TD ALIGN="right">RADIUS groups</TD> - <TD BGCOLOR="#ffffff"><% join('<BR>', $svc_acct->radius_groups) %></TD> -</TR> +<% include('tr.html', label=>'RADIUS groups', + value=>join('<BR>', $svc_acct->radius_groups) ) %> %# Can this be abstracted further? Maybe a library function like %# widget('HTML', 'view', $svc_acct) ? It would definitely make UI diff --git a/httemplate/view/svc_acct/tr.html b/httemplate/view/svc_acct/tr.html new file mode 100644 index 000000000..e2ec7d42f --- /dev/null +++ b/httemplate/view/svc_acct/tr.html @@ -0,0 +1,9 @@ +<TR> + <TD ALIGN="right"><% $opt{'label'} %></TD> + <TD BGCOLOR="#ffffff"><% $opt{'value'} %></TD> +</TR> +<%init> + +my %opt = @_; + +</%init> |