From 94b5749d4604dc0d6b7a057d48a0f9d733e035ea Mon Sep 17 00:00:00 2001 From: Chad Kieffer Date: Fri, 28 Aug 2009 13:42:45 -0600 Subject: Convert tabs to spaces. --- lib/gallery.common.js | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/lib/gallery.common.js b/lib/gallery.common.js index a959d90d..c6a619c1 100644 --- a/lib/gallery.common.js +++ b/lib/gallery.common.js @@ -140,19 +140,18 @@ /* after scaling the width, check that the height fits */ if (imageHeight > height) { - ratio = height / imageHeight; - imageWidth *= ratio; - imageHeight *= ratio; + ratio = height / imageHeight; + imageWidth *= ratio; + imageHeight *= ratio; } // handle the case where the calculation is almost zero (2.14e-14) return { - top: Number((height - imageHeight) / 2), - left: Number((width - imageWidth) / 2), - width: Number(imageWidth), - height: Number(imageHeight) + top: Number((height - imageHeight) / 2), + left: Number((width - imageWidth) / 2), + width: Number(imageWidth), + height: Number(imageHeight) }; }; })(jQuery); - -- cgit v1.2.3 From f1e008a14f2dfb51d1204dad3deb19e2e3df16c8 Mon Sep 17 00:00:00 2001 From: Chad Kieffer Date: Fri, 28 Aug 2009 13:47:35 -0600 Subject: Don't clone hover item, apply styles to the original container. Contextual menu rotates are now immediately visible. Fixes ticket 667. --- themes/default/css/screen.css | 23 +++++------------ themes/default/js/ui.init.js | 60 ++++++++++++++++++++++--------------------- 2 files changed, 37 insertions(+), 46 deletions(-) diff --git a/themes/default/css/screen.css b/themes/default/css/screen.css index 55839c57..cc5f6bcb 100644 --- a/themes/default/css/screen.css +++ b/themes/default/css/screen.css @@ -406,7 +406,6 @@ form .gError, } #gSidebar { - background-color: #fff; font-size: .9em; padding: 0 20px; width: 220px; @@ -492,23 +491,13 @@ form .gError, width: 16px; } -#gContent #gAlbumGrid #gHoverItem { +#gContent #gAlbumGrid .gHoverItem { background-color: #fff; border: 1px solid #000; - display: none; - height: auto; - padding: 0; - position: absolute; - width: auto; - z-index: 100; -} - -#gContent #gAlbumGrid #gHoverItem .gItem { - border: none; } -#gContent #gHoverItem .gItem h2, -#gContent #gHoverItem .gItem .gMetadata { +#gContent .gHoverItem h2, +#gContent .gHoverItem .gMetadata { display: block; } @@ -647,15 +636,15 @@ form .gError, line-height: 1.6em; } -#gHoverItem .gContextMenu { +.gHoverItem .gContextMenu { display: block; } -#gHoverItem .gContextMenu li { +.gHoverItem .gContextMenu li { text-align: left; } -#gHoverItem .gContextMenu a:hover { +.gHoverItem .gContextMenu a:hover { text-decoration: none; } diff --git a/themes/default/js/ui.init.js b/themes/default/js/ui.init.js index 2391f638..006d74bb 100644 --- a/themes/default/js/ui.init.js +++ b/themes/default/js/ui.init.js @@ -62,39 +62,41 @@ $(document).ready(function() { // Initialize context menus $(".gItem").hover( function(){ + // Insert invisible placeholder to hold the item's position in the grid + var placeHolder = $(this).clone(); + $(placeHolder).attr("id", "gPlaceHolder"); + $(placeHolder).css("visibility", "hidden"); + $(this).after($(placeHolder)); + // Style and position the item + $(this).addClass("gHoverItem"); var position = $(this).position(); - var item_classes = $(this).attr("class"); - var bg_color = $(this).css("background-color"); - var container = $(this).parent(); - $("#gHoverItem").remove(); - container.append("
" - + $(this).html() + "
"); - $("#gHoverItem").css("top", position.top); - $("#gHoverItem").css("left", position.left); - $("#gHoverItem").css("background-color", bg_color); - $.fn.gallery_hover_init(); - var v_align = $(this).find(".gValign"); + $(this).css("position", "absolute"); + $(this).css("top", position.top); + $(this).css("left", position.left); + $(this).css("z-index", "1000"); + // Initialize the contextual menu + $(this).gallery_context_menu(); + // Set height based on height of descendents var title = $(this).find("h2"); var meta = $(this).find(".gMetadata"); - var context = $(this).find(".gContextMenu"); var context_label = $(this).find(".gContextMenu li:first"); - $("#gHoverItem .gItem").height( - $(v_align).gallery_height() - + $(title).gallery_height() - + $(meta).gallery_height() - + parseInt($(context).css("margin-top").replace("px","")) - + $(context_label).gallery_height() - ); - - $("#gHoverItem").fadeIn("fast"); - $("#gHoverItem").hover( - function(){ - $(this).gallery_context_menu(); - }, - function() { - $(this).hide(); - } - ); + var item_ht = $(this).height(); + var title_ht = $(title).gallery_height(); + var meta_ht = $(meta).gallery_height(); + var context_label_ht = $(context_label).gallery_height(); + $(this).height(item_ht + title_ht + meta_ht + context_label_ht); + }, + function() { + // Reset item height, position, and z-index + var sib_height = $(this).next().height(); + $(this).css("height", sib_height); + $(this).css("position", "relative"); + $(this).css("top", null); + $(this).css("left", null); + $(this).css("z-index", null); + // Remove the placeholder and hover class from the item + $("#gPlaceHolder").remove(); + $(this).removeClass("gHoverItem"); } ); } -- cgit v1.2.3 From 1855642bd169a1cae69cd9efb8da4458ea6e4a3c Mon Sep 17 00:00:00 2001 From: jhilden Date: Fri, 28 Aug 2009 16:19:41 -0400 Subject: improved UI for the languages admin this should take care of bug #329 --- modules/gallery/controllers/admin_languages.php | 52 +++++++----------- modules/gallery/views/admin_languages.html.php | 71 ++++++++++++++++++++++--- themes/admin_default/css/admin_screen.css | 18 +++++-- 3 files changed, 97 insertions(+), 44 deletions(-) diff --git a/modules/gallery/controllers/admin_languages.php b/modules/gallery/controllers/admin_languages.php index ae90ad07..6dc242c6 100644 --- a/modules/gallery/controllers/admin_languages.php +++ b/modules/gallery/controllers/admin_languages.php @@ -21,7 +21,10 @@ class Admin_Languages_Controller extends Admin_Controller { public function index($share_translations_form=null) { $v = new Admin_View("admin.html"); $v->content = new View("admin_languages.html"); - $v->content->settings_form = $this->_languages_form(); + $v->content->available_locales = locales::available(); + $v->content->installed_locales = locales::installed(); + $v->content->default_locale = module::get_var("gallery", "default_locale"); + if (empty($share_translations_form)) { $share_translations_form = $this->_share_translations_form(); } @@ -32,14 +35,21 @@ class Admin_Languages_Controller extends Admin_Controller { public function save() { access::verify_csrf(); - - $form = $this->_languages_form(); - if ($form->validate()) { - module::set_var("gallery", "default_locale", $form->choose_language->locale->value); - locales::update_installed($form->choose_language->installed_locales->value); - message::success(t("Settings saved")); - } - url::redirect("admin/languages"); + + locales::update_installed($this->input->post("installed_locales")); + + $installed_locales = array_keys(locales::installed()); + $new_default_locale = $this->input->post("default_locale"); + if (!in_array($new_default_locale, $installed_locales)) { + if (!empty($installed_locales)) { + $new_default_locale = $installed_locales[0]; + } else { + $new_default_locale = "en_US"; + } + } + module::set_var("gallery", "default_locale", $new_default_locale); + + print json_encode(array("result" => "success")); } public function share() { @@ -88,30 +98,6 @@ class Admin_Languages_Controller extends Admin_Controller { } } - private function _languages_form() { - $all_locales = locales::available(); - $installed_locales = locales::installed(); - $form = new Forge("admin/languages/save", "", "post", array("id" => "gLanguageSettingsForm")); - $group = $form->group("choose_language") - ->label(t("Language settings")); - $group->dropdown("locale") - ->options($installed_locales) - ->selected(module::get_var("gallery", "default_locale")) - ->label(t("Default language")) - ->rules('required'); - - $installation_options = array(); - foreach ($all_locales as $code => $display_name) { - $installation_options[$code] = array($display_name, isset($installed_locales->$code)); - } - $group->checklist("installed_locales") - ->label(t("Installed Languages")) - ->options($installation_options) - ->rules("required"); - $group->submit("save")->value(t("Save settings")); - return $form; - } - private function _outgoing_translations_count() { return ORM::factory("outgoing_translation")->count_all(); } diff --git a/modules/gallery/views/admin_languages.html.php b/modules/gallery/views/admin_languages.html.php index f41694b4..fc3a87dc 100644 --- a/modules/gallery/views/admin_languages.html.php +++ b/modules/gallery/views/admin_languages.html.php @@ -1,14 +1,69 @@
-

