From 25ae7f02cd893127901bd26fc1297d109b781746 Mon Sep 17 00:00:00 2001 From: Fredrik Erlandsson Date: Thu, 16 Aug 2012 21:51:01 +0200 Subject: [PATCH] Squashed '3.0/themes/pear4gallery3/' changes from f9f9805..f6e42a9 f6e42a9 Support for custom size of photo resizes. Version up to 3.5.2 639cc53 fixes #27, support for image count re-enabled fe33691 Merge pull request #32 from oneoftwo/patch-3 9790a15 Update views/thumbs.html.php 77408dc Merge pull request #30 from oneoftwo/patch-1 62f7886 Update views/thumbs.html.php 25145c0 b3.4 + threaded thumbLoad 32ddbcc Merge branch 'b3.4' 5db2a89 new attempt for custom logo 1b18764 full url to custom logo stored in var cd067e4 stupid pear logo.. d64bdbf Attempt to fix custom logo issues, version up 9e8ea7f minor fixes for the FB-comment module support 9af348f version 3.4.3.1 0e6db7c fix for problematic Tag-Cloud module a7b0a70 Fixes issues with facebook plugins when the user is commenting on a photo and FB links to the album image version 3.4.3 900b94c minor errors 7954cf4 version up d307b65 attempt to fix #17, image prefetch 015ceca various fixed thanks to e-nando/chris@2243c91c400ff2c18ff40e15b2b355f5429264c5 4971e20 closes #21, no longer have a discontinuous slideshowImages array ac86dec fixes for facebook-comments, now we are using the full url efb4fde closes #20, support for the search module in a good way 7a12558 minor fixes to eleminate some debug errors git-subtree-dir: 3.0/themes/pear4gallery3 git-subtree-split: f6e42a99776267d39c074f8c6b4c3ed606e280f7 --- admin/controllers/admin_theme_options.php | 17 +++++-- controllers/pear.php | 5 +- css/pear.css | 3 +- js/pear.js | 25 +++++++--- theme.info | 2 +- views/album.html.php | 2 + views/facebook_comment.html.php | 13 ++++- views/page.html.php | 33 ++++++++++--- views/search.html.php | 60 ++++++----------------- views/thumbs.html.php | 6 +-- 10 files changed, 95 insertions(+), 71 deletions(-) diff --git a/admin/controllers/admin_theme_options.php b/admin/controllers/admin_theme_options.php index 0befe51b..3da1f39d 100644 --- a/admin/controllers/admin_theme_options.php +++ b/admin/controllers/admin_theme_options.php @@ -84,7 +84,7 @@ class Admin_Theme_Options_Controller extends Admin_Controller { ->value(module::get_var("gallery", "appletouchicon_url")); $group->input("logo_path") ->label(t("URL (relative path) to custom logo")) - ->value(module::get_var("gallery", "logo_path")); + ->value(module::get_var("th_pear4gallery3", "logo_path")); $group->input("slideshow_time") ->label(t("Slideshow timeout (in ms)")) ->value(module::get_var("th_pear4gallery3", "slideshow_time", "5000")); @@ -140,6 +140,13 @@ class Admin_Theme_Options_Controller extends Admin_Controller { "scale" => t("Shrink and grow an element"), "none" => t("Disable effects (faster switching)"))) ->selected(module::get_var("th_pear4gallery3", "mosaic_effect", "blind")); + + /* Advanced Options - Photo settings ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ + + $group = $form->group("edit_theme_adv_photo")->label(t("Advanced Options - Photo settings")); + $group->input("resize_size") + ->label(t("Photo resize size (800 is default)")) + ->value(module::get_var("gallery", "resize_size", "800")); /* $group->dropdown("photo_descmode") ->label(t("Description Display Mode")) @@ -258,8 +265,10 @@ class Admin_Theme_Options_Controller extends Admin_Controller { message::success(t("Theme details are reset")); else: // * General Settings **************************************************** + $old_resize_size = module::get_var("gallery", "resize_size", 800); + module::set_var("gallery", "resize_size", filter_var($form->edit_theme_adv_photo->resize_size->value, FILTER_VALIDATE_INT, array('options' => array('default' => 800, 'min_range' => 640)))); - $resize_size = 800; + $resize_size = module::get_var("gallery", "resize_size", 800); $build_resize = $form->maintenance->build_resize->value; $build_thumbs = $form->maintenance->build_thumbs->value; @@ -271,7 +280,7 @@ class Admin_Theme_Options_Controller extends Admin_Controller { endif; $purge_cache = $form->maintenance->purge_cache->value; - if ($build_resize): + if ($build_resize || $old_resize_size != $resize_size): graphics::remove_rule("gallery", "resize", "gallery_graphics::resize"); graphics::add_rule("gallery", "resize", "gallery_graphics::resize", array("width" => $resize_size, "height" => $resize_size, "master" => Image::AUTO), 100); @@ -297,7 +306,7 @@ class Admin_Theme_Options_Controller extends Admin_Controller { module::set_var("gallery", "page_size", 50); module::set_var("gallery", "favicon_url", $form->edit_theme->favicon->value); module::set_var("gallery", "appletouchicon_url", $form->edit_theme->appletouchicon->value); - module::set_var("gallery", "logo_path", $form->edit_theme->logo_path->value); + $this->save_item_state("logo_path", $form->edit_theme->logo_path->value, $form->edit_theme->logo_path->value); $this->save_item_state("slideshow_time", $form->edit_theme->slideshow_time->value != 5000, filter_var($form->edit_theme->slideshow_time->value, FILTER_VALIDATE_INT, array('options' => array('default' => 5000, 'min_range' => 1000)))); diff --git a/controllers/pear.php b/controllers/pear.php index d231a95a..b9bab266 100644 --- a/controllers/pear.php +++ b/controllers/pear.php @@ -24,7 +24,8 @@ class Pear_Controller extends Controller { if(module::is_active("facebook_comment")) { $v = new Theme_View("facebook_comment.html", "other", "comment-fragment"); - $v->url = $item->url(); + $v->url = $item->abs_url(); + $v->title = $item->title; print $v; } else { $comments = ORM::factory("comment") @@ -42,7 +43,7 @@ class Pear_Controller extends Controller { public function about($id){ $item = ORM::factory("item", $id); access::required("view", $item); - $v = new Theme_View("about.html"); + $v = new Theme_View("about.html","",""); $v->item = $item; $details = array(array("caption" => "Title", "value" => $item->title)); if ( $item->description != $item->title) { diff --git a/css/pear.css b/css/pear.css index 9fce1567..9648799b 100644 --- a/css/pear.css +++ b/css/pear.css @@ -204,6 +204,7 @@ outline: medium none; } #sidebarContainer { + width: 221px; position: fixed; right: 0; overflow: none; @@ -313,7 +314,7 @@ bottom: 0; #logoButton { display: block; z-index: 100; -background: transparent url('../icons/pear_logo_sml.png') no-repeat center center; +background: transparent no-repeat center center; width: 40px; height: 40px; border: 0; diff --git a/js/pear.js b/js/pear.js index f4e855b9..67f054ac 100644 --- a/js/pear.js +++ b/js/pear.js @@ -9,6 +9,7 @@ var pear = {defaultView: "grid", slideshowTimeout: 5000, currentImg: 0, hovering: false, + redirected: false, mosaicEffect: "" }; function thumbPadding() { @@ -49,6 +50,9 @@ function scaleIt(v, sliding) { } function thumbLoad(index) { + //Reindex the slideshowImages array. + slideshowImages = slideshowImages.filter(function (i) { return i != undefined}); + //Load non skimming thumbs $('.g-thumbnail').each( function() { $(this).attr('src', thumbImages[$(this).attr('id')]); }); //Load skimming thumbs @@ -57,7 +61,12 @@ function thumbLoad(index) { //Re-initiate all fancyness. if (pear.currentView === 'mosaic') { $('p.giTitle,div.giInfo').hide(); } else { $('p.giTitle,div.giInfo').show(); } scaleIt($('#imgSlider').slider('value')); - $('.g-item:not(.g-hover-item)').each(function (index) { $(this).unbind('click'); if ($(this).is('.g-photo')) { $(this).click(function () { if (pear.currentView === 'mosaic') { swatchImg(index); } else { focusImage(index); } }); }}); + $('.g-photo:not(.g-hover-item)').each(function (index) { + $(this).unbind('click'); + $(this).click(function () { + if (pear.currentView === 'mosaic') { swatchImg(index); } + else { focusImage(index); } }); + }); // Apply jQuery UI icon and hover styles to context menus if ($(".g-context-menu").length) { $(".g-context-menu li").addClass("ui-state-default"); @@ -308,6 +317,8 @@ function swatchImg(imageId) { } pear.currentImg = imageId; + //Image count. + if (!pear.redirected) { $.get(slideshowImages[pear.currentImg][6]); pear.redirected = false;} if (pear.currentView === 'mosaic') { $('#imageTitle').each(function (i) {$(this).html("

