blob: e40ebe807f280c86aa8b5e8e332bea24b5febc74 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
<INPUT TYPE="hidden" NAME="svcnum" VALUE="<% $opt{'svcnum'} %>">
<INPUT TYPE="hidden" NAME="pkgnum" VALUE="<% $opt{'pkgnum'} %>">
<INPUT TYPE="hidden" NAME="svcpart" VALUE="<% $opt{'svcpart'} %>">
<SCRIPT TYPE="text/javascript">
function srcchanged(what) {
if ( what.options[what.selectedIndex].value == 0 ) {
what.form.src.disabled = false;
what.form.src.style.backgroundColor = "white";
} else {
what.form.src.disabled = true;
what.form.src.style.backgroundColor = "lightgrey";
}
}
function dstchanged(what) {
if ( what.options[what.selectedIndex].value == 0 ) {
what.form.dst.disabled = false;
what.form.dst.style.backgroundColor = "white";
} else {
what.form.dst.disabled = true;
what.form.dst.style.backgroundColor = "lightgrey";
}
}
</SCRIPT>
<% ntable("#cccccc",2) %>
<TR>
<TD ALIGN="right">Email to</TD>
<TD>
% if ( $conf->exists('svc_forward-no_srcsvc') ) {
<INPUT NAME="srcsrc" TYPE="hidden" VALUE="0">
% } else {
<SELECT NAME="srcsvc" SIZE=1 onChange="srcchanged(this)">
% foreach my $somesvc (keys %email) {
<OPTION VALUE="<% $somesvc %>"
<% $somesvc eq $opt{'srcsvc'} ? 'SELECTED' : '' %>
><% $email{$somesvc} %></OPTION>
% }
<OPTION VALUE="0" <% $opt{'src'} ? 'SELECTED' : '' %>
>(other email address)</OPTION>
</SELECT>
% }
% my $src_disabled = $opt{'src'}
% || $conf->exists('svc_forward-no_srcsvc')
% || !scalar(%email);
<INPUT NAME = "src"
TYPE = "text"
VALUE = "<% $opt{'src'} %>"
<% $src_disabled ? '' : 'DISABLED STYLE="background-color: lightgrey"' %>
>
</TD>
</TR>
<TR><TD ALIGN="right">Forwards to</TD>
<TD><SELECT NAME="dstsvc" SIZE=1 onChange="dstchanged(this)">
% foreach my $somesvc (keys %email) {
<OPTION<% $somesvc eq $opt{'dstsvc'} ? " SELECTED" : "" %> VALUE="<% $somesvc %>"><% $email{$somesvc} %></OPTION>
% }
<OPTION <% $opt{'dst'} ? 'SELECTED' : '' %> VALUE="0">(other email address)</OPTION>
</SELECT>
<INPUT TYPE="text" NAME="dst" VALUE="<% $opt{'dst'} %>" <% ( $opt{'dst'} || !scalar(%email) ) ? '' : 'DISABLED STYLE="background-color: lightgrey"' %>>
</TD></TR>
</TABLE>
<%init>
# This is used directly by selfservice, only use what's passed
# Do not look up sensitive information here
my %opt = @_;
my $conf = $opt{'conf'};
$conf ||= new FS::Conf;
my %email;
%email = %{$opt{'email'}} if ref($opt{'email'}) eq 'HASH';
</%init>
|