1
0

Merge commit '25ae7f02cd893127901bd26fc1297d109b781746'

This commit is contained in:
Fredrik Erlandsson 2012-08-16 21:51:02 +02:00
commit b297aba1e3
10 changed files with 95 additions and 71 deletions

View File

@ -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))));

View File

@ -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) {

View File

@ -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;

View File

@ -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("<h2></h2>"); $(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');

View File

@ -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 <fredrik.e@gmail.com>"
site = 1
admin = 0

View File

@ -56,5 +56,7 @@ $(window).load(function () {
</div>
</div>
<? endif ?>
<? if(($theme->item())): ?>
<?= $theme->album_bottom() ?>
<? endif ?>

View File

@ -1,5 +1,6 @@
<?php defined("SYSPATH") or die("No direct script access.") ?>
<div class="g-facebook-comment-block">
<h1>Facebook comments for <?= $title?></h1>
<div id="fb-root"></div>
<script>
(function(d, s, id) {
@ -10,7 +11,15 @@
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
</script>
<fb:comments href="<?=$url?>" num_posts="5" width="478" colorscheme="dark"> </fb:comments>
<fb:comments href="<?if(isset($url)) { print $url; } else { print url::abs_current(); }?>"
num_posts="5" width="478" colorscheme="dark"> </fb:comments>
</div>
<script>FB.XFBML.parse(document.getElementById('g-dialog'));</script>
<script>
if (typeof(FB) != 'undefined') {
FB.XFBML.parse(document.getElementById('g-dialog'));
}
setTimeout(function () {
$("#g-dialog").removeClass("g-loading-small");
}, 10);
</script>

View File

@ -1,6 +1,12 @@
<?php defined("SYSPATH") or die("No direct script access.") ?>
<?
if (isset($_GET['ajax'])) {
if ($theme->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");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" <?= $theme->html_attributes() ?> xml:lang="en" lang="en">
<head>
<title>Photo page</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<meta http-equiv="refresh" content="1;url=<?=end($parents)->url()?>#img=<?=$i?>&amp;viewMode=detail&amp;redirected=true" />
<?= $theme->head() ?>
</head>
<body>Page moved <a href="<?=end($parents)->url()?>#img=<?=$i?>&amp;viewMode=detail&amp;redirected=true">here</a>.</body>
</html>
<?
die(0);
}?>
<? endif ?>
@ -131,7 +148,7 @@ if (isset($_GET['ajax'])) {
<? if (!module::get_var("th_pear4gallery3", "show_breadcrumbs")) break; ?>
<? endforeach ?>
<? elseif (!($theme->item() && $theme->item()->id == item::root()->id)): ?>
<button class="ui-button ui-button-text-only ui-widget ui-state-default ui-corner-all" onclick="window.location='<?= item::root()->url() ?>' + getAlbumHash(0);"> <span class="ui-button-text"><?= html::purify(text::limit_chars($parent->title, module::get_var("gallery", "visible_title_length"))) ?></span> </button>
<button class="ui-button ui-button-text-only ui-widget ui-state-default ui-corner-all" onclick="window.location='<?= item::root()->url() ?>' + getAlbumHash(0);"> <span class="ui-button-text"><?= html::purify(text::limit_chars(item::root()->title, module::get_var("gallery", "visible_title_length"))) ?></span> </button>
<? endif ?>
</div>
<? if ($theme->item()): ?>
@ -208,10 +225,14 @@ if (isset($_GET['ajax'])) {
<div class="clear"></div>
<? endif ?>
</div>
<? if (module::get_var("gallery", "logo_path")): ?>
<style type="text/css">#logoButton { background-image: url("<?= module::get_var("gallery", "logo_path") ?>"); }</style>
<? if (!module::get_var("th_pear4gallery3", "hide_logo")): ?>
<? if (module::get_var("gallery", "logo_path")) {
$logo_url = url::file(module::get_var("th_pear4gallery3", "logo_path"));
} else {
$logo_url = $theme->url("icons/pear_logo_sml.png");
} ?>
<button id="logoButton" style="background-image: url('<?= $logo_url ?>') !important"></button>
<? endif ?>
<? if (!module::get_var("th_pear4gallery3", "hide_logo")): ?><button id="logoButton"></button><? endif ?>
</div>
<? endif ?>
</body>

View File

@ -1,48 +1,18 @@
<?php defined("SYSPATH") or die("No direct script access.") ?>
<? // @todo Set hover on AlbumGrid list items ?>
<form action="<?= url::site("/search") ?>" id="g-search-form" class="g-short-form">
<fieldset>
<legend>
<?= t("Search") ?>
</legend>
<ul>
<li>
<label for="q"><?= t("Search the gallery") ?></label>
<input name="q" id="q" type="text" value="<?= html::clean_attribute($q) ?>" class="text" />
</li>
<li>
<input type="submit" value="<?= t("Search")->for_html_attr() ?>" class="submit" />
</li>
</ul>
</fieldset>
</form>
<div id="g-search-results">
<h1><?= t("Search results") ?></h1>
<? if (count($items)): ?>
<ul id="g-album-grid" class="ui-helper-clearfix">
<? foreach ($items as $item): ?>
<? $item_class = $item->is_album() ? "g-album" : "g-photo" ?>
<li class="g-item <?= $item_class ?>">
<a href="<?= $item->url() ?>">
<?= $item->thumb_img() ?>
<p>
<?= html::purify(text::limit_chars($item->title, 32, "")) ?>
</p>
<div>
<?= nl2br(html::purify(text::limit_chars($item->description, 64, ""))) ?>
</div>
</a>
</li>
<? endforeach ?>
</ul>
<?= $theme->paginator() ?>
<? else: ?>
<script>
$(function() {
$('#g-search').attr('value', '<?=$q?>');
$('.pearTitle').html("Search results for \"<?=$q?>\"");
});
</script>
<? if (count($items)): ?>
<?/* Treat dynamic pages just lite album pages. */ ?>
<? $children = $items ?>
<? $v = new View("album.html");
$v->set_global("children", $items);// = $items;
print $v;?>
<? else: ?>
<p>
<?= t("No results found for <b>%term</b>", array("term" => $q)) ?>
<?= t("No results found for <b>%term</b>", array("term" => $q)) ?>
</p>
<? endif; ?>
</div>
<? endif; ?>

View File

@ -6,7 +6,7 @@
<? if ($i > 50) break; ?>
<? $item_class = "g-photo"; ?>
<? if ($child->is_album()): ?>
<? $item_class = "g-album\" onclick=\"window.location='".$child->url()."/'+getAlbumHash(skimimg);"; ?>
<? $item_class = "g-album\" onclick=\"window.location='".$child->url()."/'+getAlbumHash((typeof skimimg === 'undefined') ? 0 : skimimg);"; ?>
<? endif ?>
<? $img_class = "g-thumbnail"; ?>
<? if ($child->is_photo()): ?>
@ -55,9 +55,7 @@ endif;
<? $item_no = ($page*$page_size)-$page_size; ?>
<? foreach ($children as $i => $child): ?>
<? if(!($child->is_album() || $child->is_movie())): ?>
slideshowImages[<?= $item_no++ ?>] = (['<?= $child->resize_url() ?>', '<?= $child->id ?>', '<?= $child->width ?>','<?= $child->height ?>', '<?= htmlentities($child->title, ENT_QUOTES) ?>', '<? if (access::can("view_full", $child)) print "true" ?>', '<?= $child->url() ?>']);
<? else: ?>
<? $item_no++ ?>
slideshowImages[<?= $item_no++ ?>] = (['<?= $child->resize_url() ?>', '<?= $child->id ?>', '<?= $child->resize_width ?>','<?= $child->resize_height ?>', '<?= htmlentities($child->title, ENT_QUOTES) ?>', '<? if (access::can("view_full", $child)) print "true" ?>', '<?= $child->url() ?>']);
<? endif ?>
<? endforeach ?>
<?= $javaScript ?>