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,4 +1,7 @@
<?php
include_once( 'includes/status_messages.php' );
/**
*
* Find the version of the Raspberry Pi
@ -47,6 +50,27 @@ function RPiVersion() {
*/
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
exec("hostname -f", $hostarray);
$hostname = $hostarray[0];
@ -102,8 +126,11 @@ function DisplaySystem(){
<div class="col-md-12">
<div class="panel panel-default">
<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">
<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>
</ul>
@ -140,6 +167,20 @@ function DisplaySystem(){
</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 class="row">
<div class="col-lg-12">
@ -148,22 +189,18 @@ function DisplaySystem(){
</div>
</div>
</div><!-- /.systemtabcontent -->
</div><!-- /.panel-body -->
</div><!-- /.panel-default -->
</div><!-- /.col-md-6 -->
</div><!-- /.row -->
</div><!-- /.panel-body -->
</form>
</div><!-- /.panel-primary -->
<div class="panel-footer"></div>
</div><!-- /.col-lg-12 -->
</div><!-- /.row -->
</div>
</div>
</xdiv>
<?php
}
?>