diff options
author | Phil Davis <phil.davis@inf.org> | 2016-07-09 17:02:33 +0930 |
---|---|---|
committer | Renato Botelho <renato@netgate.com> | 2016-07-13 19:01:46 -0300 |
commit | c323224dac91388e4d9fc237e7c725b2119dc395 (patch) | |
tree | 3934cbf480fa20b754ab59ff4fe974a2f465f4c7 | |
parent | c34b069e954cafca9caa6cbb4c367c17080a0d0a (diff) | |
download | pfsense-c323224dac91388e4d9fc237e7c725b2119dc395.zip pfsense-c323224dac91388e4d9fc237e7c725b2119dc395.tar.gz |
Fix #6050 DHCP - provide Network Booting display/hide advanced button
This one moves the "Network Booting" above the "Additional BOOTP/DHCP Options". That allows "Network Booting" to be a Display/Hide Advanced group of buttons just like TFTP, LDAP etc. (without a special section header) and for "Additional BOOTP/DHCP Options" to come last on the page.
(cherry picked from commit 68de2169b9d5cd2878d43344a0fc0a25bd86d7af)
-rw-r--r-- | src/usr/local/www/services_dhcp.php | 148 |
1 files changed, 97 insertions, 51 deletions
diff --git a/src/usr/local/www/services_dhcp.php b/src/usr/local/www/services_dhcp.php index 6bff118..4e20f1e 100644 --- a/src/usr/local/www/services_dhcp.php +++ b/src/usr/local/www/services_dhcp.php @@ -1145,6 +1145,63 @@ $section->addInput(new Form_Input( $pconfig['ldap'] ))->setHelp('Leave blank to disable. Enter a full URI for the LDAP server in the form ldap://ldap.example.com/dc=example,dc=com '); +// Advanced Network Booting options +$btnadv = new Form_Button( + 'btnadvnwkboot', + 'Display Advanced', + null, + 'fa-cog' +); + +$btnadv->setAttribute('type','button')->addClass('btn-info btn-sm'); + +$section->addInput(new Form_StaticText( + 'Network Booting', + $btnadv +)); + +$section->addInput(new Form_Checkbox( + 'netboot', + 'Enable', + 'Enables network booting', + $pconfig['netboot'] +)); + +$section->addInput(new Form_IpAddress( + 'nextserver', + 'Next Server', + $pconfig['nextserver'] +))->setHelp('Enter the IP address of the next server'); + +$section->addInput(new Form_Input( + 'filename', + 'Default BIOS file name', + 'text', + $pconfig['filename'] +)); + +$section->addInput(new Form_Input( + 'filename32', + 'UEFI 32 bit file name', + 'text', + $pconfig['filename32'] +)); + +$section->addInput(new Form_Input( + 'filename64', + 'UEFI 64 bit file name', + 'text', + $pconfig['filename64'] +))->setHelp('Both a filename and a boot server must be configured for this to work! ' . + 'All three filenames and a configured boot server are necessary for UEFI to work! '); + +$section->addInput(new Form_Input( + 'rootpath', + 'Root path', + 'text', + $pconfig['rootpath'] +))->setHelp('string-format: iscsi:(servername):(protocol):(port):(LUN):targetname '); + // Advanced Additional options $btnadv = new Form_Button( 'btnadvopts', @@ -1237,57 +1294,6 @@ $section->addInput(new Form_Button( $form->add($section); -if ($pconfig['netboot']) { - $sectate = COLLAPSIBLE|SEC_OPEN; -} else { - $sectate = COLLAPSIBLE|SEC_CLOSED; -} -$section = new Form_Section("Network Booting", nwkbootsec, $sectate); - -$section->addInput(new Form_Checkbox( - 'netboot', - 'Enable', - 'Enables network booting', - $pconfig['netboot'] -)); - -$section->addInput(new Form_IpAddress( - 'nextserver', - 'Next Server', - $pconfig['nextserver'] -))->setHelp('Enter the IP address of the next server'); - -$section->addInput(new Form_Input( - 'filename', - 'Default BIOS file name', - 'text', - $pconfig['filename'] -)); - -$section->addInput(new Form_Input( - 'filename32', - 'UEFI 32 bit file name', - 'text', - $pconfig['filename32'] -)); - -$section->addInput(new Form_Input( - 'filename64', - 'UEFI 64 bit file name', - 'text', - $pconfig['filename64'] -))->setHelp('Both a filename and a boot server must be configured for this to work! ' . - 'All three filenames and a configured boot server are necessary for UEFI to work! '); - -$section->addInput(new Form_Input( - 'rootpath', - 'Root path', - 'text', - $pconfig['rootpath'] -))->setHelp('string-format: iscsi:(servername):(protocol):(port):(LUN):targetname '); - -$form->add($section); - if ($act == "newpool") { $form->addGlobal(new Form_Input( 'act', @@ -1603,6 +1609,45 @@ events.push(function() { show_advopts(); }); + // Show advanced Network Booting options =========================================================================== + var showadvnwkboot = false; + + function show_advnwkboot(ispageload) { + var text; + // On page load decide the initial state based on the data. + if (ispageload) { +<?php + if (empty($pconfig['netboot'])) { + $showadv = false; + } else { + $showadv = true; + } +?> + showadvnwkboot = <?php if ($showadv) {echo 'true';} else {echo 'false';} ?>; + } else { + // It was a click, swap the state. + showadvnwkboot = !showadvnwkboot; + } + + hideCheckbox('netboot', !showadvnwkboot); + hideInput('nextserver', !showadvnwkboot); + hideInput('filename', !showadvnwkboot); + hideInput('filename32', !showadvnwkboot); + hideInput('filename64', !showadvnwkboot); + hideInput('rootpath', !showadvnwkboot); + + if (showadvnwkboot) { + text = "<?=gettext('Hide Advanced');?>"; + } else { + text = "<?=gettext('Display Advanced');?>"; + } + $('#btnadvnwkboot').html('<i class="fa fa-cog"></i> ' + text); + } + + $('#btnadvnwkboot').click(function(event) { + show_advnwkboot(); + }); + // ---------- On initial page load ------------------------------------------------------------ show_advdns(true); @@ -1611,6 +1656,7 @@ events.push(function() { show_advtftp(true); show_advldap(true); show_advopts(true); + show_advnwkboot(true); // Suppress "Delete row" button if there are fewer than two rows checkLastRow(); |