that we move around. A race
condition happens when you mouse over two thumbnails quickly. Whichever
server response loses the race gets displayed, and sometimes it's the one
that you're no longer hovering over.
Fix it by changing gQuickPane to be a class and creating a
per
thumbnail.
Fixes ticket #290.
---
modules/gallery/css/quick.css | 12 ++++++------
modules/gallery/js/quick.js | 20 ++++++++------------
modules/gallery/views/quick_pane.html.php | 2 +-
themes/default/css/fix-ie.css | 4 ++--
4 files changed, 17 insertions(+), 21 deletions(-)
diff --git a/modules/gallery/css/quick.css b/modules/gallery/css/quick.css
index 0e45eac2..f153d475 100644
--- a/modules/gallery/css/quick.css
+++ b/modules/gallery/css/quick.css
@@ -1,4 +1,4 @@
-#gQuickPane {
+.gQuickPane {
position: absolute;
top: 0;
left: 0;
@@ -17,7 +17,7 @@
padding: 0 !important;
}
-#gQuickPane {
+.gQuickPane {
background: #000;
border-bottom: 1px solid #ccc;
opacity: 0.9;
@@ -26,19 +26,19 @@
left: 0;
}
-#gQuickPane a {
+.gQuickPane a {
cursor: pointer;
float: left;
margin: 4px;
}
-#gQuickPaneOptions {
+.gQuickPaneOptions {
background: #000;
float: left;
width: 100%;
}
-#gQuickPaneOptions li a {
+.gQuickPaneOptions li a {
display: block;
float: none;
width: auto;
@@ -47,6 +47,6 @@
text-align: left;
}
-#gQuickPaneOptions li a:hover {
+.gQuickPaneOptions li a:hover {
background-color: #4d4d4d;
}
diff --git a/modules/gallery/js/quick.js b/modules/gallery/js/quick.js
index 3ac97f8e..fda6470f 100644
--- a/modules/gallery/js/quick.js
+++ b/modules/gallery/js/quick.js
@@ -12,15 +12,15 @@ var show_quick = function() {
var cont = $(this);
var quick = $(this).find(".gQuick");
var img = cont.find(".gThumbnail,.gResize");
- $("#gQuickPane").remove();
- cont.append("
");
- $("#gQuickPane").hide();
- cont.hover(function() {}, hide_quick);
+ cont.find(".gQuickPane").remove();
+ cont.append("
");
+ cont.find(".gQuickPane").hide();
+ cont.hover(function() {}, function() { cont.find(".gQuickPane").remove(); });
$.get(
quick.attr("href"),
{},
function(data, textStatus) {
- $("#gQuickPane").html(data).slideDown("fast");
+ cont.find(".gQuickPane").html(data).slideDown("fast");
$(".ui-state-default").hover(
function() {
$(this).addClass("ui-state-hover");
@@ -29,13 +29,13 @@ var show_quick = function() {
$(this).removeClass("ui-state-hover");
}
);
- $("#gQuickPane a:not(.options)").click(function(e) {
+ cont.find(".gQuickPane a:not(.options)").click(function(e) {
e.preventDefault();
quick_do(cont, $(this), img);
});
- $("#gQuickPane a.options").click(function(e) {
+ cont.find(".gQuickPane a.options").click(function(e) {
e.preventDefault();
- $("#gQuickPaneOptions").slideToggle("fast");
+ cont.find(".gQuickPaneOptions").slideToggle("fast");
});
}
);
@@ -76,7 +76,3 @@ var quick_do = function(cont, pane, img) {
}
return false;
};
-
-var hide_quick = function() {
- $("#gQuickPane").remove();
-};
diff --git a/modules/gallery/views/quick_pane.html.php b/modules/gallery/views/quick_pane.html.php
index eabf4a67..e5469696 100644
--- a/modules/gallery/views/quick_pane.html.php
+++ b/modules/gallery/views/quick_pane.html.php
@@ -15,7 +15,7 @@
-
+
foreach ($button_list->additional as $button): ?>
-
diff --git a/themes/default/css/fix-ie.css b/themes/default/css/fix-ie.css
index 3d9604e6..d071abac 100644
--- a/themes/default/css/fix-ie.css
+++ b/themes/default/css/fix-ie.css
@@ -45,6 +45,6 @@ input.submit {
width: 60px;
}
-#gQuickPane {
+.gQuickPane {
height: 32px !important;
-}
\ No newline at end of file
+}
--
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(-)
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(-)
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