combine ticket notification scrips, #15353
[freeside.git] / httemplate / elements / tr-freq.html
1 <% include('tr-td-label.html', @_) %>
2
3   <TD <% $style %>>
4
5     <INPUT TYPE  = "text"
6            SIZE  = "<% $opt{'size'} || 4 %>"
7            NAME  = "<% $opt{'field'} || 'freq' %>"
8            ID    = "<% $opt{'id'} %>"
9            VALUE = "<% $curr_value %>"
10     >
11
12     <SELECT NAME = "<% $opt{'field'} || 'freq' %>_units">
13 %     foreach my $freq ( keys %freq ) {
14         <OPTION VALUE="<% $freq %>"
15                 <% $freq eq $units ? 'SELECTED' : '' %>
16         ><% $freq{$freq} %>
17 %     }
18     </SELECT>
19
20   </TD>
21
22 </TR>
23
24 <%once>
25
26   tie my %freq, 'Tie::IxHash',
27     #'y' => 'years',
28     'm' => 'months',
29     'w' => 'weeks',
30     'd' => 'days',
31     'h' => 'hours',
32   ;
33
34 </%once>
35 <%init>
36
37 my %opt = @_;
38
39 my $onchange = $opt{'onchange'}
40                  ? 'onChange="'. $opt{'onchange'}. '(this)"'
41                  : '';
42
43 my $style = $opt{'cell_style'} ? 'STYLE="'. $opt{'cell_style'}. '"' : '';
44
45 my $curr_value = $opt{'curr_value'} || $opt{'value'};
46 my $units = 'm';
47
48 if ( $curr_value =~ /^(\d*)([mwdh])$/i ) {
49   $curr_value = $1;
50   $units = lc($2);
51 }
52
53 </%init>
54