summaryrefslogtreecommitdiff
path: root/utils/modules
diff options
context:
space:
mode:
authordeva <deva>2009-04-28 19:01:12 +0000
committerdeva <deva>2009-04-28 19:01:12 +0000
commite576c5f8ee44d1acfbac128631f9c203fdc26e27 (patch)
tree0cce0586d2428c531a15ee72cee1326f24057672 /utils/modules
parent5543eddbd0d0b2e707c98ef2f96f1a731a7f4822 (diff)
Made it possible to add new pages.
Diffstat (limited to 'utils/modules')
-rw-r--r--utils/modules/pages.php25
1 files changed, 24 insertions, 1 deletions
diff --git a/utils/modules/pages.php b/utils/modules/pages.php
index d69b9e9..99c8142 100644
--- a/utils/modules/pages.php
+++ b/utils/modules/pages.php
@@ -57,7 +57,8 @@ class Pages {
// Admin config
public $admin_title = "Pages";
- public $admin_submodules = array("Edit page" => "edit");
+ public $admin_submodules = array("Add page" => "add",
+ "Edit page" => "edit");
public function admin_edit($action, $vars)
{
@@ -115,12 +116,34 @@ class Pages {
}
}
+ public function admin_add($action, $vars)
+ {
+ switch($action) {
+ case "add":
+ $page = new Page($vars["title"], "");
+ $this->add($page);
+ $this->write();
+ echo "The page titled \"" . $page->title . "\" has now been added.";
+ break;
+
+ default:
+ $form = new Form("add");
+ $form->addWidget(new LineEdit("Page title (must not contain spaces or special characters)", "title", ""));
+ $form->addWidget(new Button("Add"));
+ $form->render();
+ break;
+ }
+ }
+
public function admin($sub, $action, $vars)
{
switch($sub) {
case "edit":
$this->admin_edit($action, $vars);
break;
+ case "add":
+ $this->admin_add($action, $vars);
+ break;
}
}