the last of the theme 2.0 work?
git-svn-id: file:///home/shish/svn/shimmie2/trunk@334 7f39781d-f577-437e-ae19-be835c7a54ca
This commit is contained in:
parent
ef7044ce48
commit
83b3f099d9
2 changed files with 24 additions and 18 deletions
|
@ -1,7 +1,11 @@
|
|||
<?php
|
||||
|
||||
class Tag_History extends Extension {
|
||||
var $theme;
|
||||
|
||||
public function receive_event($event) {
|
||||
if(is_null($this->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 "<a href='".make_link("tag_history/$image_id")."'>Tag History</a>\n";
|
||||
}
|
||||
|
||||
private function delete_all_tag_history($image_id)
|
||||
{
|
||||
// this function is called when an image has been deleted
|
||||
|
|
18
contrib/tag_history/theme.php
Normal file
18
contrib/tag_history/theme.php
Normal file
|
@ -0,0 +1,18 @@
|
|||
<?php
|
||||
|
||||
class Tag_HistoryTheme extends Themelet {
|
||||
public function display_history_page($page, $image_id, $history) {
|
||||
$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", $history, "main", 10));
|
||||
}
|
||||
|
||||
public function display_history_link($page, $image_id) {
|
||||
$link = "<a href='".make_link("tag_history/$image_id")."'>Tag History</a>\n";
|
||||
$page->add_block(new Block(null, $link, "main", 5));
|
||||
}
|
||||
}
|
||||
?>
|
Reference in a new issue