summaryrefslogtreecommitdiff
path: root/httemplate/elements/tower_sector.html
blob: cdcf67d7bbc96995a3ae6137ff7af9dc644a2bf8 (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
% unless ( $opt{'js_only'} ) {

  <INPUT TYPE="hidden" NAME="<%$name%>" ID="<%$id%>" VALUE="<% $curr_value %>">

  <TABLE>
    <TR>
%     foreach my $field ( @fields ) {

        <TD>
          <INPUT TYPE  = "text"
                 NAME  = "<%$name%>_<%$field%>"
                 ID    = "<%$id%>_<%$field%>"
                 SIZE  = "<% $size{$field} || 15 %>"
                 VALUE = "<% scalar($cgi->param($name."_$field"))
                             || $tower_sector->get($field) |h %>"
                 <% $onchange %>
          ><BR>
          <FONT SIZE="-1"><% $label{$field} %></FONT>
        </TD>
%     }
    </TR>
  </TABLE>


% }
<%init>

my( %opt ) = @_;

my $name = $opt{'element_name'} || $opt{'field'} || 'sectornum';
my $id = $opt{'id'} || 'sectornum';

my $curr_value = $opt{'curr_value'} || $opt{'value'};

my $onchange = '';
if ( $opt{'onchange'} ) {
  $onchange = $opt{'onchange'};
  $onchange .= '(this)' unless $onchange =~ /\(\w*\);?$/;
  $onchange =~ s/\(what\);/\(this\);/g; #ugh, terrible hack.  all onchange
                                        #callbacks should act the same
  $onchange = 'onChange="'. $onchange. '"';
}

my $tower_sector;
if ( $curr_value ) {
  $tower_sector = qsearchs('tower_sector', { 'sectornum' => $curr_value } );
} else {
  $tower_sector = new FS::tower_sector {};
}

my %size = ( 'title' => 12 );

tie my %label, 'Tie::IxHash',
  'sectorname'   => 'Name',
  'ip_addr'      => 'IP Address',
  'height'       => 'Height (feet)',
  'freq_mhz'     => 'Freq. (MHz)',
  'direction'    => 'Direction (&deg; from north)', # or a button to set these to 0 for omni
  'downtilt'     => 'Downtilt (&deg; below horizontal)',
  'width'        => 'Horiz. width (&deg; 0 - 360)',
  'v_width'      => 'Vert. width (&deg; 0 - 360)',
  'sector_range' => 'Range (miles)',
  'margin'       => 'Signal margin (dB)',
  'up_rate_limit' => 'Up rate limit (kbps)',
  'down_rate_limit' => 'Down rate limit (kbps)',
;

my @fields = keys %label;

</%init>