TagFaces bugfix.
This commit is contained in:
parent
84f9e25c42
commit
29001ad186
@ -26,6 +26,19 @@ class tagfaces_Controller extends Controller {
|
||||
access::required("view", $item);
|
||||
access::required("edit", $item);
|
||||
|
||||
// Make sure the item actually has tags on it.
|
||||
$all_tags = ORM::factory("tag")
|
||||
->join("items_tags", "tags.id", "items_tags.tag_id")
|
||||
->where("items_tags.item_id", $id)
|
||||
->find_all();
|
||||
|
||||
// If it doesn't, display an error and direct back to the photo.
|
||||
if (count($all_tags) == 0) {
|
||||
message::error(t("Please add some tags first."));
|
||||
url::redirect(url::abs_site("{$item->type}s/{$item->id}"));
|
||||
|
||||
}
|
||||
|
||||
// Create the page.
|
||||
$template = new Theme_View("page.html", "drawfaces");
|
||||
$template->set_global("item_id", $id);
|
||||
|
@ -34,10 +34,14 @@ class tagfaces_event_Core {
|
||||
|
||||
static function site_menu($menu, $theme) {
|
||||
// Create a menu option for adding face data.
|
||||
if (!$theme->item()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$item = $theme->item();
|
||||
|
||||
if ((access::can("view", $item)) && (access::can("edit", $item))) {
|
||||
if ($item->is_photo()) {
|
||||
if ($item->is_photo()) {
|
||||
if ((access::can("view", $item)) && (access::can("edit", $item))) {
|
||||
$menu->get("options_menu")
|
||||
->append(Menu::factory("link")
|
||||
->id("tagfaces")
|
||||
|
Reference in New Issue
Block a user