Project

General

Profile

« Previous | Next » 

Revision 3666d731

Added by Phil Davis about 8 years ago

Add user option to sort interface names RELENG_2_3

Signed-off-by: Phil Davis <>

View differences:

src/etc/inc/auth.inc
1542 1542
	$settings['webgui']['dashboardcolumns'] = $config['system']['webgui']['dashboardcolumns'];
1543 1543
	$settings['webgui']['webguihostnamemenu'] = $config['system']['webgui']['webguihostnamemenu'];
1544 1544
	$settings['webgui']['webguicss'] = $config['system']['webgui']['webguicss'];
1545
	$settings['webgui']['interfacessort'] = isset($config['system']['webgui']['interfacessort']);
1545 1546
	$settings['webgui']['dashboardavailablewidgetspanel'] = isset($config['system']['webgui']['dashboardavailablewidgetspanel']);
1546 1547
	$settings['webgui']['webguifixedmenu'] = isset($config['system']['webgui']['webguifixedmenu']);
1547 1548
	$settings['webgui']['webguileftcolumnhyper'] = isset($config['system']['webgui']['webguileftcolumnhyper']);
......
1565 1566
		if (isset($user['webguihostnamemenu'])) {
1566 1567
			$settings['webgui']['webguihostnamemenu'] = $user['webguihostnamemenu'];
1567 1568
		}
1569
		$settings['webgui']['interfacessort'] = isset($user['interfacessort']);
1568 1570
		$settings['webgui']['dashboardavailablewidgetspanel'] = isset($user['dashboardavailablewidgetspanel']);
1569 1571
		$settings['webgui']['webguifixedmenu'] = isset($user['webguifixedmenu']);
1570 1572
		$settings['webgui']['webguileftcolumnhyper'] = isset($user['webguileftcolumnhyper']);
src/etc/inc/pfsense-utils.inc
287 287
	));
288 288
}
289 289

  
290
/****f* pfsense-utils/gen_interfacessort_field
291
 * NAME
292
 *   gen_interfacessort_field
293
 * INPUTS
294
 *   Pointer to section object
295
 *   Initial value for the field
296
 * RESULT
297
 *   no return value, section object is updated
298
 ******/
299
function gen_interfacessort_field(&$section, $value) {
300

  
301
	$section->addInput(new Form_Checkbox(
302
		'interfacessort',
303
		'Interfaces Sort',
304
		'Sort Alphabetically',
305
		$value
306
	))->setHelp('If selected, lists of interfaces will be sorted by description, otherwise they are listed wan,lan,optn...');
307
}
308

  
290 309
/****f* pfsense-utils/gen_associatedpanels_fields
291 310
 * NAME
292 311
 *   gen_associatedpanels_fields
......
388 407
	gen_webguifixedmenu_field($section, $pconfig['webguifixedmenu']);
389 408
	gen_webguihostnamemenu_field($section, $pconfig['webguihostnamemenu']);
390 409
	gen_dashboardcolumns_field($section, $pconfig['dashboardcolumns']);
410
	gen_interfacessort_field($section, $pconfig['interfacessort']);
391 411
	gen_associatedpanels_fields(
392 412
		$section,
393 413
		$pconfig['dashboardavailablewidgetspanel'],
src/etc/inc/util.inc
1446 1446

  
1447 1447
/* return the configured interfaces list with their description. */
1448 1448
function get_configured_interface_with_descr($only_opt = false, $withdisabled = false) {
1449
	global $config;
1449
	global $config, $user_settings;
1450 1450

  
1451 1451
	$iflist = array();
1452 1452

  
......
1464 1464
		}
1465 1465
	}
1466 1466

  
1467
	if ($user_settings['webgui']['interfacessort']) {
1468
		asort($iflist);
1469
	}
1470

  
1467 1471
	return $iflist;
1468 1472
}
1469 1473

  
src/usr/local/www/head.inc
263 263
$system_menu = msort(array_merge($system_menu, return_ext_menu("System")), 0);
264 264

  
265 265
// Interfaces
266
// NOTE:
267
// Special items at the top should not be sorted. Only the variable list of interfaces may be sorted.
266 268
$interfaces_menu = array();
269
$interfaces_top = array();
270
$interfaces_bottom = array();
271

  
267 272
if (!isset($config['system']['webgui']['noassigninterfaces'])) {
268
	$interfaces_menu[] = array(gettext("(assign)"), "/interfaces_assign.php");
273
	$interfaces_top[] = array(gettext("(assign)"), "/interfaces_assign.php");
269 274
}
275

  
270 276
$opts = get_configured_interface_with_descr(false, true);
277

  
271 278
foreach ($opts as $oif => $odescr) {
272 279
	if (!isset($config['interfaces'][$oif]['ovpn'])) {
273
		$interfaces_menu[] = array(htmlspecialchars($odescr), "/interfaces.php?if={$oif}");
280
		$interfaces_bottom[] = array(htmlspecialchars($odescr), "/interfaces.php?if={$oif}");
274 281
	}
275 282
}
276
$interfaces_menu = msort(array_merge($interfaces_menu, return_ext_menu("Interfaces")), 0);
283

  
284
$interfaces_bottom = array_merge($interfaces_bottom, return_ext_menu("Interfaces"));
285

  
286
if ($user_settings['webgui']['interfacessort']) {
287
	$interfaces_bottom = msort($interfaces_bottom, 0);
288
}
289

  
290
// Combine the top bottom section of this menu
291
$interfaces_menu = array_merge($interfaces_top, $interfaces_bottom);
277 292

  
278 293
// Firewall
279 294
$firewall_menu = array();
src/usr/local/www/system.php
99 99
$pconfig['webguicss'] = $config['system']['webgui']['webguicss'];
100 100
$pconfig['webguifixedmenu'] = $config['system']['webgui']['webguifixedmenu'];
101 101
$pconfig['dashboardcolumns'] = $config['system']['webgui']['dashboardcolumns'];
102
$pconfig['interfacessort'] = isset($config['system']['webgui']['interfacessort']);
102 103
$pconfig['webguileftcolumnhyper'] = isset($config['system']['webgui']['webguileftcolumnhyper']);
103 104
$pconfig['dashboardavailablewidgetspanel'] = isset($config['system']['webgui']['dashboardavailablewidgetspanel']);
104 105
$pconfig['systemlogsfilterpanel'] = isset($config['system']['webgui']['systemlogsfilterpanel']);
......
308 309
			set_language();