+

+

+ +

- - -

- " - class="gDialogLink"> - - +
"> + + + + + + + + + $display_name): ?> + + +
+ + + + + + + + "> + + + + + + + +
+ +
+ " /> +
+ +

diff --git a/themes/admin_default/css/admin_screen.css b/themes/admin_default/css/admin_screen.css index d408acf0..913631dc 100644 --- a/themes/admin_default/css/admin_screen.css +++ b/themes/admin_default/css/admin_screen.css @@ -451,8 +451,20 @@ li.gDefaultGroup h4, li.gDefaultGroup .gUser { cursor: pointer; } -#gLanguageSettingsForm .checklist li { - width: 150px; - overflow: hidden; +#gLanguagesForm table { + width: 400px; + float: left; + margin: 0 3em 1em 0; +} +#gLanguagesForm .installed { + background-color: #EEEEEE; } +#gLanguagesForm .default { + background-color: #C5DBEC; + font-weight: bold; +} +#gLanguagesForm input, #gShareTranslationsForm, #gLanguages h2 { + clear: both; +} + -- cgit v1.2.3 From 1d5262f9c354a8564f05a8a31b915ad479f4d361 Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Fri, 28 Aug 2009 13:44:01 -0700 Subject: Fix ticket #591: reCaptcha always on the page. 1) move creating the "Add a comment" button into the comments.html.php 2) use $.get() to retrieve the comment add form --- modules/comment/helpers/comment_theme.php | 2 -- modules/comment/js/comment.js | 10 +++++++++- modules/comment/views/comments.html.php | 10 ++++++++-- themes/default/css/screen.css | 7 +++++++ themes/default/js/ui.init.js | 12 ------------ themes/default/views/movie.html.php | 3 --- themes/default/views/photo.html.php | 3 --- 7 files changed, 24 insertions(+), 23 deletions(-) diff --git a/modules/comment/helpers/comment_theme.php b/modules/comment/helpers/comment_theme.php index b807e2cf..38a00b5c 100644 --- a/modules/comment/helpers/comment_theme.php +++ b/modules/comment/helpers/comment_theme.php @@ -26,7 +26,6 @@ class comment_theme_Core { static function photo_bottom($theme) { $block = new Block; $block->css_id = "gComments"; - $block->anchor = t("comments"); $block->title = t("Comments"); $view = new View("comments.html"); @@ -37,7 +36,6 @@ class comment_theme_Core { ->find_all(); $block->content = $view; - $block->content .= comment::get_add_form($theme->item())->render("form.html"); return $block; } } \ No newline at end of file diff --git a/modules/comment/js/comment.js b/modules/comment/js/comment.js index 00fc6027..9fd63c1a 100644 --- a/modules/comment/js/comment.js +++ b/modules/comment/js/comment.js @@ -1,5 +1,13 @@ $("document").ready(function() { - ajaxify_comment_form(); + $("#gAddCommentButton").click(function(event) { + event.preventDefault(); + $.get($(this).attr("href"), + {}, + function(data) { + $("#gCommentDetail").append(data); + ajaxify_comment_form(); + }); + }); }); function ajaxify_comment_form() { diff --git a/modules/comment/views/comments.html.php b/modules/comment/views/comments.html.php index f7251389..6dce9971 100644 --- a/modules/comment/views/comments.html.php +++ b/modules/comment/views/comments.html.php @@ -1,11 +1,17 @@ + id})") ?>" id="gAddCommentButton" + class="gButtonLink ui-corner-all ui-icon-left ui-state-default right"> + + + +
count()): ?>

