summaryrefslogtreecommitdiff
path: root/utils/modules/config.php
diff options
context:
space:
mode:
Diffstat (limited to 'utils/modules/config.php')
-rw-r--r--utils/modules/config.php62
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;
}