From c323224dac91388e4d9fc237e7c725b2119dc395 Mon Sep 17 00:00:00 2001 From: Phil Davis Date: Sat, 9 Jul 2016 17:02:33 +0930 Subject: 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) --- src/usr/local/www/services_dhcp.php | 148 +++++++++++++++++++++++------------- 1 file changed, 97 insertions(+), 51 deletions(-) (limited to 'src/usr') 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) { + + showadvnwkboot = ; + } 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 = ""; + } else { + text = ""; + } + $('#btnadvnwkboot').html(' ' + 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(); -- cgit v1.1