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
@ -1,7 +1,11 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
class Tag_History extends Extension {
|
class Tag_History extends Extension {
|
||||||
|
var $theme;
|
||||||
|
|
||||||
public function receive_event($event) {
|
public function receive_event($event) {
|
||||||
|
if(is_null($this->theme)) $this->theme = get_theme_object("tag_history", "Tag_HistoryTheme");
|
||||||
|
|
||||||
if(is_a($event, 'InitExtEvent')) {
|
if(is_a($event, 'InitExtEvent')) {
|
||||||
// shimmie is being installed so call install to create the table.
|
// shimmie is being installed so call install to create the table.
|
||||||
global $config;
|
global $config;
|
||||||
@ -21,22 +25,13 @@ class Tag_History extends Extension {
|
|||||||
{
|
{
|
||||||
// must be an attempt to view a tag history
|
// must be an attempt to view a tag history
|
||||||
$image_id = int_escape($event->get_arg(0));
|
$image_id = int_escape($event->get_arg(0));
|
||||||
global $page;
|
$this->theme->display_history_page($event->page, $image_id, $this->build_tag_history($image_id));
|
||||||
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));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
if(is_a($event, 'DisplayingImageEvent'))
|
if(is_a($event, 'DisplayingImageEvent'))
|
||||||
{
|
{
|
||||||
// handle displaying a link on the view page
|
// handle displaying a link on the view page
|
||||||
global $page;
|
$this->theme->display_history_link($event->page, $event->image->id);
|
||||||
$page->add_block(new Block(null, $this->build_link($event->image->id), "main", 5));
|
|
||||||
}
|
}
|
||||||
if(is_a($event, 'ImageDeletionEvent'))
|
if(is_a($event, 'ImageDeletionEvent'))
|
||||||
{
|
{
|
||||||
@ -53,7 +48,6 @@ class Tag_History extends Extension {
|
|||||||
if(is_a($event, 'TagSetEvent')) {
|
if(is_a($event, 'TagSetEvent')) {
|
||||||
$this->add_tag_history($event->image_id);
|
$this->add_tag_history($event->image_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function install()
|
protected function install()
|
||||||
@ -172,12 +166,6 @@ class Tag_History extends Extension {
|
|||||||
return ($row ? $row : null);
|
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)
|
private function delete_all_tag_history($image_id)
|
||||||
{
|
{
|
||||||
// this function is called when an image has been deleted
|
// 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));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
Loading…
x
Reference in New Issue
Block a user