From 83b3f099d98ec0921e14301e4a125d82a6a20955 Mon Sep 17 00:00:00 2001 From: shish Date: Thu, 19 Jul 2007 14:41:42 +0000 Subject: [PATCH] the last of the theme 2.0 work? git-svn-id: file:///home/shish/svn/shimmie2/trunk@334 7f39781d-f577-437e-ae19-be835c7a54ca --- contrib/tag_history/main.php | 24 ++++++------------------ contrib/tag_history/theme.php | 18 ++++++++++++++++++ 2 files changed, 24 insertions(+), 18 deletions(-) create mode 100644 contrib/tag_history/theme.php diff --git a/contrib/tag_history/main.php b/contrib/tag_history/main.php index 45585233..2118e6b3 100644 --- a/contrib/tag_history/main.php +++ b/contrib/tag_history/main.php @@ -1,7 +1,11 @@ theme)) $this->theme = get_theme_object("tag_history", "Tag_HistoryTheme"); + if(is_a($event, 'InitExtEvent')) { // shimmie is being installed so call install to create the table. global $config; @@ -21,22 +25,13 @@ class Tag_History extends Extension { { // must be an attempt to view a tag history $image_id = int_escape($event->get_arg(0)); - global $page; - global $config; - $page_heading = "Tag History: $image_id"; - $page->set_title("Image $image_id Tag History"); - $page->set_heading($page_heading); - - $page->add_block(new NavBlock()); - $page->add_block(new Block("Tag History", $this->build_tag_history($image_id), "main", 10)); + $this->theme->display_history_page($event->page, $image_id, $this->build_tag_history($image_id)); } - } if(is_a($event, 'DisplayingImageEvent')) { // handle displaying a link on the view page - global $page; - $page->add_block(new Block(null, $this->build_link($event->image->id), "main", 5)); + $this->theme->display_history_link($event->page, $event->image->id); } if(is_a($event, 'ImageDeletionEvent')) { @@ -53,7 +48,6 @@ class Tag_History extends Extension { if(is_a($event, 'TagSetEvent')) { $this->add_tag_history($event->image_id); } - } protected function install() @@ -172,12 +166,6 @@ class Tag_History extends Extension { return ($row ? $row : null); } - private function build_link($image_id) - { - // this function is called when a user is viewing an image - return "Tag History\n"; - } - private function delete_all_tag_history($image_id) { // this function is called when an image has been deleted diff --git a/contrib/tag_history/theme.php b/contrib/tag_history/theme.php new file mode 100644 index 00000000..6e337d95 --- /dev/null +++ b/contrib/tag_history/theme.php @@ -0,0 +1,18 @@ +set_title("Image $image_id Tag History"); + $page->set_heading($page_heading); + + $page->add_block(new NavBlock()); + $page->add_block(new Block("Tag History", $history, "main", 10)); + } + + public function display_history_link($page, $image_id) { + $link = "Tag History\n"; + $page->add_block(new Block(null, $link, "main", 5)); + } +} +?>