diff --git a/ext/pools/main.php b/ext/pools/main.php index 0845e861..cba63ea9 100644 --- a/ext/pools/main.php +++ b/ext/pools/main.php @@ -108,10 +108,9 @@ class Pools extends Extension { global $page, $user; if ($event->page_matches("pool")) { - $pool_id = 0; $pool = array(); - + // Check if we have pool id, since this is most often the case. if (isset($_POST["pool_id"])) { $pool_id = int_escape($_POST["pool_id"]); @@ -502,7 +501,7 @@ class Pools extends Extension { $poolsMaxResults = $config->get_int("poolsMaxImportResults", 1000); $images = $images = Image::find_images(0, $poolsMaxResults, Tag::explode($_POST["pool_tag"])); - $this->theme->pool_result($page, $images, $pool_id); + $this->theme->pool_result($page, $images, $this->get_pool($pool_id)); } diff --git a/ext/pools/theme.php b/ext/pools/theme.php index c42bdbb0..b546d129 100644 --- a/ext/pools/theme.php +++ b/ext/pools/theme.php @@ -87,12 +87,6 @@ class PoolsTheme extends Themelet { $html .= ""; - $nav_html = ' - Index -
Create Pool -
Pool Changes - '; - $order_html = ' '; - $blockTitle = "Pools"; - $page->set_title(html_escape($blockTitle)); - $page->set_heading(html_escape($blockTitle)); - $page->add_block(new Block($blockTitle, $html, "main", 10)); - $page->add_block(new Block("Navigation", $nav_html, "left", 10)); + $this->display_top(null, "Pools"); $page->add_block(new Block("Order By", $order_html, "left", 15)); + $page->add_block(new Block("Pools", $html, "main", 10)); + + + $this->display_paginator($page, "pool/list", null, $pageNumber, $totalPages); } - /* * HERE WE DISPLAY THE NEW POOL COMPOSER */ @@ -128,9 +121,7 @@ class PoolsTheme extends Themelet { "; - $blockTitle = "Create Pool"; - $page->set_title(html_escape($blockTitle)); - $page->set_heading(html_escape($blockTitle)); + $this->display_top(null, "Create Pool"); $page->add_block(new Block("Create Pool", $create_html, "main", 20)); } @@ -144,6 +135,17 @@ class PoolsTheme extends Themelet { $page->set_title($heading); $page->set_heading($heading); + + $nav_html = 'Index'; + $poolnav_html = ' + Index +
Create Pool +
Pool Changes + '; + + $page->add_block(new Block($nav_html, null, "left", 5)); + $page->add_block(new Block("Pool Navigation", $poolnav_html, "left", 10)); + if(count($pools) == 1) { $pool = $pools[0]; if($pool['public'] == "Y" || $user->is_admin()) {// IF THE POOL IS PUBLIC OR IS ADMIN SHOW EDIT PANEL @@ -155,34 +157,8 @@ class PoolsTheme extends Themelet { $bb = new BBCode(); $page->add_block(new Block(html_escape($pool['title']), $bb->format($pool['description']), "main", 10)); } - else { - $pool_info = ' - - - - - '; - - foreach($pools as $pool) { - $pool_info .= "". - "". - "". - ""; - - // this will make disasters if more than one pool comes in the parameter - if($pool['public'] == "Y" || $user->is_admin()) {// IF THE POOL IS PUBLIC OR IS ADMIN SHOW EDIT PANEL - if(!$user->is_anonymous()) {// IF THE USER IS REGISTERED AND LOGGED IN SHOW EDIT PANEL - $this->sidebar_options($page, $pool, $check_all); - } - } - } - - $pool_info .= "
TitleDescription
".html_escape($pool['title'])."".html_escape($pool['description'])."
"; - $page->add_block(new Block($heading, $pool_info, "main", 10)); - } } - /** * HERE WE DISPLAY THE POOL WITH TITLE DESCRIPTION AND IMAGES WITH PAGINATION. * @@ -202,14 +178,7 @@ class PoolsTheme extends Themelet { $pool_images .= "\n".$thumb_html."\n"; } - $nav_html = ' - Index -
Create Pool -
Pool Changes - '; - - $page->add_block(new Block("Navigation", $nav_html, "left", 10)); - $page->add_block(new Block("Viewing Posts", $pool_images, "main", 30)); + $page->add_block(new Block("Viewing Posts", $pool_images, "main", 30)); $this->display_paginator($page, "pool/view/".$pools[0]['id'], null, $pageNumber, $totalPages); } @@ -265,12 +234,7 @@ class PoolsTheme extends Themelet { @@ -278,7 +242,7 @@ class PoolsTheme extends Themelet { "; } - $page->add_block(new Block("Manage Pool", $editor, "left", 10)); + $page->add_block(new Block("Manage Pool", $editor, "left", 15)); } @@ -287,22 +251,14 @@ class PoolsTheme extends Themelet { * * @param Page $page * @param array $images - * @param int $pool_id + * @param array $pool */ - public function pool_result(Page $page, /*array*/ $images, /*int*/ $pool_id) { - // TODO: this could / should be done using jQuery + public function pool_result(Page $page, /*array*/ $images, /*array*/ $pool) { + + $this->display_top($pool, "Importing Posts", true); $pool_images = "