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