From 050a9a17dfe1a9607e278dad1662d4c0de30bdc4 Mon Sep 17 00:00:00 2001 From: "green-ponies (jgen)" Date: Wed, 8 Feb 2012 16:42:29 -0500 Subject: [PATCH] Added config option for Next image. --- contrib/pools/main.php | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/contrib/pools/main.php b/contrib/pools/main.php index 900c3435..dc637c60 100644 --- a/contrib/pools/main.php +++ b/contrib/pools/main.php @@ -63,6 +63,7 @@ class Pools extends SimpleExtension { $config->set_int("poolsUpdatedPerPage", 20); $config->set_bool("poolsInfoOnViewImage", "N"); $config->set_bool("poolsAdderOnViewImage", "N"); + $config->set_bool("poolsShowNextLink","N"); log_info("pools", "extension installed"); } @@ -76,6 +77,7 @@ class Pools extends SimpleExtension { $sb->add_int_option("poolsListsPerPage", "
Index list items per page: "); $sb->add_int_option("poolsUpdatedPerPage", "
Updated list items per page: "); $sb->add_bool_option("poolsInfoOnViewImage", "
Show pool info on image: "); + $sb->add_bool_option("poolsShowNextLink", "
Show 'Next' link when viewing pool images: "); //$sb->add_bool_option("poolsAdderOnViewImage", "
Show pool adder on image: "); $event->panel->add_block($sb); } @@ -223,7 +225,8 @@ class Pools extends SimpleExtension { /** * When displaying an image, optionally list all the pools that the - * image is currently a member of on a side panel. + * image is currently a member of on a side panel, as well as a link + * to the Next image in the pool. */ public function onDisplayingImage($event) { global $config, $database, $page; @@ -231,16 +234,22 @@ class Pools extends SimpleExtension { if($config->get_bool("poolsInfoOnViewImage")) { $imageID = $event->image->id; $poolsIDs = $this->get_pool_id($imageID); + + $show_next = $config->get_bool("poolsShowNextLink", false); + $linksPools = array(); foreach($poolsIDs as $poolID) { $pools = $this->get_pool($poolID['pool_id']); foreach ($pools as $pool){ $linksPools[] = "".html_escape($pool['title']).""; - // TODO: make a config for this - $next_image_in_pool = get_next_post($pool['id'], $imageID); - if (!empty($next_image_in_pool)) { - $linksPools[] = 'Next'; + + // Optionally show a link the Next image in the Pool. + if ($show_next) { + $next_image_in_pool = $this->get_next_post($pool['id'], $imageID); + if (!empty($next_image_in_pool)) { + $linksPools[] = 'Next'; + } } } }