"); $(this).attr("savedH", $(this).height()); }); @@ -362,7 +373,7 @@ function showHoverView() { pear.hideHoverViewHandler = setTimeout(hideHoverView, 3000); } -function focusImage(id, redirected) { +function focusImage(id) { if (id < 0 || id >= slideshowImages.length) { if ( navigation.next !== '') { $.get(navigation.next,{ ajax: '1'},function (data) { @@ -377,10 +388,9 @@ function focusImage(id, redirected) { pear.detailView = true; swatchImg(id); $('#play_detail,#pause_detail').addClass('hidden'); + $('.g-block-content').hide(); $('#detailView').fadeIn('slow'); showHoverView(); - //Image count. - //if (!redirected) { $.get(slideshowImages[pear.currentImg][6]); } } function checkCookie() { @@ -440,6 +450,7 @@ function startSlideshow() { slideShowMode = true; $('#play_detail').addClass('hidden'); $('#pause_detail').removeClass('hidden'); + $('.g-block-content').hide(); $('#detailView').fadeIn('slow'); showHoverView(); pear.slideShowId = pear.currentImg; @@ -510,6 +521,7 @@ function startImageFlow() { function hideDetailView() { $('#detailView').hide(); + $('.g-block-content').show(); pear.slideShowMode = pear.detailView = false; if (pear.slideShowHandler !== null) { clearTimeout(pear.slideShowHandler); } pear.slideShowHandler = null; @@ -563,10 +575,11 @@ function pearInit(options) { if (h.bgcolor !== undefined) { pear.currentBg = h.bgcolor; } + pear.redirected = (h.redirected === 'true'); if (h.viewMode !== undefined) { if (h.viewMode === 'detail') { pear.currentView = pear.defaultView; - focusImage(pear.currentImg, h.redirected); + focusImage(pear.currentImg); } pear.currentView = h.viewMode; } @@ -594,7 +607,7 @@ function pearInit(options) { } setKeys(); - thumbLoad(); + setTimeout(thumbLoad, 1); $('#gridContainer').endlessScroll({ fireOnce: true, bottomPixels: 200, callback: function(p) { loadMore(); } }); $('#gridContainer').trigger('scroll'); diff --git a/theme.info b/theme.info index 58956738..67d9e1a2 100644 --- a/theme.info +++ b/theme.info @@ -1,6 +1,6 @@ name = ".Pear Theme" description = "A theme with the intention to mimic Apples mobile me gallery." -version = 3.4.1 +version = 3.5.2 author = "Fredrik Erlandsson " site = 1 admin = 0 diff --git a/views/album.html.php b/views/album.html.php index 747f94c5..8db6b7f8 100644 --- a/views/album.html.php +++ b/views/album.html.php @@ -56,5 +56,7 @@ $(window).load(function () { +item())): ?> album_bottom() ?> + diff --git a/views/facebook_comment.html.php b/views/facebook_comment.html.php index 1558d68c..31d14722 100644 --- a/views/facebook_comment.html.php +++ b/views/facebook_comment.html.php @@ -1,5 +1,6 @@
+

