From b0e7dded2362de6cc7b2bfad47286de322d79064 Mon Sep 17 00:00:00 2001
From: Bharat Mediratta
Date: Sun, 14 Jun 2009 08:15:32 +0800
Subject: Add a warning about eAccelerator interfering with g2_import.
Signed-off-by:
---
modules/g2_import/views/admin_g2_import.html.php | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
(limited to 'modules')
diff --git a/modules/g2_import/views/admin_g2_import.html.php b/modules/g2_import/views/admin_g2_import.html.php
index c0ee2b17..d5e29e12 100644
--- a/modules/g2_import/views/admin_g2_import.html.php
+++ b/modules/g2_import/views/admin_g2_import.html.php
@@ -3,7 +3,10 @@
= t("Gallery 2 Import") ?>
= t("Import your Gallery 2 users, photos, movies, comments and tags into your new Gallery 3 installation.") ?>
- = t("Note: The importer is a work in progress and does not currently support permissions, and movie formats other than Flash video and MP4") ?>
+
+ = t("Note: The importer is a work in progress and does not currently support permissions, and movie formats other than Flash video and MP4") ?>
+
+ = t("Note: The importer has known issues with the eAccelerator PHP accelerator. If you're using eAccelerator, please disable it. One way to do that is to put php_value eaccelerator.enable 0 in gallery3/.htaccess") ?>
= $form ?>
--
cgit v1.2.3
From fda706f55cab4bd65b90e25a82b59a83e40443ed Mon Sep 17 00:00:00 2001
From: Bharat Mediratta
Date: Mon, 15 Jun 2009 01:41:34 +0800
Subject: Get rid of the word "items" in the delete confirmation dialog.
Signed-off-by:
---
modules/gallery/controllers/quick.php | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
(limited to 'modules')
diff --git a/modules/gallery/controllers/quick.php b/modules/gallery/controllers/quick.php
index 30383307..cff6686b 100644
--- a/modules/gallery/controllers/quick.php
+++ b/modules/gallery/controllers/quick.php
@@ -101,7 +101,9 @@ class Quick_Controller extends Controller {
access::required("edit", $item);
if ($item->is_album()) {
- print t("Delete the album %title? All items within the album will also be deleted.", array("title" => $item->title));
+ print t(
+ "Delete the album %title? All photos and movies in the album will also be deleted.",
+ array("title" => $item->title));
} else {
print t("Are you sure you want to delete %title?", array("title" => $item->title));
}
--
cgit v1.2.3
From 10d9c6a92ac0002b4838d6a4056fe9cce5b934ba Mon Sep 17 00:00:00 2001
From: Tim Almdal
Date: Mon, 15 Jun 2009 01:13:12 +0800
Subject: Rename Rss_Controller::__call to Rss_Controller::feed, which changes
the feed url to rss/feed//[] Where feed name is the name of
the feed (i.e. albums, updates, comments, tags etc.) and id is the optional
element id that the feed applies to.
Signed-off-by:
---
modules/rss/controllers/rss.php | 5 ++---
modules/rss/helpers/rss.php | 6 +++---
2 files changed, 5 insertions(+), 6 deletions(-)
(limited to 'modules')
diff --git a/modules/rss/controllers/rss.php b/modules/rss/controllers/rss.php
index 164803cb..8cf083db 100644
--- a/modules/rss/controllers/rss.php
+++ b/modules/rss/controllers/rss.php
@@ -20,10 +20,9 @@
class Rss_Controller extends Controller {
public static $page_size = 30;
- public function __call($method, $arguments) {
- $id = empty($arguments) ? null : $arguments[0];
+ public function feed($method, $id=null) {
$page = $this->input->get("page", 1);
- $feed_uri = "rss/$method" . (empty($id) ? "" : "/$id");
+ $feed_uri = "rss/feed/$method" . (empty($id) ? "" : "/$id");
if ($page < 1) {
url::redirect($feed_uri);
}
diff --git a/modules/rss/helpers/rss.php b/modules/rss/helpers/rss.php
index 1d30425f..3c278b49 100644
--- a/modules/rss/helpers/rss.php
+++ b/modules/rss/helpers/rss.php
@@ -21,11 +21,11 @@
class rss_Core {
static function item_feed($item) {
$id = $item->is_album() ? $item->id : $item->parent_id;
- return url::site("rss/albums/$id");
+ return url::site("rss/feed/albums/$id");
}
static function tag_feed($tag) {
- return url::site("rss/tags/$tag->id}");
+ return url::site("rss/feed/tags/$tag->id}");
}
/**
@@ -40,7 +40,7 @@ class rss_Core {
if ($sidebar_only && !$feed["sidebar"]) {
continue;
}
- $feeds[$feed["description"]] = url::site("rss/{$feed['uri']}");
+ $feeds[$feed["description"]] = url::site("rss/feed/{$feed['uri']}");
}
}
}
--
cgit v1.2.3
From 879e81f0a1fc4477a8e563d45348330706b6da8a Mon Sep 17 00:00:00 2001
From: Tim Almdal
Date: Mon, 15 Jun 2009 02:20:08 +0800
Subject: Rename: rss::get_feeds() -> rss::available_feeds()
rss::process_feed() -> rss::feed_data()
Signed-off-by:
---
modules/rss/controllers/rss.php | 2 +-
modules/rss/helpers/rss.php | 4 ++--
modules/rss/helpers/rss_theme.php | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)
(limited to 'modules')
diff --git a/modules/rss/controllers/rss.php b/modules/rss/controllers/rss.php
index 8cf083db..8c3544e4 100644
--- a/modules/rss/controllers/rss.php
+++ b/modules/rss/controllers/rss.php
@@ -27,7 +27,7 @@ class Rss_Controller extends Controller {
url::redirect($feed_uri);
}
- $feed = rss::process_feed($method, ($page - 1) * self::$page_size, self::$page_size, $id);
+ $feed = rss::feed_data($method, ($page - 1) * self::$page_size, self::$page_size, $id);
if ($feed->max_pages && $page > $feed->max_pages) {
url::redirect("$feed_uri?page={$feed->max_pages}");
}
diff --git a/modules/rss/helpers/rss.php b/modules/rss/helpers/rss.php
index 3c278b49..cf42ec28 100644
--- a/modules/rss/helpers/rss.php
+++ b/modules/rss/helpers/rss.php
@@ -31,7 +31,7 @@ class rss_Core {
/**
* Get all available rss feeds
*/
- static function get_feeds($item, $sidebar_only=true) {
+ static function available_feeds($item, $sidebar_only=true) {
$feeds = array();
foreach (module::active() as $module) {
$class_name = "{$module->name}_rss";
@@ -48,7 +48,7 @@ class rss_Core {
return $feeds;
}
- static function process_feed($feed, $offset, $limit, $id) {
+ static function feed_data($feed, $offset, $limit, $id) {
foreach (module::active() as $module) {
$class_name = "{$module->name}_rss";
if (method_exists($class_name, $feed)) {
diff --git a/modules/rss/helpers/rss_theme.php b/modules/rss/helpers/rss_theme.php
index b82133bd..0f12b475 100644
--- a/modules/rss/helpers/rss_theme.php
+++ b/modules/rss/helpers/rss_theme.php
@@ -40,7 +40,7 @@ class rss_theme_Core {
$block->css_id = "gRss";
$block->title = t("Available RSS Feeds");
$block->content = new View("rss_block.html");
- $block->content->feeds = rss::get_feeds($theme->item());
+ $block->content->feeds = rss::available_feeds($theme->item());
return $block;
}
--
cgit v1.2.3
From fdbffc870d84ec035068420f5a8b4292d7aade13 Mon Sep 17 00:00:00 2001
From: Tim Almdal
Date: Mon, 15 Jun 2009 02:39:53 +0800
Subject: Remove rss:item_feed, rss::tag_fead and rss_theme::head and move that
functionality in the _theme::head function. Created
rss::feed_link to wrap the module supplied uri in the html link element.
Signed-off-by:
---
modules/gallery/helpers/gallery_theme.php | 4 ++++
modules/rss/helpers/rss.php | 10 +++-------
modules/rss/helpers/rss_theme.php | 12 ------------
modules/tag/helpers/tag_theme.php | 6 +++++-
4 files changed, 12 insertions(+), 20 deletions(-)
(limited to 'modules')
diff --git a/modules/gallery/helpers/gallery_theme.php b/modules/gallery/helpers/gallery_theme.php
index f955e8f7..290434ed 100644
--- a/modules/gallery/helpers/gallery_theme.php
+++ b/modules/gallery/helpers/gallery_theme.php
@@ -42,6 +42,10 @@ class gallery_theme_Core {
$buf .= html::script("modules/gallery/js/fullsize.js");
}
+ if ($theme->item()) {
+ $buf .= rss::feed_link("albums/{$theme->item()->id}");
+ }
+
if ($session->get("l10n_mode", false)) {
$buf .= "";
diff --git a/modules/rss/helpers/rss.php b/modules/rss/helpers/rss.php
index cf42ec28..e4d6f5e9 100644
--- a/modules/rss/helpers/rss.php
+++ b/modules/rss/helpers/rss.php
@@ -19,13 +19,9 @@
*/
class rss_Core {
- static function item_feed($item) {
- $id = $item->is_album() ? $item->id : $item->parent_id;
- return url::site("rss/feed/albums/$id");
- }
-
- static function tag_feed($tag) {
- return url::site("rss/feed/tags/$tag->id}");
+ static function feed_link($uri) {
+ $url = url::site("rss/feed/$uri");
+ return "";
}
/**
diff --git a/modules/rss/helpers/rss_theme.php b/modules/rss/helpers/rss_theme.php
index 0f12b475..52d988bf 100644
--- a/modules/rss/helpers/rss_theme.php
+++ b/modules/rss/helpers/rss_theme.php
@@ -18,18 +18,6 @@
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
*/
class rss_theme_Core {
- static function head($theme) {
- if ($theme->item()) {
- $url = rss::item_feed($theme->item());
- } else if ($theme->tag()) {
- $url = rss::tag_feed($theme->tag());
- }
-
- if (!empty($url)) {
- return "";
- }
- }
-
static function sidebar_blocks($theme) {
// @todo this needs to be data driven
if (!$theme->item()) {
diff --git a/modules/tag/helpers/tag_theme.php b/modules/tag/helpers/tag_theme.php
index a32d71b6..45f55986 100644
--- a/modules/tag/helpers/tag_theme.php
+++ b/modules/tag/helpers/tag_theme.php
@@ -20,7 +20,11 @@
class tag_theme_Core {
static function head($theme) {
$url = url::file("modules/tag/js/tag.js");
- return "";
+ $head[] = "";
+ if ($theme->tag() && module::is_active("rss")) {
+ $head[] = rss::feed_link("tags/{$theme->tag()->id}");
+ }
+ return implode("\n", $head);
}
static function sidebar_blocks($theme) {
--
cgit v1.2.3
From 6007843c4acf3a83580989351de73ae64a2e61ed Mon Sep 17 00:00:00 2001
From: Tim Almdal
Date: Mon, 15 Jun 2009 03:09:47 +0800
Subject: Remove the sidebar flag from the feed definition returned by
available_feeds and replace with a type field with one of two values (head
and block). We need to do this to determine what fields go in the rss block
so we can ignore the definitions that are related to the page head when
creating the rss block that goes into the sidebar.
Signed-off-by:
---
modules/comment/helpers/comment_rss.php | 4 ++--
modules/gallery/helpers/gallery_rss.php | 4 ++--
modules/rss/helpers/rss.php | 7 +++----
modules/tag/helpers/tag_rss.php | 2 +-
4 files changed, 8 insertions(+), 9 deletions(-)
(limited to 'modules')
diff --git a/modules/comment/helpers/comment_rss.php b/modules/comment/helpers/comment_rss.php
index b191c326..2e958eef 100644
--- a/modules/comment/helpers/comment_rss.php
+++ b/modules/comment/helpers/comment_rss.php
@@ -21,10 +21,10 @@
class comment_rss_Core {
static function available_feeds($item) {
return array(array("description" => t("All new comments"),
- "sidebar" => true,
+ "type" => "block",
"uri" => "comments"),
array("description" => sprintf(t("Comments on %s"), $item->title),
- "sidebar" => true,
+ "type" => "block",
"uri" => "comments/{$item->id}"));
}
diff --git a/modules/gallery/helpers/gallery_rss.php b/modules/gallery/helpers/gallery_rss.php
index 6e722ff6..455e210f 100644
--- a/modules/gallery/helpers/gallery_rss.php
+++ b/modules/gallery/helpers/gallery_rss.php
@@ -21,10 +21,10 @@
class gallery_rss_Core {
static function available_feeds($item) {
return array(array("description" => t("New photos or movies"),
- "sidebar" => true,
+ "type" => "block",
"uri" => "updates"),
array("description" => t("Album feed"),
- "sidebar" => false,
+ "type" => "head",
"uri" => "albums"));
}
diff --git a/modules/rss/helpers/rss.php b/modules/rss/helpers/rss.php
index e4d6f5e9..403ee225 100644
--- a/modules/rss/helpers/rss.php
+++ b/modules/rss/helpers/rss.php
@@ -27,16 +27,15 @@ class rss_Core {
/**
* Get all available rss feeds
*/
- static function available_feeds($item, $sidebar_only=true) {
+ static function available_feeds($item) {
$feeds = array();
foreach (module::active() as $module) {
$class_name = "{$module->name}_rss";
if (method_exists($class_name, "available_feeds")) {
foreach (call_user_func(array($class_name, "available_feeds"), $item) as $feed) {
- if ($sidebar_only && !$feed["sidebar"]) {
- continue;
+ if ($feed["type"] == "block") {
+ $feeds[$feed["description"]] = url::site("rss/feed/{$feed['uri']}");
}
- $feeds[$feed["description"]] = url::site("rss/feed/{$feed['uri']}");
}
}
}
diff --git a/modules/tag/helpers/tag_rss.php b/modules/tag/helpers/tag_rss.php
index ace7fd6a..7846edf6 100644
--- a/modules/tag/helpers/tag_rss.php
+++ b/modules/tag/helpers/tag_rss.php
@@ -21,7 +21,7 @@
class tag_rss_Core {
static function available_feeds($item) {
return array(array("description" => t("Tag Album feed"),
- "sidebar" => false,
+ "type" => "head",
"uri" => "tags"));
}
--
cgit v1.2.3
From 83d1b15c1e9ca89cc55879a5582cd9abafc5a792 Mon Sep 17 00:00:00 2001
From: Tim Almdal
Date: Mon, 15 Jun 2009 03:38:57 +0800
Subject: Don't use stdClass to return the feed data. Just use an array.
Signed-off-by:
---
modules/comment/helpers/comment_rss.php | 15 +++++++--------
modules/gallery/helpers/gallery_rss.php | 22 ++++++++++------------
modules/rss/controllers/rss.php | 14 +++++++++-----
modules/tag/helpers/tag_rss.php | 11 +++++------
4 files changed, 31 insertions(+), 31 deletions(-)
(limited to 'modules')
diff --git a/modules/comment/helpers/comment_rss.php b/modules/comment/helpers/comment_rss.php
index 2e958eef..56de4284 100644
--- a/modules/comment/helpers/comment_rss.php
+++ b/modules/comment/helpers/comment_rss.php
@@ -29,7 +29,6 @@ class comment_rss_Core {
}
static function comments($offset, $limit, $id) {
- $feed = new stdClass();
$orm = ORM::factory("comment")
->where("state", "published")
->orderby("created", "DESC");
@@ -37,12 +36,12 @@ class comment_rss_Core {
$orm->where("item_id", $id);
}
- $feed->view = "comment.mrss";
+ $feed["view"] = "comment.mrss";
$comments = $orm->find_all($limit, $offset);
- $feed->data["children"] = array();
+ $feed["children"] = array();
foreach ($comments as $comment) {
$item = $comment->item();
- $feed->data["children"][] = array(
+ $feed["children"][] = array(
"pub_date" => date("D, d M Y H:i:s T", $comment->created),
"text" => htmlspecialchars($comment->text),
"thumb_url" => $item->thumb_url(),
@@ -55,10 +54,10 @@ class comment_rss_Core {
);
}
- $feed->max_pages = ceil($comments->count() / $limit);
- $feed->data["title"] = htmlspecialchars(t("Recent Comments"));
- $feed->data["link"] = url::abs_site("albums/" . (empty($id) ? "1" : $id));
- $feed->data["description"] = t("Recent Comments");
+ $feed["max_pages"] = ceil($comments->count() / $limit);
+ $feed["title"] = htmlspecialchars(t("Recent Comments"));
+ $feed["link"] = url::abs_site("albums/" . (empty($id) ? "1" : $id));
+ $feed["description"] = t("Recent Comments");
return $feed;
}
diff --git a/modules/gallery/helpers/gallery_rss.php b/modules/gallery/helpers/gallery_rss.php
index 455e210f..6535d29d 100644
--- a/modules/gallery/helpers/gallery_rss.php
+++ b/modules/gallery/helpers/gallery_rss.php
@@ -29,16 +29,15 @@ class gallery_rss_Core {
}
static function updates($offset, $limit) {
- $feed = new stdClass();
- $feed->data["children"] = ORM::factory("item")
+ $feed["children"] = ORM::factory("item")
->viewable()
->where("type !=", "album")
->orderby("created", "DESC")
->find_all($limit, $offset);
- $feed->max_pages = ceil($feed->data["children"]->count() / $limit);
- $feed->data["title"] = t("Recent Updates");
- $feed->data["link"] = url::abs_site("albums/1");
- $feed->data["description"] = t("Recent Updates");
+ $feed["max_pages"] = ceil($feed["children"]->count() / $limit);
+ $feed["title"] = t("Recent Updates");
+ $feed["link"] = url::abs_site("albums/1");
+ $feed["description"] = t("Recent Updates");
return $feed;
}
@@ -47,14 +46,13 @@ class gallery_rss_Core {
$item = ORM::factory("item", $id);
access::required("view", $item);
- $feed = new stdClass();
- $feed->data["children"] = $item
+ $feed["children"] = $item
->viewable()
->descendants($limit, $offset, "photo");
- $feed->max_pages = ceil($item->viewable()->descendants_count("photo") / $limit);
- $feed->data["title"] = $item->title;
- $feed->data["link"] = url::abs_site("albums/{$item->id}");
- $feed->data["description"] = $item->description;
+ $feed["max_pages"] = ceil($item->viewable()->descendants_count("photo") / $limit);
+ $feed["title"] = $item->title;
+ $feed["link"] = url::abs_site("albums/{$item->id}");
+ $feed["description"] = $item->description;
return $feed;
}
diff --git a/modules/rss/controllers/rss.php b/modules/rss/controllers/rss.php
index 8c3544e4..80803dfd 100644
--- a/modules/rss/controllers/rss.php
+++ b/modules/rss/controllers/rss.php
@@ -28,12 +28,16 @@ class Rss_Controller extends Controller {
}
$feed = rss::feed_data($method, ($page - 1) * self::$page_size, self::$page_size, $id);
- if ($feed->max_pages && $page > $feed->max_pages) {
- url::redirect("$feed_uri?page={$feed->max_pages}");
+ $max_pages = $feed["max_pages"];
+ if ($max_pages && $page > $max_pages) {
+ url::redirect("$feed_uri?page={$max_pages}");
}
+ unset($feed["max_pages"]);
- $view = new View(empty($feed->view) ? "feed.mrss" : $feed->view);
- foreach ($feed->data as $field => $value) {
+ $view = new View(empty($feed["view"]) ? "feed.mrss" : $feed["view"]);
+ unset($feed["view"]);
+
+ foreach ($feed as $field => $value) {
$view->$field = $value;
}
$view->feed_link = url::abs_site($feed_uri);
@@ -43,7 +47,7 @@ class Rss_Controller extends Controller {
$view->previous_page_link = url::site("$feed_uri?page={$previous_page}");
}
- if ($page < $feed->max_pages) {
+ if ($page < $max_pages) {
$next_page = $page + 1;
$view->next_page_link = url::site("$feed_uri?page={$next_page}");
}
diff --git a/modules/tag/helpers/tag_rss.php b/modules/tag/helpers/tag_rss.php
index 7846edf6..3d6399ca 100644
--- a/modules/tag/helpers/tag_rss.php
+++ b/modules/tag/helpers/tag_rss.php
@@ -31,12 +31,11 @@ class tag_rss_Core {
return Kohana::show_404();
}
- $feed = new stdClass();
- $feed->data["children"] = $tag->items($limit, $offset, "photo");
- $feed->max_pages = ceil($tag->count / $limit);
- $feed->data["title"] = $tag->name;
- $feed->data["link"] = url::abs_site("tags/{$tag->id}");
- $feed->data["description"] = t("Photos related to %tag_name", array("tag_name" => $tag->name));
+ $feed["children"] = $tag->items($limit, $offset, "photo");
+ $feed["max_pages"] = ceil($tag->count / $limit);
+ $feed["title"] = $tag->name;
+ $feed["link"] = url::abs_site("tags/{$tag->id}");
+ $feed["description"] = t("Photos related to %tag_name", array("tag_name" => $tag->name));
return $feed;
}
--
cgit v1.2.3
From 08a5b753453057dedb4c8d25bd68264f92ac0fb8 Mon Sep 17 00:00:00 2001
From: unostar
Date: Mon, 15 Jun 2009 02:02:25 -0700
Subject: Add string to localizer
---
modules/user/views/admin_users.html.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
(limited to 'modules')
diff --git a/modules/user/views/admin_users.html.php b/modules/user/views/admin_users.html.php
index 68486e6d..542b8b8b 100644
--- a/modules/user/views/admin_users.html.php
+++ b/modules/user/views/admin_users.html.php
@@ -60,7 +60,7 @@
');
+
+ $("#gFullsize").append('');
+ $("#gFullsizeClose").click(function() {
+ $("#gFullsizeOverlay*").remove();
+ $("#gFullsize").remove();
+ });
+ $(window).resize(function() {
+ $("#gFullsizeOverlay").width($(document).width());
+ $("#gFullsizeOverlay").height($(document).height());
+ image_size = _auto_fit(fullsize_detail.width, fullsize_detail.height);
+ $("#gFullsize").height(image_size.height);
+ $("#gFullsize").width(image_size.width);
+ $("#gFullsize").css("top", image_size.top);
+ $("#gFullsize").css("left", image_size.left);
+ $("#gFullSizeImage").height(image_size.height);
+ $("#gFullSizeImage").width(image_size.width);
+ });
+ });
+});
+
+/*
+ * Calculate the size of the image panel based on the size of the image and the size of the
+ * window. Scale the image so the entire panel fits in the view port.
+ */
+function _auto_fit(imageWidth, imageHeight) {
+ // ui-dialog gives a padding of 2 pixels
+ var windowWidth = $(window).width() - 10;
+ var windowHeight = $(window).height() - 10;
+
+ /* If the width is greater then scale the image width first */
+ if (imageWidth > windowWidth) {
+ var ratio = windowWidth / imageWidth;
+ imageWidth *= ratio;
+ imageHeight *= ratio;
+ }
+ /* after scaling the width, check that the height fits */
+ if (imageHeight > windowHeight) {
+ var ratio = windowHeight / imageHeight;
+ imageWidth *= ratio;
+ imageHeight *= ratio;
+ }
+
+ // handle the case where the calculation is almost zero (2.14e-14)
+ return {
+ top: ((windowHeight - imageHeight) / 2).toFixed(2),
+ left: ((windowWidth - imageWidth) / 2).toFixed(2),
+ width: imageWidth.toFixed(2),
+ height: imageHeight.toFixed(2)
+ };
+}
diff --git a/themes/default/views/photo.html.php b/themes/default/views/photo.html.php
index cc4cc750..0fbaa3e0 100644
--- a/themes/default/views/photo.html.php
+++ b/themes/default/views/photo.html.php
@@ -1,4 +1,17 @@
+
+ if (access::can("view_full", $theme->item())): ?>
+
+
+ endif ?>
+
= $theme->photo_top() ?>
--
cgit v1.2.3
From 15f3d58b0275c1e59d380730e01c061747e95067 Mon Sep 17 00:00:00 2001
From: Bharat Mediratta
Date: Wed, 17 Jun 2009 08:57:24 +0800
Subject: Add the real image url to the anchor elements for our full size links
so that right clicking works.
Turn the full size rendering code into a function and call it with
arguments, instead of creating a hacky named data structure to hold
the info.
Further partial fixes for ticket #427.
Signed-off-by:
---
modules/gallery/helpers/gallery_menu.php | 11 ++-
themes/default/js/fullsize.js | 134 +++++++++++++++----------------
themes/default/views/photo.html.php | 18 ++---
3 files changed, 80 insertions(+), 83 deletions(-)
(limited to 'modules')
diff --git a/modules/gallery/helpers/gallery_menu.php b/modules/gallery/helpers/gallery_menu.php
index 4499e50a..fb0234b1 100644
--- a/modules/gallery/helpers/gallery_menu.php
+++ b/modules/gallery/helpers/gallery_menu.php
@@ -96,12 +96,11 @@ class gallery_menu_Core {
static function photo($menu, $theme) {
if (access::can("view_full", $theme->item())) {
- $menu
- ->append(Menu::factory("link")
- ->id("fullsize")
- ->label(t("View full size"))
- ->url("#")
- ->css_class("gFullSizeLink"));
+ $menu->append(Menu::factory("link")
+ ->id("fullsize")
+ ->label(t("View full size"))
+ ->url($theme->item()->file_url())
+ ->css_class("gFullSizeLink"));
}
}
diff --git a/themes/default/js/fullsize.js b/themes/default/js/fullsize.js
index f95dc428..b2895c23 100644
--- a/themes/default/js/fullsize.js
+++ b/themes/default/js/fullsize.js
@@ -1,78 +1,76 @@
/**
* @todo Move inline CSS out to external style sheet (theme style sheet)
*/
-$(document).ready(function() {
- $(".gFullSizeLink").click(function() {
- var width = $(document).width();
- var height = $(document).height();
+var show_full_size = function(image_url, image_width, image_height) {
+ /*
+ * Calculate the size of the image panel based on the size of the image and the size of the
+ * window. Scale the image so the entire panel fits in the view port.
+ */
+ function _auto_fit(imageWidth, imageHeight) {
+ // ui-dialog gives a padding of 2 pixels
+ var windowWidth = $(window).width() - 10;
+ var windowHeight = $(window).height() - 10;
- $("body").append('
');
+ /* If the width is greater then scale the image width first */
+ if (imageWidth > windowWidth) {
+ var ratio = windowWidth / imageWidth;
+ imageWidth *= ratio;
+ imageHeight *= ratio;
+ }
+ /* after scaling the width, check that the height fits */
+ if (imageHeight > windowHeight) {
+ var ratio = windowHeight / imageHeight;
+ imageWidth *= ratio;
+ imageHeight *= ratio;
+ }
- var image_size = _auto_fit(fullsize_detail.width, fullsize_detail.height);
+ // handle the case where the calculation is almost zero (2.14e-14)
+ return {
+ top: ((windowHeight - imageHeight) / 2).toFixed(2),
+ left: ((windowWidth - imageWidth) / 2).toFixed(2),
+ width: imageWidth.toFixed(2),
+ height: imageHeight.toFixed(2)
+ };
+ }
- $("body").append('
');
-/*
- * Calculate the size of the image panel based on the size of the image and the size of the
- * window. Scale the image so the entire panel fits in the view port.
- */
-function _auto_fit(imageWidth, imageHeight) {
- // ui-dialog gives a padding of 2 pixels
- var windowWidth = $(window).width() - 10;
- var windowHeight = $(window).height() - 10;
+ var image_size = _auto_fit(image_width, image_height);
- /* If the width is greater then scale the image width first */
- if (imageWidth > windowWidth) {
- var ratio = windowWidth / imageWidth;
- imageWidth *= ratio;
- imageHeight *= ratio;
- }
- /* after scaling the width, check that the height fits */
- if (imageHeight > windowHeight) {
- var ratio = windowHeight / imageHeight;
- imageWidth *= ratio;
- imageHeight *= ratio;
- }
+ $("body").append('