diff options
Diffstat (limited to 'src/usr/local/www/firewall_aliases_edit.php')
-rwxr-xr-x | src/usr/local/www/firewall_aliases_edit.php | 34 |
1 files changed, 28 insertions, 6 deletions
diff --git a/src/usr/local/www/firewall_aliases_edit.php b/src/usr/local/www/firewall_aliases_edit.php index 8e2ccee..0b68583 100755 --- a/src/usr/local/www/firewall_aliases_edit.php +++ b/src/usr/local/www/firewall_aliases_edit.php @@ -565,6 +565,16 @@ $section_str = array( 'urltable_ports' => gettext("URL Table (Ports)") ); +$btn_str = array( + 'network' => gettext("Add Network"), + 'host' => gettext("Add Host"), + 'port' => gettext("Add Port"), + 'url' => gettext("Add URL"), + 'url_ports' => gettext("Add URL"), + 'urltable' => gettext("Add URL Table"), + 'urltable_ports' => gettext("Add URL Table") + ); + $label_str = array( 'network' => gettext("Network or FQDN"), 'host' => gettext("IP or FQDN"), @@ -700,16 +710,16 @@ while ($counter < count($addresses)) { $group->add(new Form_IpAddress( 'address' . $counter, - null, + 'Address', $address ))->addMask('address_subnet' . $counter, $address_subnet)->setWidth(4)->setPattern('[0-9, a-z, A-Z and .'); $group->add(new Form_Input( 'detail' . $counter, - null, + 'Description', 'text', $details[$counter] - ))->setHelp('Description')->setWidth(4); + ))->setWidth(4); $group->add(new Form_Button( 'deleterow' . $counter, @@ -722,8 +732,8 @@ while ($counter < count($addresses)) { $form->addGlobal(new Form_Button( 'addrow', - 'Add host' -))->removeClass('btn-primary')->addClass('btn-success'); + $btn_str[$tab] +))->removeClass('btn-primary')->addClass('btn-success addbtn'); $form->add($section); @@ -733,7 +743,7 @@ print $form; <script> //<![CDATA[ events.push(function(){ - + function typechange() { var tab = $('#type').find('option:selected').val(); $("[id^='address_subnet']").prop("disabled", (tab == 'host') || (tab == 'port') || (tab == 'url') || (tab == 'url_ports')); @@ -746,9 +756,21 @@ events.push(function(){ var sectionstr = <?php echo json_encode($section_str); ?>; $('.panel-title:last').text(sectionstr[tab]); + var buttonstr = <?php echo json_encode($btn_str); ?>; + $('.btn-success').prop('value', buttonstr[tab]); + // Set the input field label by tab var labelstr = <?php echo json_encode($label_str); ?>; $('.repeatable:first').find('label').text(labelstr[tab]); + + // The add button and delete buttons must not show on URL Table IP or URL table ports + if((tab == 'urltable') || (tab == 'urltable_ports')) { + hideClass('addbtn', true); + $('[id^=deleterow]').hide(); + } else { + hideClass('addbtn', false); + $('[id^=deleterow]').show(); + } } // On load . . |