summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/gallery.show_full_size.js76
-rw-r--r--modules/gallery/controllers/l10n_client.php14
-rw-r--r--modules/gallery/controllers/simple_uploader.php3
-rw-r--r--modules/gallery/helpers/gallery_menu.php11
-rw-r--r--modules/gallery/helpers/gallery_theme.php10
-rw-r--r--modules/gallery/helpers/graphics.php7
-rw-r--r--modules/gallery/helpers/movie.php7
-rwxr-xr-xmodules/gallery/images/missing_movie.pngbin0 -> 8474 bytes
-rw-r--r--modules/gallery/js/fullsize.js78
-rw-r--r--modules/gallery/views/l10n_client.html.php6
-rw-r--r--themes/default/views/photo.html.php16
11 files changed, 128 insertions, 100 deletions
diff --git a/lib/gallery.show_full_size.js b/lib/gallery.show_full_size.js
new file mode 100644
index 00000000..b2895c23
--- /dev/null
+++ b/lib/gallery.show_full_size.js
@@ -0,0 +1,76 @@
+/**
+ * @todo Move inline CSS out to external style sheet (theme style sheet)
+ */
+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;
+
+ /* 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)
+ };
+ }
+
+ var width = $(document).width();
+ var height = $(document).height();
+
+ $("body").append('<div id="gFullsizeOverlay" class="ui-dialog-overlay" ' +
+ 'style="border: none; margin: 0; padding: 0; background-color: #000; ' +
+ 'position: absolute; top: 0px; left: 0px; ' +
+ 'width: ' + width + 'px; height: ' + height + 'px; opacity: 0.7; filter: alpha(opacity=70);' +
+ '-moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; ' +
+ '-moz-background-inline-policy: -moz-initial; z-index: 1001;"> </div>');
+
+ var image_size = _auto_fit(image_width, image_height);
+
+ $("body").append('<div id="gFullsize" class="ui-dialog ui-widget" ' +
+ 'style="overflow: hidden; display: block; ' +
+ 'position: absolute; z-index: 1002; outline-color: -moz-use-text-color; ' +
+ 'outline-style: none; outline-width: 0px; ' +
+ 'height: ' + image_size.height + 'px; ' +
+ 'width: ' + image_size.width + 'px; ' +
+ 'top: ' + image_size.top + 'px; left: ' + image_size.left + 'px;">' +
+ '<img id="gFullSizeImage" src="' + image_url + '"' +
+ 'height="' + image_size.height + '" width="' + image_size.width + '"/></div>');
+
+ $("#gFullsize").append('<span id="gFullsizeClose" class="fg-button ui-icon ui-state-default ' +
+ 'ui-icon-closethick ui-corner-all" style="z-index: 1003; position: absolute; ' +
+ 'right: 1em; top: 1em;"></span>');
+ $("#gFullsizeClose").click(function() {
+ $("#gFullsizeOverlay*").remove();
+ $("#gFullsize").remove();
+ });
+ $(window).resize(function() {
+ $("#gFullsizeOverlay").width($(document).width());
+ $("#gFullsizeOverlay").height($(document).height());
+ image_size = _auto_fit(image_width, image_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);
+ });
+};
diff --git a/modules/gallery/controllers/l10n_client.php b/modules/gallery/controllers/l10n_client.php
index aa93a758..831c79c1 100644
--- a/modules/gallery/controllers/l10n_client.php
+++ b/modules/gallery/controllers/l10n_client.php
@@ -106,7 +106,19 @@ class L10n_Client_Controller extends Controller {
}
public static function l10n_form() {
- $calls = I18n::instance()->call_log();
+ if (Input::instance()->get("show_all_l10n_messages")) {
+ $calls = array();
+ foreach (Database::instance()
+ ->select("key", "message")
+ ->from("incoming_translations")
+ ->where(array("locale" => 'root'))
+ ->get()
+ ->as_array() as $row) {
+ $calls[$row->key] = array(unserialize($row->message), array());
+ }
+ } else {
+ $calls = I18n::instance()->call_log();
+ }
$locale = I18n::instance()->locale();
if ($calls) {
diff --git a/modules/gallery/controllers/simple_uploader.php b/modules/gallery/controllers/simple_uploader.php
index dfbd4f17..e68df2b8 100644
--- a/modules/gallery/controllers/simple_uploader.php
+++ b/modules/gallery/controllers/simple_uploader.php
@@ -39,7 +39,8 @@ class Simple_Uploader_Controller extends Controller {
access::verify_csrf();
$file_validation = new Validation($_FILES);
- $file_validation->add_rules("Filedata", "upload::valid", "upload::type[gif,jpg,png,flv,mp4]");
+ $file_validation->add_rules(
+ "Filedata", "upload::valid", "upload::type[gif,jpg,jpeg,png,flv,mp4]");
if ($file_validation->validate()) {
// SimpleUploader.swf does not yet call /start directly, so simulate it here for now.
if (!batch::in_progress()) {
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/modules/gallery/helpers/gallery_theme.php b/modules/gallery/helpers/gallery_theme.php
index c28c9040..44c1d3f1 100644
--- a/modules/gallery/helpers/gallery_theme.php
+++ b/modules/gallery/helpers/gallery_theme.php
@@ -31,16 +31,6 @@ class gallery_theme_Core {
url::file("modules/gallery/css/quick.css") . "\" />";
$buf .= html::script("modules/gallery/js/quick.js");
}
- if ($theme->page_type == "photo" && access::can("view_full", $theme->item())) {
- $buf .= "<script type=\"text/javascript\" >" .
- " var fullsize_detail = { " .
- " close: \"" . url::file("modules/gallery/images/ico-close.png") . "\", " .
- " url: \"" . $theme->item()->file_url() . "\", " .
- " width: " . $theme->item()->width . ", " .
- " height: " . $theme->item()->height . "};" .
- "</script>";
- $buf .= html::script("modules/gallery/js/fullsize.js");
- }
if (module::is_active("rss")) {
if ($item = $theme->item()) {
diff --git a/modules/gallery/helpers/graphics.php b/modules/gallery/helpers/graphics.php
index feebfb34..3f3317ae 100644
--- a/modules/gallery/helpers/graphics.php
+++ b/modules/gallery/helpers/graphics.php
@@ -135,7 +135,12 @@ class graphics_Core {
if ($input_item->is_movie()) {
// Convert the movie to a JPG first
$output_file = preg_replace("/...$/", "jpg", $output_file);
- movie::extract_frame($input_file, $output_file);
+ try {
+ movie::extract_frame($input_file, $output_file);
+ } catch (Exception $e) {
+ // Assuming this is MISSING_FFMPEG for now
+ copy(MODPATH . "gallery/images/missing_movie.png", $output_file);
+ }
$working_file = $output_file;
} else {
$working_file = $input_file;
diff --git a/modules/gallery/helpers/movie.php b/modules/gallery/helpers/movie.php
index 1d1d29d1..28c15d81 100644
--- a/modules/gallery/helpers/movie.php
+++ b/modules/gallery/helpers/movie.php
@@ -53,7 +53,12 @@ class movie_Core {
throw new Exception("@todo NAME_CANNOT_END_IN_PERIOD");
}
- $movie_info = movie::getmoviesize($filename);
+ try {
+ $movie_info = movie::getmoviesize($filename);
+ } catch (Exception $e) {
+ // Assuming this is MISSING_FFMPEG for now
+ $movie_info = getimagesize(MODPATH . "gallery/images/missing_movie.png");
+ }
// Force an extension onto the name
$pi = pathinfo($filename);
diff --git a/modules/gallery/images/missing_movie.png b/modules/gallery/images/missing_movie.png
new file mode 100755
index 00000000..fdc97779
--- /dev/null
+++ b/modules/gallery/images/missing_movie.png
Binary files differ
diff --git a/modules/gallery/js/fullsize.js b/modules/gallery/js/fullsize.js
deleted file mode 100644
index f95dc428..00000000
--- a/modules/gallery/js/fullsize.js
+++ /dev/null
@@ -1,78 +0,0 @@
-/**
- * @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();
-
- $("body").append('<div id="gFullsizeOverlay" class="ui-dialog-overlay" ' +
- 'style="border: none; margin: 0; padding: 0; background-color: #000; ' +
- 'position: absolute; top: 0px; left: 0px; ' +
- 'width: ' + width + 'px; height: ' + height + 'px; opacity: 0.7; filter: alpha(opacity=70);' +
- '-moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; ' +
- '-moz-background-inline-policy: -moz-initial; z-index: 1001;"> </div>');
-
- var image_size = _auto_fit(fullsize_detail.width, fullsize_detail.height);
-
- $("body").append('<div id="gFullsize" class="ui-dialog ui-widget" ' +
- 'style="overflow: hidden; display: block; ' +
- 'position: absolute; z-index: 1002; outline-color: -moz-use-text-color; ' +
- 'outline-style: none; outline-width: 0px; ' +
- 'height: ' + image_size.height + 'px; ' +
- 'width: ' + image_size.width + 'px; ' +
- 'top: ' + image_size.top + 'px; left: ' + image_size.left + 'px;">' +
- '<img id="gFullSizeImage" src="' + fullsize_detail.url + '"' +
- 'height="' + image_size.height + '" width="' + image_size.width + '"/></div>');
-
- $("#gFullsize").append('<span id="gFullsizeClose" class="fg-button ui-icon ui-state-default ' +
- 'ui-icon-closethick ui-corner-all" style="z-index: 1003; position: absolute; ' +
- 'right: 1em; top: 1em;"></span>');
- $("#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/modules/gallery/views/l10n_client.html.php b/modules/gallery/views/l10n_client.html.php
index 2e53f48f..01537e25 100644
--- a/modules/gallery/views/l10n_client.html.php
+++ b/modules/gallery/views/l10n_client.html.php
@@ -2,7 +2,11 @@
<div id="l10n-client" class="hidden">
<div class="labels">
<span class="toggle"><?= t("Translate Text") ?></span>
- <div class="label strings"><h2><?= t("Page Text") ?></h2></div>
+ <div class="label strings"><h2><?= t("Page Text") ?>
+ <? if (!Input::instance()->get('show_all_l10n_messages')): ?>
+ <a style="background-color:#fff" href="<?= url::site("admin/languages?show_all_l10n_messages=1") ?>"><?= t("(Show All)") ?></a>
+ <? endif; ?>
+ </h2></div>
<div class="label source"><h2><?= t("Source") ?></div>
<div class="label translation"><h2><?= t("Translation to %language",
array("language" => locale::display_name())) ?></h2></div>
diff --git a/themes/default/views/photo.html.php b/themes/default/views/photo.html.php
index cc4cc750..1c3b81a7 100644
--- a/themes/default/views/photo.html.php
+++ b/themes/default/views/photo.html.php
@@ -1,4 +1,18 @@
<?php defined("SYSPATH") or die("No direct script access.") ?>
+
+<? if (access::can("view_full", $theme->item())): ?>
+<!-- Use javascript to show the full size as an overlay on the current page -->
+<script src="<?= url::file("lib/gallery.show_full_size.js") ?>" type="text/javascript"></script>
+<script>
+ $(document).ready(function() {
+ $(".gFullSizeLink").click(function() {
+ show_full_size("<?= $theme->item()->file_url() ?>", "<?= $theme->item()->width ?>", "<?= $theme->item()->height ?>");
+ return false;
+ });
+ });
+</script>
+<? endif ?>
+
<div id="gItem">
<?= $theme->photo_top() ?>
@@ -27,7 +41,7 @@
<div id="gPhoto">
<?= $theme->resize_top($item) ?>
<? if (access::can("view_full", $item)): ?>
- <a href="#" class="gFullSizeLink" title="<?= t("View full size") ?>">
+ <a href="<?= $item->file_url() ?>" class="gFullSizeLink" title="<?= t("View full size") ?>">
<? endif ?>
<?= $item->resize_img(array("id" => "gPhotoId-{$item->id}", "class" => "gResize")) ?>
<? if (access::can("view_full", $item)): ?>