From 1a96ce145cfa529708852a46d4cab3c0d4d1b37e Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Mon, 20 Jul 2009 20:47:47 -0700 Subject: Don't let the task status message exceed the size of the status column when there's an error. --- modules/gallery/helpers/task.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'modules/gallery/helpers') diff --git a/modules/gallery/helpers/task.php b/modules/gallery/helpers/task.php index 6a9f63c2..352fe522 100644 --- a/modules/gallery/helpers/task.php +++ b/modules/gallery/helpers/task.php @@ -87,7 +87,7 @@ class task_Core { $task->log($e->__toString()); $task->state = "error"; $task->done = true; - $task->status = $e->getMessage(); + $task->status = substr($e->getMessage(), 0, 255); $task->save(); } -- cgit v1.2.3 From 90ba32065578289898040f686cce766bfeb9cb51 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Tue, 21 Jul 2009 11:25:03 -0700 Subject: The RSS link should go to the parent album when looking at photos/movies. Fixes ticket #566. --- modules/gallery/helpers/gallery_theme.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'modules/gallery/helpers') diff --git a/modules/gallery/helpers/gallery_theme.php b/modules/gallery/helpers/gallery_theme.php index 226b8a42..f245ea31 100644 --- a/modules/gallery/helpers/gallery_theme.php +++ b/modules/gallery/helpers/gallery_theme.php @@ -32,7 +32,11 @@ class gallery_theme_Core { if (module::is_active("rss")) { if ($item = $theme->item()) { - $buf .= rss::feed_link("gallery/album/{$item->id}"); + if ($item->is_album()) { + $buf .= rss::feed_link("gallery/album/{$item->id}"); + } else { + $buf .= rss::feed_link("gallery/album/{$item->parent()->id}"); + } } else if ($tag = $theme->tag()) { $buf .= rss::feed_link("tag/tag/{$tag->id}"); } -- cgit v1.2.3 From 9f410ec764cdb8ece4dc6ce1fb1754afad929335 Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Tue, 21 Jul 2009 15:49:42 -0700 Subject: Always display the option menu so that modules with options that require menu items with view permission have somewhere to hang these menu items from. If its empty it will get removed by $menu->compact() --- modules/gallery/helpers/gallery_menu.php | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) (limited to 'modules/gallery/helpers') diff --git a/modules/gallery/helpers/gallery_menu.php b/modules/gallery/helpers/gallery_menu.php index b6f763b8..040b19e1 100644 --- a/modules/gallery/helpers/gallery_menu.php +++ b/modules/gallery/helpers/gallery_menu.php @@ -19,8 +19,6 @@ */ class gallery_menu_Core { static function site($menu, $theme) { - $is_admin = user::active()->admin; - $menu->append(Menu::factory("link") ->id("home") ->label(t("Home")) @@ -28,8 +26,8 @@ class gallery_menu_Core { $item = $theme->item(); - $can_edit = $item && access::can("edit", $item) || $is_admin; - $can_add = $item && (access::can("add", $item) || $is_admin); + $can_edit = $item && access::can("edit", $item); + $can_add = $item && access::can("add", $item); if ($can_add) { $menu->append(Menu::factory("dialog") @@ -38,11 +36,10 @@ class gallery_menu_Core { ->url(url::site("simple_uploader/app/$item->id"))); } - if ($item && $can_edit || $can_add) { - $menu->append($options_menu = Menu::factory("submenu") - ->id("options_menu") - ->label(t("Options"))); - + $menu->append($options_menu = Menu::factory("submenu") + ->id("options_menu") + ->label(t("Options"))); + if ($item && ($can_edit || $can_add)) { if ($can_edit) { $options_menu ->append(Menu::factory("dialog") @@ -71,7 +68,7 @@ class gallery_menu_Core { } } - if ($is_admin) { + if (user::active()->admin) { $menu->append($admin_menu = Menu::factory("submenu") ->id("admin_menu") ->label(t("Admin"))); -- cgit v1.2.3 From f533aee1cc71e8db739406859ac0cf43dce030ec Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Tue, 21 Jul 2009 15:52:46 -0700 Subject: Add an API method user_can that allows for checking a specific user has the specified permission to the item. Changed can to delegate to this method passing in the active user. --- modules/gallery/helpers/access.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'modules/gallery/helpers') diff --git a/modules/gallery/helpers/access.php b/modules/gallery/helpers/access.php index 63324e5d..224b51e0 100644 --- a/modules/gallery/helpers/access.php +++ b/modules/gallery/helpers/access.php @@ -78,11 +78,23 @@ class access_Core { * @return boolean */ static function can($perm_name, $item) { + return self::user_can(user::active(), $perm_name, $item); + } + + /** + * Does the user have this permission on this item? + * + * @param User_Model $user + * @param string $perm_name + * @param Item_Model $item + * @return boolean + */ + static function user_can($user, $perm_name, $item) { if (!$item->loaded) { return false; } - if (user::active()->admin) { + if ($user->admin) { return true; } -- cgit v1.2.3