1
0
mirror of https://github.com/billz/raspap-webgui.git synced 2023-10-10 13:37:24 +02:00

Added language tab and selector

This commit is contained in:
billz 2018-05-29 19:16:40 +00:00
parent 2b8e37880e
commit 534d44c03d

View File

@ -1,10 +1,13 @@
<?php <?php
include_once( 'includes/status_messages.php' );
/** /**
* *
* Find the version of the Raspberry Pi * Find the version of the Raspberry Pi
* Currently only used for the system information page but may useful elsewhere * Currently only used for the system information page but may useful elsewhere
* *
*/ */
function RPiVersion() { function RPiVersion() {
// Lookup table from http://www.raspberrypi-spy.co.uk/2012/09/checking-your-raspberry-pi-board-version/ // Lookup table from http://www.raspberrypi-spy.co.uk/2012/09/checking-your-raspberry-pi-board-version/
@ -42,11 +45,32 @@ function RPiVersion() {
} }
/** /**
* *
* *
*/ */
function DisplaySystem(){ function DisplaySystem(){
$status = new StatusMessages();
if( isset($_POST['SaveLanguage']) ) {
if (CSRFValidate()) {
if(isset($_POST['locale'])) {
$_SESSION['locale'] = $_POST['locale'];
$status->addMessage('Language setting saved', 'success');
}
} else {
error_log('CSRF violation');
}
}
// define locales
$arrLocales = array(
'en_GB.UTF-8' => 'English',
'fr_FR.UTF-8' => 'français',
'it_IT.UTF-8' => 'italiano',
'pt_BR.UTF-8' => 'Português'
);
// hostname // hostname
exec("hostname -f", $hostarray); exec("hostname -f", $hostarray);
$hostname = $hostarray[0]; $hostname = $hostarray[0];
@ -80,14 +104,14 @@ function DisplaySystem(){
elseif ($cpuload > 75) { $cpuload_status = "warning"; } elseif ($cpuload > 75) { $cpuload_status = "warning"; }
elseif ($cpuload > 0) { $cpuload_status = "success"; } elseif ($cpuload > 0) { $cpuload_status = "success"; }
?> ?>
<div class="row"> <div class="row">
<div class="col-lg-12"> <div class="col-lg-12">
<div class="panel panel-primary"> <div class="panel panel-primary">
<div class="panel-heading"><i class="fa fa-cube fa-fw"></i> <?php echo _("System"); ?></div> <div class="panel-heading"><i class="fa fa-cube fa-fw"></i> <?php echo _("System"); ?></div>
<div class="panel-body"> <div class="panel-body">
<?php <?php
if (isset($_POST['system_reboot'])) { if (isset($_POST['system_reboot'])) {
echo '<div class="alert alert-warning">' . _("System Rebooting Now!") . '</div>'; echo '<div class="alert alert-warning">' . _("System Rebooting Now!") . '</div>';
$result = shell_exec("sudo /sbin/reboot"); $result = shell_exec("sudo /sbin/reboot");
@ -96,14 +120,17 @@ function DisplaySystem(){
echo '<div class="alert alert-warning">' . _("System Shutting Down Now!") . '</div>'; echo '<div class="alert alert-warning">' . _("System Shutting Down Now!") . '</div>';
$result = shell_exec("sudo /sbin/shutdown -h now"); $result = shell_exec("sudo /sbin/shutdown -h now");
} }
?> ?>
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-body"> <div class="panel-body">
<p><?php $status->showMessages(); ?></p>
<form role="form" action="?page=system_info" method="POST">
<ul class="nav nav-tabs" role="tablist"> <ul class="nav nav-tabs" role="tablist">
<li role="presentation" class="active systemtab"><a href="#system" aria-controls="system" role="tab" data-toggle="tab"><?php echo _("System"); ?></a></li> <li role="presentation" class="active systemtab"><a href="#system" aria-controls="system" role="tab" data-toggle="tab"><?php echo _("System"); ?></a></li>
<li role="presentation" class="languagetab"><a href="#language" aria-controls="language" role="tab" data-toggle="tab"><?php echo _("Language"); ?></a></li>
<li role="presentation" class="consoletab"><a href="#console" aria-controls="console" role="tab" data-toggle="tab"><?php echo _("Console"); ?></a></li> <li role="presentation" class="consoletab"><a href="#console" aria-controls="console" role="tab" data-toggle="tab"><?php echo _("Console"); ?></a></li>
</ul> </ul>
@ -140,6 +167,20 @@ function DisplaySystem(){
</div> </div>
</div> </div>
</div> </div>
<div role="tabpanel" class="tab-pane" id="language">
<h4><?php echo _("Language settings") ;?></h4>
<?php CSRFToken() ?>
<div class="row">
<div class="form-group col-md-4">
<label for="code"><?php echo _("Select a language"); ?></label>
<?php SelectorOptions('locale', $arrLocales, $_SESSION['locale']); ?>
</div>
</div>
<input type="submit" class="btn btn-outline btn-primary" name="SaveLanguage" value="<?php echo _("Save settings"); ?>" />
<input type="button" class="btn btn-outline btn-primary" value="<?php echo _("Refresh"); ?>" onclick="document.location.reload(true)" />
</div>
<div role="tabpanel" class="tab-pane" id="console"> <div role="tabpanel" class="tab-pane" id="console">
<div class="row"> <div class="row">
<div class="col-lg-12"> <div class="col-lg-12">
@ -148,22 +189,18 @@ function DisplaySystem(){
</div> </div>
</div> </div>
</div><!-- /.systemtabcontent -->
</div><!-- /.panel-body -->
</div><!-- /.panel-default --> </div><!-- /.panel-default -->
</div><!-- /.col-md-6 --> </div><!-- /.col-md-6 -->
</div><!-- /.row --> </div><!-- /.row -->
</div><!-- /.panel-body --> </div><!-- /.panel-body -->
</form>
</div><!-- /.panel-primary --> </div><!-- /.panel-primary -->
<div class="panel-footer"></div>
</div><!-- /.col-lg-12 --> </div><!-- /.col-lg-12 -->
</div><!-- /.row --> </div><!-- /.row -->
</xdiv>
<?php
</div>
</div>
<?php
} }
?> ?>