[freeside-commits] freeside/httemplate/edit/cust_main/first_pkg svc_acct.html, NONE, 1.1 svc_phone.html, NONE, 1.1 select-part_pkg.html, NONE, 1.1
Ivan,,,
ivan at wavetail.420.am
Sat Apr 11 23:09:14 PDT 2009
Update of /home/cvs/cvsroot/freeside/httemplate/edit/cust_main/first_pkg
In directory wavetail.420.am:/tmp/cvs-serv9781/httemplate/edit/cust_main/first_pkg
Added Files:
svc_acct.html svc_phone.html select-part_pkg.html
Log Message:
add svc_phone on new customer first package, RT#4315
--- NEW FILE: svc_phone.html ---
<% ntable("#cccccc") %>
%#XXX this should be hidden or something in most/all cases
<TR>
<TD ALIGN="right" ID="countrycode_label_td">Country code</TD>
<TD ID="countrycode_td">
<INPUT TYPE = "text"
NAME = "countrycode"
ID = "countrycode"
VALUE = "<% $opt{'countrycode'} %>"
SIZE = 4
MAXLENGTH = 3
>
</TD>
</TR>
%#we don't know the svcpart until the dropdown is changed :/
%#<% include('/elements/tr-select-did.html',
%# 'label' => 'Phone number',
%# 'curr_value' => $opt{'phonenum'},
%# )
%#%>
<TR>
<TD ALIGN="right" ID="phonenum_label_td">Phone Number</TD>
<TD ID="phonenum_td">
<INPUT TYPE = "text"
NAME = "phonenum"
ID = "phonenum"
VALUE = "<% $opt{'phonenum'} %>"
SIZE = 21
MAXLENGTH = 20
>
</TD>
</TR>
<TR>
<TD ALIGN="right" ID="sip_password_label_td">SIP password</TD>
<TD ID="sip_password_td">
<INPUT TYPE = "text"
NAME = "sip_password"
ID = "sip_password"
VALUE = "<% $opt{'sip_password'} %>"
MAXLENGTH = 80
>
</TD>
</TR>
<TR>
<TD ALIGN="right" ID="pin_label_td">Voicemail PIN</TD>
<TD ID="pin_td">
<INPUT TYPE = "text"
NAME = "pin"
ID = "pin"
VALUE = "<% $opt{'pin'} %>"
SIZE = 5
MAXLENGTH = 4
>
</TD>
</TR>
%#XXX this should be hidden or something in most/all cases
<TR>
<TD ALIGN="right" ID="phone_name_label_td">Name</TD>
<TD ID="phone_name_td">
<INPUT TYPE = "text"
NAME = "phone_name"
ID = "phone_name"
VALUE = "<% $opt{'phone_name'} %>"
MAXLENGTH = 80
>
</TD>
</TR>
</TABLE>
<%init>
my( %opt ) = @_;
#my $conf = new FS::Conf;
</%init>
--- NEW FILE: svc_acct.html ---
<% ntable("#cccccc") %>
<TR>
<TD ALIGN="right">Username</TD>
<TD>
<INPUT TYPE = "text"
NAME = "username"
VALUE = "<% $opt{'username'} %>"
SIZE = <% $ulen2 %>
MAXLENGTH = <% $ulen %>
>
</TD>
</TR>
<TR>
<TD ALIGN="right">Domain</TD>
<TD>
<SELECT NAME="domsvc">
<OPTION>(none)</OPTION>
</SELECT>
</TD>
</TR>
<TR>
<TD ALIGN="right">Password</TD>
<TD>
<INPUT TYPE = "text"
NAME = "_password"
VALUE = "<% $opt{'password'} %>"
SIZE = <% $pmax2 %>
MAXLENGTH = <% $passwordmax %>>
(blank to generate)
</TD>
</TR>
<TR>
<TD ALIGN="right">Access number</TD>
<TD><% FS::svc_acct_pop::popselector($opt{'popnum'}) %></TD>
</TR>
</TABLE>
<%init>
#use FS::svc_acct_pop;
my( %opt ) = @_;
my $conf = new FS::Conf;
#false laziness: (mostly) copied from edit/svc_acct.cgi
#$ulen = $svc_acct->dbdef_table->column('username')->length;
my $ulen = dbdef->table('svc_acct')->column('username')->length;
my $ulen2 = $ulen+2;
my $passwordmax = $conf->config('passwordmax') || 8;
my $pmax2 = $passwordmax + 2;
</%init>
--- NEW FILE: select-part_pkg.html ---
<% include('/elements/xmlhttp.html',
'url' => $p.'misc/svc_acct-domains.cgi',
'subs' => [ $opt{'prefix'}. 'get_domains' ],
)
%>
<% include('/elements/xmlhttp.html',
'url' => $p.'misc/part_svc-columns.cgi',
'subs' => [ $opt{'prefix'}. 'get_part_svc' ],
)
%>
<SCRIPT TYPE="text/javascript">
function selopt(what,value,text,selected) {
var optionName = new Option(text, value, false, selected);
var length = what.length;
what.options[length] = optionName;
}
var pkgpart_svcpart2svcdb = {
% foreach my $pkgpart ( map $_->pkgpart, @part_pkg ) {
"<% $pkgpart_svcpart{$pkgpart} %>":"<% $svcdb{$pkgpart} %>",
% }
'':''
};
function <% $opt{'prefix'} %>pkgpart_svcpart_changed_too(what,selected) {
pkgpart_svcpart = what.options[what.selectedIndex].value;
var svcdb = pkgpart_svcpart2svcdb[pkgpart_svcpart];
if ( svcdb == 'svc_acct' ) {
// go get the new domains
function <% $opt{'prefix'} %>update_domains(domains) {
// blank the current domain list
for ( var i = what.form.<% $opt{'prefix'} %>domsvc.length; i >= 0; i-- )
what.form.<% $opt{'prefix'} %>domsvc.options[i] = null;
// add the new domains
var domainArray = eval('(' + domains + ')' );
for ( var s = 0; s < domainArray.length; s=s+2 ) {
var domainLabel = domainArray[s+1];
if ( domainLabel == "" )
domainLabel = '(n/a)';
selopt( what.form.<% $opt{'prefix'} %>domsvc,
domainArray[s],
domainLabel,
(domainArray[s] == selected) ? true : false
);
}
}
<% $opt{'prefix'} %>get_domains( pkgpart_svcpart,
<% $opt{'prefix'} %>update_domains
);
} else if ( svcdb == 'svc_phone' ) {
function <% $opt{'prefix'} %>update_svc_phone(part_svc_column) {
var colArray = eval('(' + part_svc_column + ')' );
for ( var s = 0; s < colArray.length; s=s+3 ) {
var name = colArray[s];
var flag = colArray[s+1];
var value = colArray[s+2];
var td_label = document.getElementById(name+'_label_td');
var td = document.getElementById(name+'_td');
var input = document.getElementById(name);
if ( flag == 'D' ) {
if ( ! input.value ) { input.value = value; }
td_label.style.display = ''
td.style.display = ''
} else if ( flag == 'F' ) {
input.value = value;
td_label.style.display = 'none'
td.style.display = 'none'
} else {
td_label.style.display = ''
td.style.display = ''
}
}
}
<% $opt{'prefix'} %>get_part_svc( pkgpart_svcpart,
<% $opt{'prefix'} %>update_svc_phone
);
}
}
</SCRIPT>
<% include( '/elements/selectlayers.html',
'field' => $opt{'prefix'}. 'pkgpart_svcpart',
'curr_value' => $opt{pkgpart_svcpart},
'options' => \@options,
'labels' => \%labels,
'html_between' => '</TD></TR></TABLE>',
#'onchange' => $opt{'prefix'}. 'pkgpart_svcpart_changed(this,0);',
'onchange' => $opt{'prefix'}. 'pkgpart_svcpart_changed_too(what,0)',
'layer_callback' => $layer_callback,
'layermap' => \%layermap,
)
%>
<SCRIPT TYPE="text/javascript">
pkgpart_svcpart_changed_too( document.CustomerForm.pkgpart_svcpart,
<% $opt{saved_domsvc} %>
);
</SCRIPT>
<%init>
my %opt = @_;
foreach my $opt (qw( svc_part pkgparts saved_pkgpart saved_domsvc prefix)) {
$opt{$_} = '' unless exists($opt{$_}) && defined($opt{$_});
}
$opt{saved_domsvc} = 0 unless $opt{saved_domsvc};
my @part_pkg = @{$opt{'part_pkg'}};
my @first_svc = ( 'svc_acct', 'svc_phone' );
my %pkgpart_svcpart = ();
my %svcdb = ();
my %layermap = ();
foreach my $part_pkg ( @part_pkg ) {
my $pkgpart = $part_pkg->pkgpart;
my $pkgpart_svcpart = $pkgpart. "_". $part_pkg->svcpart(\@first_svc);
$pkgpart_svcpart{$pkgpart} = $pkgpart_svcpart;
$svcdb{$pkgpart} = $part_pkg->part_svc(\@first_svc)->svcdb;
$layermap{$pkgpart_svcpart} = $svcdb{$pkgpart};
}
my @options = ( '', map $pkgpart_svcpart{ $_->pkgpart }, @part_pkg );
my %labels = ( '' => '(none)',
map { $pkgpart_svcpart{ $_->pkgpart }
=> $_->pkg. " - ". $_->comment
}
@part_pkg
);
my $layer_callback = sub {
my $layer = shift;
#$layer_fields, $layer_values, $layer_prefix
# my( $pkgpart, $svcpart ) = split('_', $layer);
# my $svcdb = $svcdb{$pkgpart};
my $svcdb = $layer;
return '' unless $svcdb; #'<BR><BR><BR><BR><BR>'
#full path cause we're being slung around as a coderef (mason closures?)
include("/edit/cust_main/first_pkg/$svcdb.html", %opt, );
};
</%init>
More information about the freeside-commits
mailing list