[freeside-commits] freeside/httemplate/elements select-agent_types.html, NONE, 1.1 select-taxproduct.html, 1.1, 1.2 selectlayers.html, 1.2, 1.3 tr-input-text.html, 1.3, 1.4 tr-part_pkg_freq.html, 1.1, 1.2 tr-pkg_svc.html, NONE, 1.1 tr-select-agent_types.html, NONE, 1.1 tr-title.html, 1.1, 1.2
Ivan,,,
ivan at wavetail.420.am
Tue Apr 15 06:42:43 PDT 2008
Update of /home/cvs/cvsroot/freeside/httemplate/elements
In directory wavetail.420.am:/tmp/cvs-serv418/elements
Modified Files:
select-taxproduct.html selectlayers.html tr-input-text.html
tr-part_pkg_freq.html tr-title.html
Added Files:
select-agent_types.html tr-pkg_svc.html
tr-select-agent_types.html
Log Message:
new package editor
--- NEW FILE: select-agent_types.html ---
%# 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>
Index: selectlayers.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/elements/selectlayers.html,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- selectlayers.html 13 Apr 2008 10:20:09 -0000 1.2
+++ selectlayers.html 15 Apr 2008 13:42:40 -0000 1.3
@@ -44,6 +44,10 @@
...
},
+ #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 @@
%>"
>
- <% 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_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 ) = @_;
Index: select-taxproduct.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/elements/select-taxproduct.html,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- select-taxproduct.html 13 Apr 2008 02:56:28 -0000 1.1
+++ select-taxproduct.html 15 Apr 2008 13:42:40 -0000 1.2
@@ -20,4 +20,7 @@
my %opt = @_;
+$opt{'taxproduct_description'} ||= $opt{'object'}->taxproduct_description
+ if $opt{'object'};
+
</%init>
--- NEW FILE: tr-pkg_svc.html ---
<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>
Index: tr-part_pkg_freq.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/elements/tr-part_pkg_freq.html,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- tr-part_pkg_freq.html 13 Apr 2008 02:55:44 -0000 1.1
+++ tr-part_pkg_freq.html 15 Apr 2008 13:42:40 -0000 1.2
@@ -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 = @_;
Index: tr-input-text.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/elements/tr-input-text.html,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- tr-input-text.html 13 Apr 2008 08:21:42 -0000 1.3
+++ tr-input-text.html 15 Apr 2008 13:42:40 -0000 1.4
@@ -35,6 +35,11 @@
? '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, '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'}. '"' : '';
--- NEW FILE: tr-select-agent_types.html ---
% 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>
Index: tr-title.html
===================================================================
RCS file: /home/cvs/cvsroot/freeside/httemplate/elements/tr-title.html,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- tr-title.html 1 Aug 2007 22:25:10 -0000 1.1
+++ tr-title.html 15 Apr 2008 13:42:40 -0000 1.2
@@ -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', @_) %>
More information about the freeside-commits
mailing list