dhcp: remove print_content_box() use and make it all consistent

This commit is contained in:
Franco Fichtner 2022-07-15 15:11:49 +02:00
parent 31f3e82c6b
commit 97b76cd291
5 changed files with 19 additions and 35 deletions

View File

@ -207,18 +207,6 @@ function print_alert_box($msg, $alert = 'warning', $button = '')
EOFnp;
}
function print_content_box($msg)
{
echo <<<EOFnp
<div class="table-responsive">
<table class="table table-striped">
<tr><td>{$msg}</td></tr>
</table>
</div>
EOFnp;
}
function print_info_box_apply($msg, $alert = 'info')
{
$iface = !empty($_POST['if']) ? $_POST['if'] : (!empty($_GET['if']) ? $_GET['if'] : '');

View File

@ -601,15 +601,15 @@ include("head.inc");
<section class="page-content-main">
<div class="container-fluid">
<div class="row">
<?php if (isset($config['dhcrelay']['enable'])): ?>
<?php print_info_box(gettext("DHCP Relay is currently enabled. Cannot enable the DHCP Server service while the DHCP Relay is enabled on any interface.")); ?>
<?php else: ?>
<?php if (isset($input_errors) && count($input_errors) > 0) print_input_errors($input_errors); ?>
<?php if (isset($savemsg)) print_info_box($savemsg); ?>
<?php if (is_subsystem_dirty('staticmaps')): ?><br/>
<?php print_info_box_apply(gettext("The static mapping configuration has been changed") . ".<br />" . gettext("You must apply the changes in order for them to take effect."));?><br />
<?php endif; ?>
<section class="col-xs-12">
<?php if (isset($config['dhcrelay']['enable'])): ?>
<?php print_info_box(gettext("DHCP Relay is currently enabled. Cannot enable the DHCP Server service while the DHCP Relay is enabled on any interface.")); ?>
<?php else: ?>
<div class="tab-content content-box col-xs-12">
<form method="post" name="iform" id="iform">
<div class="table-responsive">
@ -1204,10 +1204,8 @@ include("head.inc");
</div>
</div>
</section>
<?php
endif; ?>
<?php
endif; ?>
<?php endif ?>
<?php endif ?>
</div>
</div>
</section>

View File

@ -102,16 +102,16 @@ include("head.inc");
<section class="page-content-main">
<div class="container-fluid">
<div class="row">
<?php
if ($dhcpd_enabled) {
print_info_box(gettext('DHCP Server is currently enabled. Cannot enable the DHCP Relay service while the DHCP Server is enabled on any interface.'));
} else {
?>
<?php if (isset($input_errors) && count($input_errors) > 0) print_input_errors($input_errors); ?>
<?php if (isset($savemsg)) print_info_box($savemsg); ?>
<section class="col-xs-12">
<div class="content-box">
<form method="post" name="iform" id="iform">
<?php
if ($dhcpd_enabled) {
print_content_box(gettext('DHCP Server is currently enabled. Cannot enable the DHCP Relay service while the DHCP Server is enabled on any interface.'));
} else {
?>
<div>
<div class="table-responsive">
<table class="table table-striped opnsense_standard_table_form">
@ -176,10 +176,10 @@ include("head.inc");
</table>
</div>
</div>
<?php } ?>
</form>
</div>
</section>
<?php } ?>
</div>
</div>
</section>

View File

@ -430,6 +430,9 @@ include("head.inc");
<section class="page-content-main">
<div class="container-fluid">
<div class="row">
<?php if (!empty($config['dhcrelay6']['enabled'])): ?>
<?php print_info_box(gettext('DHCP Relay is currently enabled. Cannot enable the DHCP Server service while the DHCP Relay is enabled on any interface.')); ?>
<?php else: ?>
<?php if (isset($input_errors) && count($input_errors) > 0) print_input_errors($input_errors); ?>
<?php if (isset($savemsg)) print_info_box($savemsg); ?>
<?php if (is_subsystem_dirty('staticmaps')): ?><p>
@ -438,9 +441,6 @@ include("head.inc");
<section class="col-xs-12">
<div class="tab-content content-box col-xs-12">
<form method="post" name="iform" id="iform">
<?php if (!empty($config['dhcrelay6']['enabled'])): ?>
<?php print_content_box(gettext('DHCP Relay is currently enabled. Cannot enable the DHCP Server service while the DHCP Relay is enabled on any interface.')); ?>
<?php else: ?>
<div class="table-responsive">
<table class="table table-striped opnsense_standard_table_form">
<tr>
@ -812,9 +812,8 @@ include("head.inc");
endif; ?>
</table>
</div>
<?php
endif; ?>
</div>
<?php endif; ?>
</section>
</div>
</div>

View File

@ -102,12 +102,12 @@ include("head.inc");
<section class="page-content-main">
<div class="container-fluid">
<div class="row">
<?php if ($dhcpd_enabled):
print_info_box(gettext('The DHCPv6 server is currently enabled. Cannot enable the DHCPv6 relay while the DHCPv6 server is enabled on any interface.'));
else: ?>
<?php if (isset($input_errors) && count($input_errors) > 0) print_input_errors($input_errors); ?>
<?php if (isset($savemsg)) print_info_box($savemsg); ?>
<section class="col-xs-12">
<?php if ($dhcpd_enabled):
print_info_box(gettext('The DHCPv6 server is currently enabled. Cannot enable the DHCPv6 relay while the DHCPv6 server is enabled on any interface.'));
else: ?>
<div class="content-box">
<form method="post" name="iform" id="iform">
<div>
@ -178,9 +178,8 @@ include("head.inc");
</div>
</form>
</div>
<?php
endif; ?>
</section>
<?php endif ?>
</div>
</div>
</section>