From 7d2c828a4c909bab4c73656cfb1730176066b1db Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Mon, 3 Nov 2008 00:27:35 +0000 Subject: Put info about installed modules directly into the scaffolding page, and create methods to install/uninstall modules. --- core/controllers/welcome.php | 24 ++++++++++++++++++++---- core/views/welcome.html.php | 2 +- core/views/welcome_syscheck.html.php | 35 ++++++++++++++++++++++++++++++++--- 3 files changed, 53 insertions(+), 8 deletions(-) diff --git a/core/controllers/welcome.php b/core/controllers/welcome.php index 061a4176..93670cfe 100644 --- a/core/controllers/welcome.php +++ b/core/controllers/welcome.php @@ -18,14 +18,30 @@ * Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ class Welcome_Controller extends Template_Controller { - public $template = 'welcome.html'; + public $template = "welcome.html"; function index() { - $this->template->syscheck = new View('welcome_syscheck.html'); + $this->template->syscheck = new View("welcome_syscheck.html"); $this->template->syscheck->errors = $this->_get_config_errors(); + + try { + $this->template->syscheck->modules = ORM::factory("module")->find_all(); + } catch (Exception $e) { + $this->template->syscheck->modules = array(); + } $this->_create_directories(); } + function install($module) { + call_user_func(array("{$module}_installer", "install")); + url::redirect("welcome"); + } + + function uninstall($module) { + call_user_func(array("{$module}_installer", "uninstall")); + url::redirect("welcome"); + } + private function _get_config_errors() { $errors = array(); if (!file_exists(VARPATH)) { @@ -56,13 +72,13 @@ class Welcome_Controller extends Template_Controller { $error->message2 = "Then edit this file and enter your database configuration settings."; $errors[] = $error; } else { - $old_handler = set_error_handler(array('Welcome_Controller', '_error_handler')); + $old_handler = set_error_handler(array("Welcome_Controller", "_error_handler")); try { Database::instance()->connect(); } catch (Exception $e) { $error = new stdClass(); $error->message = "Database error: {$e->getMessage()}"; - $db_name = Kohana::config('database.default.connection.database'); + $db_name = Kohana::config("database.default.connection.database"); if (strchr($error->message, "Unknown database")) { $error->instructions[] = "mysqladmin -uroot create $db_name"; } else { diff --git a/core/views/welcome.html.php b/core/views/welcome.html.php index 9b77ce20..957b091c 100644 --- a/core/views/welcome.html.php +++ b/core/views/welcome.html.php @@ -27,7 +27,6 @@ p { margin: 0 0 0 0; - padding-left: 1em; } pre { @@ -49,6 +48,7 @@ div.block { padding: 0px; + padding-left: 1em; margin: 0px; padding-bottom: 1em; } diff --git a/core/views/welcome_syscheck.html.php b/core/views/welcome_syscheck.html.php index 3a6b352c..7355e431 100644 --- a/core/views/welcome_syscheck.html.php +++ b/core/views/welcome_syscheck.html.php @@ -15,8 +15,37 @@ + -

- Your system is ready to go. -

+
+ +

+ Your system is ready, but Gallery is not yet installed. +

+

+ +

+ +

+ Your Gallery is ready with the following modules installed: +

+ + + + + + + + + + + + + +
NameVersionAction
name ?>version ?> + name}", "install") ?>, + name}", "uninstall") ?> +
+ +
-- cgit v1.2.3