309 310
		}
310 311

  
312
		unset($config['system']['webgui']['interfacessort']);
313
		$config['system']['webgui']['interfacessort'] = $_POST['interfacessort'] ? true : false;
314

  
311 315
		unset($config['system']['webgui']['webguileftcolumnhyper']);
312 316
		$config['system']['webgui']['webguileftcolumnhyper'] = $_POST['webguileftcolumnhyper'] ? true : false;
313 317

  
......
610 614
gen_webguifixedmenu_field($section, $pconfig['webguifixedmenu']);
611 615
gen_webguihostnamemenu_field($section, $pconfig['webguihostnamemenu']);
612 616
gen_dashboardcolumns_field($section, $pconfig['dashboardcolumns']);
617
gen_interfacessort_field($section, $pconfig['interfacessort']);
613 618
gen_associatedpanels_fields(
614 619
	$section,
615 620
	$pconfig['dashboardavailablewidgetspanel'],
src/usr/local/www/system_user_settings.php
74 74
	$pconfig['webguifixedmenu'] = $a_user[$id]['webguifixedmenu'];
75 75
	$pconfig['webguihostnamemenu'] = $a_user[$id]['webguihostnamemenu'];
76 76
	$pconfig['dashboardcolumns'] = $a_user[$id]['dashboardcolumns'];
77
	$pconfig['interfacessort'] = isset($a_user[$id]['interfacessort']);
77 78
	$pconfig['dashboardavailablewidgetspanel'] = isset($a_user[$id]['dashboardavailablewidgetspanel']);
78 79
	$pconfig['systemlogsfilterpanel'] = isset($a_user[$id]['systemlogsfilterpanel']);
79 80
	$pconfig['systemlogsmanagelogpanel'] = isset($a_user[$id]['systemlogsmanagelogpanel']);
......
115 116

  
116 117
		$pconfig['dashboardcolumns'] = $userent['dashboardcolumns'] = $_POST['dashboardcolumns'];
117 118

  
119
		if ($_POST['interfacessort']) {
120
			$pconfig['interfacessort'] = $userent['interfacessort'] = true;
121
		} else {
122
			$pconfig['interfacessort'] = false;
123
			unset($userent['interfacessort']);
124
		}
125

  
118 126
		if ($_POST['dashboardavailablewidgetspanel']) {
119 127
			$pconfig['dashboardavailablewidgetspanel'] = $userent['dashboardavailablewidgetspanel'] = true;
120 128
		} else {
src/usr/local/www/system_usermanager.php
98 98
	$pconfig['webguifixedmenu'] = $a_user[$id]['webguifixedmenu'];
99 99
	$pconfig['webguihostnamemenu'] = $a_user[$id]['webguihostnamemenu'];
100 100
	$pconfig['dashboardcolumns'] = $a_user[$id]['dashboardcolumns'];
101
	$pconfig['interfacessort'] = isset($a_user[$id]['interfacessort']);
101 102
	$pconfig['dashboardavailablewidgetspanel'] = isset($a_user[$id]['dashboardavailablewidgetspanel']);
102 103
	$pconfig['systemlogsfilterpanel'] = isset($a_user[$id]['systemlogsfilterpanel']);
103 104
	$pconfig['systemlogsmanagelogpanel'] = isset($a_user[$id]['systemlogsmanagelogpanel']);
......
368 369
			unset($userent['webguihostnamemenu']);
369 370
		}
370 371

  
372
		if ($_POST['interfacessort']) {
373
			$userent['interfacessort'] = true;
374
		} else {
375
			unset($userent['interfacessort']);
376
		}
377

  
371 378
		if ($_POST['dashboardavailablewidgetspanel']) {
372 379
			$userent['dashboardavailablewidgetspanel'] = true;
373 380
		} else {
......
984 991
		hideInput('webguifixedmenu', !adv);
985 992
		hideInput('webguihostnamemenu', !adv);
986 993
		hideInput('dashboardcolumns', !adv);
994
		hideCheckbox('interfacessort', !adv);
987 995
		hideCheckbox('dashboardavailablewidgetspanel', !adv);
988 996
		hideCheckbox('systemlogsfilterpanel', !adv);
989 997
		hideCheckbox('systemlogsmanagelogpanel', !adv);

Also available in: Unified diff