Project

General

Profile

« Previous | Next » 

Revision c323224d

Added by Phil Davis about 9 years ago

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)

View differences:

src/usr/local/www/services_dhcp.php
1145 1145
	$pconfig['ldap']
1146 1146
))->setHelp('Leave blank to disable. Enter a full URI for the LDAP server in the form ldap://ldap.example.com/dc=example,dc=com ');
1147 1147

  
1148
// Advanced Network Booting options
1149
$btnadv = new Form_Button(
1150
	'btnadvnwkboot',
1151
	'Display Advanced',
1152
	null,
1153
	'fa-cog'
1154
);
1155

  
1156
$btnadv->setAttribute('type','button')->addClass('btn-info btn-sm');
1157

  
1158
$section->addInput(new Form_StaticText(
1159
	'Network Booting',
1160
	$btnadv
1161
));
1162

  
1163
$section->addInput(new Form_Checkbox(
1164
	'netboot',
1165
	'Enable',
1166
	'Enables network booting',
1167
	$pconfig['netboot']
1168
));
1169

  
1170
$section->addInput(new Form_IpAddress(
1171
	'nextserver',
1172
	'Next Server',
1173
	$pconfig['nextserver']
1174
))->setHelp('Enter the IP address of the next server');
1175

  
1176
$section->addInput(new Form_Input(
1177
	'filename',
1178
	'Default BIOS file name',
1179
	'text',
1180
	$pconfig['filename']
1181
));
1182

  
1183
$section->addInput(new Form_Input(
1184
	'filename32',
1185
	'UEFI 32 bit file name',
1186
	'text',
1187
	$pconfig['filename32']
1188
));
1189

  
1190
$section->addInput(new Form_Input(
1191
	'filename64',
1192
	'UEFI 64 bit file name',
1193
	'text',
1194
	$pconfig['filename64']
1195
))->setHelp('Both a filename and a boot server must be configured for this to work! ' .
1196
			'All three filenames and a configured boot server are necessary for UEFI to work! ');
1197

  
1198
$section->addInput(new Form_Input(
1199
	'rootpath',
1200
	'Root path',
1201
	'text',
1202
	$pconfig['rootpath']
1203
))->setHelp('string-format: iscsi:(servername):(protocol):(port):(LUN):targetname ');
1204

  
1148 1205
// Advanced Additional options
1149 1206
$btnadv = new Form_Button(
1150 1207
	'btnadvopts',
......
1237 1294

  
1238 1295
$form->add($section);
1239 1296

  
1240
if ($pconfig['netboot']) {
1241
	$sectate = COLLAPSIBLE|SEC_OPEN;
1242
} else {
1243
	$sectate = COLLAPSIBLE|SEC_CLOSED;
1244
}
1245
$section = new Form_Section("Network Booting", nwkbootsec, $sectate);
1246

  
1247
$section->addInput(new Form_Checkbox(
1248
	'netboot',
1249
	'Enable',
1250
	'Enables network booting',
1251
	$pconfig['netboot']
1252
));
1253

  
1254
$section->addInput(new Form_IpAddress(
1255
	'nextserver',
1256
	'Next Server',
1257
	$pconfig['nextserver']
1258
))->setHelp('Enter the IP address of the next server');
1259

  
1260
$section->addInput(new Form_Input(
1261
	'filename',
1262
	'Default BIOS file name',
1263
	'text',
1264
	$pconfig['filename']
1265
));
1266

  
1267
$section->addInput(new Form_Input(
1268
	'filename32',
1269
	'UEFI 32 bit file name',
1270
	'text',
1271
	$pconfig['filename32']
1272
));
1273

  
1274
$section->addInput(new Form_Input(
1275
	'filename64',
1276
	'UEFI 64 bit file name',
1277
	'text',
1278
	$pconfig['filename64']
1279
))->setHelp('Both a filename and a boot server must be configured for this to work! ' .
1280
			'All three filenames and a configured boot server are necessary for UEFI to work! ');
1281

  
1282
$section->addInput(new Form_Input(
1283
	'rootpath',
1284
	'Root path',
1285
	'text',
1286
	$pconfig['rootpath']
1287
))->setHelp('string-format: iscsi:(servername):(protocol):(port):(LUN):targetname ');
1288

  
1289
$form->add($section);
1290

  
1291 1297
if ($act == "newpool") {
1292 1298
	$form->addGlobal(new Form_Input(
1293 1299
		'act',
......
1603 1609
		show_advopts();
1604 1610
	});
1605 1611

  
1612
	// Show advanced Network Booting options ===========================================================================
1613
	var showadvnwkboot = false;
1614

  
1615
	function show_advnwkboot(ispageload) {
1616
		var text;
1617
		// On page load decide the initial state based on the data.
1618
		if (ispageload) {
1619
<?php
1620
			if (empty($pconfig['netboot'])) {
1621
				$showadv = false;
1622
			} else {
1623
				$showadv = true;
1624
			}
1625
?>
1626
			showadvnwkboot = <?php if ($showadv) {echo 'true';} else {echo 'false';} ?>;
1627
		} else {
1628
			// It was a click, swap the state.
1629
			showadvnwkboot = !showadvnwkboot;
1630
		}
1631

  
1632
		hideCheckbox('netboot', !showadvnwkboot);
1633
		hideInput('nextserver', !showadvnwkboot);
1634
		hideInput('filename', !showadvnwkboot);
1635
		hideInput('filename32', !showadvnwkboot);
1636
		hideInput('filename64', !showadvnwkboot);
1637
		hideInput('rootpath', !showadvnwkboot);
1638

  
1639
		if (showadvnwkboot) {
1640
			text = "<?=gettext('Hide Advanced');?>";
1641
		} else {
1642
			text = "<?=gettext('Display Advanced');?>";
1643
		}
1644
		$('#btnadvnwkboot').html('<i class="fa fa-cog"></i> ' + text);
1645
	}
1646

  
1647
	$('#btnadvnwkboot').click(function(event) {
1648
		show_advnwkboot();
1649
	});
1650

  
1606 1651
	// ---------- On initial page load ------------------------------------------------------------
1607 1652

  
1608 1653
	show_advdns(true);
......
1611 1656
	show_advtftp(true);
1612 1657
	show_advldap(true);
1613 1658
	show_advopts(true);
1659
	show_advnwkboot(true);
1614 1660

  
1615 1661
	// Suppress "Delete row" button if there are fewer than two rows
1616 1662
	checkLastRow();

Also available in: Unified diff