diff options
Diffstat (limited to 'httemplate/elements')
-rw-r--r-- | httemplate/elements/select-tower_sector.html | 43 | ||||
-rw-r--r-- | httemplate/elements/tr-selectmultiple-part_pkg.html | 9 |
2 files changed, 48 insertions, 4 deletions
diff --git a/httemplate/elements/select-tower_sector.html b/httemplate/elements/select-tower_sector.html index a64d886..1973ef9 100644 --- a/httemplate/elements/select-tower_sector.html +++ b/httemplate/elements/select-tower_sector.html @@ -1,3 +1,4 @@ +% if ( ! $opt{'multiple'} ) { <& /elements/select-table.html, table => 'tower_sector', name_col => 'description', @@ -5,3 +6,45 @@ empty_label => ' ', @_ &> +% } +% else { # currently only multiple sectors, not towers +<& /elements/select-table.html, + table => 'tower', + name_col => 'towername', + id => 'towernum', + field => 'dummy_towernum' + onchange => 'change_towernum(this.value);', + element_etc => 'STYLE="vertical-align:top"', +&> +<SELECT NAME="sectornum" ID="sectornum" MULTIPLE SIZE="6"></SELECT> +<SCRIPT TYPE="text/javascript"> +var sectors_of = <% encode_json(\%sectors_of) %>; +var select_sectornum = document.getElementById('sectornum'); +function change_towernum(towernum) { + select_sectornum.options.length = 0; + for (var sectornum in sectors_of[towernum]) { + var o = document.createElement('OPTION'); + o.value = sectornum; + o.text = sectors_of[towernum][sectornum]; + o.selected = true; + select_sectornum.add(o, null); + } + return; +} +change_towernum(''); +% } +</SCRIPT> +<BR> +<INPUT TYPE="checkbox" VALUE="none" NAME="sectornum" CHECKED> No sector +<%init> +my %opt = @_; + +my %sectors_of; +if ( $opt{'multiple'} ) { + foreach my $sector ( qsearch('tower_sector',{}) ) { + $sectors_of{$sector->towernum} ||= {}; + $sectors_of{$sector->towernum}->{$sector->sectornum} = $sector->sectorname; + $sectors_of{''}->{$sector->sectornum} = $sector->description; + } +} +</%init> diff --git a/httemplate/elements/tr-selectmultiple-part_pkg.html b/httemplate/elements/tr-selectmultiple-part_pkg.html index d959a5b..0b83da0 100644 --- a/httemplate/elements/tr-selectmultiple-part_pkg.html +++ b/httemplate/elements/tr-selectmultiple-part_pkg.html @@ -1,6 +1,5 @@ -<TR> - <TD ALIGN="right"><% $opt{'label'} || 'Packages' %></TD> - <TD> +<& tr-td-label.html, label => emt('Packages'), %opt &> + <TD <% $style %>> <% include( '/elements/select-table.html', 'table' => 'part_pkg', 'name_col' => 'pkg', @@ -8,12 +7,14 @@ 'element_etc' => 'multiple', %opt, ) - %> + %> </TD> </TR> <%init> my %opt = @_; +my $style = $opt{'cell_style'}; +$style = 'STYLE="'.$style.'"' if $style; </%init> |