From 73c437758ad033c0ca03e1ca1838039e3b1fed95 Mon Sep 17 00:00:00 2001 From: shish Date: Tue, 17 Jul 2007 18:07:18 +0000 Subject: [PATCH] news, upload, comment, and tag_list now respond to PostListBuildingEvents rather than PageRequestEvent(index) git-svn-id: file:///home/shish/svn/shimmie2/trunk@318 7f39781d-f577-437e-ae19-be835c7a54ca --- ext/comment/main.php | 3 ++- ext/index/main.php | 12 ++++++++++++ ext/news/main.php | 3 ++- ext/tag_list/main.php | 10 +++++----- ext/upload/main.php | 3 ++- 5 files changed, 23 insertions(+), 8 deletions(-) diff --git a/ext/comment/main.php b/ext/comment/main.php index 9c05c7c9..44a8505f 100644 --- a/ext/comment/main.php +++ b/ext/comment/main.php @@ -91,7 +91,8 @@ class CommentList extends Extension { $this->build_page($event->get_arg(1)); } } - if(is_a($event, 'PageRequestEvent') && ($event->page_name == "index")) { + + if(is_a($event, 'PostListBuildingEvent')) { global $config; if($config->get_int("comment_count") > 0) { $event->page->add_block(new Block("Comments", $this->build_recent_comments(), "left")); diff --git a/ext/index/main.php b/ext/index/main.php index 1617631e..3e170346 100644 --- a/ext/index/main.php +++ b/ext/index/main.php @@ -1,5 +1,15 @@ page = $page; + $this->search_terms = $search; + } +} + class Index extends Extension { var $theme; @@ -40,6 +50,8 @@ class Index extends Extension { $total_pages = $database->count_pages($search_terms); $count = $config->get_int('index_width') * $config->get_int('index_height'); $images = $database->get_images(($page_number-1)*$count, $count, $search_terms); + + send_event(new PostListBuildingEvent($event->page, $search_terms)); $this->theme->set_page($page_number, $total_pages, $search_terms); $this->theme->display_page($event->page, $images); diff --git a/ext/news/main.php b/ext/news/main.php index 24d4ef86..43011f8e 100644 --- a/ext/news/main.php +++ b/ext/news/main.php @@ -6,12 +6,13 @@ class News extends Extension { public function receive_event($event) { if(is_null($this->theme)) $this->theme = get_theme_object("news", "NewsTheme"); - if(is_a($event, 'PageRequestEvent') && ($event->page_name == "index")) { + if(is_a($event, 'PostListBuildingEvent')) { global $config; if(strlen($config->get_string("news_text")) > 0) { $this->theme->display_news($event->page, $config->get_string("news_text")); } } + if(is_a($event, 'SetupBuildingEvent')) { $sb = new SetupBlock("News"); $sb->add_longtext_option("news_text"); diff --git a/ext/tag_list/main.php b/ext/tag_list/main.php index 78d8e1de..97bdfa78 100644 --- a/ext/tag_list/main.php +++ b/ext/tag_list/main.php @@ -35,15 +35,15 @@ class TagList extends Extension { } $this->theme->display_page($page); } - if(is_a($event, 'PageRequestEvent') && ($event->page_name == "index")) { + + if(is_a($event, 'PostListBuildingEvent')) { global $config; - global $page; if($config->get_int('tag_list_length') > 0) { - if(isset($_GET['search'])) { - $this->add_refine_block($page, tag_explode($_GET['search'])); + if(!is_null($event->search_terms)) { + $this->add_refine_block($event->page, $event->search_terms); } else { - $this->add_popular_block($page); + $this->add_popular_block($event->page); } } } diff --git a/ext/upload/main.php b/ext/upload/main.php index 1493dead..796649e9 100644 --- a/ext/upload/main.php +++ b/ext/upload/main.php @@ -13,11 +13,12 @@ class Upload extends Extension { $config->set_default_bool('upload_anon', false); } - if(is_a($event, 'PageRequestEvent') && ($event->page_name == "index")) { + if(is_a($event, 'PostListBuildingEvent')) { if($this->can_upload()) { $this->theme->display_block($event->page); } } + if(is_a($event, 'PageRequestEvent') && ($event->page_name == "upload")) { if($this->can_upload()) { global $page;