1
0

Merge pull request #2 from gallery/master

Retrofit gallery/gallery3-contrib into mikemayer67/gallery3-contrib (master)
This commit is contained in:
Mike Mayer 2012-10-18 22:37:42 -07:00
commit b0c2a60c8c
23 changed files with 290 additions and 213 deletions

View File

@ -23,26 +23,35 @@ class author_block_Core {
}
static function get($block_id, $theme) {
$block = "";
$item = $theme->item;
if ($block_id != 'author' || $item->is_album() ) {
return '';
if ((!isset($theme->item)) || ($item->is_album())) {
return;
}
$record = db::build()
->select("author")
->from("author_records")
->where("item_id", "=", $item->id)
->execute()
->current();
switch ($block_id) {
case "author":
$record = ORM::factory("author_record")->where("item_id", "=", $item->id)->find();
$byline = "";
if ($record->loaded()) {
$byline = $record->author;
}
if ($byline == '') {
$byline = author::fix($item);
}
$byline = $record->author;
if ($byline == '') {
$byline = author::fix($item);
$block = new Block();
$block->css_id = "g-author";
$block->content = new View("author_block.html");
$block->content->author = $byline;
break;
}
$block = new Block();
$block->content = new View("author_block.html");
$block->content->author = $byline;
return $block;
}
}

View File

@ -100,14 +100,14 @@ class Admin_Carousel_Controller extends Admin_Controller {
$shortrange["$key"] = sprintf("%.1f", (float)$i / 2);
}
if (module::get_var("carousel", "autoscroll") == true) {
$disableme == "false";
$disableme = "false";
} else {
$disableme == "true";
$disableme = "true";
}
$form = new Forge("admin/carousel/handler", "", "post", array("id" => "g-admin-form"));
$group = $form->group("carousel")->label(t("General carousel settings"));
$group->checkbox("circular")->label(t('Enable the carousel to be circular so it starts over again from the beggining.'))
$group->checkbox("circular")->label(t('Enable the carousel to be circular so it starts over again from the beginning.'))
->checked(module::get_var("carousel", "circular", "0"));
$group->checkbox("autoscroll")->label(t('Carousel should auto scroll. Toggle value to change settings below.'))
->onClick("toggle()")
@ -135,7 +135,7 @@ class Admin_Carousel_Controller extends Admin_Controller {
$group->dropdown("visible2")->label(t('Enter number of thumbs to show. (height of carousel)'))
->options($shortrange)
->selected(module::get_var("carousel", "visible2", "1"));
$group->dropdown("quantity2")->label(t("Choose the toal quantity of thumbs in recent carousel."))
$group->dropdown("quantity2")->label(t("Choose the total quantity of thumbs in recent carousel."))
->options($range)
->selected(module::get_var("carousel", "quantity2", "25"));
$group->checkbox("onalbum2")->label(t("Show on album & collection pages"))
@ -152,7 +152,7 @@ class Admin_Carousel_Controller extends Admin_Controller {
$group->dropdown("visible3")->label(t('Enter number of thumbs to show. (height of carousel)'))
->options($shortrange)
->selected(module::get_var("carousel", "visible3", "1"));
$group->dropdown("quantity3")->label(t("Choose the toal quantity of thumbs in popular carousel."))
$group->dropdown("quantity3")->label(t("Choose the total quantity of thumbs in popular carousel."))
->options($range)
->selected(module::get_var("carousel", "quantity3", "25"));
$group->checkbox("onalbum3")->label(t("Show on album & collection pages"))
@ -169,7 +169,7 @@ class Admin_Carousel_Controller extends Admin_Controller {
$group->dropdown("visible")->label(t('Enter number of thumbs to show. (height of carousel)'))
->options($shortrange)
->selected(module::get_var("carousel", "visible", "1"));
$group->dropdown("quantity")->label(t("Choose the toal quantity of thumbs in random carousel."))
$group->dropdown("quantity")->label(t("Choose the total quantity of thumbs in random carousel."))
->options($range)
->selected(module::get_var("carousel", "quantity", "25"));
$group->checkbox("onalbum")->label(t("Show on album & collection pages"))
@ -180,4 +180,4 @@ class Admin_Carousel_Controller extends Admin_Controller {
$form->submit("submit")->value(t("Save"));
return $form;
}
}
}

View File

@ -17,7 +17,10 @@ window.onload=toggle;
<div class="g-block">
<hr />
<h3><?= t("Notes:") ?></h3>
<p><?= t("Navigation buttons are hard to style and clutter the user interface.<br />
Use mouse wheel to scroll thought the images.") ?></p>
<p>
<?= t("Navigation buttons are hard to style and clutter the user interface.") ?>
<br />
<?= t("Use mouse wheel to scroll through the images.") ?>
</p>
</div>
</div>

View File

@ -27,6 +27,7 @@ class Admin_Social_Share_Controller extends Admin_Controller {
$form = $this->_get_form();
if ($form->validate()) {
module::set_var("social_share", "general_impage_only", $form->general_settings->general_impage_only->value);
module::set_var("social_share", "facebook_share_enabled", $form->facebook_share_settings->facebook_share_enabled->value);
module::set_var("social_share", "facebook_share_layout", $form->facebook_share_settings->facebook_share_layout->value);
module::set_var("social_share", "facebook_share_link_text", $form->facebook_share_settings->facebook_share_link_text->value);
@ -42,6 +43,8 @@ class Admin_Social_Share_Controller extends Admin_Controller {
module::set_var("social_share", "google_enabled", $form->google_settings->google_enabled->value);
module::set_var("social_share", "google_size", $form->google_settings->google_size->value);
module::set_var("social_share", "google_annotation", $form->google_settings->google_annotation->value);
module::set_var("social_share", "pinterest_enabled", $form->pinterest_settings->pinterest_enabled->value);
module::set_var("social_share", "pinterest_count_location", $form->pinterest_settings->pinterest_count_location->value);
module::set_var("social_share", "twitter_enabled", $form->twitter_settings->twitter_enabled->value);
module::set_var("social_share", "twitter_count_location", $form->twitter_settings->twitter_count_location->value);
module::set_var("social_share", "twitter_size", $form->twitter_settings->twitter_size->value);
@ -62,6 +65,12 @@ class Admin_Social_Share_Controller extends Admin_Controller {
private function _get_form() {
$form = new Forge("admin/social_share/handler", "", "post", array("id" => "g-admin-form"));
/// General Settings
$group_general = $form->group("general_settings")->label(t("General Settings"));
$group_general->checkbox("general_impage_only")->label(t("Display the enabled buttons on image and movie pages only"))
->checked(module::get_var("social_share", "general_impage_only", true) == 1);
/// Facebook share settings
$group_facebook_share = $form->group("facebook_share_settings")->label(t("Facebook Share Button Settings"));
$group_facebook_share->checkbox("facebook_share_enabled")->label(t("Display the button"))
->checked(module::get_var("social_share", "facebook_share_enabled", false) == 1);
@ -73,7 +82,8 @@ class Admin_Social_Share_Controller extends Admin_Controller {
->selected(module::get_var("social_share", "facebook_share_layout"));
$group_facebook_share->input("facebook_share_link_text")->label(t('Enter the text to place next to the Facebook icon.'))
->value(module::get_var("social_share", "facebook_share_link_text", "Share"));
/// Facebook like settings
$group_facebook_like = $form->group("facebook_like_settings")->label(t("Facebook Like Button Settings"));
$group_facebook_like->checkbox("facebook_like_enabled")->label(t("Display the button"))
->checked(module::get_var("social_share", "facebook_like_enabled", false) == 1);
@ -107,7 +117,8 @@ class Admin_Social_Share_Controller extends Admin_Controller {
"button_count" => t("Button count"),
"box_count" => t("Box count")))
->selected(module::get_var("social_share", "facebook_like_layout"));
/// Google settings
$group_google = $form->group("google_settings")->label(t("Google+ +1 Button Settings"));
$group_google->checkbox("google_enabled")->label(t("Display the button"))
->checked(module::get_var("social_share", "google_enabled", false) == 1);
@ -125,6 +136,18 @@ class Admin_Social_Share_Controller extends Admin_Controller {
"none" => t("None")))
->selected(module::get_var("social_share", "google_annotation"));
/// Pinterest settings
$group_pinterest = $form->group("pinterest_settings")->label(t("Pinterest Pinit Settings"));
$group_pinterest->checkbox("pinterest_enabled")->label(t("Display the button"))
->checked(module::get_var("social_share", "pinterest_enabled", false) == 1);
$group_pinterest->dropdown("pinterest_count_location")
->label(t("Tweet count location"))
->options(array("horizontal" => t("Horizontal"),
"vertical" => t("Vertical"),
"none" => t("None")))
->selected(module::get_var("social_share", "pinterest_count_location"));
/// Twitter settings
$group_twitter = $form->group("twitter_settings")->label(t("Twitter Tweet Settings"));
$group_twitter->checkbox("twitter_enabled")->label(t("Display the button"))
->checked(module::get_var("social_share", "twitter_enabled", false) == 1);

View File

@ -18,30 +18,37 @@
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
*/
class social_share_block_Core {
static function get_site_list() {
return array(
"social_share" => t("Social Share"));
}
static function get_site_list() {
return array("social_share" => t("Social Share"));
}
static function get($block_id, $theme) {
$block = new Block();
$block->css_id = "g-social-share";
$block->title = 'Share With Friends';
$block->content = '';
if(module::get_var("social_share", "facebook_share_enabled")){
$block->content .= new View("facebook_share.html");
}
if(module::get_var("social_share", "facebook_like_enabled")){
$block->content .= new View("facebook_like.html");
}
if(module::get_var("social_share", "google_enabled")){
$block->content .= new View("google.html");
}
if(module::get_var("social_share", "twitter_enabled")){
$block->content .= new View("twitter.html");
}
return $block;
}
static function get($block_id, $theme) {
/// Check if the user wants to show the block on all pages or just the image and movie page types.
$impageonly = module::get_var("social_share", "general_impage_only");
$showblock = !$impageonly || ($impageonly && ($theme->page_subtype == "photo") || ($theme->page_subtype == "movie"));
if ($showblock){
$block = new Block();
$block->css_id = "g-social-share";
$block->title = 'Share With Friends';
$block->content = '';
if(module::get_var("social_share", "facebook_share_enabled")){
$block->content .= new View("facebook_share.html");
}
if(module::get_var("social_share", "facebook_like_enabled")){
$block->content .= new View("facebook_like.html");
}
if(module::get_var("social_share", "google_enabled")){
$block->content .= new View("google.html");
}
if(module::get_var("social_share", "pinterest_enabled")){
$block->content .= new View("pinterest.html");
}
if(module::get_var("social_share", "twitter_enabled")){
$block->content .= new View("twitter.html");
}
return $block;
}
}
}

View File

@ -18,39 +18,46 @@
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
*/
class social_share_installer {
static function deactivate() {
module::clear_var("social_share", "facebook_share_enabled");
module::clear_var("social_share", "facebook_share_layout");
module::clear_var("social_share", "facebook_share_link_text");
module::clear_var("social_share", "facebook_like_enabled");
module::clear_var("social_share", "facebook_like_appId");
module::clear_var("social_share", "facebook_like_adminId");
module::clear_var("social_share", "facebook_like_site_name");
module::clear_var("social_share", "facebook_like_code_type");
module::clear_var("social_share", "facebook_like_show_faces");
module::clear_var("social_share", "facebook_like_send");
module::clear_var("social_share", "facebook_like_action");
module::clear_var("social_share", "facebook_like_layout");
module::clear_var("social_share", "google_enabled");
module::clear_var("social_share", "google_size");
module::clear_var("social_share", "google_annotation");
module::clear_var("social_share", "twitter_enabled");
module::clear_var("social_share", "twitter_count_location");
module::clear_var("social_share", "twitter_size");
}
static function upgrade($version) {
if ($version < 1) {
module::set_version("social_share", $version = 1);
static function deactivate() {
module::clear_var("social_share", "general_impage_only");
module::clear_var("social_share", "facebook_share_enabled");
module::clear_var("social_share", "facebook_share_layout");
module::clear_var("social_share", "facebook_share_link_text");
module::clear_var("social_share", "facebook_like_enabled");
module::clear_var("social_share", "facebook_like_appId");
module::clear_var("social_share", "facebook_like_adminId");
module::clear_var("social_share", "facebook_like_site_name");
module::clear_var("social_share", "facebook_like_code_type");
module::clear_var("social_share", "facebook_like_show_faces");
module::clear_var("social_share", "facebook_like_send");
module::clear_var("social_share", "facebook_like_action");
module::clear_var("social_share", "facebook_like_layout");
module::clear_var("social_share", "google_enabled");
module::clear_var("social_share", "google_size");
module::clear_var("social_share", "google_annotation");
module::clear_var("social_share", "pinterest_enabled");
module::clear_var("social_share", "pinterest_count_location");
module::clear_var("social_share", "twitter_enabled");
module::clear_var("social_share", "twitter_count_location");
module::clear_var("social_share", "twitter_size");
}
static function upgrade($version) {
if ($version < 1) {
module::set_version("social_share", $version = 1);
}
if ($version < 2) {
module::set_var("social_share", "facebook_share_enabled", module::get_var("social_share", "facebook"));
module::clear_var("social_share", "facebook");
module::set_var("social_share", "google_enabled", module::get_var("social_share", "google"));
module::clear_var("social_share", "google");
module::set_var("social_share", "twitter_enabled", module::get_var("social_share", "twitter"));
module::clear_var("social_share", "twitter");
module::set_version("social_share", $version = 2);
if ($version < 2) {
module::set_var("social_share", "facebook_share_enabled", module::get_var("social_share", "facebook"));
module::clear_var("social_share", "facebook");
module::set_var("social_share", "google_enabled", module::get_var("social_share", "google"));
module::clear_var("social_share", "google");
module::set_var("social_share", "twitter_enabled", module::get_var("social_share", "twitter"));
module::clear_var("social_share", "twitter");
module::set_version("social_share", $version = 2);
}
if ($version < 3) {
module::set_version("social_share", $version = 3);
}
}
}
}

View File

@ -18,21 +18,24 @@
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
*/
class social_share_theme_Core {
static function head($theme) {
if ($theme->item()) {
$item = $theme->item();
$url = $item->thumb_url(true);
$appId = module::get_var("social_share", "facebook_like_appId");
$adminId = module::get_var("social_share", "facebook_like_adminId");
$site_name = module::get_var("social_share", "facebook_like_site_name");
$selfURL = url::abs_current(true);
return "\t<meta property=\"og:image\" content=\"$url\"/>
<meta property=\"og:title\" content=\"$item->title\"/>
<meta property=\"og:type\" content=\"article\"/>
<meta property=\"og:url\" content=\"$selfURL\"/>
<meta property=\"og:site_name\" content=\"$site_name\"/>
<meta property=\"fb:app_id\" content=\"$appId\"/>
<meta property=\"fb:admins\" content=\"$adminId\"/>";
}
}
static function head($theme) {
$impageonly = module::get_var("social_share", "general_impage_only");
$showblock = !$impageonly || ($impageonly && ($theme->page_subtype == "photo") || ($theme->page_subtype == "movie"));
if ($showblock && $theme->item()) {
$item = $theme->item();
$url = $item->thumb_url(true);
$appId = module::get_var("social_share", "facebook_like_appId");
$adminId = module::get_var("social_share", "facebook_like_adminId");
$site_name = module::get_var("social_share", "facebook_like_site_name");
$selfURL = url::abs_current(true);
return "\t<meta property=\"og:image\" content=\"$url\"/>
<meta property=\"og:title\" content=\"$item->title\"/>
<meta property=\"og:type\" content=\"article\"/>
<meta property=\"og:url\" content=\"$selfURL\"/>
<meta property=\"og:site_name\" content=\"$site_name\"/>
<meta property=\"fb:app_id\" content=\"$appId\"/>
<meta property=\"fb:admins\" content=\"$adminId\"/>";
}
}
}

View File

@ -1,6 +1,6 @@
name = "Social Share"
description = "Adds links to share the page to social media sites in the sidebar."
version = 2
version = 3
author_name = "jasonhardin"
author_url = "http://codex.gallery2.org/User:psychoph"
info_url = "http://codex.gallery2.org/Gallery3:Modules:social_share"

View File

@ -17,7 +17,6 @@ if (module::get_var("social_share", "facebook_like_send")) {
$send = "false";
}
?>
<div class="g-social_share-facebook_like">
<?php if ($codeType == 'iframe'){ ?>
@ -28,14 +27,13 @@ if (module::get_var("social_share", "facebook_like_send")) {
&amp;show_faces=<?= $show_faces ?>
&amp;width=180
&amp;locale=<?= locales::cookie_locale(); ?>
&amp;action=<?= $layout ?>
&amp;action=<?= $action ?>
&amp;colorscheme=light&amp;height=<?= $hite; ?>" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:180px; height:<?= $hite; ?>px;" allowTransparency="true">
</iframe>
<?php } else { ?>
<div id="fb-root"></div>
<script>(function(d, s, id) {
window.FB = null;FB=null;// this is needed for the facebook share button being on.
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
@ -45,12 +43,11 @@ if (module::get_var("social_share", "facebook_like_send")) {
<?php if($codeType == 'xfbml'){?>
<fb:like href="<?= $selfURL; ?>" send="<?= $send ?>" width="180" show_faces="<?= $show_faces ?>" layout="<?= $layout?>" action="<?= $layout ?>"></fb:like>
<fb:like href="http://test.com" send="true" width="180" show_faces="false"></fb:like>
<fb:like href="<?= $selfURL; ?>" send="<?= $send ?>" width="180" show_faces="<?= $show_faces ?>" layout="<?= $layout?>" action="<?= $action ?>"></fb:like>
<?php } else { ?>
<div class="fb-like" data-href="<?= $selfURL; ?>" data-send="<?= $send ?>" data-layout="<?= $layout?>" data-width="180" data-show-faces="<?= $show_faces ?>" data-action="<?= $layout ?>"></div>
<div class="fb-like" data-href="<?= $selfURL; ?>" data-send="<?= $send ?>" data-layout="<?= $layout?>" data-width="180" data-show-faces="<?= $show_faces ?>" data-action="<?= $action ?>"></div>
<?php }
}

View File

@ -1,5 +1,5 @@
<?php defined("SYSPATH") or die("No direct script access.") ?>
<?php defined("SYSPATH") or die("No direct script access.")?>
<div class="g-social_share-facebook_share">
<a id="facebookicon" name="fb_share" type="<?= module::get_var("social_share", "facebook_share_layout") ?>"><?= module::get_var("social_share", "facebook_share_link_text") ?></a>
<a id="facebookicon" name="fb_share" type="<?= module::get_var("social_share", "facebook_share_layout") ?>"></a>
<script src="http://static.ak.fbcdn.net/connect.php/js/FB.Share" type="text/javascript"></script>
</div>

View File

@ -11,7 +11,7 @@
(function() {
var po = document.createElement('script');
po.type = 'text/javascript';
x2po.async = true;
po.async = true;
po.src = 'https://apis.google.com/js/plusone.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s);
})();

View File

@ -0,0 +1,14 @@
<?php defined("SYSPATH") or die("No direct script access.");
if ($theme->item()) {
$url = urlencode(url::abs_current(true));
$item = $theme->item();
$media = urlencode($item->thumb_url(true));
$description=urlencode($item->description);
?>
<div class="g-social_share-pinterest_pinit">
<a href="http://pinterest.com/pin/create/button/?url=<?= $url; ?>&media=<?= $media; ?>&description=<?= $description; ?>" class="pin-it-button" count-layout="<?= module::get_var("social_share", "pinterest_count_location") ?>">
<img border="0" src="//assets.pinterest.com/images/PinExt.png" title="Pin It" />
</a>
<script type="text/javascript" src="//assets.pinterest.com/js/pinit.js"></script>
</div>
<?php } ?>

View File

@ -1,4 +1,5 @@
<?php defined("SYSPATH") or die("No direct script access.") ?>
<?php header("X-Frame-Options: SAMEORIGIN"); ?>
<!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">
@ -10,11 +11,11 @@
<?= $page_title ?>
<? else: ?>
<? if ($theme->item()): ?>
<?= $theme->item()->title ?>
<?= html::purify($theme->item()->title) ?>
<? elseif ($theme->tag()): ?>
<?= t("Photos tagged with %tag_title", array("tag_title" => $theme->tag()->name)) ?>
<? else: /* Not an item, not a tag, no page_title specified. Help! */ ?>
<?= item::root()->title ?>
<?= html::purify(item::root()->title) ?>
<? endif ?>
<? endif ?>
</title>
@ -24,7 +25,7 @@
<link rel="apple-touch-icon-precomposed"
href="<?= url::file(module::get_var("gallery", "apple_touch_icon_url")) ?>" />
<? if ($theme->page_type == "collection"): ?>
<? if ($thumb_proportion != 1): ?>
<? if (($thumb_proportion = $theme->thumb_proportion($theme->item())) != 1): ?>
<? $new_width = round($thumb_proportion * 213) ?>
<? $new_height = round($thumb_proportion * 240) ?>
<style type="text/css">
@ -77,7 +78,7 @@
<!-- LOOKING FOR YOUR CSS? It's all been combined into the link below -->
<?= $theme->get_combined("css") ?>
<!-- LOOKING FOR YOUR JAVASCRIPT? It's all been combined into the link below -->
<?= $theme->get_combined("script") ?>
</head>
@ -92,7 +93,7 @@
<?= $header_text ?>
<? else: ?>
<a id="g-logo" class="g-left" href="<?= item::root()->url() ?>" title="<?= t("go back to the Gallery home")->for_html_attr() ?>">
<img alt="<?= t("Gallery logo: Your photos on your web site")->for_html_attr() ?>" src="<?= url::file("lib/images/logo.png") ?>" />
<img width="107" height="48" alt="<?= t("Gallery logo: Your photos on your web site")->for_html_attr() ?>" src="<?= url::file("lib/images/logo.png") ?>" />
</a>
<? endif ?>
<?= $theme->user_menu() ?>
@ -107,28 +108,16 @@
<?= $theme->header_bottom() ?>
</div>
<? if ($theme->item() && !empty($parents)): ?>
<? if (!empty($breadcrumbs)): ?>
<ul class="g-breadcrumbs">
<? $i = 0 ?>
<? foreach ($parents as $parent): ?>
<li<? if ($i == 0) print " class=\"g-first\"" ?>>
<? // Adding ?show=<id> causes Gallery3 to display the page
// containing that photo. For now, we just do it for
// the immediate parent so that when you go back up a
// level you're on the right page. ?>
<a href="<?= $parent->url($parent->id == $theme->item()->parent_id ?
"show={$theme->item()->id}" : null) ?>">
<? // limit the title length to something reasonable (defaults to 15) ?>
<?= html::purify(text::limit_chars($parent->title,
module::get_var("gallery", "visible_title_length"))) ?>
</a>
</li>
<? $i++ ?>
<? foreach ($breadcrumbs as $breadcrumb): ?>
<li class="<?= $breadcrumb->last ? "g-active" : "" ?>
<?= $breadcrumb->first ? "g-first" : "" ?>">
<? if (!$breadcrumb->last): ?> <a href="<?= $breadcrumb->url ?>"><? endif ?>
<?= html::purify(text::limit_chars($breadcrumb->title, module::get_var("gallery", "visible_title_length"))) ?>
<? if (!$breadcrumb->last): ?></a><? endif ?>
</li>
<? endforeach ?>
<li class="g-active<? if ($i == 0) print " g-first" ?>">
<?= html::purify(text::limit_chars($theme->item()->title,
module::get_var("gallery", "visible_title_length"))) ?>
</li>
</ul>
<? endif ?>
</div>

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"));
@ -120,7 +120,7 @@ class Admin_Theme_Options_Controller extends Admin_Controller {
->label(t("<a href=\"http://www.google.com/analytics/\">Google analytics</a> code."))
->value(module::get_var("th_pear4gallery3", "ga_code"));
$group->input("skimm_lim")
->label(t("Limit amount of thumbs in album skimming"))
->label(t("Limit amount of thumbs in album skimming (set to 0 to disable)"))
->value(module::get_var("th_pear4gallery3", "skimm_lim", "50"));
/* Advanced Options - Mosaic page ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
@ -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

@ -85,7 +85,7 @@ h2 {
position: fixed;
top: 44px;
width: 100%;
z-index: 50;
z-index: 150;
}
/*Menu*/
.sf-menu li:hover, .sf-menu li.sfHover, .sf-menu a:focus, .sf-menu a:hover, .sf-menu a:active {
@ -161,12 +161,11 @@ outline: medium none;
#mosaicTable {
position: fixed;
top: 45px;
bottom: 40px;
overflow: hidden;
left: 0;
right: 0;
margin-top: 5px;
margin: 0;
}
#mosaicDetail {
@ -181,6 +180,7 @@ outline: medium none;
margin: 0 auto;
width: 100%;
position: absolute;
padding: 5px 0;
}
#mosaicImg {
@ -204,6 +204,7 @@ outline: medium none;
}
#sidebarContainer {
width: 221px;
position: fixed;
right: 0;
overflow: none;
@ -212,8 +213,8 @@ outline: medium none;
}
#toggleSidebar {
position: absolute;
z-index: 1;
top: 2px;
z-index: 101;
top: 1px;
left: -18px;
}
@ -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");
@ -192,6 +201,7 @@ function mosaicResize() {
myHeight = myHeight - $('#g-site-status').outerHeight(true) - $('#paginator').outerHeight(true);
myHeight -= 138;
$('#g-header').css('top', $('#gsNavBar').outerHeight(true) + $('#g-site-status').outerHeight(true) - 4);
$('#mosaicTable, #sidebarContainer').css('top', $('#gsNavBar').outerHeight(true) + $('#g-site-status').outerHeight(true) + $('#g-action-status').outerHeight(true) - 2 );
if ($('#g-movie').length) {
myHeight += 18;
@ -308,6 +318,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 +374,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 +389,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 +451,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 +522,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 +576,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 +608,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.4
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 ?>