Facebook comments for

- +
- + diff --git a/views/page.html.php b/views/page.html.php index ef6c2719..f5b040d4 100644 --- a/views/page.html.php +++ b/views/page.html.php @@ -1,6 +1,12 @@ page_subtype == "search") { + $v = new View("thumbs.html"); + $v->children = $content->items; + print $v; + die(0); + } echo new View("thumbs.html"); die(0); } @@ -9,8 +15,19 @@ if (isset($_GET['ajax'])) { foreach (end($parents)->viewable()->children() as $i => $child) if(!($child->is_album() || $child->is_movie())) if($child->url() == $_SERVER['REQUEST_URI']) { - header("HTTP/1.1 302 Found"); - header("Location: ".end($parents)->url()."#img=$i&viewMode=detail&redirected=true"); +?> + +html_attributes() ?> xml:lang="en" lang="en"> + + Photo page + + + head() ?> + + Page moved here. + + @@ -131,7 +148,7 @@ if (isset($_GET['ajax'])) { item() && $theme->item()->id == item::root()->id)): ?> - + item()): ?> @@ -208,10 +225,14 @@ if (isset($_GET['ajax'])) {
- - + + url("icons/pear_logo_sml.png"); + } ?> + - diff --git a/views/search.html.php b/views/search.html.php index 3436a00c..cf7d99f1 100644 --- a/views/search.html.php +++ b/views/search.html.php @@ -1,48 +1,18 @@ - -
" id="g-search-form" class="g-short-form"> -
- - - -
    -
  • - - -
  • -
  • - for_html_attr() ?>" class="submit" /> -
  • -
-
-
- -
-

- - - - paginator() ?> - - + + + + + set_global("children", $items);// = $items; + print $v;?> +

- %term", array("term" => $q)) ?> + %term", array("term" => $q)) ?>

- - -
+ diff --git a/views/thumbs.html.php b/views/thumbs.html.php index 716ad657..fe61e065 100644 --- a/views/thumbs.html.php +++ b/views/thumbs.html.php @@ -6,7 +6,7 @@ 50) break; ?> is_album()): ?> - url()."/'+getAlbumHash(skimimg);"; ?> + url()."/'+getAlbumHash((typeof skimimg === 'undefined') ? 0 : skimimg);"; ?> is_photo()): ?> @@ -55,9 +55,7 @@ endif; $child): ?> is_album() || $child->is_movie())): ?> -slideshowImages[] = (['resize_url() ?>', 'id ?>', 'width ?>','height ?>', 'title, ENT_QUOTES) ?>', '', 'url() ?>']); - - +slideshowImages[] = (['resize_url() ?>', 'id ?>', 'resize_width ?>','resize_height ?>', 'title, ENT_QUOTES) ?>', '', 'url() ?>']);