From 9511569ed425270f3624e0bed2be8205ed40409e Mon Sep 17 00:00:00 2001 From: Daku Date: Mon, 30 Dec 2013 06:51:47 +0000 Subject: [PATCH] added option to edit pool description to pool edit page --- ext/pools/main.php | 22 ++++++++++++++++++++++ ext/pools/theme.php | 14 +++++++++++++- 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/ext/pools/main.php b/ext/pools/main.php index 7cdc0374..6bb9a24d 100644 --- a/ext/pools/main.php +++ b/ext/pools/main.php @@ -209,6 +209,17 @@ class Pools extends Extension { break; + case "edit_description": + if ($this->have_permission($user, $pool)) { + $this->edit_description(); + $page->set_mode("redirect"); + $page->set_redirect(make_link("pool/view/".$pool_id)); + } else { + $this->theme->display_error(403, "Permission Denied", "You do not have permission to access this page"); + } + + break; + case "nuke": // Completely remove the given pool. // -> Only admins and owners may do this @@ -508,6 +519,17 @@ class Pools extends Extension { return $poolID; } + /* + * Allows editing of pool description. + */ + private function edit_description() { + global $database; + + $poolID = int_escape($_POST['pool_id']); + $database->execute("UPDATE pools SET description=:dsc WHERE id=:pid", array("dsc"=>$_POST['description'], "pid"=>$poolID)); + + return $poolID; + } /** * This function checks if a given image is contained within a given pool. diff --git a/ext/pools/theme.php b/ext/pools/theme.php index cc924045..269b9a1c 100644 --- a/ext/pools/theme.php +++ b/ext/pools/theme.php @@ -322,8 +322,17 @@ class PoolsTheme extends Themelet { public function edit_pool(Page $page, /*array*/ $pools, /*array*/ $images) { global $user; - $this->display_top($pools, "Editing Pool", true); + /* EDIT POOL DESCRIPTION */ + $desc_html = " + ".make_form(make_link("pool/edit_description"))." +
+ + + + "; + + /* REMOVE POOLS */ $pool_images = "\n
"; foreach($images as $pair) { @@ -341,6 +350,9 @@ class PoolsTheme extends Themelet { "". "
"; + $pools[0]['description'] = ""; //This is a rogue fix to avoid showing the description twice. + $this->display_top($pools, "Editing Pool", true); + $page->add_block(new Block("Editing Description", $desc_html, "main", 28)); $page->add_block(new Block("Editing Posts", $pool_images, "main", 30)); }