Commit 0b558af2 authored by Franco Fichtner's avatar Franco Fichtner

system: shuffle more features and bring back ETC zones

PR: https://forum.opnsense.org/index.php?topic=3004
(cherry picked from commit d8f5a12d)
parent 11b19fab
......@@ -278,7 +278,16 @@ function get_firmware_flavours()
function get_zoneinfo()
{
return timezone_identifiers_list(DateTimeZone::ALL ^ DateTimeZone::UTC);
$zones = timezone_identifiers_list(DateTimeZone::ALL ^ DateTimeZone::UTC);
$etcs = glob('/usr/share/zoneinfo/Etc/*');
foreach ($etcs as $etc) {
$zones[] = ltrim($etc, '/usr/share/zoneinfo/');
}
natsort($zones);
return $zones;
}
function get_searchdomains()
......
......@@ -78,7 +78,6 @@ function thermal_modules()
if ($_SERVER['REQUEST_METHOD'] === 'GET') {
$pconfig = array();
$pconfig['gw_switch_default'] = isset($config['system']['gw_switch_default']);
$pconfig['powerd_enable'] = isset($config['system']['powerd_enable']);
$pconfig['crypto_hardware'] = !empty($config['system']['crypto_hardware']) ? $config['system']['crypto_hardware'] : null;
$pconfig['cryptodev_enable'] = isset($config['system']['cryptodev_enable']);
......@@ -109,12 +108,6 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
}
if (count($input_errors) == 0) {
if (!empty($pconfig['gw_switch_default'])) {
$config['system']['gw_switch_default'] = true;
} elseif (isset($config['system']['gw_switch_default'])) {
unset($config['system']['gw_switch_default']);
}
if (!empty($pconfig['powerd_enable'])) {
$config['system']['powerd_enable'] = true;
} elseif (isset($config['system']['powerd_enable'])) {
......@@ -203,87 +196,12 @@ include("head.inc");
<form method="post" name="iform" id="iform">
<table class="table table-striped">
<tr>
<td width="22%"><strong><?= gettext('Load Balancing') ?></strong></td>
<td width="22%"><strong><?= gettext('Cryptographic Hardware Acceleration') ?></strong></td>
<td width="78%" align="right">
<small><?=gettext("full help"); ?> </small>
<i class="fa fa-toggle-off text-danger" style="cursor: pointer;" id="show_all_help_page" type="button"></i>
</td>
</tr>
<tr>
<td><a id="help_for_gw_switch_default" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("Gateway switching");?> </td>
<td>
<input name="gw_switch_default" type="checkbox" id="gw_switch_default" value="yes" <?= !empty($pconfig['gw_switch_default']) ? "checked=\"checked\"" : "";?> />
<strong><?=gettext("Allow default gateway switching"); ?></strong><br />
<div class="hidden" for="help_for_gw_switch_default">
<?=gettext("If the link where the default gateway resides fails " .
"switch the default gateway to another available one."); ?>
</div>
</td>
</tr>
<tr>
<th colspan="2" valign="top" class="listtopic"><?=gettext("Power Savings"); ?></th>
</tr>
<tr>
<td><a id="help_for_powerd_enable" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("Use PowerD"); ?></td>
<td>
<input name="powerd_enable" type="checkbox" id="powerd_enable" value="yes" <?=!empty($pconfig['powerd_enable']) ? "checked=\"checked\"" : "";?> />
<div class="hidden" for="help_for_powerd_enable">
<?=gettext("The powerd utility monitors the system state and sets various power control " .
"options accordingly. It offers four modes (maximum, minimum, adaptive " .
"and hiadaptive) that can be individually selected while on AC power or batteries. " .
"The modes maximum, minimum, adaptive and hiadaptive may be abbreviated max, " .
"min, adp, hadp. Maximum mode chooses the highest performance values. Minimum " .
"mode selects the lowest performance values to get the most power savings. " .
"Adaptive mode attempts to strike a balance by degrading performance when " .
"the system appears idle and increasing it when the system is busy. It " .
"offers a good balance between a small performance loss for greatly " .
"increased power savings. Hiadaptive mode is alike adaptive mode, but " .
"tuned for systems where performance and interactivity are more important " .
"than power consumption. It raises frequency faster, drops slower and " .
"keeps twice lower CPU load."); ?>
</div>
</td>
</tr>
<tr>
<td><i class="fa fa-info-circle text-muted"></i> <?=gettext('On AC Power Mode') ?></td>
<td>
<select name="powerd_ac_mode" class="selectpicker" data-style="btn-default" data-width="auto">
<option value="hadp" <?=$pconfig['powerd_ac_mode']=="hadp" ? "selected=\"selected\"" : "";?>>
<?=gettext("Hiadaptive");?>
</option>
<option value="adp" <?=$pconfig['powerd_ac_mode']=="adp" ? "selected=\"selected\"" : "";?>>
<?=gettext("Adaptive");?>
</option>
<option value="min" <?=$pconfig['powerd_ac_mode']=="min" ? "selected=\"selected\"" : "";?>>
<?=gettext("Minimum");?>
</option>
<option value="max" <?=$pconfig['powerd_ac_mode']=="max" ? " selected=\"selected\"" : "";?>>
<?=gettext("Maximum");?>
</option>
</select>
</td>
<tr>
<td><i class="fa fa-info-circle text-muted"></i> <?=gettext('On Battery Power Mode') ?></td>
<td>
<select name="powerd_battery_mode" class="selectpicker" data-style="btn-default" data-width="auto">
<option value="hadp"<?=$pconfig['powerd_battery_mode']=="hadp" ? "selected=\"selected\"" : "";?>>
<?=gettext("Hiadaptive");?>
</option>
<option value="adp" <?=$pconfig['powerd_battery_mode']=="adp" ? "selected=\"selected\"" : "";?>>
<?=gettext("Adaptive");?>
</option>
<option value="min" <?=$pconfig['powerd_battery_mode']=="min" ? "selected=\"selected\"" :"";?>>
<?=gettext("Minimum");?>
</option>
<option value="max" <?=$pconfig['powerd_battery_mode']=="max" ? "selected=\"selected\"" : "";?>>
<?=gettext("Maximum");?>
</option>
</select>
</td>
</tr>
<tr>
<th colspan="2" valign="top" class="listtopic"><?=gettext("Cryptographic Hardware Acceleration"); ?></th>
</tr>
<tr>
<td><a id="help_for_crypto_hardware" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("Hardware");?></td>
<td>
......@@ -408,6 +326,67 @@ include("head.inc");
</div>
</td>
</tr>
<tr>
<th colspan="2" valign="top" class="listtopic"><?=gettext("Power Savings"); ?></th>
</tr>
<tr>
<td><a id="help_for_powerd_enable" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("Use PowerD"); ?></td>
<td>
<input name="powerd_enable" type="checkbox" id="powerd_enable" value="yes" <?=!empty($pconfig['powerd_enable']) ? "checked=\"checked\"" : "";?> />
<div class="hidden" for="help_for_powerd_enable">
<?=gettext("The powerd utility monitors the system state and sets various power control " .
"options accordingly. It offers four modes (maximum, minimum, adaptive " .
"and hiadaptive) that can be individually selected while on AC power or batteries. " .
"The modes maximum, minimum, adaptive and hiadaptive may be abbreviated max, " .
"min, adp, hadp. Maximum mode chooses the highest performance values. Minimum " .
"mode selects the lowest performance values to get the most power savings. " .
"Adaptive mode attempts to strike a balance by degrading performance when " .
"the system appears idle and increasing it when the system is busy. It " .
"offers a good balance between a small performance loss for greatly " .
"increased power savings. Hiadaptive mode is alike adaptive mode, but " .
"tuned for systems where performance and interactivity are more important " .
"than power consumption. It raises frequency faster, drops slower and " .
"keeps twice lower CPU load."); ?>
</div>
</td>
</tr>
<tr>
<td><i class="fa fa-info-circle text-muted"></i> <?=gettext('On AC Power Mode') ?></td>
<td>
<select name="powerd_ac_mode" class="selectpicker" data-style="btn-default" data-width="auto">
<option value="hadp" <?=$pconfig['powerd_ac_mode']=="hadp" ? "selected=\"selected\"" : "";?>>
<?=gettext("Hiadaptive");?>
</option>
<option value="adp" <?=$pconfig['powerd_ac_mode']=="adp" ? "selected=\"selected\"" : "";?>>
<?=gettext("Adaptive");?>
</option>
<option value="min" <?=$pconfig['powerd_ac_mode']=="min" ? "selected=\"selected\"" : "";?>>
<?=gettext("Minimum");?>
</option>
<option value="max" <?=$pconfig['powerd_ac_mode']=="max" ? " selected=\"selected\"" : "";?>>
<?=gettext("Maximum");?>
</option>
</select>
</td>
<tr>
<td><i class="fa fa-info-circle text-muted"></i> <?=gettext('On Battery Power Mode') ?></td>
<td>
<select name="powerd_battery_mode" class="selectpicker" data-style="btn-default" data-width="auto">
<option value="hadp"<?=$pconfig['powerd_battery_mode']=="hadp" ? "selected=\"selected\"" : "";?>>
<?=gettext("Hiadaptive");?>
</option>
<option value="adp" <?=$pconfig['powerd_battery_mode']=="adp" ? "selected=\"selected\"" : "";?>>
<?=gettext("Adaptive");?>
</option>
<option value="min" <?=$pconfig['powerd_battery_mode']=="min" ? "selected=\"selected\"" :"";?>>
<?=gettext("Minimum");?>
</option>
<option value="max" <?=$pconfig['powerd_battery_mode']=="max" ? "selected=\"selected\"" : "";?>>
<?=gettext("Maximum");?>
</option>
</select>
</td>
</tr>
<tr>
<th colspan="2" valign="top" class="listtopic"><?=gettext("RAM Disk Settings (Reboot to Apply Changes)"); ?></th>
</tr>
......
......@@ -52,6 +52,7 @@ function get_locale_list()
if ($_SERVER['REQUEST_METHOD'] === 'GET') {
$pconfig = array();
$pconfig['dns1gw'] = null;
$pconfig['dns2gw'] = null;
$pconfig['dns3gw'] = null;
......@@ -61,10 +62,11 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
$pconfig['timezone'] = "Etc/UTC";
$pconfig['mirror'] = 'default';
$pconfig['flavour'] = 'default';
$pconfig['prefer_ipv4'] = isset($config['system']['prefer_ipv4']);
$pconfig['gw_switch_default'] = isset($config['system']['gw_switch_default']);
$pconfig['hostname'] = $config['system']['hostname'];
$pconfig['domain'] = $config['system']['domain'];
if (isset($config['system']['dnsserver'])) {
list($pconfig['dns1'],$pconfig['dns2'],$pconfig['dns3'],$pconfig['dns4']) = $config['system']['dnsserver'];
} else {
......@@ -191,6 +193,12 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
unset($config['system']['prefer_ipv4']);
}
if (!empty($pconfig['gw_switch_default'])) {
$config['system']['gw_switch_default'] = true;
} elseif (isset($config['system']['gw_switch_default'])) {
unset($config['system']['gw_switch_default']);
}
$olddnsservers = $config['system']['dnsserver'];
$config['system']['dnsserver'] = array();
foreach (array('dns1', 'dns2', 'dns3', 'dns4') as $dnsopt) {
......@@ -333,6 +341,107 @@ include("head.inc");
</div>
</td>
</tr>
<tr>
<td><a id="help_for_timezone" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("Time zone"); ?></td>
<td>
<select name="timezone" id="timezone" data-size="10" class="selectpicker" data-style="btn-default" data-live-search="true">
<?php
foreach (get_zoneinfo() as $value): ?>
<option value="<?=htmlspecialchars($value);?>" <?= $value == $pconfig['timezone'] ? 'selected="selected"' : '' ?>>
<?=htmlspecialchars($value);?>
</option>
<?php
endforeach; ?>
</select>
<div class="hidden" for="help_for_timezone">
<?=gettext("Select the location closest to you"); ?>
</div>
</td>
</tr>
<tr>
<th colspan="2" valign="top" class="listtopic"><?=gettext("Firmware"); ?></th>
</tr>
<tr>
<td><a id="help_for_language" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("Language");?></td>
<td>
<select name="language" class="selectpicker" data-size="10" data-style="btn-default" data-width="auto">
<?php
foreach (get_locale_list() as $lcode => $ldesc):?>
<option value="<?=$lcode;?>" <?=$lcode == $pconfig['language'] ? "selected=\"selected\"" : "";?>>
<?=$ldesc;?>
</option>
<?php
endforeach;?>
</select>
<div class="hidden" for="help_for_language">
<strong>
<?=gettext("Choose a language for the webConfigurator"); ?>
</strong>
</div>
</td>
</tr>
<tr>
<td><a id="help_for_theme" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("Theme"); ?></td>
<td>
<select name="theme" class="selectpicker" data-size="10" data-width="auto">
<?php
$curtheme = get_current_theme();
foreach (return_dir_as_array('/usr/local/opnsense/www/themes/') as $file):?>
<option <?=$file == $curtheme ? "selected=\"selected\"" : "";?>>
<?=$file;?>
</option>
<?php
endforeach; ?>
</select>
<div class="hidden" for="help_for_theme">
<strong>
<?=gettext("This will change the look and feel of"); ?>
<?=$g['product_name'];?>.
</strong>
</div>
</td>
</tr>
<tr>
<td><a id="help_for_mirror" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("Firmware Mirror"); ?></td>
<td>
<select name="mirror" class="selectpicker" data-size="10" data-width="auto">
<?php
foreach (get_firmware_mirrors() as $mcode => $mdesc):?>
<option value="<?=$mcode;?>" <?=$mcode == $pconfig['mirror'] ? "selected=\"selected\"":"";?>>
<?=$mdesc;?>
</option>
<?php
endforeach;?>
</select>
<div class="hidden" for="help_for_mirror">
<strong>
<?=gettext("Select an alternate firmware mirror."); ?>
</strong>
</div>
</td>
</tr>
<tr>
<td><a id="help_for_flavour" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("Firmware Flavour"); ?></td>
<td width="78%" class="vtable">
<select name="flavour" class="selectpicker" data-size="10" data-style="btn-default" data-width="auto">
<?php
foreach (get_firmware_flavours() as $fcode => $fdesc):?>
<option value="<?=$fcode;?>" <?=$fcode == $pconfig['flavour'] ? "selected=\"selected\"" : "" ;?>>
<?=$fdesc;?>
</option>
<?php
endforeach;?>
</select>
<div class="hidden" for="help_for_flavour">
<strong>
<?=gettext("Select the firmware cryptography flavour."); ?>
</strong>
</div>
</td>
</tr>
<tr>
<th colspan="2" valign="top" class="listtopic"><?=gettext("Name resolution"); ?></th>
</tr>
<tr>
<td><a id="help_for_dnsservers" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("DNS servers"); ?></td>
<td>
......@@ -412,6 +521,9 @@ include("head.inc");
</div>
</td>
</tr>
<tr>
<th colspan="2" valign="top" class="listtopic"><?=gettext("Networking"); ?></th>
</tr>
<tr>
<td><a id="help_for_prefer_ipv4" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("Prefer IPv4 over IPv6"); ?></td>
<td>
......@@ -425,100 +537,13 @@ include("head.inc");
</td>
</tr>
<tr>
<td><a id="help_for_timezone" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("Time zone"); ?></td>
<td>
<select name="timezone" id="timezone" data-size="10" class="selectpicker" data-style="btn-default" data-live-search="true">
<?php
foreach (get_zoneinfo() as $value):
if(strstr($value, "GMT")) {
continue;
}?>
<option value="<?=htmlspecialchars($value);?>" <?=$value == $pconfig['timezone'] ? "selected=\"selected\"" :"";?>>
<?=htmlspecialchars($value);?>
</option>
<?php
endforeach; ?>
</select>
<div class="hidden" for="help_for_timezone">
<?=gettext("Select the location closest to you"); ?>
</div>
</td>
</tr>
<tr>
<td><a id="help_for_language" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("Language");?></td>
<td>
<select name="language" class="selectpicker" data-size="10" data-style="btn-default" data-width="auto">
<?php
foreach (get_locale_list() as $lcode => $ldesc):?>
<option value="<?=$lcode;?>" <?=$lcode == $pconfig['language'] ? "selected=\"selected\"" : "";?>>
<?=$ldesc;?>
</option>
<?php
endforeach;?>
</select>
<div class="hidden" for="help_for_language">
<strong>
<?=gettext("Choose a language for the webConfigurator"); ?>
</strong>
</div>
</td>
</tr>
<tr>
<td><a id="help_for_theme" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("Theme"); ?></td>
<td>
<select name="theme" class="selectpicker" data-size="10" data-width="auto">
<?php
$curtheme = get_current_theme();
foreach (return_dir_as_array('/usr/local/opnsense/www/themes/') as $file):?>
<option <?=$file == $curtheme ? "selected=\"selected\"" : "";?>>
<?=$file;?>
</option>
<?php
endforeach; ?>
</select>
<div class="hidden" for="help_for_theme">
<strong>
<?=gettext("This will change the look and feel of"); ?>
<?=$g['product_name'];?>.
</strong>
</div>
</td>
</tr>
<tr>
<td><a id="help_for_mirror" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("Firmware Mirror"); ?></td>
<td><a id="help_for_gw_switch_default" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("Gateway switching");?> </td>
<td>
<select name="mirror" class="selectpicker" data-size="10" data-width="auto">
<?php
foreach (get_firmware_mirrors() as $mcode => $mdesc):?>
<option value="<?=$mcode;?>" <?=$mcode == $pconfig['mirror'] ? "selected=\"selected\"":"";?>>
<?=$mdesc;?>
</option>
<?php
endforeach;?>
</select>
<div class="hidden" for="help_for_mirror">
<strong>
<?=gettext("Select an alternate firmware mirror."); ?>
</strong>
</div>
</td>
</tr>
<tr>
<td><a id="help_for_flavour" href="#" class="showhelp"><i class="fa fa-info-circle"></i></a> <?=gettext("Firmware Flavour"); ?></td>
<td width="78%" class="vtable">
<select name="flavour" class="selectpicker" data-size="10" data-style="btn-default" data-width="auto">
<?php
foreach (get_firmware_flavours() as $fcode => $fdesc):?>
<option value="<?=$fcode;?>" <?=$fcode == $pconfig['flavour'] ? "selected=\"selected\"" : "" ;?>>
<?=$fdesc;?>
</option>
<?php
endforeach;?>
</select>
<div class="hidden" for="help_for_flavour">
<strong>
<?=gettext("Select the firmware cryptography flavour."); ?>
</strong>
<input name="gw_switch_default" type="checkbox" id="gw_switch_default" value="yes" <?= !empty($pconfig['gw_switch_default']) ? "checked=\"checked\"" : "";?> />
<strong><?=gettext("Allow default gateway switching"); ?></strong><br />
<div class="hidden" for="help_for_gw_switch_default">
<?=gettext("If the link where the default gateway resides fails " .
"switch the default gateway to another available one."); ?>
</div>
</td>
</tr>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment