Commit 0a7e8655 authored by Manuel Faux's avatar Manuel Faux

Cleaner way to show banner for disabled services

parent 5d159b2c
......@@ -606,10 +606,7 @@ include("head.inc");
<div class="container-fluid">
<div class="row">
<?php if (isset($config['system']['disablefilter'])): ?>
<?php print_warning_box(gettext("The firewall has globally been disabled. Configured rules are currently not enforced."));?>
<?php endif; ?>
<?php print_service_disabled_banner('firewall'); ?>
<?php if (isset($input_errors) && count($input_errors) > 0) print_input_errors($input_errors); ?>
<section class="col-xs-12">
......
......@@ -87,10 +87,7 @@ include("head.inc");
<div class="container-fluid">
<div class="row">
<?php if (isset($config['system']['disablefilter'])): ?>
<?php print_warning_box(gettext("The firewall has globally been disabled. Configured rules are currently not enforced."));?>
<?php endif; ?>
<?php print_service_disabled_banner('firewall'); ?>
<?php if (isset($input_errors) && count($input_errors) > 0) print_input_errors($input_errors); ?>
<section class="col-xs-12">
......
......@@ -63,10 +63,7 @@ include("head.inc");
<div class="container-fluid">
<div class="row">
<?php if (isset($config['system']['disablefilter'])): ?>
<?php print_warning_box(gettext("The firewall has globally been disabled. Configured rules are currently not enforced."));?>
<?php endif; ?>
<?php print_service_disabled_banner('firewall'); ?>
<?php if (isset($input_errors) && count($input_errors) > 0) print_input_errors($input_errors); ?>
<section class="col-xs-12">
......
......@@ -114,9 +114,7 @@ include("head.inc"); ?>
<section class="page-content-main">
<div class="container-fluid">
<div class="row">
<?php if (isset($config['system']['disablefilter'])): ?>
<?php print_warning_box(gettext("The firewall has globally been disabled. Configured rules are currently not enforced."));?>
<?php endif; ?>
<?php print_service_disabled_banner('firewall'); ?>
<?php if (isset($input_errors) && count($input_errors) > 0) print_input_errors($input_errors); ?>
<section class="col-xs-12">
<div class="tab-content content-box col-xs-12">
......
......@@ -69,6 +69,7 @@ $( document ).ready(function() {
<section class="page-content-main">
<div class="container-fluid col-xs-12">
<div class="row">
<?php print_service_disabled_banner('firewall'); ?>
<section class="col-xs-12">
<ul class="nav nav-tabs" data-tabs="tabs" id="maintabs">
<?php
......
......@@ -200,9 +200,7 @@ $( document ).ready(function() {
<section class="page-content-main">
<div class="container-fluid">
<div class="row">
<?php if (isset($config['system']['disablefilter'])): ?>
<?php print_warning_box(gettext("The firewall has globally been disabled. Configured rules are currently not enforced."));?>
<?php endif; ?>
<?php print_service_disabled_banner('firewall'); ?>
<?php if (isset($savemsg)) print_info_box($savemsg); ?>
<?php if (is_subsystem_dirty('filter')): ?><p>
<?php print_info_box_apply(gettext("The firewall rule configuration has been changed.<br />You must apply the changes in order for them to take effect."));?>
......
......@@ -237,8 +237,7 @@ function print_info_box($msg)
EOFnp;
}
function print_warning_box($msg)
{
function print_warning_box($msg) {
echo <<<EOFnp
<div class="col-xs-12">
<div class="alert alert-warning alert-dismissible" role="alert">
......@@ -248,6 +247,29 @@ function print_warning_box($msg)
EOFnp;
}
function is_service_enabled($service) {
global $config;
switch ($service) {
case 'firewall':
case 'filter':
return !isset($config['system']['disablefilter']);
default:
return false;
}
}
function print_service_disabled_banner($service) {
if (!is_service_enabled($service)) {
switch ($service) {
case 'firewall':
case 'filter':
print_warning_box(gettext("The firewall has globally been disabled. Configured rules are currently not enforced."));
break;
}
}
}
function get_std_save_message() {
global $d_sysrebootreqd_path;
$filter_related = false;
......
......@@ -65,7 +65,7 @@ include("head.inc");
<section class="page-content-main">
<div class="container-fluid">
<div class="row">
<?php print_service_disabled_banner('firewall'); ?>
<?php if (isset($input_errors) && count($input_errors) > 0) print_input_errors($input_errors); ?>
<section class="col-xs-12">
......
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