diff options
-rw-r--r-- | config.php | 2 | ||||
-rw-r--r-- | dictionary.json | 31 | ||||
-rw-r--r-- | dictionary.php | 14 | ||||
-rw-r--r-- | index.php | 3 | ||||
-rw-r--r-- | lang.txt | 1 | ||||
-rw-r--r-- | modules/adduser.inc.php | 2 | ||||
-rw-r--r-- | modules/news.inc.php | 10 | ||||
-rw-r--r-- | modules/sysconfig.inc.php | 2 | ||||
-rw-r--r-- | templates/page-news.html | 15 |
9 files changed, 69 insertions, 11 deletions
@@ -14,6 +14,8 @@ define('CONFIG_SQL_PASS', 'geheim'); define('CONFIG_SQL_FORCE_UTF8', false); //define('CONFIG_SQL_DB', 'openslx'); +define('LANG',str_replace("\n", "", file_get_contents('lang.txt'))); + define('CONFIG_TGZ_LIST_DIR', '/opt/openslx/configs'); define('CONFIG_REMOTE_ML', 'http://mltk.boot.openslx.org/update/new'); diff --git a/dictionary.json b/dictionary.json new file mode 100644 index 00000000..251de4ea --- /dev/null +++ b/dictionary.json @@ -0,0 +1,31 @@ +{ "activeNews":{ + "english":"Active News", + "german":"Aktive News", + "portuguese":"Novidades" + }, +"content":{ + "english":"Content", + "german":"Inhalt", + "portuguese":"Conteúdo" + }, +"latestUpdate":{ + "english":"Latest update", + "german":"Letzte Aktualisierung", + "portuguese":"Última atualização" + }, +"save":{ + "english":"Save", + "german":"Speichern", + "portuguese":"Salvar" + }, +"title":{ + "english":"Title", + "german":"Titel", + "portuguese":"Título" + }, +"welcome":{ + "english":"Welcome", + "german":"Willkommen", + "portuguese":"Bem-vindo" + } +} diff --git a/dictionary.php b/dictionary.php new file mode 100644 index 00000000..9563f7c3 --- /dev/null +++ b/dictionary.php @@ -0,0 +1,14 @@ +<?php + +class Dictionary{ + private $dictionary; + + function __construct(){ + $this->dictionary = json_decode(file_get_contents("dictionary.json"),true); + } + + + public function translate($text){ + return $this->dictionary[$text][LANG]; + } +} @@ -2,6 +2,9 @@ require_once 'config.php'; +require_once 'dictionary.php'; + + /** * Page class which all "modules" must be extending from */ diff --git a/lang.txt b/lang.txt new file mode 100644 index 00000000..97ab12f0 --- /dev/null +++ b/lang.txt @@ -0,0 +1 @@ +english diff --git a/modules/adduser.inc.php b/modules/adduser.inc.php index 19fa5425..cf224531 100644 --- a/modules/adduser.inc.php +++ b/modules/adduser.inc.php @@ -47,9 +47,11 @@ class Page_AddUser extends Page if (Database::queryFirst('SELECT userid FROM user LIMIT 1') !== false) { Message::addError('adduser-disabled'); } else { + Render::setTitle('Benutzer anlegen'); Render::addTemplate('page-adduser', $_POST); } + } } diff --git a/modules/news.inc.php b/modules/news.inc.php index 2f169fb5..19955978 100644 --- a/modules/news.inc.php +++ b/modules/news.inc.php @@ -85,13 +85,19 @@ class Page_News extends Page if ($row['newsid'] == $this->newsId) $row['active'] = "active"; $lines[] = $row; } - // render each entry + $dictionary = new Dictionary(); $paginate->render('page-news', array( 'token' => Session::get('token'), 'latestDate' => ($this->newsDate ? date('d.m.Y H:i', $this->newsDate) : '--'), 'latestContent' => $this->newsContent, 'latestTitle' => $this->newsTitle, - 'list' => $lines + 'list' => $lines, + 'activeNews' => $dictionary->translate("activeNews"), + 'title' => $dictionary->translate("title"), + 'content' => $dictionary->translate("content"), + 'save' => $dictionary->translate("save"), + 'latestUpdate' => $dictionary->translate("latestUpdate"), + 'welcome' => $dictionary->translate("welcome") )); } diff --git a/modules/sysconfig.inc.php b/modules/sysconfig.inc.php index 8be001e6..1808784e 100644 --- a/modules/sysconfig.inc.php +++ b/modules/sysconfig.inc.php @@ -48,7 +48,7 @@ class Page_SysConfig extends Page if (!User::hasPermission('superadmin')) { Message::addError('no-permission'); - Util::redirect('?do=Main'); + return; } $action = Request::any('action', 'list'); diff --git a/templates/page-news.html b/templates/page-news.html index c9a2ccb3..130ecf3d 100644 --- a/templates/page-news.html +++ b/templates/page-news.html @@ -2,21 +2,20 @@ <p>Hier haben Sie die Möglichkeit, die von bwLehrpool-Clients angezeigten News zu editieren.</p> <div class="panel panel-default"> <div class="panel-heading"> - Aktive News + {{activeNews}} </div> <div class="panel-body"> <form action="?do=News&action=save" method="post"> <div class="form-group"> - <label for="news-title-id">Titel</label> - <input type="text" name="news-title" id ="news-title-id" class="form-control" placeholder="Willkommen!" value="{{latestTitle}}"> + <label for="news-title-id">{{title}}</label> + <input type="text" name="news-title" id ="news-title-id" class="form-control" placeholder="{{welcome}}" value="{{latestTitle}}"> </div> <div class="form-group"> - <label for="news-content-id">Inhalt</label> - <textarea name="news-content" id ="news-content-id" class="form-control" rows="5" cols="30" placeholder="Willkommen beim bwLehrpool-System!">{{latestContent}}</textarea> + <label for="news-content-id">{{content}}</label> + <textarea name="news-content" id ="news-content-id" class="form-control" rows="5" cols="30" placeholder="">{{latestContent}}</textarea> </div> - <p>Letzte Aktualisierung: {{latestDate}}</p> - <button class="btn btn-primary btn-sm" type="submit"><span class="glyphicon glyphicon-save"></span> Speichern</button> - <a class="btn btn-primary btn-sm" href="?do=news&action=clear"><span class="glyphicon glyphicon-trash"></span> Leeren</a> + <p>{{latestUpdate}}: {{latestDate}}</p> + <button class="btn btn-primary btn-sm" type="submit">{{save}}</button> <input type="hidden" name="token" value="{{token}}"> </form> </div> |