comment!", array("attrs" => "href=\"#add_comment_form\" class=\"showCommentForm\"")) ?>

-
    +
    • @@ -26,4 +32,4 @@

    - +
diff --git a/themes/default/css/screen.css b/themes/default/css/screen.css index ecae2bb2..481581a2 100644 --- a/themes/default/css/screen.css +++ b/themes/default/css/screen.css @@ -530,6 +530,7 @@ form .gError, #gContent #gComments { margin-top: 2em; + position: relative; } #gContent #gComments ul li { @@ -561,6 +562,12 @@ form .gError, width: 32px; } +#gAddCommentButton { + position: absolute; + right: 0; + top: 2px; +} + #gContent #gAddCommentForm { margin-top: 2em; } diff --git a/themes/default/js/ui.init.js b/themes/default/js/ui.init.js index 2391f638..67cdb968 100644 --- a/themes/default/js/ui.init.js +++ b/themes/default/js/ui.init.js @@ -110,18 +110,6 @@ $(document).ready(function() { $(this).gallery_context_menu(); }); - // Collapse comments form, insert button to expand - if ($("#gAddCommentForm").length) { - var showCommentForm = '' - + '' + ADD_A_COMMENT + ''; - $("#gAddCommentForm").hide(); - $("#gComments").prepend(showCommentForm); - $(".showCommentForm").click(function(){ - $("#gAddCommentForm").show(1000); - }); - } - // Add scroll effect for links to named anchors $.localScroll({ queue: true, diff --git a/themes/default/views/movie.html.php b/themes/default/views/movie.html.php index c8ecd769..29789f8e 100644 --- a/themes/default/views/movie.html.php +++ b/themes/default/views/movie.html.php @@ -32,9 +32,6 @@
description)) ?>
- photo_bottom() ?> context_menu($item, "#gMovieId-{$item->id}") ?> diff --git a/themes/default/views/photo.html.php b/themes/default/views/photo.html.php index fa5def47..39e61ef6 100644 --- a/themes/default/views/photo.html.php +++ b/themes/default/views/photo.html.php @@ -55,8 +55,5 @@
description)) ?>
- photo_bottom() ?> -- cgit v1.2.3 From c428e49f3273f04fd220107b4992e6177aa1b265 Mon Sep 17 00:00:00 2001 From: Chad Kieffer Date: Fri, 28 Aug 2009 15:24:21 -0600 Subject: Make gMessage 100% of the width of its container. --- themes/admin_default/css/screen.css | 2 +- themes/default/css/screen.css | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/themes/admin_default/css/screen.css b/themes/admin_default/css/screen.css index 88631e81..062c0e41 100644 --- a/themes/admin_default/css/screen.css +++ b/themes/admin_default/css/screen.css @@ -276,7 +276,7 @@ li.gError select { /* Status messages ~~~~~~~~~~~~~~~~~~~~~~~ */ #gMessage { - width: 99%; + width: 100%; } #gAdminAkismet .gSuccess, diff --git a/themes/default/css/screen.css b/themes/default/css/screen.css index 26339e35..8a8f634a 100644 --- a/themes/default/css/screen.css +++ b/themes/default/css/screen.css @@ -276,7 +276,7 @@ li.gError select { /* Status messages ~~~~~~~~~~~~~~~~~~~~~~~ */ #gMessage { - width: 99%; + width: 100%; } #gAdminAkismet .gSuccess, -- cgit v1.2.3 From 1ce8643b8056266139552045fcdb48bbdb9c665b Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Fri, 28 Aug 2009 15:17:07 -0700 Subject: Fix for #440. Basically add a check that the mysql version is > 5.0.0. It was felt that actually listing the requirements might be overwhelming to novice users. --- installer/installer.php | 7 +++++++ installer/views/invalid_db_version.html.php | 5 +++++ installer/web.php | 2 ++ 3 files changed, 14 insertions(+) create mode 100644 installer/views/invalid_db_version.html.php diff --git a/installer/installer.php b/installer/installer.php index b0af561e..456cffaa 100644 --- a/installer/installer.php +++ b/installer/installer.php @@ -104,6 +104,13 @@ class installer { mysql_select_db($config["dbname"]); } + static function verify_version($config) { + $result = mysql_query("SHOW VARIABLES WHERE variable_name = \"version\""); + $row = mysql_fetch_object($result); + $version = substr($row->Value, 0, strpos($row->Value, "-")); + return version_compare($version, "5.0.0", ">="); + } + static function db_empty($config) { $query = "SHOW TABLES IN {$config['dbname']} LIKE '{$config['prefix']}items'"; return mysql_num_rows(mysql_query($query)) == 0; diff --git a/installer/views/invalid_db_version.html.php b/installer/views/invalid_db_version.html.php new file mode 100644 index 00000000..8776ac35 --- /dev/null +++ b/installer/views/invalid_db_version.html.php @@ -0,0 +1,5 @@ + +

Uh oh!

+

+ The MySql database that you are referencing is less than the minimum version of 5.0.0. +

diff --git a/installer/web.php b/installer/web.php index f31c0644..aceb5368 100644 --- a/installer/web.php +++ b/installer/web.php @@ -41,6 +41,8 @@ if (installer::already_installed()) { if (!installer::connect($config)) { $content = render("invalid_db_info.html.php"); + } else if (!installer::verify_version($config)) { + $content = render("invalid_db_version.html.php"); } else if (!installer::select_db($config)) { $content = render("missing_db.html.php"); } else if (!installer::db_empty($config)) { -- cgit v1.2.3 From fc1c4d5119959a4db0d49b7c0aa618749f27c740 Mon Sep 17 00:00:00 2001 From: Chad Kieffer Date: Fri, 28 Aug 2009 16:37:14 -0600 Subject: Button styles and event handlers weren't being applied in dialogs, fixes #669. --- lib/gallery.dialog.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/gallery.dialog.js b/lib/gallery.dialog.js index ace588f6..d1ea3edf 100644 --- a/lib/gallery.dialog.js +++ b/lib/gallery.dialog.js @@ -30,7 +30,7 @@ $("#gDialog").html(data).gallery_show_loading(); if ($("#gDialog form").length) { - self._trigger("form_loaded", null, $("#gDialog form")); + self.form_loaded(null, $("#gDialog form")); } self._layout(); @@ -70,7 +70,7 @@ $("#gDialog").dialog('option', 'width', dialogWidth); }, - form_loaded: function event(event, ui) { + form_loaded: function(event, ui) { // Should be defined (and localized) in the theme MSG_CANCEL = MSG_CANCEL || 'Cancel'; var eCancel = '' + MSG_CANCEL + ''; @@ -78,7 +78,7 @@ $("#gDialog .submit").addClass("ui-state-default ui-corner-all"); $("#gDialog .submit").parent().append(eCancel); $("#gDialog .gCancel").click(function(event) { - $("gDialog").dialog("close"); + $("#gDialog").dialog("close"); event.preventDefault(); }); } @@ -92,7 +92,7 @@ ); }, - close_dialog: function (event, ui) { + close_dialog: function(event, ui) { var self = $("#gDialog").dialog("option", "self"); if ($("#gDialog form").length) { self._trigger("form_closing", null, $("#gDialog form")); -- cgit v1.2.3 From c234f9fd392d355bb7a143e28474bb689ed65e48 Mon Sep 17 00:00:00 2001 From: jhilden Date: Fri, 28 Aug 2009 20:53:06 -0400 Subject: improved translations admin interface --- modules/gallery/controllers/l10n_client.php | 13 +++-- modules/gallery/views/admin_languages.html.php | 80 ++++++++++++++++++-------- themes/admin_default/css/admin_screen.css | 12 +++- 3 files changed, 75 insertions(+), 30 deletions(-) diff --git a/modules/gallery/controllers/l10n_client.php b/modules/gallery/controllers/l10n_client.php index 831c79c1..0775791e 100644 --- a/modules/gallery/controllers/l10n_client.php +++ b/modules/gallery/controllers/l10n_client.php @@ -90,10 +90,15 @@ class L10n_Client_Controller extends Controller { } $session = Session::instance(); - $session->set("l10n_mode", - !$session->get("l10n_mode", false)); - - url::redirect("albums/1"); + $l10n_mode = $session->get("l10n_mode", false); + $session->set("l10n_mode", !$l10n_mode); + + $redirect_url = "admin/languages"; + if (!$l10n_mode) { + $redirect_url .= "#l10n-client"; + } + + url::redirect($redirect_url); } private static function _l10n_client_search_form() { diff --git a/modules/gallery/views/admin_languages.html.php b/modules/gallery/views/admin_languages.html.php index fc3a87dc..4025437a 100644 --- a/modules/gallery/views/admin_languages.html.php +++ b/modules/gallery/views/admin_languages.html.php @@ -2,7 +2,7 @@

- +

"> @@ -40,31 +40,61 @@
+ dataType: "json", + success: function(data) { + if (data.result == "success") { + el = $('">'); // this is a little hack to trigger the update_l10n task in a dialog + el.gallery_dialog(); + el.trigger('click'); + } + } + }); + +
-

+
+

+

+ +

+ +

+ + + +

Sharing your translations

+
diff --git a/themes/admin_default/css/admin_screen.css b/themes/admin_default/css/admin_screen.css index 913631dc..3083114c 100644 --- a/themes/admin_default/css/admin_screen.css +++ b/themes/admin_default/css/admin_screen.css @@ -463,8 +463,18 @@ li.gDefaultGroup h4, li.gDefaultGroup .gUser { background-color: #C5DBEC; font-weight: bold; } -#gLanguagesForm input, #gShareTranslationsForm, #gLanguages h2 { +#gLanguagesForm input { clear: both; } +#gTranslations { + padding: 2em 0 0 0; + clear: both; +} +#gTranslations .gButtonLink { + padding: .5em; +} +.gDocLink { + float: right; +} -- cgit v1.2.3