mirror of
https://github.com/billz/raspap-webgui.git
synced 2023-10-10 13:37:24 +02:00
Merge pull request #1317 from RaspAP/maint/system-tab
Move theme UI under System tab
This commit is contained in:
commit
1532b3e58f
@ -94,3 +94,33 @@ bindtextdomain(LOCALE_DOMAIN, LOCALE_ROOT);
|
||||
bind_textdomain_codeset(LOCALE_DOMAIN, 'UTF-8');
|
||||
|
||||
textdomain(LOCALE_DOMAIN);
|
||||
|
||||
function getLocales()
|
||||
{
|
||||
$arrLocales = array(
|
||||
'en_GB.UTF-8' => 'English',
|
||||
'cs_CZ.UTF-8' => 'Čeština',
|
||||
'zh_TW.UTF-8' => '正體中文 (Chinese traditional)',
|
||||
'zh_CN.UTF-8' => '简体中文 (Chinese simplified)',
|
||||
'da_DK.UTF-8' => 'Dansk',
|
||||
'de_DE.UTF-8' => 'Deutsch',
|
||||
'es_MX.UTF-8' => 'Español',
|
||||
'fi_FI.UTF-8' => 'Finnish',
|
||||
'fr_FR.UTF-8' => 'Français',
|
||||
'el_GR.UTF-8' => 'Ελληνικά',
|
||||
'id_ID.UTF-8' => 'Indonesian',
|
||||
'it_IT.UTF-8' => 'Italiano',
|
||||
'ja_JP.UTF-8' => '日本語 (Japanese)',
|
||||
'ko_KR.UTF-8' => '한국어 (Korean)',
|
||||
'nl_NL.UTF-8' => 'Nederlands',
|
||||
'pl_PL.UTF-8' => 'Polskie',
|
||||
'pt_BR.UTF-8' => 'Português',
|
||||
'ru_RU.UTF-8' => 'Русский',
|
||||
'ro_RO.UTF-8' => 'Română',
|
||||
'sv_SE.UTF-8' => 'Svenska',
|
||||
'tr_TR.UTF-8' => 'Türkçe',
|
||||
'vi_VN.UTF-8' => 'Tiếng Việt (Vietnamese)'
|
||||
);
|
||||
return $arrLocales;
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
<?php
|
||||
|
||||
require_once 'includes/status_messages.php';
|
||||
require_once 'includes/functions.php';
|
||||
require_once 'config.php';
|
||||
require_once 'app/lib/system.php';
|
||||
|
||||
@ -62,10 +63,9 @@ function RPiVersion()
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
function DisplaySystem()
|
||||
function DisplaySystem(&$extraFooterScripts)
|
||||
{
|
||||
|
||||
$status = new StatusMessages();
|
||||
@ -128,30 +128,7 @@ function DisplaySystem()
|
||||
$serverBind = str_replace('"', '',$conf['server.bind']);
|
||||
|
||||
// define locales
|
||||
$arrLocales = array(
|
||||
'en_GB.UTF-8' => 'English',
|
||||
'cs_CZ.UTF-8' => 'Čeština',
|
||||
'zh_TW.UTF-8' => '正體中文 (Chinese traditional)',
|
||||
'zh_CN.UTF-8' => '简体中文 (Chinese simplified)',
|
||||
'da_DK.UTF-8' => 'Dansk',
|
||||
'de_DE.UTF-8' => 'Deutsch',
|
||||
'es_MX.UTF-8' => 'Español',
|
||||
'fi_FI.UTF-8' => 'Finnish',
|
||||
'fr_FR.UTF-8' => 'Français',
|
||||
'el_GR.UTF-8' => 'Ελληνικά',
|
||||
'id_ID.UTF-8' => 'Indonesian',
|
||||
'it_IT.UTF-8' => 'Italiano',
|
||||
'ja_JP.UTF-8' => '日本語 (Japanese)',
|
||||
'ko_KR.UTF-8' => '한국어 (Korean)',
|
||||
'nl_NL.UTF-8' => 'Nederlands',
|
||||
'pl_PL.UTF-8' => 'Polskie',
|
||||
'pt_BR.UTF-8' => 'Português',
|
||||
'ru_RU.UTF-8' => 'Русский',
|
||||
'ro_RO.UTF-8' => 'Română',
|
||||
'sv_SE.UTF-8' => 'Svenska',
|
||||
'tr_TR.UTF-8' => 'Türkçe',
|
||||
'vi_VN.UTF-8' => 'Tiếng Việt (Vietnamese)'
|
||||
);
|
||||
$arrLocales = getLocales();
|
||||
|
||||
#fetch system status variables.
|
||||
$system = new \RaspAP\System\Sysinfo;
|
||||
@ -209,6 +186,20 @@ function DisplaySystem()
|
||||
$hostapd_led = "service-status-down";
|
||||
}
|
||||
|
||||
// theme options
|
||||
$themes = [
|
||||
"default" => "RaspAP (default)",
|
||||
"hackernews" => "HackerNews"
|
||||
];
|
||||
$themeFiles = [
|
||||
"default" => "custom.php",
|
||||
"hackernews" => "hackernews.css"
|
||||
];
|
||||
$selectedTheme = array_search($_COOKIE['theme'], $themeFiles);
|
||||
|
||||
$extraFooterScripts[] = array('src'=>'dist/huebee/huebee.pkgd.min.js', 'defer'=>false);
|
||||
$extraFooterScripts[] = array('src'=>'app/js/huebee.js', 'defer'=>false);
|
||||
|
||||
echo renderTemplate("system", compact(
|
||||
"arrLocales",
|
||||
"status",
|
||||
@ -229,6 +220,8 @@ function DisplaySystem()
|
||||
"cputemp_led",
|
||||
"hostapd",
|
||||
"hostapd_status",
|
||||
"hostapd_led"
|
||||
"hostapd_led",
|
||||
"themes",
|
||||
"selectedTheme"
|
||||
));
|
||||
}
|
||||
|
@ -1,22 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
*
|
||||
*/
|
||||
function DisplayThemeConfig(&$extraFooterScripts)
|
||||
{
|
||||
$themes = [
|
||||
"default" => "RaspAP (default)",
|
||||
"hackernews" => "HackerNews"
|
||||
];
|
||||
$themeFiles = [
|
||||
"default" => "custom.php",
|
||||
"hackernews" => "hackernews.css"
|
||||
];
|
||||
$selectedTheme = array_search($_COOKIE['theme'], $themeFiles);
|
||||
|
||||
echo renderTemplate("themes", compact("themes", "selectedTheme"));
|
||||
|
||||
$extraFooterScripts[] = array('src'=>'dist/huebee/huebee.pkgd.min.js', 'defer'=>false);
|
||||
$extraFooterScripts[] = array('src'=>'app/js/huebee.js', 'defer'=>false);
|
||||
}
|
11
index.php
11
index.php
@ -41,7 +41,6 @@ require_once 'includes/system.php';
|
||||
require_once 'includes/sysstats.php';
|
||||
require_once 'includes/configure_client.php';
|
||||
require_once 'includes/networking.php';
|
||||
require_once 'includes/themes.php';
|
||||
require_once 'includes/data_usage.php';
|
||||
require_once 'includes/about.php';
|
||||
require_once 'includes/openvpn.php';
|
||||
@ -180,11 +179,6 @@ $bridgedEnabled = getBridgedState();
|
||||
<?php if (RASPI_CONFAUTH_ENABLED) : ?>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="auth_conf"><i class="fas fa-user-lock fa-fw mr-2"></i><span class="nav-label"><?php echo _("Authentication"); ?></a>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
<?php if (RASPI_CHANGETHEME_ENABLED) : ?>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="theme_conf"><i class="fas fa-paint-brush fa-fw mr-2"></i><span class="nav-label"><?php echo _("Change Theme"); ?></a>
|
||||
</li>
|
||||
<?php endif; ?>
|
||||
<?php if (RASPI_VNSTAT_ENABLED) : ?>
|
||||
@ -287,14 +281,11 @@ $bridgedEnabled = getBridgedState();
|
||||
case "/save_hostapd_conf":
|
||||
SaveTORAndVPNConfig();
|
||||
break;
|
||||
case "/theme_conf":
|
||||
DisplayThemeConfig($extraFooterScripts);
|
||||
break;
|
||||
case "/data_use":
|
||||
DisplayDataUsage($extraFooterScripts);
|
||||
break;
|
||||
case "/system_info":
|
||||
DisplaySystem();
|
||||
DisplaySystem($extraFooterScripts);
|
||||
break;
|
||||
case "/about":
|
||||
DisplayAbout();
|
||||
|
@ -15,12 +15,14 @@
|
||||
<ul class="nav nav-tabs" role="tablist">
|
||||
<li role="presentation" class="nav-item"><a class="nav-link active" id="basictab" href="#basic" aria-controls="basic" role="tab" data-toggle="tab"><?php echo _("Basic"); ?></a></li>
|
||||
<li role="presentation" class="nav-item"><a class="nav-link" id="languagetab" href="#language" aria-controls="language" role="tab" data-toggle="tab"><?php echo _("Language"); ?></a></li>
|
||||
<li role="presentation" class="nav-item"><a class="nav-link" id="themetab" href="#theme" aria-controls="theme" role="tab" data-toggle="tab"><?php echo _("Theme"); ?></a></li>
|
||||
<li role="presentation" class="nav-item"><a class="nav-link" id="advancedtab" href="#advanced" aria-controls="advanced" role="tab" data-toggle="tab"><?php echo _("Advanced"); ?></a></li>
|
||||
</ul>
|
||||
<!-- Tab panes -->
|
||||
<div class="tab-content">
|
||||
<?php echo renderTemplate("system/basic", $__template_data) ?>
|
||||
<?php echo renderTemplate("system/language", $__template_data) ?>
|
||||
<?php echo renderTemplate("system/theme", $__template_data) ?>
|
||||
<?php echo renderTemplate("system/advanced", $__template_data) ?>
|
||||
</div><!-- /.tab-content -->
|
||||
</form>
|
||||
|
20
templates/system/theme.php
Normal file
20
templates/system/theme.php
Normal file
@ -0,0 +1,20 @@
|
||||
<!-- theme tab -->
|
||||
<div role="tabpanel" class="tab-pane" id="theme">
|
||||
<h4 class="mt-3"><?php echo _("Change theme") ;?></h4>
|
||||
<div class="row">
|
||||
<div class="form-group col-xs-3 col-sm-3">
|
||||
<label for="code"><?php echo _("Select a theme"); ?></label>
|
||||
<?php SelectorOptions("theme", $themes, $selectedTheme, "theme-select") ?>
|
||||
</div>
|
||||
<div class="col-xs-3 col-sm-3">
|
||||
<label for="code"><?php echo _("Color"); ?></label>
|
||||
<input class="form-control color-input" value="#2b8080" aria-label="color" />
|
||||
</div>
|
||||
</div>
|
||||
<form action="system_info" method="POST">
|
||||
<?php echo CSRFTokenFieldTag() ?>
|
||||
<button type="button" onClick="window.location.reload();" class="btn btn-outline btn-primary"><i class="fas fa-sync-alt"></i> <?php echo _("Refresh") ?></a>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
|
@ -1,31 +0,0 @@
|
||||
<div class="row">
|
||||
<div class="col-lg-12">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<i class="fas fa-paint-brush mr-2"></i><?php echo _("Change Theme"); ?>
|
||||
</div>
|
||||
</div><!-- /.row -->
|
||||
</div><!-- /.card-header -->
|
||||
<div class="card-body">
|
||||
<h4><?php echo _("Theme settings"); ?></h4>
|
||||
<div class="row">
|
||||
<div class="form-group col-xs-3 col-sm-3">
|
||||
<label for="code"><?php echo _("Select a theme"); ?></label>
|
||||
<?php SelectorOptions("theme", $themes, $selectedTheme, "theme-select") ?>
|
||||
</div>
|
||||
<div class="col-xs-3 col-sm-3">
|
||||
<label for="code"><?php echo _("Color"); ?></label>
|
||||
<input class="form-control color-input" value="#2b8080" aria-label="color" />
|
||||
</div>
|
||||
</div>
|
||||
<form action="system_info" method="POST">
|
||||
<?php echo CSRFTokenFieldTag() ?>
|
||||
<button type="button" onClick="window.location.reload();" class="btn btn-outline btn-primary"><i class="fas fa-sync-alt"></i> <?php echo _("Refresh") ?></a>
|
||||
</form>
|
||||
</div><!-- /.card-body -->
|
||||
<div class="card-footer"></div>
|
||||
</div><!-- /.card -->
|
||||
</div><!-- /.col-lg-12 -->
|
||||
</div><!-- /.row -->
|
Loading…
Reference in New Issue
Block a user