summaryrefslogtreecommitdiff
path: root/httemplate/elements/tower_sector.html
diff options
context:
space:
mode:
authorivan <ivan>2011-12-10 00:36:47 +0000
committerivan <ivan>2011-12-10 00:36:47 +0000
commite6f7e02b32ebaa471230819d36a88f88b98bed6a (patch)
tree7af39d4c474621a698d1b2b71efb9c630aedefab /httemplate/elements/tower_sector.html
parent980f3fdaab3a99451b83367860427a3226ab9f98 (diff)
tower tracking, RT#15538
Diffstat (limited to 'httemplate/elements/tower_sector.html')
-rw-r--r--httemplate/elements/tower_sector.html60
1 files changed, 60 insertions, 0 deletions
diff --git a/httemplate/elements/tower_sector.html b/httemplate/elements/tower_sector.html
new file mode 100644
index 0000000..a8bbbc5
--- /dev/null
+++ b/httemplate/elements/tower_sector.html
@@ -0,0 +1,60 @@
+% 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',
+;
+
+my @fields = keys %label;
+
+</%init>