diff options
-rw-r--r-- | inc/property.inc.php | 10 | ||||
-rw-r--r-- | index.php | 3 | ||||
-rw-r--r-- | lang/de/templates/main-menu.json | 1 | ||||
-rw-r--r-- | lang/en/templates/main-menu.json | 1 | ||||
-rw-r--r-- | modules/main.inc.php | 18 | ||||
-rw-r--r-- | templates/main-menu.html | 3 |
6 files changed, 29 insertions, 7 deletions
diff --git a/inc/property.inc.php b/inc/property.inc.php index e4b4340b..afbdf0de 100644 --- a/inc/property.inc.php +++ b/inc/property.inc.php @@ -159,5 +159,15 @@ class Property { return self::get('last-warn-event-id', 0); } + + public static function setNeedsSetup($value) + { + self::set('needs-setup', $value); + } + + public static function getNeedsSetup() + { + return self::get('needs-setup'); + } } @@ -119,7 +119,8 @@ Render::addTemplate('main-menu', array( 'langs' => Dictionary::getLanguages(true), 'dbupdate' => Database::needSchemaUpdate(), 'user' => User::getName(), - 'warning' => User::getName() && User::getLastSeenEvent() < Property::getLastWarningId() + 'warning' => User::getName() !== false && User::getLastSeenEvent() < Property::getLastWarningId(), + 'needsSetup' => User::getName() !== false && Property::getNeedsSetup() )); Message::renderList(); diff --git a/lang/de/templates/main-menu.json b/lang/de/templates/main-menu.json index a681ef02..1044f2b0 100644 --- a/lang/de/templates/main-menu.json +++ b/lang/de/templates/main-menu.json @@ -9,6 +9,7 @@ "lang_localization": "Lokalisierung", "lang_login": "Anmelden", "lang_logout": "Abmelden", + "lang_needsSetup": "Einrichtung unvollst\u00e4ndig", "lang_news": "News", "lang_server": "Server", "lang_serverStatus": "Server Status", diff --git a/lang/en/templates/main-menu.json b/lang/en/templates/main-menu.json index 493d8d80..8fe57baa 100644 --- a/lang/en/templates/main-menu.json +++ b/lang/en/templates/main-menu.json @@ -9,6 +9,7 @@ "lang_localization": "Localization", "lang_login": "Login", "lang_logout": "Logout", + "lang_needsSetup": "Setup incomplete", "lang_news": "News", "lang_server": "Server", "lang_serverStatus": "Server status", diff --git a/modules/main.inc.php b/modules/main.inc.php index 01adf768..71d5071a 100644 --- a/modules/main.inc.php +++ b/modules/main.inc.php @@ -3,9 +3,17 @@ class Page_Main extends Page { + private $sysconfig; + private $minilinux; + private $vmstore; + protected function doPreprocess() { User::load(); + $this->sysconfig = !file_exists(CONFIG_HTTP_DIR . '/default/config.tgz'); + $this->minilinux = !file_exists(CONFIG_HTTP_DIR . '/default/kernel') || !file_exists(CONFIG_HTTP_DIR . '/default/initramfs-stage31') || !file_exists(CONFIG_HTTP_DIR . '/default/stage32.sqfs'); + $this->vmstore = !is_array(Property::getVmStoreConfig()); + Property::setNeedsSetup(($this->sysconfig || $this->minilinux || $this->vmstore) ? 1 : 0); } protected function doRender() @@ -19,14 +27,12 @@ class Page_Main extends Page return; } // Logged in here - $sysconfig = !file_exists(CONFIG_HTTP_DIR . '/default/config.tgz'); - $minilinux = !file_exists(CONFIG_HTTP_DIR . '/default/kernel') || !file_exists(CONFIG_HTTP_DIR . '/default/initramfs-stage31') || !file_exists(CONFIG_HTTP_DIR . '/default/stage32.sqfs'); - $vmstore = !is_array(Property::getVmStoreConfig()); + Render::addTemplate('page-main', array( 'user' => User::getName(), - 'sysconfig' => $sysconfig, - 'minilinux' => $minilinux, - 'vmstore' => $vmstore + 'sysconfig' => $this->sysconfig, + 'minilinux' => $this->minilinux, + 'vmstore' => $this->vmstore )); } diff --git a/templates/main-menu.html b/templates/main-menu.html index da00335c..afc948c9 100644 --- a/templates/main-menu.html +++ b/templates/main-menu.html @@ -49,6 +49,9 @@ {{#warning}} <li><a href="?do=EventLog"><span class="slx-warning-badge badge"><span class="glyphicon glyphicon-exclamation-sign"></span> {{lang_warning}}</span></a></li> {{/warning}} + {{#needsSetup}} + <li><a href="?do=Main"><span class="slx-warning-badge badge"><span class="glyphicon glyphicon-exclamation-sign"></span> {{lang_needsSetup}}</span></a></li> + {{/needsSetup}} </ul> <ul class="nav navbar-nav navbar-right"> {{#user}} |