summaryrefslogtreecommitdiff
path: root/httemplate/elements/tr-select-avail-time-from_to.html
blob: b867388f85b2c90fa633a8b29bec3c9a551f2062 (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
% unless ( $opt{'js_only'} ) {

    <& tr-td-label.html, %opt &>

      <TD <% $colspan %> <% $style %>>
% }
    <& checkbox.html,
         %opt,
         prefix     => '',
         value      => 'Y',
         curr_value => $curr_value,
         onchange   => $opt{field}. '_changed',
    &>

    <& select-time-from_to.html,
         %opt,
         disabled => ($curr_value eq 'Y' ? '' : 'DISABLED' )
    &>

% unless ( $opt{'js_only'} ) {
      </TD>
    </TR>
% }
% unless ( $opt{'html_only'} || $opt{'js_only'} ) {
    <SCRIPT TYPE="text/javascript">
% }
% unless ( $opt{'html_only'} ) {
      function <% $opt{field} %>_changed(what) {

        <% $opt{'onchange'} %>

        var stime_el = what.form.<% $opt{field} %>_stime;
        var etime_el = what.form.<% $opt{field} %>_etime;

        if ( what.checked ) {
          stime_el.disabled = false;
          etime_el.disabled = false;
        } else {
          stime_el.disabled = true;
          etime_el.disabled = true;
        }

      }  
% }
% unless ( $opt{'html_only'} || $opt{'js_only'} ) {
    </SCRIPT>
% }
<%init>

my %opt = @_;

my $style = $opt{'cell_style'} ? 'STYLE="'. $opt{'cell_style'}. '"' : '';

my $colspan = $opt{'colspan'} ? 'COLSPAN="'.$opt{'colspan'}.'"' : '';

my $curr_value = $cgi->param($opt{'field'}); #wtf?

</%init>