summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorBharat Mediratta <bharat@menalto.com>2009-07-23 17:15:53 -0700
committerBharat Mediratta <bharat@menalto.com>2009-07-23 17:15:53 -0700
commit01aea268e67e2e036da138abc66de45ff62540ee (patch)
tree02727ba62dd2fda5e5b753f37744e77080f7e829 /modules
parent0bf69c63d852e2a33b79a5bca2dcdc16066e8937 (diff)
Disable the album cover icon if the item is already the current album cover.
Diffstat (limited to 'modules')
-rw-r--r--modules/gallery/helpers/gallery_quick.php16
1 files changed, 12 insertions, 4 deletions
diff --git a/modules/gallery/helpers/gallery_quick.php b/modules/gallery/helpers/gallery_quick.php
index d0ffc584..8a92890b 100644
--- a/modules/gallery/helpers/gallery_quick.php
+++ b/modules/gallery/helpers/gallery_quick.php
@@ -108,12 +108,20 @@ class gallery_quick_Core {
"href" => url::site("move/browse/$item->id"));
}
- if (access::can("edit", $item->parent())) {
- $disabledState =
- $item->type == "album" && empty($item->album_cover_item_id) ? " ui-state-disabled" : "";
+ $parent = $item->parent();
+ if (access::can("edit", $parent)) {
+ // We can't make this item the highlight if it's an album with no album cover, or if it's
+ // already the album cover.
+ if (($item->type == "album" && empty($item->album_cover_item_id)) ||
+ ($item->type == "album" && $parent->album_cover_item_id == $item->album_cover_item_id) ||
+ $parent->album_cover_item_id == $item->id) {
+ $disabledState = " ui-state-disabled";
+ } else {
+ $disabledState = " ";
+ }
$elements["right"][] = (object)array(
"title" => $cover_title,
- "class" => "gButtonLink{$disabledState}",
+ "class" => "gButtonLink$disabledState",
"icon" => "ui-icon-star",
"href" => url::site("quick/make_album_cover/$item->id?csrf=$csrf&page_type=$page_type"));