From 358842a847ce67632204135bbb3c9c8f2267f243 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Thu, 16 Oct 2014 11:35:14 +0200 Subject: Show notice in menu bar if setup is incomplete --- modules/main.inc.php | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'modules/main.inc.php') 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 )); } -- cgit v1.2.3-55-g7522