diff options
Diffstat (limited to 'httemplate/elements')
| -rw-r--r-- | httemplate/elements/select-agent_types.html | 30 | ||||
| -rw-r--r-- | httemplate/elements/select-taxproduct.html | 3 | ||||
| -rw-r--r-- | httemplate/elements/selectlayers.html | 8 | ||||
| -rw-r--r-- | httemplate/elements/tr-input-text.html | 8 | ||||
| -rw-r--r-- | httemplate/elements/tr-part_pkg_freq.html | 19 | ||||
| -rw-r--r-- | httemplate/elements/tr-pkg_svc.html | 93 | ||||
| -rw-r--r-- | httemplate/elements/tr-select-agent_types.html | 19 | ||||
| -rw-r--r-- | httemplate/elements/tr-title.html | 12 | 
8 files changed, 165 insertions, 27 deletions
| diff --git a/httemplate/elements/select-agent_types.html b/httemplate/elements/select-agent_types.html new file mode 100644 index 000000000..e56fee43c --- /dev/null +++ b/httemplate/elements/select-agent_types.html @@ -0,0 +1,30 @@ +%# if ( $cgi->param('clone') ) { #XXX +% if ( $opt{'disable'} ) {  + +    <INPUT TYPE="hidden" NAME="agent_type" VALUE=""> + +% } elsif ( scalar(@all_agent_types) == 1) { + +    <INPUT TYPE="hidden" NAME="agent_type" VALUE="<% $all_agent_types[0] %>"> + +% } else { + +    <% include( 'select-table.html', +                  'element_name' => 'agent_type', +                  'table'        => 'agent_type', +                  'name_col'     => 'atype', +                  #'value'        => \@agent_type, +                  'element_etc'  => 'size="10"', +                  %opt, +                  'multiple'     =>  '1', #cause edit.html is dum +              ) +    %> + +% } +<%init> + +my %opt = @_; + +my @all_agent_types = map {$_->typenum} qsearch('agent_type',{}); + +</%init> diff --git a/httemplate/elements/select-taxproduct.html b/httemplate/elements/select-taxproduct.html index f2ae9ebcb..dc7ab97d3 100644 --- a/httemplate/elements/select-taxproduct.html +++ b/httemplate/elements/select-taxproduct.html @@ -20,4 +20,7 @@  my %opt = @_; +$opt{'taxproduct_description'} ||= $opt{'object'}->taxproduct_description +  if $opt{'object'}; +  </%init> diff --git a/httemplate/elements/selectlayers.html b/httemplate/elements/selectlayers.html index 302621775..82f5dd1a7 100644 --- a/httemplate/elements/selectlayers.html +++ b/httemplate/elements/selectlayers.html @@ -44,6 +44,10 @@ Example:                          ...                        }, +    #or manual control, instead of layer_fields and layer_values above +    #called with args: my( $layer, $layer_fields, $layer_values, $layer_prefix ) +    'layer_callback' =>  +      'html_between  => '', #optional HTML displayed between the SELECT and the                            #layers, scalar or coderef ('field' passed as a param)      'onchange'     => '', #javascript code run when the SELECT changes @@ -129,7 +133,7 @@ Example:                    %>"        > -        <% layer_callback($layer, $layer_fields, $layer_values, $layer_prefix) %> +        <% &{$layer_callback}($layer, $layer_fields, $layer_values, $layer_prefix) %>        </DIV> @@ -165,6 +169,8 @@ my $layer_fields = $opt{layer_fields};  my $layer_values = $opt{layer_values};  my $layer_prefix = $opt{layer_prefix}; +my $layer_callback = $opt{layer_callback} || \&layer_callback; +  sub layer_callback {    my( $layer, $layer_fields, $layer_values, $layer_prefix ) = @_; diff --git a/httemplate/elements/tr-input-text.html b/httemplate/elements/tr-input-text.html index 49ae166ee..f71f2f7fb 100644 --- a/httemplate/elements/tr-input-text.html +++ b/httemplate/elements/tr-input-text.html @@ -35,6 +35,11 @@ my $maxlength = $opt{'maxlength'}                  ? 'MAXLENGTH="'. $opt{'maxlength'}. '"'                  : ''; +$opt{'disabled'} = &{ $opt{'disabled'} }( \%opt ) +  if ref($opt{'disabled'}) eq 'CODE'; +$opt{'disabled'} = 'DISABLED' +  if $opt{'disabled'} && $opt{'disabled'} !~ /disabled/i; # uuh... yeah? +  my @style = ();  push @style, 'text-align: '. $opt{'text-align'} @@ -43,9 +48,6 @@ push @style, 'text-align: '. $opt{'text-align'}  push @style, 'background-color: #dddddd'    if $opt{'disabled'}; -$opt{'disabled'} = 'DISABLED' -  if $opt{'disabled'} && $opt{'disabled'} !~ /disabled/i; # uuh... yeah? -  my $style = scalar(@style) ? 'STYLE="'. join(';', @style). '"' : '';  my $cell_style = $opt{'cell_style'} ? 'STYLE="'. $opt{'cell_style'}. '"' : ''; diff --git a/httemplate/elements/tr-part_pkg_freq.html b/httemplate/elements/tr-part_pkg_freq.html index 98b7da5a5..649f8a2d0 100644 --- a/httemplate/elements/tr-part_pkg_freq.html +++ b/httemplate/elements/tr-part_pkg_freq.html @@ -1,15 +1,10 @@ -<% include('tr-td-label.html', @_ ) %> - -  <TD> -    <SELECT NAME="freq"> -%     foreach my $freq ( @freq ) { -        <OPTION VALUE="<% $freq %>" <% $freq eq $curr_value ? 'SELECTED' : '' %>><% $freq{$freq} %> -%     } -    </SELECT> -  </TD> - -</TR> - +<% include('tr-select.html', @_,  +             'field'      => 'freq', +             'options'    => \@freq, +             'labels'     => \%freq, +             'curr_value' => $curr_value, +          ) +%>  <%init>  my %opt = @_; diff --git a/httemplate/elements/tr-pkg_svc.html b/httemplate/elements/tr-pkg_svc.html new file mode 100644 index 000000000..4c8a839bf --- /dev/null +++ b/httemplate/elements/tr-pkg_svc.html @@ -0,0 +1,93 @@ +<TR> +  <TD BGCOLOR="#e8e8e8" COLSPAN=99> + +<% itable('', 4, 1) %><TR><TD VALIGN="top"> +<% $thead %> + +%foreach my $part_svc ( @part_svc ) { +%  my $svcpart = $part_svc->svcpart; +%  my $pkg_svc = $pkg_svc{$svcpart} +%             || new FS::pkg_svc ( { +%                                   'pkgpart'     => $pkgpart, +%                                   'svcpart'     => $svcpart, +%                                   'quantity'    => 0, +%                                   'primary_svc' => '', +%                                } ); +%  if ( $cgi->param('error') ) { +%    my $primary_svc = ( $pkg_svc->primary_svc =~ /^Y/i ); +%    my $pkg_svc_primary = scalar($cgi->param('pkg_svc_primary')); +%    $pkg_svc->primary_svc('') +%      if $primary_svc && $pkg_svc_primary != $svcpart; +%    $pkg_svc->primary_svc('Y') +%      if ! $primary_svc && $pkg_svc_primary == $svcpart; +%  } +% +%  push @fixups, "pkg_svc$svcpart"; +% +%  my $quan = 0; +%  if ( $cgi->param("pkg_svc$svcpart") =~ /^\s*(\d+)\s*$/ ) { +%    $quan = $1; +%  } elsif ( $pkg_svc->quantity ) { +%    $quan = $pkg_svc->quantity; +%  } + +  <TR> +    <TD> +      <INPUT TYPE="text" NAME="pkg_svc<% $svcpart %>" SIZE=4 MAXLENGTH=3 VALUE="<% $quan %>"> +    </TD> +    +    <TD ALIGN="center"> +      <INPUT TYPE="radio" NAME="pkg_svc_primary" VALUE="<% $svcpart %>" <% $pkg_svc->primary_svc =~ /^Y/i ? ' CHECKED' : '' %>> +    </TD> + +    <TD> +      <A HREF="part_svc.cgi?<% $part_svc->svcpart %>"><% $part_svc->svc %></A>      <% $part_svc->disabled =~ /^Y/i ? ' (DISABLED' : '' %> +    </TD> +  </TR> +% foreach ( 1 .. $columns-1 ) { +%       if ( $count == int( $_ * scalar(@part_svc) / $columns ) ) {  +%   + +         </TABLE></TD><TD VALIGN="top"><% $thead %> +%   } +%     } +%     $count++; +%   +% }  + +</TR></TABLE></TD></TR></TABLE> + +  </TD> +</TR> + +<%init> + +my %opt = @_; +my $cgi = $opt{'cgi'}; + +my $thead =  "\n\n". ntable('#cccccc', 2). +             '<TR><TH BGCOLOR="#dcdcdc"><FONT SIZE=-1>Quan.</FONT></TH>'. +             '<TH BGCOLOR="#dcdcdc"><FONT SIZE=-2>Primary</FONT></TH>'. +             '<TH BGCOLOR="#dcdcdc">Service</TH></TR>'; + +my $part_pkg = $opt{'object'}; +my $pkgpart = $part_pkg->pkgpart; + +my $where =  "WHERE disabled IS NULL OR disabled = ''"; +if ( $pkgpart ) { +  $where .=  "   OR 0 < ( SELECT quantity FROM pkg_svc +                           WHERE pkg_svc.svcpart = part_svc.svcpart +                             AND pkgpart = $pkgpart +                        )"; +} +my @part_svc = qsearch('part_svc', {}, '', $where); + +#my $q_part_pkg = $clone_part_pkg || $part_pkg; +#my %pkg_svc = map { $_->svcpart => $_ } $q_part_pkg->pkg_svc; +my %pkg_svc = map { $_->svcpart => $_ } $part_pkg->pkg_svc; + +my @fixups = (); +my $count = 0; +my $columns = 3; + +</%init> diff --git a/httemplate/elements/tr-select-agent_types.html b/httemplate/elements/tr-select-agent_types.html new file mode 100644 index 000000000..29ac7f1b4 --- /dev/null +++ b/httemplate/elements/tr-select-agent_types.html @@ -0,0 +1,19 @@ +% unless ( $opt{'disable'} || scalar(@all_agent_types) == 1 ) { + +<% include('/elements/tr-justtitle.html', value=>'Agent (reseller) types') %> + +% } + +<TR> +  <TD COLSPAN=2> +    <% include('select-agent_types.html', %opt) %> +  </TD> +</TR> + +<%init> + +my %opt = @_; + +my @all_agent_types = map {$_->typenum} qsearch('agent_type',{}); + +</%init> diff --git a/httemplate/elements/tr-title.html b/httemplate/elements/tr-title.html index 6e2f58f6a..8517737ae 100644 --- a/httemplate/elements/tr-title.html +++ b/httemplate/elements/tr-title.html @@ -2,14 +2,4 @@    <TD BGCOLOR="#e8e8e8" COLSPAN=2> </TD>  </TR> -<TR> -  <TH BGCOLOR="#e8e8e8" COLSPAN=2 ALIGN="left"> -    <FONT SIZE="+1"><% $opt{value} %></FONT> -  </TH> -</TR> - -<%init> - -my %opt = @_; - -</%init> +<% include('tr-justtitle.html', @_) %> | 
