diff options
author | deva <deva> | 2010-03-01 08:27:57 +0000 |
---|---|---|
committer | deva <deva> | 2010-03-01 08:27:57 +0000 |
commit | 9e701aea428bb62f892ad9fa2fdafb93b5465d3a (patch) | |
tree | c722efe871a8e61b7d98cc1805f794936bc1e96a /utils | |
parent | 9d6e3ab0be248bde75ed5b70dbab5f24d2bfeac5 (diff) |
Moved vars out from config.php and into the config module.
Diffstat (limited to 'utils')
-rw-r--r-- | utils/modules/config.php | 62 |
1 files changed, 44 insertions, 18 deletions
diff --git a/utils/modules/config.php b/utils/modules/config.php index 4c7ac07..13cdda1 100644 --- a/utils/modules/config.php +++ b/utils/modules/config.php @@ -12,6 +12,8 @@ class Config { // Admin config public $admin_title = "Site Config"; public $admin_submodules = array("Title" => "title", + "CSS" => "css", + "Default page" => "defaultpage", "Menu" => "menu", "Splash" => "splash"); @@ -33,6 +35,24 @@ class Config { } } + public function admin_css($action, $vars) + { + switch($action) { + case "update": + $this->setValue("css", $vars["css"]); + echo "The stylesheet has now been changed to \"". $this->value("css") . "\""; + $this->write(); + break; + + default: + $form = new Form("update"); + $form->addWidget(new LineEdit("CSS file:", "css", $this->value("css", "CSS not yet set"))); + $form->addWidget(new Button("Update")); + $form->render(); + break; + } + } + public function admin_splash($action, $vars) { switch($action) { @@ -55,6 +75,24 @@ class Config { } } + public function admin_defaultpage($action, $vars) + { + switch($action) { + case "update": + $this->setValue("defaultpage", $vars["defaultpage"]); + echo "Default page has now been set to ".$this->value("defaultpage")."."; + $this->write(); + break; + + default: + $form = new Form("update"); + $form->addWidget(new LineEdit("Default page:", "defaultpage", $this->value("defaultpage", ""))); + $form->addWidget(new Button("Update")); + $form->render(); + break; + } + } + public function admin_menu($action, $vars) { switch($action) { @@ -89,6 +127,12 @@ class Config { case "title": $this->admin_title($action, $vars); break; + case "css": + $this->admin_css($action, $vars); + break; + case "defaultpage": + $this->admin_defaultpage($action, $vars); + break; case "menu": $this->admin_menu($action, $vars); break; @@ -130,24 +174,6 @@ class Config { public function value($name, $default = "") { if(isset($this->configs[$name])) return $this->configs[$name]; - - ////////// - ////////// TEMPORARY VAR EXPANSION - Remove when the real values are done. - ////////// - global $TITLE, $PRELOAD, $DEFAULT_PAGE, $MENU; - switch($name) { - case 'title': - return $TITLE; - case 'preload': - return $PRELOAD; - case 'default': - return $DEFAULT_PAGE; - case 'menu': - return $MENU; - default: - return $default; - } - return $default; } |