1
0

Merge branch 'master' of github.com:gallery/gallery3-contrib

This commit is contained in:
Bharat Mediratta 2011-12-25 17:27:21 -08:00
commit adcfca0f5b
36 changed files with 1023 additions and 491 deletions

View File

@ -22,7 +22,16 @@ __all__ = ['Album' , 'Image' , 'LocalImage' , 'RemoteImage' , 'LocalMovie' ,
'RemoteMovie' , 'getItemFromResp' , 'getItemsFromResp']
from datetime import datetime
import json , weakref , types , os , mimetypes , re
import weakref , types , os , mimetypes , re
try:
import json
except:
try:
import simplejson
except ImportError , e:
raise ImportError('You must have either the "json" or "simplejson"'
'library installed!')
class BaseRemote(object):
def __init__(self , respObj , weakGalObj , weakParent=None):

View File

@ -26,7 +26,15 @@ from G3Items import getItemFromResp , getItemsFromResp , BaseRemote , Album , \
RemoteImage , Tag
from urllib import quote , urlencode
from uuid import uuid4
import urllib2 , os , json
import urllib2 , os
try:
import json
except:
try:
import simplejson
except ImportError , e:
raise ImportError('You must have either the "json" or "simplejson"'
'library installed!')
class Gallery3(object):
"""
@ -129,7 +137,6 @@ class Gallery3(object):
uri(str) : The uri string defining the resource on the defined host
"""
url = self._buildUrl(uri , kwargs)
print url
return self.getRespFromUrl(url)
def addAlbum(self , parent , albumName , title , description=''):

View File

@ -21,4 +21,4 @@
from G3Items import *
from Gallery3 import *
__version__ = '0.1.4'
__version__ = '0.1.5'

View File

@ -0,0 +1,46 @@
<?php defined("SYSPATH") or die("No direct script access.");
class Admin_fittoscreen_Controller extends Admin_Controller {
public function index() {
print $this->_get_view();
}
private function _get_view($form=null) {
$view = new Admin_View("admin.html");
$view->page_title = t("Fit to Screen parameters");
$view->content = new View("admin_fittoscreen.html");
$view->content->form = (empty($form) ? $this->_get_form() : $form) ;
return $view;
}
private function _get_form() {
$form = new Forge("admin/fittoscreen/save", "", "post", array("id" => "g-admin-form"));
$form->dropdown("width_unit")->label(t("Image width unit"))->options(array("px"=>"pixel margin","pr"=>"max pourcentage"))->selected(module::get_var("fittoscreen", "width_unit"));
$form->input("width")->label(t('width'))->rules("required|valid_numeric|length[1,5]")->value(module::get_var("fittoscreen", "width"));
$form->dropdown("height_unit")->label(t("Image height unit"))->options(array("px"=>"pixel margin","pr"=>"max pourcentage"))->selected(module::get_var("fittoscreen", "height_unit"));
$form->input("height")->label(t('height'))->rules("required|valid_numeric|length[1,5]")->value(module::get_var("fittoscreen", "height"));
$form->submit("submit")->value(t("Save"));
return $form;
}
public function save(){
access::verify_csrf();
$form = $this->_get_form();
if ($form->validate()) {
module::set_var("fittoscreen", "width_unit", $form->width_unit->value);
module::set_var("fittoscreen", "width", $form->width->value);
module::set_var("fittoscreen", "height_unit", $form->height_unit->value);
module::set_var("fittoscreen", "height", $form->height->value);
}
print $this->_get_view($form);
}
}
?>

View File

@ -0,0 +1,13 @@
<?php defined("SYSPATH") or die("No direct script access.");
class fittoscreen_event_Core {
static function admin_menu($menu, $theme) {
$menu->get("settings_menu")
->append(Menu::factory("link")
->id("fittoscreen_menu")
->label(t("Fit to Screen"))
->url(url::site("admin/fittoscreen")));
}
}
?>

View File

@ -0,0 +1,14 @@
<?php defined("SYSPATH") or die("No direct script access.");
class fittoscreen_installer {
static function install() {
module::set_var("fittoscreen", "width", "150");
module::set_var("fittoscreen", "height", "200");
module::set_version("fittoscreen", 10);
}
}
?>

View File

@ -0,0 +1,9 @@
<?php defined("SYSPATH") or die("No direct script access.");
class fittoscreen_theme {
static function photo_top($theme) {
return new View("fittoscreen_photo.html");
}
}
?>

View File

@ -0,0 +1,7 @@
name = "Fit to Screen"
description = "Dynamicaly resize the photo size to fit the screen.<br />Version 1.0 | By <a href=http://www.bouthors.fr>Matthieu Bouthors</a> | <a href=http://codex.gallery2.org/Gallery3:Modules:fittoscreen>Visit plugin Site</a> | <a href=http://gallery.menalto.com/node/103929>Support</a> | <a href=fittoscreen>Settings</a>"
version = 10
author_name = "Matthieu Bouthors"
author_url = "http://www.bouthors.fr"
info_url = "http://codex.gallery2.org/Gallery3:Modules:Fittoscreen"
discuss_url = "http://gallery.menalto.com/node/103929"

View File

@ -0,0 +1,7 @@
<?php defined("SYSPATH") or die("No direct script access.") ?>
<div class="g-block">
<h1> <?= t("Fit to Screen parameters") ?> </h1>
<div class="g-block-content">
<?= $form ?>
</div>
</div>

View File

@ -0,0 +1,35 @@
<?php defined("SYSPATH") or die("No direct script access.") ?>
<script type="text/javascript">
function dynresize() {
var $maxheight = <?= $item->resize_height ?>;
var $maxwidth = <?= $item->resize_width ?>;
var $ratio = $maxwidth/$maxheight;
var $winwidth = $(window).width() <?= (module::get_var("fittoscreen", "width_unit")=="pr" ? "*".number_format(module::get_var("fittoscreen", "width")/100,2,".","") : "-".module::get_var("fittoscreen", "width")) ?>;
var $winheight = $(window).height() <?= (module::get_var("fittoscreen", "height_unit")=="pr" ? "*".number_format(module::get_var("fittoscreen", "height")/100,2,".","") : "-".module::get_var("fittoscreen", "height")) ?>;
if (($winwidth/$winheight)<$ratio) {
$finalwidth = ($winwidth > $maxwidth ? $maxwidth : $winwidth);
$finalheight = $finalwidth / $ratio;
}
else {
$finalheight = ($winheight > $maxheight ? $maxheight : $winheight);
$finalwidth = $finalheight * $ratio;
}
// $('body').prepend('<div>' + $finalheight + " " + $finalwidth + '</div>');
$("img.g-resize").attr({
height: $finalheight,
width: $finalwidth,
});
}
$(window).resize(dynresize);
$(document).ready(dynresize);
</script>

View File

@ -1,135 +0,0 @@
<?php defined("SYSPATH") or die("No direct script access.") ?>
<?
// The g-info block was taken from album.html.php and $theme->album_top() was changed to $theme->dynamic_top().
// $item->title and $item->description have been changed to $title and $description.
//
// The g-album-grid block was also taken from album.html.php. The section for uploading new photos to an empty album
// has been removed. Also, $theme->context_menu has been removed as well (it was crashing the page).
?>
<div id="g-album-header">
<?= $theme->dynamic_top() ?>
<h1><?= $theme->bb2html(html::purify($title), 1) ?></h1>
</div>
<?= $theme->add_paginator("top"); ?>
<? if (($theme->album_descmode == "top") and ($description)): ?>
<div id="g-info"><div class="g-description"><?= $theme->bb2html(html::purify($description), 1) ?></div></div>
<? endif; ?>
<? if (isset($filter_text) && (module::get_var("tag_albums", "tag_index_filter"))): ?>
<div id="g-tags-filter">
<br/ >
<center><?= $filter_text; ?></center>
</div>
<? endif ?>
<div class="g-album-grid-container">
<ul id="g-album-grid" class="<?= $theme->get_grid_column_class(); ?>">
<? if (count($children)): ?>
<? foreach ($children as $i => $child): ?>
<?
// This code is based on grey dragon's get_thumb_element function.
$thumb_item = $child;
$is_portrait = ($thumb_item->thumb_height > $thumb_item->thumb_width);
$item_class = $child->is_album() ? "g-album" : "g-photo";
$content = '<li id="g-item-id-' . $child->id . '" class="g-item ' . $item_class . ' ' . $theme->thumb_type;
if ($child->is_album()):
$_thumb_descmode = $theme->thumb_descmode_a;
else:
$_thumb_descmode = $theme->thumb_descmode;
endif;
$content .= ($_thumb_descmode == "bottom")? " g-expanded" : " g-default";
$content .= ($is_portrait)? " g-portrait" : " g-landscape";
$content .= '">' . $theme->thumb_top($child);
if ($theme->thumb_topalign):
$_shift = "";
else:
if (($theme->crop_factor == 1) and (!$is_portrait)):
$_shift = 'style="margin-top: ' . intval(($theme->_thumb_size_y - $thumb_item->thumb_height) / 2) . 'px;"';
else:
if (($theme->crop_factor > 0) and ($is_portrait)):
$_shift = 'style="margin-top: -' . intval(($thumb_item->thumb_height - $theme->_thumb_size_y) / 2) . 'px;"';
else:
$_shift = "";
endif;
endif;
endif;
// $ss = 'z-index: 22; opacity: 1; -ms-transform: rotate(' . (-15 + rand(0, 31)) . 'deg);'; style="' . $ss . '"
$content .= '<div class="g-thumbslide"><p class="g-thumbcrop">';
$content .= '<a '. $_shift . ' class="g-thumblink" href="' . $child->url() . '">';
if ($thumb_item->has_thumb()):
$content .= $thumb_item->thumb_img();
else:
$content .= '<img title="No Image" alt="No Image" src="' . $theme->url("images/missing-img.png") . '"/>';
endif;
$content .= '</a></p>';
if (($theme->thumb_metamode != "hide") and ($_thumb_descmode == "overlay_bottom")):
$_thumb_metamode = "merged";
else:
$_thumb_metamode = $theme->thumb_metamode;
endif;
if (($_thumb_descmode == "overlay") or ($_thumb_descmode == "overlay_top") or ($_thumb_descmode == "overlay_bottom")):
$content .= '<ul class="g-description ';
if ($_thumb_descmode == "overlay_top"):
$content .= 'g-overlay-top';
endif;
if ($_thumb_descmode == "overlay_bottom"):
$content .= 'g-overlay-bottom';
endif;
$content .= '"><li class="g-title">' . $theme->bb2html(html::purify($child->title), 2) . '</li>';
if ($_thumb_metamode == "merged"):
$content .= $theme->thumb_info($child);
endif;
$content .= '</ul>';
endif;
if (($_thumb_metamode == "default") and ($_thumb_descmode != "overlay_bottom")):
$content .= '<ul class="g-metadata">' . $theme->thumb_info($child) . '</ul>';
endif;
if ($_thumb_descmode == "bottom"):
$content .= '<ul class="g-description">';
$content .= '<li class="g-title">' . $theme->bb2html(html::purify($child->title), 2) . '</li>';
if ($_thumb_metamode == "merged"):
$content .= $theme->thumb_info($child);
endif;
$content .= '</ul>';
endif;
/*
if ($addcontext):
$_text = $this->context_menu($child, "#g-item-id-{$child->id} .g-thumbnail");
$content .= (stripos($_text, '<li>'))? $_text : null;
endif;
*/
$content .= '</div>';
$content .= $theme->thumb_bottom($child);
$content .= '</li>';
print $content;
// End rWatcher Edit.
?>
<? endforeach ?>
<? else: ?>
<li><?= t("There aren't any photos here yet!") ?></li>
<? endif; ?>
</ul>
</div>
<?= $theme->dynamic_bottom() ?>
<? if (($theme->album_descmode == "bottom") and ($description)): ?>
<div id="g-info"><div class="g-description"><?= $theme->bb2html(html::purify($description), 1) ?></div></div>
<? endif; ?>
<?= $theme->add_paginator("bottom"); ?>

View File

@ -19,7 +19,7 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<? $theme->load_sessioninfo(); ?>
<!-- <?= $theme->themename ?> v.<?= $theme->themeversion ?> (ColorPack: <?= $theme->colorpack ?>) - Copyright (c) 2009-2011 Serguei Dosyukov - All Rights Reserved -->
<!-- <?= $theme->themename ?> v.<?= $theme->themeversion ?> (<?= $theme->colorpack ?> : <?= $theme->framepack ?>) - Copyright (c) 2009-2011 Serguei Dosyukov - All Rights Reserved -->
<html xmlns="http://www.w3.org/1999/xhtml" <?= $theme->html_attributes() ?> xml:lang="en" lang="en" <?= ($theme->is_rtl)? "dir=rtl" : null; ?> >
<?
$item = $theme->item();
@ -55,10 +55,6 @@
<meta name="msnbot" content="noindex, nofollow, noarchive, nosnippet, noodp" />
<meta name="teoma" content="noindex, nofollow, noarchive" />
<? endif; ?>
<? if ($theme->blendpagetrans): ?>
<meta http-equiv="Page-Enter" content="blendtrans(duration=0.5)" />
<meta http-equiv="Page-Exit" content="blendtrans(duration=0.5)" />
<? endif; ?>
<!-- Internet Explorer 9 Meta tags : Start -->
<meta name="application-name" content="<?= $_title; ?>" />
<meta name="msapplication-tooltip" content="<?= t("Start"); ?> <?= $_title; ?>" />
@ -74,7 +70,6 @@
<meta name="msapplication-task" content="name=<?= t("Admin") ?>: <?= t("Dashboard") ?>; action-uri=<?= url::site("admin"); ?>; icon-uri=favicon.ico" />
<? endif; ?>
<!-- Internet Explorer 9 Meta tags : End -->
<link rel="shortcut icon" href="<?= $theme->favicon ?>" type="image/x-icon" />
<? if ($theme->appletouchicon): ?>
<link rel="apple-touch-icon" href="<?= $theme->appletouchicon; ?>"/>
@ -100,22 +95,12 @@
<?= $theme->head() ?>
<? /* Theme specific CSS/JS goes last so that it can override module CSS/JS */ ?>
<?= $theme->script("animation.js"); ?>
<?= $theme->script("ui.support.js"); ?>
<? // Theme specific CSS/JS goes last so that it can override module CSS/JS ?>
<?= $theme->theme_js_inject(); ?>
<?= $theme->theme_css_inject(); ?>
<!-- LOOKING FOR YOUR CSS? It's all been combined into the link below -->
<?= $theme->get_combined("css"); ?>
<?= $theme->css_link("colorpacks/" . $theme->colorpack . "/colors.css", FALSE); ?>
<?= $theme->css_link("framepacks/" . $theme->framepack . "/frame.css", FALSE); ?>
<? if ($theme->custom_css_path != ""): ?>
<?= $theme->css_link($theme->custom_css_path, TRUE); ?>
<? endif; ?>
<!-- LOOKING FOR YOUR JAVASCRIPT? It's all been combined into the link below -->
<?= $theme->get_combined("script") ?>
<?= $theme->get_combined("css"); // LOOKING FOR YOUR CSS? It's all been combined into the link ?>
<?= $theme->custom_css_inject(TRUE); ?>
<?= $theme->get_combined("script") // LOOKING FOR YOUR JAVASCRIPT? It's all been combined into the link ?>
<!--[if IE 6]>
<link rel="stylesheet" href="<?= $theme->url("css/old_ie.css") ?>" type="text/css" media="screen,print,projection" />
@ -128,24 +113,18 @@
$item = $theme->item();
else:
$item = item::root();
endif;
if ($theme->is_rtl):
$body_class = "rtl";
else:
$body_class = "";
endif;
if ($theme->viewmode == "mini"):
$body_class .= "viewmode-mini";
endif; ?>
<body <?= $theme->body_attributes() ?><?= ($theme->show_root_page)? ' id="g-rootpage"' : null; ?> <?= ($body_class)? 'class="' . $body_class . '"' : null; ?>>
<?= $theme->page_top() ?>
<body <?= $theme->body_attributes() ?><?= ($theme->show_root_page)? ' id="g-rootpage"' : null; ?> <?= $theme->get_bodyclass(); ?>>
<div class="QOverlay" style="left: 0px; top: 0px; width: 100%; height: 100%; position: fixed;">
</div>
<?= $theme->page_top() ?>
<?= $theme->site_status() ?>
<? if (((!$user->guest) or ($theme->show_guest_menu)) and ($theme->mainmenu_position == "bar")): ?>
<style type="text/css"> html { margin-top: 30px !important; } </style>
<div id="g-site-menu" class="g-<?= $theme->mainmenu_position; ?>">
<?= $theme->site_menu($theme->item() ? "#g-item-id-{$theme->item()->id}" : "") ?>
</div>
<? endif ?>
<? endif; ?>
<div id="g-header">
<?= $theme->header_top() ?>
<? if ($theme->viewmode != "mini"): ?>
@ -175,40 +154,45 @@
// The rest of this file is the original page.html.php file from the Grey Dragon theme.
?>
<? if (empty($breadcrumbs)): ?>
<? // This block is the original breadcrumb code ?>
<? if (empty($parents)): ?>
<?= $theme->breadcrumb_menu($theme, null); ?>
<? else: ?>
<?= $theme->breadcrumb_menu($theme, $parents); ?>
<? endif; ?>
<? // End Original Breadcrumb code, begin modified code. ?>
<? else: ?>
<?
// This is based on the libraries/My_Theme_View.php -> breadcrumb_menu function.
$breadcrumb_content = "";
if ($this->breadcrumbs_position == "hide"):
else:
$limit_title_length = module::get_var("gallery", "visible_title_length", 999);
$breadcrumb_content .= '<ul class="g-breadcrumbs g-' . module::get_var("th_greydragon", "breadcrumbs_position", "default") . '">';
$breadcrumb_content .= '<ul class="g-breadcrumbs g-' . $this->breadcrumbs_position . '">';
$i = 0;
foreach ($breadcrumbs as $breadcrumb):
if ($breadcrumb->url):
$breadcrumb_content .= '<li ' . (($i == 0)? " class=\"g-first\"" : null) . '>';
$breadcrumb_content .= '<a href="' . $breadcrumb->url . '">';
$breadcrumb_content .= text::limit_chars($theme->bb2html(html::purify($breadcrumb->title), 2), $limit_title_length);
$breadcrumb_content .= '</a></li>';
else:
$breadcrumb_content .= '<li class="g-active ' . (($i == 0)? " g-first" : null) . '">' . text::limit_chars($theme->bb2html(html::purify($breadcrumb->title), 2), $limit_title_length) . '</li>';
endif;
if ($breadcrumb->url):
$breadcrumb_content .= '<li ' . (($i == 0)? " class=\"g-first\"" : null) . '>';
$breadcrumb_content .= (($i > 0)? " :: " : null );
$breadcrumb_content .= '<a href="' . $breadcrumb->url . '">';
$breadcrumb_content .= text::limit_chars($theme->bb2html(html::purify($breadcrumb->title), 2), $limit_title_length);
$breadcrumb_content .= '</a></li>';
else:
$breadcrumb_content .= '<li class="g-active ' . (($i == 0)? " g-first" : null) . '"> '. (($i > 0)? " :: " : null ) . text::limit_chars($theme->bb2html(html::purify($breadcrumb->title), 2), $limit_title_length) . '</li>';
endif;
$i++;
endforeach;
$breadcrumb_content .= '</ul>';
endif;
print $breadcrumb_content;
// End Edit.
print $breadcrumb_content;
?>
<? endif; // End Edit. ?>
<? endif; ?>
<?= $theme->custom_header(); ?>
</div>
<? if (($theme->page_subtype != "login") and ($theme->page_subtype != "reauthenticate") and ($theme->sidebarvisible == "top")): ?>

View File

@ -59,7 +59,7 @@
endfor;
else:
// End rWatcher Mod.
switch ($page_type) {
case "collection":
if (isset($item)):
@ -189,7 +189,7 @@
<? if (isset($parent_url)): ?>
<a title="<?= t("up") ?>" id="g-navi-parent" href="<?= $parent_url ?>"><span class="ui-icon ui-icon-parent">&nbsp;</span></a>
<? elseif (isset($parent)): ?>
<a title="<?= t("up") ?>" id="g-navi-parent" href="<?= $parent->url() ?>"><span class="ui-icon ui-icon-parent">&nbsp;</span></a>
<a title="<?= t("up") ?>" id="g-navi-parent" href="<?= $parent->url("show={$item->id}"); ?>"><span class="ui-icon ui-icon-parent">&nbsp;</span></a>
<? else: ?>
<span class="ui-icon ui-icon-parent-d">&nbsp;</span>
<? endif ?>

View File

@ -56,8 +56,8 @@
<div id="g-photo">
<?= $theme->resize_top($item) ?>
<? $_resizewidth = $item->resize_width;
// rWatcher Modification.
//ORIGINAL LINE $siblings = $item->parent()->children();
$siblings = "";
if (isset($dynamic_siblings)) {
$siblings = $dynamic_siblings;
@ -66,7 +66,7 @@
}
// End rWatcher Modification
?>
<div class="g-resize" style="margin-left: -<?= intval($_resizewidth / 2); ?>px; ">
<? $script = "<script type=\"text/javascript\">\n";
$script .= " if (document.images) {\n";

View File

@ -0,0 +1,239 @@
<?php defined("SYSPATH") or die("No direct script access."); ?>
<?
// Used album.html.php as starting point.
// The g-info block was taken from album.html.php and $theme->album_top() was changed to $theme->dynamic_top().
// $item->title and $item->description have been changed to $title and $description.
//
// The g-album-grid block was also taken from album.html.php. The section for uploading new photos to an empty album
// has been removed. Also, $theme->context_menu has been removed as well (it was crashing the page).
?>
<div id="g-album-header">
<?= $theme->dynamic_top() ?>
<h1><?= $theme->bb2html(html::purify($title), 1) ?></h1>
</div>
<?= $theme->add_paginator("top"); ?>
<? if (($theme->album_descmode == "top") and ($description)): ?>
<div id="g-info"><div class="g-description"><?= $theme->bb2html(html::purify($description), 1) ?></div></div>
<? endif; ?>
<? if (isset($filter_text) && (module::get_var("tag_albums", "tag_index_filter"))): ?>
<div id="g-tags-filter">
<br/ >
<center><?= $filter_text; ?></center>
</div>
<? endif ?>
<div class="g-album-grid-container">
<ul id="g-album-grid" class="<?= $theme->get_grid_column_class(); ?>">
<?
if (count($children)):
$siblings = $all_siblings;
if (($theme->disablephotopage) && (count($siblings) > count($children))):
$j = 0;
foreach ($siblings as $i => $sibling):
//if ($sibling->rand_key == $children[$j]->rand_key):
if ($sibling->id == $children[$j]->item_id):
//echo $theme->get_thumb_element($sibling, !$theme->hidecontextmenu);
echo rw_get_thumb_element($children[$j], $theme);
if ($j + 1 < count($children)):
$j++;
endif;
else:
echo $theme->get_thumb_link($sibling);
//echo rw_get_thumb_link($sibling, $theme);
endif;
endforeach;
else:
foreach ($children as $i => $child):
//echo $theme->get_thumb_element($child, !$theme->hidecontextmenu);
echo rw_get_thumb_element($child, $theme);
endforeach;
endif;
else: ?>
<li><?= t("There aren't any photos here yet!") ?></li>
<? endif; ?>
</ul>
</div>
<?= $theme->dynamic_bottom() ?>
<? if (($theme->album_descmode == "bottom") and ($description)): ?>
<div id="g-info"><div class="g-description"><?= $theme->bb2html(html::purify($description), 1) ?></div></div>
<? endif; ?>
<?= $theme->add_paginator("bottom"); ?>
<?
function rw_get_thumb_link($item, $theme) {
// This code is based on grey dragon's get_thumb_link function.
// Change all $this to $theme
if ($item->is_album()):
return "";
endif;
/*
if (access::can("view_full", $item)):
$direct_link = $item->file_url();
else:
$direct_link = $item->resize_url();
endif;*/
$direct_link = $child->full_or_resize_url();
return '<a title="' . $theme->bb2html(html::purify($item->title), 2) . '" style="display: none;" class="g-sb-preview" rel="g-preview" href="' . $direct_link . '">&nbsp;</a>';
}
function rw_get_thumb_element($child, $theme) {
// This code is based on grey dragon's get_thumb_element function.
// Change all $item to $child
// Change all $this to $theme
$thumb_item = $child;
if ($theme->thumb_random):
if ($child->is_album() && ($rnd = item::random_query()->where("parent_id", "=", $child->id)->find()) && $rnd->loaded()):
$thumb_item = $rnd;
endif;
endif;
$item_class = $child->is_album() ? "g-album" : "g-photo";
$content = '<li id="g-item-id-' . $child->id . '" class="g-item ' . $item_class . ' ' . $theme->thumb_type;
if ($child->is_album()):
$_thumb_descmode = $theme->thumb_descmode_a;
else:
$_thumb_descmode = $theme->thumb_descmode;
endif;
$content .= ($_thumb_descmode == "bottom")? " g-expanded" : " g-default";
if ($thumb_item->has_thumb()):
$is_portrait = ($thumb_item->thumb_height > $thumb_item->thumb_width);
$_shift = "";
switch ($theme->thumb_imgalign):
case "center":
if (($theme->crop_factor == 1) and (!$is_portrait)):
$_shift = 'style="margin-top: ' . intval(($theme->_thumb_size_y - $thumb_item->thumb_height) / 2) . 'px;"';
elseif ($theme->crop_factor > 0):
$_shift = 'style="margin-top: -' . intval(($thumb_item->thumb_height - $theme->_thumb_size_y) / 2) . 'px;"';
endif;
break;
case "bottom":
if (($theme->crop_factor == 1) and (!$is_portrait)):
$_shift = 'style="margin-top: ' . intval($theme->_thumb_size_y - $thumb_item->thumb_height) . 'px;"';
elseif ($theme->crop_factor > 0):
$_shift = 'style="margin-top: -' . intval($thumb_item->thumb_height - $theme->_thumb_size_y) . 'px;"';
endif;
break;
case "fit":
break;
case "top":
default:
break;
endswitch;
else:
$is_portrait = FALSE;
$_shift = 'style="margin-top: 0px;"';
endif;
$content .= ($is_portrait)? " g-portrait" : " g-landscape";
$content .= '">' . $theme->thumb_top($child);
$content .= '<div class="g-thumbslide">';
$thumb_content = '<p class="g-thumbcrop">';
$use_direct_link = (($theme->disablephotopage) && (!$child->is_album()));
$class_name = "g-thumblink";
if ($use_direct_link):
$class_name .= ' g-sb-preview" rel="g-preview';
//if (access::can("view_full", $child)):
//$direct_link = $child->file_url();
//else:
$direct_link = $child->full_or_resize_url();
//endif;
else:
$direct_link = $child->url();
endif;
if ($use_direct_link && module::is_active("exif") && module::info("exif")):
$thumb_content .= '<a class="g-meta-exif-link g-dialog-link" href="' . url::site("exif/show/{$child->id}") . '" title="' . t("Photo details")->for_html_attr() . '">&nbsp;</a>';
endif;
$thumb_content .= '<a title="' . $theme->bb2html(html::purify($child->title), 2) . '" '. $_shift . ' class="' . $class_name . '" href="' . $direct_link . '">';
if ($thumb_item->has_thumb()):
if (($theme->crop_factor > 1) && ($theme->thumb_imgalign == "fit")):
if ($thumb_item->thumb_height > $theme->_thumb_size_y):
if ($is_portrait):
$_max = $theme->_thumb_size_y;
else:
$_max = intval($theme->_thumb_size_x * ($theme->_thumb_size_y / $thumb_item->thumb_height));
endif;
else:
$_max = $theme->_thumb_size_x;
endif;
$_max = min($thumb_item->thumb_width, $_max);
$thumb_content .= $thumb_item->thumb_img(array(), $_max);
else:
$thumb_content .= $thumb_item->thumb_img();
endif;
else:
$thumb_content .= '<img title="No Image" alt="No Image" src="' . $theme->url("images/missing-img.png") . '"/>';
endif;
$thumb_content .= '</a></p>';
if (($theme->thumb_metamode != "hide") and ($_thumb_descmode == "overlay_bottom")):
$_thumb_metamode = "merged";
else:
$_thumb_metamode = $theme->thumb_metamode;
endif;
if (($_thumb_descmode == "overlay") or ($_thumb_descmode == "overlay_top") or ($_thumb_descmode == "overlay_bottom")):
$thumb_content .= '<ul class="g-description ';
if ($_thumb_descmode == "overlay_top"):
$thumb_content .= 'g-overlay-top';
endif;
if ($_thumb_descmode == "overlay_bottom"):
$thumb_content .= 'g-overlay-bottom';
endif;
$thumb_content .= '"><li class="g-title">' . $theme->bb2html(html::purify($child->title), 2) . '</li>';
if ($_thumb_metamode == "merged"):
$thumb_content .= $theme->thumb_info($child);
endif;
$thumb_content .= '</ul>';
endif;
if (($_thumb_metamode == "default") and ($_thumb_descmode != "overlay_bottom")):
$thumb_content .= '<ul class="g-metadata">' . $theme->thumb_info($child) . '</ul>';
endif;
if ($_thumb_descmode == "bottom"):
$thumb_content .= '<ul class="g-description">';
$thumb_content .= '<li class="g-title">' . $theme->bb2html(html::purify($child->title), 2) . '</li>';
if ($_thumb_metamode == "merged"):
$thumb_content .= $theme->thumb_info($item);
endif;
$thumb_content .= '</ul>';
endif;
/*
if ($addcontext):
$_text = $this->context_menu($item, "#g-item-id-{$item->id} .g-thumbnail");
$thumb_content .= (stripos($_text, '<li>'))? $_text : null;
endif;
*/
try {
$view = new View("frame.html");
$view->thumb_content = $thumb_content;
$content .= $view;
} catch (Exception $e) {
$content .= $thumb_content;
}
$content .= '</div>';
$content .= $theme->thumb_bottom($child);
$content .= '</li>';
return $content;
//print $content;
// End of modified function code.
}
?>

View File

@ -71,7 +71,11 @@ class tag_albums_Controller extends Controller {
$index = $this->_get_position($child->$sort_page_field, $child->id, $tag_ids, "items." . $sort_page_field, $sort_page_direction, $album_tags_search_type, true);
if ($index) {
$page = ceil($index / $page_size);
url::redirect($str_page_url . "?page=$page");
if ($page == 1) {
url::redirect($str_page_url);
} else {
url::redirect($str_page_url . "?page=$page");
}
}
}
@ -98,17 +102,18 @@ class tag_albums_Controller extends Controller {
// Figure out which items to display on this page and store their details in $children.
$tag_children = $this->_get_records($tag_ids, $page_size, $offset, "items." . $sort_page_field, $sort_page_direction, $album_tags_search_type, true);
$children = Array();
$children_array = Array();
foreach ($tag_children as $one_child) {
$child_tag = new Tag_Albums_Item($one_child->title, url::site("tag_albums/show/" . $one_child->id . "/0/" . $id . "/" . urlencode($one_child->name)), $one_child->type);
$child_tag = new Tag_Albums_Item($one_child->title, url::site("tag_albums/show/" . $one_child->id . "/0/" . $id . "/" . urlencode($one_child->name)), $one_child->type, $one_child->id);
$child_tag->id = $one_child->id;
$child_tag->view_count = $one_child->view_count;
$child_tag->owner = identity::lookup_user($one_child->owner_id);
if ($one_child->has_thumb()) {
$child_tag->set_thumb($one_child->thumb_url(), $one_child->thumb_width, $one_child->thumb_height);
}
$children[] = $child_tag;
$children_array[] = $child_tag;
}
$children = new Tag_Albums_Children($children_array);
// Set up the previous and next page buttons.
if ($page > 1) {
@ -141,6 +146,7 @@ class tag_albums_Controller extends Controller {
$template->set_global("page_size", $page_size);
$template->set_global("max_pages", $max_pages);
$template->set_global("children", $children);
$template->set_global("all_siblings", $this->_get_records($tag_ids, $count, 0, "items." . $sort_page_field, $sort_page_direction, $album_tags_search_type, false));
$template->set_global("children_count", $count);
$template->set_global("parent_url", $parent_album->url()); // Used by Grey Dragon.
$template->content = new View("tag_albums_album.html");
@ -185,7 +191,7 @@ class tag_albums_Controller extends Controller {
->where("id", "=", $id)
->find_all();
if (count($album_tags) == 0) {
$id = "";
$id = 0;
}
// Inherit permissions, title and description from the album that linked to this page,
@ -194,7 +200,7 @@ class tag_albums_Controller extends Controller {
$page_title = module::get_var("tag_albums", "tag_page_title", "All Tags");
$page_description = "";
$str_page_url = "";
if ($id == "") {
if ($id == 0) {
$album = ORM::factory("item", 1);
access::required("view", $album);
$str_page_url = "tag_albums/";
@ -239,7 +245,11 @@ class tag_albums_Controller extends Controller {
}
if ($index) {
$page = ceil($index / $page_size);
url::redirect("$str_page_url?page=$page");
if ($page == 1) {
url::redirect("$str_page_url");
} else {
url::redirect("$str_page_url?page=$page");
}
}
}
@ -309,7 +319,7 @@ class tag_albums_Controller extends Controller {
// Generate an arry of "fake" items, one for each tag on the page.
// Grab thumbnails from the most recently uploaded item for each tag, if available.
$children = Array();
$children_array = Array();
foreach ($display_tags as $one_tag) {
$tag_item = ORM::factory("item")
->viewable()
@ -317,19 +327,20 @@ class tag_albums_Controller extends Controller {
->where("items_tags.tag_id", "=", $one_tag->id)
->order_by("items.id", "DESC")
->find_all(1, 0);
$child_tag = new Tag_Albums_Item($one_tag->name, url::site("tag_albums/tag/" . $one_tag->id . "/" . $id . "/" . urlencode($one_tag->name)), "album");
$child_tag = new Tag_Albums_Item($one_tag->name, url::site("tag_albums/tag/" . $one_tag->id . "/" . $id . "/" . urlencode($one_tag->name)), "album", 0);
if (count($tag_item) > 0) {
if ($tag_item[0]->has_thumb()) {
$child_tag->set_thumb($tag_item[0]->thumb_url(), $tag_item[0]->thumb_width, $tag_item[0]->thumb_height);
}
}
$children[] = $child_tag;
$children_array[] = $child_tag;
}
$children = new Tag_Albums_Children($children_array);
// Set up breadcrumbs.
$tag_album_breadcrumbs = Array();
$parent_url = "";
if ($id != "") {
if ($id > 0) {
$counter = 0;
$tag_album_breadcrumbs[$counter++] = new Tag_Albums_Breadcrumb($album->title, "");
$parent_item = ORM::factory("item", $album->parent_id);
@ -375,7 +386,7 @@ class tag_albums_Controller extends Controller {
->where("id", "=", $album_id)
->find_all();
if (count($album_tags) == 0) {
$album_id = "";
$album_id = 0;
}
// Load the current tag.
@ -398,7 +409,11 @@ class tag_albums_Controller extends Controller {
$index = $this->_get_position($child->$sort_page_field, $child->id, Array($id), "items." . $sort_page_field, $sort_page_direction, "OR", true);
if ($index) {
$page = ceil($index / $page_size);
url::redirect($str_page_url . "?page=$page");
if ($page == 1) {
url::redirect($str_page_url);
} else {
url::redirect($str_page_url . "?page=$page");
}
}
}
@ -428,18 +443,19 @@ class tag_albums_Controller extends Controller {
$tag_children = $this->_get_records(Array($id), $page_size, $offset, "items." . $sort_page_field, $sort_page_direction, "OR", true);
// Create an array of "fake" items to display on the page.
$children = Array();
$children_array = Array();
foreach ($tag_children as $one_child) {
$child_tag = new Tag_Albums_Item($one_child->title, url::site("tag_albums/show/" . $one_child->id . "/" . $id . "/" . $album_id . "/" . urlencode($one_child->name)), $one_child->type);
$child_tag = new Tag_Albums_Item($one_child->title, url::site("tag_albums/show/" . $one_child->id . "/" . $id . "/" . $album_id . "/" . urlencode($one_child->name)), $one_child->type, $one_child->id);
$child_tag->id = $one_child->id;
$child_tag->view_count = $one_child->view_count;
$child_tag->owner = identity::lookup_user($one_child->owner_id);
if ($one_child->has_thumb()) {
$child_tag->set_thumb($one_child->thumb_url(), $one_child->thumb_width, $one_child->thumb_height);
}
$children[] = $child_tag;
$children_array[] = $child_tag;
}
$children = new Tag_Albums_Children($children_array);
// Set up the previous and next page buttons.
if ($page > 1) {
$previous_page = $page - 1;
@ -453,7 +469,7 @@ class tag_albums_Controller extends Controller {
// Set up breadcrumbs for the page.
$tag_album_breadcrumbs = Array();
$parent_url = "";
if ($album_id != "") {
if ($album_id > 0) {
$counter = 0;
$tag_album_breadcrumbs[$counter++] = new Tag_Albums_Breadcrumb($display_tag->name, "");
$parent_item = ORM::factory("item", $album_tags[0]->album_id);
@ -491,6 +507,7 @@ class tag_albums_Controller extends Controller {
$template->set_global("page_size", $page_size);
$template->set_global("max_pages", $max_pages);
$template->set_global("children", $children);
$template->set_global("all_siblings", $this->_get_records(Array($id), $count, 0, "items." . $sort_page_field, $sort_page_direction, "OR", false));
$template->set_global("children_count", $count);
$template->set_global("parent_url", $parent_url); // Used by Grey Dragon.
$template->content = new View("tag_albums_album.html");
@ -508,7 +525,7 @@ class tag_albums_Controller extends Controller {
->where("id", "=", $album_id)
->find_all();
if (count($album_tags) == 0) {
$album_id = "";
$album_id = 0;
}
// Load the tag and item, make sure the user has access to the item.
@ -542,12 +559,12 @@ class tag_albums_Controller extends Controller {
if ($position > 1) {
$previous_item_object = $this->_get_records(Array($tag_id), 1, $position-2, "items." . $sort_page_field, $sort_page_direction, $album_tags_search_type, false);
if (count($previous_item_object) > 0) {
$previous_item = new Tag_Albums_Item($previous_item_object[0]->title, url::site("tag_albums/show/" . $previous_item_object[0]->id . "/" . $tag_id . "/" . $album_id . "/" . urlencode($previous_item_object[0]->name)), $previous_item_object[0]->type);
$previous_item = new Tag_Albums_Item($previous_item_object[0]->title, url::site("tag_albums/show/" . $previous_item_object[0]->id . "/" . $tag_id . "/" . $album_id . "/" . urlencode($previous_item_object[0]->name)), $previous_item_object[0]->type, $previous_item_object[0]->id);
}
}
$next_item_object = $this->_get_records(Array($tag_id), 1, $position, "items." . $sort_page_field, $sort_page_direction, $album_tags_search_type, false);
if (count($next_item_object) > 0) {
$next_item = new Tag_Albums_Item($next_item_object[0]->title, url::site("tag_albums/show/" . $next_item_object[0]->id . "/" . $tag_id . "/" . $album_id . "/" . urlencode($next_item_object[0]->name)), $next_item_object[0]->type);
$next_item = new Tag_Albums_Item($next_item_object[0]->title, url::site("tag_albums/show/" . $next_item_object[0]->id . "/" . $tag_id . "/" . $album_id . "/" . urlencode($next_item_object[0]->name)), $next_item_object[0]->type, $next_item_object[0]->id);
}
$dynamic_siblings = $this->_get_records(Array($tag_id), null, null, "items." . $sort_page_field, $sort_page_direction, $album_tags_search_type, false);
} else {
@ -576,7 +593,7 @@ class tag_albums_Controller extends Controller {
// Set up breadcrumbs
$tag_album_breadcrumbs = Array();
if ($album_id != "") {
if ($album_id > 0) {
$counter = 0;
$tag_album_breadcrumbs[$counter++] = new Tag_Albums_Breadcrumb($item->title, "");
if ($album_tags[0]->tags == "*") {

View File

@ -0,0 +1,48 @@
<?php defined("SYSPATH") or die("No direct script access.");
/**
* Gallery - a web based photo album viewer and editor
* Copyright (C) 2000-2011 Bharat Mediratta
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
*/
class Tag_Albums_Children_Core implements Iterator {
public $array = Array();
private $position = 0;
public function __construct($children) {
$this->position = 0;
$this->array = $children;
}
function rewind() {
$this->position = 0;
}
function current() {
return $this->array[$this->position];
}
function key() {
return $this->position;
}
function next() {
++$this->position;
}
function valid() {
return isset($this->array[$this->position]);
}
}

View File

@ -20,6 +20,7 @@
class Tag_Albums_Item_Core {
public $title = "";
public $id = -1;
public $item_id = 0;
public $url = "#";
public $thumb_url = "";
public $thumb_width = 0;
@ -45,6 +46,19 @@ class Tag_Albums_Item_Core {
}
}
public function full_or_resize_url() {
if ($this->item_id > 0) {
$item = ORM::factory("item", $this->item_id);
if (access::can("view_full", $item)) {
return $item->file_url();
} else {
return $item->resize_url();
}
} else {
return "";
}
}
public function thumb_img($extra_attrs=array(), $max=null, $center_vertically=false) {
list ($height, $width) = $this->scale_dimensions($max);
if ($center_vertically && $max) {
@ -105,10 +119,11 @@ class Tag_Albums_Item_Core {
$this->thumb_height = $new_height;
}
public function __construct($new_title, $new_url, $new_type) {
public function __construct($new_title, $new_url, $new_type, $new_id) {
$this->title = $new_title;
$this->url = $new_url;
$this->item_type = $new_type;
$this->type = $new_type;
$this->item_id = $new_id;
}
}

View File

@ -34,6 +34,7 @@ class WebDAV_Controller extends Controller {
$server->setBaseUri(url::site("webdav/gallery"));
// $server->addPlugin($lock);
$server->addPlugin($filter);
$server->addPlugin(new Sabre_DAV_Browser_GuessContentType());
if ($this->_authenticate()) {
$server->exec();

View File

@ -87,7 +87,7 @@ class Admin_Theme_Options_Controller extends Admin_Controller {
->checked(module::get_var("th_pear4gallery3", "hide_logo"));
$group->dropdown("mainmenu_view")
->label(t("Main page View"))
->options(array("grid" => t("Grid (Default)"), "mosaic" => t("Mosaic")))
->options(array("grid" => t("Grid (Default)"), "mosaic" => t("Mosaic"), "carousel" => t("Carousel")))
->selected(module::get_var("th_pear4gallery3", "mainmenu_view"));
$group->checkbox("show_guest_menu")
->label(t("Show Main Menu for Guest Users"))

View File

@ -1,8 +1,6 @@
.gallery-thumb {
float: left;
margin-bottom: 5px;
margin-left: 5px;
margin-right: 5px;
padding: 3px 5px 7px 5px;
position: relative;
text-align: center;
cursor: pointer;
@ -40,9 +38,11 @@ th, td {
.giTitle {
font-size: 1.1em;
font-weight: bold;
margin: 3px 10px !important;
margin: 0.3em 3px !important;
padding: 0 0;
text-align: left;
height: 1.2em;
overflow: hidden;
}
#gsNavBar div {

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

View File

@ -1,6 +1,17 @@
.gallery-thumb-round {
background: url('rounded.png') no-repeat scroll left top;
position: absolute;
height: 200px;
width: 200px;
}
.p-video{
background: url('movie.png') no-repeat center;
position: absolute;
width: 200px;
height: 200px;
left: 0px;
top: 0px;
}
.skimm_div {
@ -59,7 +70,7 @@ height:40px;
display: block;
z-index: 100;
background: transparent url('pear_logo_sml.png') no-repeat center left;
width: 83px;
width: 30px;
height: 40px;
border: 0px;
padding: 0px;
@ -301,7 +312,7 @@ cursor: default;
#viewControls {
position: relative;
color: #616161;
width: 381px;
width: 334px;
float: left;
margin-left: 30px;
margin-top: 13px;

View File

@ -1,3 +1,4 @@
var viewMode="";
var skimimg = 0;
var hash="";
var bgcolor="black";
@ -5,9 +6,8 @@ var detailViewMode=false;
var savedHeight = 0;
var savedWidth = 0;
$(window).resize(function (e) {
if (window.innerHeight == savedHeight &&
window.innerWidth == savedWidth) { e.stop(); }
$(window).resize(function () {
if (window.innerHeight == savedHeight && window.innerWidth == savedWidth) return;
savedHeight = window.innerHeight;
savedWidth = window.innerWidth;
mosaicResize();
@ -24,7 +24,7 @@ function swatchSkin(intSkin){
case 'dkgrey' :
case 1 :
$('div.gallery-thumb-round').css('backgroundPosition' , "-200px 0px");
$('#mosaicTable').css('backgroundColor' , "#262626");
$('#mosaicTable,.pear').css('backgroundColor' , "#262626");
$('p.giTitle').css("color", "#a9a9a9");
$("#dkgrey").addClass("dkgrey sel dkgrey-with-sel-with-swatch");
bgcolor="dkgrey";
@ -33,7 +33,7 @@ function swatchSkin(intSkin){
case 'ltgrey' :
case 2 :
$('div.gallery-thumb-round').css('backgroundPosition' , "-400px 0px");
$('#mosaicTable').css('backgroundColor' , "#d9d9d9");
$('#mosaicTable,.pear').css('backgroundColor' , "#d9d9d9");
$('p.giTitle').css("color", "#333333");
$("#ltgrey").addClass("ltgrey sel ltgrey-with-sel-with-swatch");
bgcolor="ltgrey";
@ -42,7 +42,7 @@ function swatchSkin(intSkin){
case 'white' :
case 3 :
$('div.gallery-thumb-round').css('backgroundPosition' , "-600px 0px");
$('#mosaicTable').css('backgroundColor' , "#ffffff");
$('#mosaicTable,.pear').css('backgroundColor' , "#ffffff");
$('p.giTitle').css("color", "#444444");
$("#white").addClass("white sel white-with-sel-with-swatch");
bgcolor="white";
@ -52,7 +52,7 @@ function swatchSkin(intSkin){
case 0 :
default:
$('div.gallery-thumb-round').css('backgroundPosition' , "0px 0px");
$('#mosaicTable').css('backgroundColor' , "#000");
$('#mosaicTable,.pear').css('backgroundColor' , "#000");
$('p.giTitle').css("color", "#a3a3a3");
$("#black").addClass("black sel black-with-sel-with-swatch");
bgcolor="black";
@ -66,14 +66,16 @@ function scaleIt(v,sliding){
// Remap the 0-1 scale to fit the desired range
//v=.26+(v*(1.0-.26));
size = (mosaicView) ? v/2 : v;
var size = (mosaicView) ? v/2 : v;
toggleReflex(true);
$(".p-photo").each(function (i) {
$(this).attr({height: size+'px',width: size + 'px'});
$(this).css({height: size+'px',width: size+'px'});});
$(".g-photo").css({width: size+'px'});
if(!mosaicView && !sliding)
toggleReflex(false);
thumbPadding();
}
function setCookie(c_name,value,expiredays)
{
@ -153,17 +155,24 @@ function swatchImg(imageId)
updateHash();
$('#info_detail').attr('href', slideshowImages[currentImg][1]);
}
function getViewMode()
{
var vm = detailViewMode ? "detail" : viewMode;
if(vm !== '')
vm = "&viewMode=" + vm;
return vm;
}
function updateHash()
{
viewMode = detailViewMode ? "detail" : (mosaicView ? "mosaic" : "grid");
hash = "#img=" + currentImg + "&viewMode=" + viewMode + "&bgcolor=" + bgcolor;
var img="";
if(currentImg !== 0)
img = "img=" + currentImg;
hash = "#" + img + getViewMode() + "&bgcolor=" + bgcolor;
window.location.hash = hash;
}
function getAlbumHash(img)
{
viewMode = detailViewMode ? "detail" : (mosaicView ? "mosaic" : "grid");
return "#img=" + img + "&viewMode=" + viewMode + "&bgcolor=" + bgcolor;
return "#img=" + img + getViewMode() + "&bgcolor=" + bgcolor;
}
var currentImg=0;
@ -186,8 +195,6 @@ function mosaicResize()
myWidth = document.body.clientWidth;
myHeight = document.body.clientHeight;
}
if($('#pearImageFlow').length != 0)
$('#pearImageFlow').css({'height' : (myHeight-87)+'px', 'width': myWidth+'px', 'minHeight': ((myHeight-70)*0.9)+'px'});
if($('#imageflow').length != 0)
$('#imageflow').css({'height': (myHeight-53)+'px', 'width': (((myWidth*0.5)<(myHeight-53)) ? myWidth : ((myHeight-65)*2)) +'px'});
$('#detailImageView').css({'height': myHeight-165+"px"});
@ -196,10 +203,14 @@ function mosaicResize()
$('#img_detail').css({'height': iHeight+"px", 'width':iWidth+"px"});
myWidth=myWidth-7;
myHeight = myHeight - $('#g-site-status').outerHeight(true);
$('#pearFlowPadd').css({'height' : myHeight-90-(Math.round(myWidth / 2.4))+'px'});
($('#paginator').length != 0) ? myHeight-=165: myHeight-=138;
myHeight = myHeight - $('#g-site-status').outerHeight(true);
$('#g-header').css('top', $('#gsNavBar').outerHeight(true)+$('#g-site-status').outerHeight(true)-4);
if($('#g-movie').length)
myHeight+=18;
if ( !mosaicView )
{
$('#mosaicGridContainer').css({'height': (myHeight+33)+"px", 'width': myWidth+"px"});
@ -214,10 +225,20 @@ function mosaicResize()
(iRatio>(myWidth/myHeight)) ? $('#mosaicImg').attr({height: myWidth/iRatio,width: myWidth}) : $('#mosaicImg').attr({height: myHeight,width: myHeight*iRatio});
if(iHeight<myHeight&&iWidth<myWidth) $('#mosaicImg').attr({height:iHeight, width:iWidth});
}
thumbPadding();
if($('#conf_imageflow').length) refresh();
}
function thumbPadding() {
/* Padding on thumbs to make them flow nicer */
var size = Math.ceil((mosaicView) ? $('#imgSlider').slider('value')/2 : $('#imgSlider').slider('value'))+10;
var width =$('#mosaicGridContainer').innerWidth()-15;
var margin = width/Math.floor(width/size)-size;
console.log(size, width, margin,"px" );
$('.gallery-thumb').css({'margin-left': Math.ceil(margin/2) + 'px', 'margin-right': Math.floor(margin/2) + 'px'});
}
function bodyLoad(viewMode, bgcolor) {
function bodyLoad(vm, bgcolor) {
/* Parse hash */
hash = window.location.hash;
var h = $.parseQuery(hash.substring(1));
@ -225,10 +246,8 @@ function bodyLoad(viewMode, bgcolor) {
currentImg = parseInt(h.img);
if(h.bgcolor != undefined)
swatchSkin(h.bgcolor);
if(h.viewMode == 'detail')
focusImage(currentImg, h.redirected);
else
viewMode = h.viewMode;
if(h.viewMode != undefined)
viewMode = vm = h.viewMode;
/* end parse hash */
if(navigator.appName == "Microsoft Internet Explorer") $('.track').each(function(s){$(this).css('top', '-16px');}); //Fix for IE's poor page rendering.
@ -253,15 +272,22 @@ function bodyLoad(viewMode, bgcolor) {
if (co==null || co=="")
swatchSkin(bgcolor);
if(typeof slideshowImages != 'undefined')
if(!slideshowImages.length)
viewMode='grid';
vm='grid';
switch (viewMode) {
switch (vm) {
case 'carousel':
startImageFlow(false);
break;
case 'grid':
switchToGrid();
switchToGrid(false);
break;
case 'mosaic':
switchToMosaic();
switchToMosaic(false);
break;
case 'detail':
focusImage(currentImg, h.redirected);
break;
default:
mosaicResize();
@ -272,10 +298,13 @@ function bodyLoad(viewMode, bgcolor) {
setKeys();
}
function switchToGrid()
function switchToGrid(userSet)
{
if(userSet === true) {
viewMode = "grid";
}
toggleReflex(true);
$('#pearImageFlow').hide();
$('#pearImageFlow,#pearFlowPadd').hide();
$('#mosaicTable').show();
if(!$('#mosaicGridContainer').length) return;
mosaicView=false;
@ -286,13 +315,15 @@ function switchToGrid()
$('p.giTitle,div.giInfo').each(function(s){$(this).show();});
switchMode('grid');
mosaicResize();
updateHash();
}
function switchToMosaic()
function switchToMosaic(userSet)
{
if(userSet === true) {
viewMode = "mosaic";
}
toggleReflex(false);
$('#pearImageFlow').hide(); //.hide();
$('#pearImageFlow,#pearFlowPadd').hide();
$('#mosaicTable').show();
if(!$('#mosaicGridContainer').length) return;
mosaicView=true;
@ -361,39 +392,29 @@ function focusImage(id, redirected)
$('#info_detail').attr('href', slideshowImages[currentImg][1]);
}
var pearCarousel;
function startImageFlow()
function startImageFlow(userSet)
{
if(userSet === true) {
viewMode = "carousel";
}
$('#mosaicTable').hide();
$('#pearImageFlow').show();
$('#pearImageFlow,#pearFlowPadd').show();
toggleReflex(true);
for (var i = 0; i < slideshowImages.length; i++) {
var img = '<div class="item"><img class="content" src="'+slideshowImages[i][0]+'"/><div class="caption">'+$('#mosaicGridContainer img').eq(i).attr('alt')+'"</div></div>';
var img = '<img src="'+slideshowImages[i][0]+'" longdesc="'+i+'" width="'+slideshowImages[i][2]+'" height="'+slideshowImages[i][3]+'" alt="'+slideshowImages[i][4]+'" style="display: none;">';
console.log(img);
$('#pearImageFlow').append(img);
}
if(!pearCarousel){
pearCarousel = new ImageFlow();
pearCarousel.init({ImageFlowID: 'pearImageFlow', aspectRatio: 2.4, imagesHeight: 0.6, opacity: true, reflections: false, startID: currentImg, onClick: function() {focusImage($(this).attr('longdesc'));}, startAnimation: true, xStep: 200, imageFocusM: 1.7, imageFocusMax: 4, opacityArray: [10, 9, 6, 2], percentOther: 130, captions: false, slider: false});
for (var i = 0; i < slideshowImages.length; i++) {
var img = '<div class="item"><img class="content" src="'+slideshowImages[i][0]+'"/><div class="caption">'+$('#mosaicGridContainer img').eq(i).attr('alt')+'"</div></div>';
var img = '<img src="'+slideshowImages[i][0]+'" longdesc="'+i+'" width="'+slideshowImages[i][2]+'" height="'+slideshowImages[i][3]+'" alt="'+slideshowImages[i][4]+'" style="display: none;">';
// console.log(img);
$('#pearImageFlow').append(img);
}
pearCarousel = new ImageFlow();
pearCarousel.init({ImageFlowID: 'pearImageFlow', aspectRatio: 2.4, imagesHeight: 0.6, opacity: true, reflections: false, startID: currentImg+1, onClick: function() {focusImage($(this).attr('longdesc'));}, startAnimation: true, xStep: 200, imageFocusM: 1.7, imageFocusMax: 4, opacityArray: [10, 9, 6, 2], percentOther: 130, captions: false, slider: false});
}
/*
current=(currentImg)*-xstep;
caption_id=currentImg;
refresh(true);
iShow(conf_images);
iShow(conf_scrollbar);
initMouseWheel();
initMouseDrag();
mosaicResize();
moveTo(current);
glideTo(current, caption_id);
*/
switchMode('carousel');
mosaicResize();
}
function setKeys()
{
@ -436,6 +457,7 @@ var hovering=false;
function switchMode(mode){
$('#mosaic,#grid,#carousel').removeClass("sel sel-with-viewSwitcher");
$('#'+mode).addClass("sel sel-with-viewSwitcher");
updateHash();
}
function preFetch()

View File

@ -1,6 +1,6 @@
name = ".Pear Theme"
description = "A theme with the intention to mimic Apples mobile me gallery."
version = 2.3
version = 2.7
author = "Fredrik Erlandsson <fredrik.e@gmail.com>"
site = 1
admin = 0

View File

@ -30,13 +30,19 @@ $(function() {
<? if ($child->is_photo()): ?>
<? $img_class = "g-thumbnail p-photo"; ?>
<? endif ?>
<? if ($child->is_movie()): ?>
<a href="<?= $child->url() ?>">
<? endif ?>
<div id="g-thumb-id-<?= $child->id ?>" class="g-item gallery-thumb <?= $item_class ?>" title="<?= $child->description?>">
<?= $theme->thumb_top($child) ?>
<? if ($child->is_album()): ?>
<div class="gallery-thumb-round" style="height: 200px; width: 200px;"></div>
<? if ($child->is_album() || $child->is_movie()): ?>
<div class="gallery-thumb-round"></div>
<? endif ?>
<? if ($child->has_thumb()): ?>
<?= $child->thumb_img(array("class" => $img_class, "id" => "thumb_$child->id", "style" => "width: 200px; height 200px;")) ?>
<? if ($child->is_movie()): ?>
<span class="p-video"></span>
<? endif ?>
<? endif ?>
<?// Begin skimming
if($child->is_album()):
@ -47,7 +53,7 @@ if($child->is_album()):
<? if(++$i > 50) break; ?>
<? if ($granchild->has_thumb()): ?>
<?= $granchild->thumb_img(array("style" => "display: none;")) ?>
<div class="skimm_div" style="height: 200px; width: <?=$step?>px; left: <?=$offset?>px; top: 0px;" onmouseover="$('#thumb_<?=$child->id?>').attr('src', '<?=$granchild->thumb_url()?>');skimimg=<?=$i?>;" id="area_<?=$granchild->id?>"></div>
<div class="skimm_div" style="height: 200px; width: <?=$step?>px; left: <?=$offset?>px; top: 0px;" onmouseover="$('#thumb_<?=$child->id?>').attr('src', '<?=$granchild->thumb_url()?>');skimimg=<?=$i-1?>;" id="area_<?=$granchild->id?>"></div>
<? endif ?>
<? $offset+=$step;
endforeach;
@ -56,6 +62,9 @@ endif;
<p class="giTitle <? if(!$child->is_album()) print 'center';?>"><?= html::purify(text::limit_chars($child->title, 20)) ?> </p>
<? if($child->is_album()): ?><div class="giInfo"><?= count($granchildren)?> photos</div><? endif ?>
</div>
<? if ($child->is_movie()): ?>
</a>
<? endif ?>
<?/* <?= $theme->thumb_bottom($child) ?>
<?= $theme->context_menu($child, "#g-item-id-{$child->id} .g-thumbnail") ?>
<h2><span class="<?= $item_class ?>"></span>
@ -69,7 +78,7 @@ endif;
var slideshowImages = new Array();
<? foreach ($children as $i => $child): ?>
<? if(!($child->is_album() || $child->is_movie())): ?>
slideshowImages.push(['<?= $child->resize_url() ?>', '<?= url::site("exif/show/$child->id") ?>', '<?= $child->width ?>','<?= $child->height ?>', '<?= $child->title ?>', '<?= $child->file_url() ?>', '<?= $child->url() ?>']);
slideshowImages.push(['<?= $child->resize_url() ?>', '<?= url::site("exif/show/$child->id") ?>', '<?= $child->width ?>','<?= $child->height ?>', '<?= htmlentities($child->title, ENT_QUOTES) ?>', '<?= $child->file_url() ?>', '<?= $child->url() ?>']);
<? endif ?>
<? endforeach ?>
</script>
@ -87,4 +96,5 @@ endif;
<?= $theme->album_bottom() ?>
<?= $theme->paginator() ?>
<div id="pearFlowPadd" class="imageflow" style="display: none;"></div>
<div id="pearImageFlow" class="imageflow" style="display: none;"> </div>

View File

@ -1,9 +1,12 @@
<?php defined("SYSPATH") or die("No direct script access.") ?>
<script type="text/javascript">
$(function() { bodyLoad('grid',''); });
</script>
<div id="g-item">
<?= $theme->photo_top() ?>
<?= $theme->paginator() ?>
<div id="mosaicGridContainer">
<div id="g-movie" class="ui-helper-clearfix">
<?= $theme->resize_top($item) ?>
<?= $item->movie_img(array("class" => "g-movie", "id" => "g-item-id-{$item->id}")) ?>
@ -14,6 +17,6 @@
<h1><?= html::purify($item->title) ?></h1>
<div><?= nl2br(html::purify($item->description)) ?></div>
</div>
</div>
<?= $theme->photo_bottom() ?>
</div>

View File

@ -122,7 +122,7 @@
<? if ($theme->item()): ?>
<? if(!empty($parents)): ?>
<? $parent = end($parents) ?>
<button class="large push large-with-push" onclick="window.location='<?= $parent->url($parent->id == $theme->item()->parent_id ? "show={$theme->item()->id}" : null) ?>';// + '#viewMode=' + viewMode;"> <div class="outer"> <div class="label"> <?= html::purify(text::limit_chars($parent->title, module::get_var("gallery", "visible_title_length"))) ?></div> </div></button>
<button class="large push large-with-push" onclick="window.location='<?= $parent->url($parent->id == $theme->item()->parent_id ? "show={$theme->item()->id}" : null) ?>' + '#viewMode=' + viewMode;"> <div class="outer"> <div class="label"> <?= html::purify(text::limit_chars($parent->title, module::get_var("gallery", "visible_title_length"))) ?></div> </div></button>
<? endif ?>
</div>
<div class="pearTitle" title="<?= $theme->item()->description ?>"> <?= html::purify(text::limit_chars($theme->item()->title, 40)) ?> &nbsp;
@ -154,8 +154,8 @@
<div id="footerWrapper">
<div title="Change size of photos" id="sliderView" class="sliderView">
<div class="sliderRightCap"></div>
<div title="View at smallest photo size" class="smaller" onclick="$('#slider').slider('value', 0);"></div>
<div title="View at largest photo size" class="larger" onclick="$('#slider').slider('value', 250);"></div>
<div title="View at smallest photo size" class="smaller" onclick="$('#imgSlider').slider('value', 0);"></div>
<div title="View at largest photo size" class="larger" onclick="$('#imgSlider').slider('value', 250);"></div>
<div id="imgSlider" class="track">
</div>
</div>
@ -169,14 +169,15 @@
</div>
<div class="" style="" id="viewControls">
<div title="Display this album in a grid view" id="grid" class="grid viewSwitcher sel sel-with-viewSwitcher" onclick="switchToGrid();">
<? if ($theme->page_subtype != "movie"): ?>
<div title="Display this album in a grid view" id="grid" class="grid viewSwitcher sel sel-with-viewSwitcher" onclick="switchToGrid(true);">
<div class="label">Grid</div>
</div>
<div title="Display this album in a mosaic view" id="mosaic" class="viewSwitcher mosaic" onclick="switchToMosaic();">
<div title="Display this album in a mosaic view" id="mosaic" class="viewSwitcher mosaic" onclick="switchToMosaic(true);">
<!-- <div style="margin-top:-2px;margin-left:-4px;"> -->
<div class="label">Mosaic</div>
</div>
<div title="Display this album in a carousel view" id="carousel" class="carousel viewSwitcher" onclick="startImageFlow();">
<div title="Display this album in a carousel view" id="carousel" class="carousel viewSwitcher" onclick="startImageFlow(true);">
<!-- <div style="margin-top:-2px;"> -->
<div class="label">Carousel</div>
</div>
@ -185,6 +186,7 @@
<div class="label">Slideshow</div>
</div>
<div class="clear"></div>
<? endif ?>
</div>
<? if (!module::get_var("th_pear4gallery3", "hide_logo")): ?><button id="logoButton"></button><?endif?>
</div>

View File

@ -1,135 +0,0 @@
<?php defined("SYSPATH") or die("No direct script access.") ?>
<?
// The g-info block was taken from album.html.php and $theme->album_top() was changed to $theme->dynamic_top().
// $item->title and $item->description have been changed to $title and $description.
//
// The g-album-grid block was also taken from album.html.php. The section for uploading new photos to an empty album
// has been removed. Also, $theme->context_menu has been removed as well (it was crashing the page).
?>
<div id="g-album-header">
<?= $theme->dynamic_top() ?>
<h1><?= $theme->bb2html(html::purify($title), 1) ?></h1>
</div>
<?= $theme->add_paginator("top"); ?>
<? if (($theme->album_descmode == "top") and ($description)): ?>
<div id="g-info"><div class="g-description"><?= $theme->bb2html(html::purify($description), 1) ?></div></div>
<? endif; ?>
<? if (isset($filter_text) && (module::get_var("tag_albums", "tag_index_filter"))): ?>
<div id="g-tags-filter">
<br/ >
<center><?= $filter_text; ?></center>
</div>
<? endif ?>
<div class="g-album-grid-container">
<ul id="g-album-grid" class="<?= $theme->get_grid_column_class(); ?>">
<? if (count($children)): ?>
<? foreach ($children as $i => $child): ?>
<?
// This code is based on grey dragon's get_thumb_element function.
$thumb_item = $child;
$is_portrait = ($thumb_item->thumb_height > $thumb_item->thumb_width);
$item_class = $child->is_album() ? "g-album" : "g-photo";
$content = '<li id="g-item-id-' . $child->id . '" class="g-item ' . $item_class . ' ' . $theme->thumb_type;
if ($child->is_album()):
$_thumb_descmode = $theme->thumb_descmode_a;
else:
$_thumb_descmode = $theme->thumb_descmode;
endif;
$content .= ($_thumb_descmode == "bottom")? " g-expanded" : " g-default";
$content .= ($is_portrait)? " g-portrait" : " g-landscape";
$content .= '">' . $theme->thumb_top($child);
if ($theme->thumb_topalign):
$_shift = "";
else:
if (($theme->crop_factor == 1) and (!$is_portrait)):
$_shift = 'style="margin-top: ' . intval(($theme->_thumb_size_y - $thumb_item->thumb_height) / 2) . 'px;"';
else:
if (($theme->crop_factor > 0) and ($is_portrait)):
$_shift = 'style="margin-top: -' . intval(($thumb_item->thumb_height - $theme->_thumb_size_y) / 2) . 'px;"';
else:
$_shift = "";
endif;
endif;
endif;
// $ss = 'z-index: 22; opacity: 1; -ms-transform: rotate(' . (-15 + rand(0, 31)) . 'deg);'; style="' . $ss . '"
$content .= '<div class="g-thumbslide"><p class="g-thumbcrop">';
$content .= '<a '. $_shift . ' class="g-thumblink" href="' . $child->url() . '">';
if ($thumb_item->has_thumb()):
$content .= $thumb_item->thumb_img();
else:
$content .= '<img title="No Image" alt="No Image" src="' . $theme->url("images/missing-img.png") . '"/>';
endif;
$content .= '</a></p>';
if (($theme->thumb_metamode != "hide") and ($_thumb_descmode == "overlay_bottom")):
$_thumb_metamode = "merged";
else:
$_thumb_metamode = $theme->thumb_metamode;
endif;
if (($_thumb_descmode == "overlay") or ($_thumb_descmode == "overlay_top") or ($_thumb_descmode == "overlay_bottom")):
$content .= '<ul class="g-description ';
if ($_thumb_descmode == "overlay_top"):
$content .= 'g-overlay-top';
endif;
if ($_thumb_descmode == "overlay_bottom"):
$content .= 'g-overlay-bottom';
endif;
$content .= '"><li class="g-title">' . $theme->bb2html(html::purify($child->title), 2) . '</li>';
if ($_thumb_metamode == "merged"):
$content .= $theme->thumb_info($child);
endif;
$content .= '</ul>';
endif;
if (($_thumb_metamode == "default") and ($_thumb_descmode != "overlay_bottom")):
$content .= '<ul class="g-metadata">' . $theme->thumb_info($child) . '</ul>';
endif;
if ($_thumb_descmode == "bottom"):
$content .= '<ul class="g-description">';
$content .= '<li class="g-title">' . $theme->bb2html(html::purify($child->title), 2) . '</li>';
if ($_thumb_metamode == "merged"):
$content .= $theme->thumb_info($child);
endif;
$content .= '</ul>';
endif;
/*
if ($addcontext):
$_text = $this->context_menu($child, "#g-item-id-{$child->id} .g-thumbnail");
$content .= (stripos($_text, '<li>'))? $_text : null;
endif;
*/
$content .= '</div>';
$content .= $theme->thumb_bottom($child);
$content .= '</li>';
print $content;
// End rWatcher Edit.
?>
<? endforeach ?>
<? else: ?>
<li><?= t("There aren't any photos here yet!") ?></li>
<? endif; ?>
</ul>
</div>
<?= $theme->dynamic_bottom() ?>
<? if (($theme->album_descmode == "bottom") and ($description)): ?>
<div id="g-info"><div class="g-description"><?= $theme->bb2html(html::purify($description), 1) ?></div></div>
<? endif; ?>
<?= $theme->add_paginator("bottom"); ?>

View File

@ -19,7 +19,7 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<? $theme->load_sessioninfo(); ?>
<!-- <?= $theme->themename ?> v.<?= $theme->themeversion ?> (ColorPack: <?= $theme->colorpack ?>) - Copyright (c) 2009-2011 Serguei Dosyukov - All Rights Reserved -->
<!-- <?= $theme->themename ?> v.<?= $theme->themeversion ?> (<?= $theme->colorpack ?> : <?= $theme->framepack ?>) - Copyright (c) 2009-2011 Serguei Dosyukov - All Rights Reserved -->
<html xmlns="http://www.w3.org/1999/xhtml" <?= $theme->html_attributes() ?> xml:lang="en" lang="en" <?= ($theme->is_rtl)? "dir=rtl" : null; ?> >
<?
$item = $theme->item();
@ -55,10 +55,6 @@
<meta name="msnbot" content="noindex, nofollow, noarchive, nosnippet, noodp" />
<meta name="teoma" content="noindex, nofollow, noarchive" />
<? endif; ?>
<? if ($theme->blendpagetrans): ?>
<meta http-equiv="Page-Enter" content="blendtrans(duration=0.5)" />
<meta http-equiv="Page-Exit" content="blendtrans(duration=0.5)" />
<? endif; ?>
<!-- Internet Explorer 9 Meta tags : Start -->
<meta name="application-name" content="<?= $_title; ?>" />
<meta name="msapplication-tooltip" content="<?= t("Start"); ?> <?= $_title; ?>" />
@ -74,7 +70,6 @@
<meta name="msapplication-task" content="name=<?= t("Admin") ?>: <?= t("Dashboard") ?>; action-uri=<?= url::site("admin"); ?>; icon-uri=favicon.ico" />
<? endif; ?>
<!-- Internet Explorer 9 Meta tags : End -->
<link rel="shortcut icon" href="<?= $theme->favicon ?>" type="image/x-icon" />
<? if ($theme->appletouchicon): ?>
<link rel="apple-touch-icon" href="<?= $theme->appletouchicon; ?>"/>
@ -100,22 +95,12 @@
<?= $theme->head() ?>
<? /* Theme specific CSS/JS goes last so that it can override module CSS/JS */ ?>
<?= $theme->script("animation.js"); ?>
<?= $theme->script("ui.support.js"); ?>
<? // Theme specific CSS/JS goes last so that it can override module CSS/JS ?>
<?= $theme->theme_js_inject(); ?>
<?= $theme->theme_css_inject(); ?>
<!-- LOOKING FOR YOUR CSS? It's all been combined into the link below -->
<?= $theme->get_combined("css"); ?>
<?= $theme->css_link("colorpacks/" . $theme->colorpack . "/colors.css", FALSE); ?>
<?= $theme->css_link("framepacks/" . $theme->framepack . "/frame.css", FALSE); ?>
<? if ($theme->custom_css_path != ""): ?>
<?= $theme->css_link($theme->custom_css_path, TRUE); ?>
<? endif; ?>
<!-- LOOKING FOR YOUR JAVASCRIPT? It's all been combined into the link below -->
<?= $theme->get_combined("script") ?>
<?= $theme->get_combined("css"); // LOOKING FOR YOUR CSS? It's all been combined into the link ?>
<?= $theme->custom_css_inject(TRUE); ?>
<?= $theme->get_combined("script") // LOOKING FOR YOUR JAVASCRIPT? It's all been combined into the link ?>
<!--[if IE 6]>
<link rel="stylesheet" href="<?= $theme->url("css/old_ie.css") ?>" type="text/css" media="screen,print,projection" />
@ -128,24 +113,18 @@
$item = $theme->item();
else:
$item = item::root();
endif;
if ($theme->is_rtl):
$body_class = "rtl";
else:
$body_class = "";
endif;
if ($theme->viewmode == "mini"):
$body_class .= "viewmode-mini";
endif; ?>
<body <?= $theme->body_attributes() ?><?= ($theme->show_root_page)? ' id="g-rootpage"' : null; ?> <?= ($body_class)? 'class="' . $body_class . '"' : null; ?>>
<?= $theme->page_top() ?>
<body <?= $theme->body_attributes() ?><?= ($theme->show_root_page)? ' id="g-rootpage"' : null; ?> <?= $theme->get_bodyclass(); ?>>
<div class="QOverlay" style="left: 0px; top: 0px; width: 100%; height: 100%; position: fixed;">
</div>
<?= $theme->page_top() ?>
<?= $theme->site_status() ?>
<? if (((!$user->guest) or ($theme->show_guest_menu)) and ($theme->mainmenu_position == "bar")): ?>
<style type="text/css"> html { margin-top: 30px !important; } </style>
<div id="g-site-menu" class="g-<?= $theme->mainmenu_position; ?>">
<?= $theme->site_menu($theme->item() ? "#g-item-id-{$theme->item()->id}" : "") ?>
</div>
<? endif ?>
<? endif; ?>
<div id="g-header">
<?= $theme->header_top() ?>
<? if ($theme->viewmode != "mini"): ?>
@ -175,40 +154,45 @@
// The rest of this file is the original page.html.php file from the Grey Dragon theme.
?>
<? if (empty($breadcrumbs)): ?>
<? // This block is the original breadcrumb code ?>
<? if (empty($parents)): ?>
<?= $theme->breadcrumb_menu($theme, null); ?>
<? else: ?>
<?= $theme->breadcrumb_menu($theme, $parents); ?>
<? endif; ?>
<? // End Original Breadcrumb code, begin modified code. ?>
<? else: ?>
<?
// This is based on the libraries/My_Theme_View.php -> breadcrumb_menu function.
$breadcrumb_content = "";
if ($this->breadcrumbs_position == "hide"):
else:
$limit_title_length = module::get_var("gallery", "visible_title_length", 999);
$breadcrumb_content .= '<ul class="g-breadcrumbs g-' . module::get_var("th_greydragon", "breadcrumbs_position", "default") . '">';
$breadcrumb_content .= '<ul class="g-breadcrumbs g-' . $this->breadcrumbs_position . '">';
$i = 0;
foreach ($breadcrumbs as $breadcrumb):
if ($breadcrumb->url):
$breadcrumb_content .= '<li ' . (($i == 0)? " class=\"g-first\"" : null) . '>';
$breadcrumb_content .= '<a href="' . $breadcrumb->url . '">';
$breadcrumb_content .= text::limit_chars($theme->bb2html(html::purify($breadcrumb->title), 2), $limit_title_length);
$breadcrumb_content .= '</a></li>';
else:
$breadcrumb_content .= '<li class="g-active ' . (($i == 0)? " g-first" : null) . '">' . text::limit_chars($theme->bb2html(html::purify($breadcrumb->title), 2), $limit_title_length) . '</li>';
endif;
if ($breadcrumb->url):
$breadcrumb_content .= '<li ' . (($i == 0)? " class=\"g-first\"" : null) . '>';
$breadcrumb_content .= (($i > 0)? " :: " : null );
$breadcrumb_content .= '<a href="' . $breadcrumb->url . '">';
$breadcrumb_content .= text::limit_chars($theme->bb2html(html::purify($breadcrumb->title), 2), $limit_title_length);
$breadcrumb_content .= '</a></li>';
else:
$breadcrumb_content .= '<li class="g-active ' . (($i == 0)? " g-first" : null) . '"> '. (($i > 0)? " :: " : null ) . text::limit_chars($theme->bb2html(html::purify($breadcrumb->title), 2), $limit_title_length) . '</li>';
endif;
$i++;
endforeach;
$breadcrumb_content .= '</ul>';
endif;
print $breadcrumb_content;
// End Edit.
print $breadcrumb_content;
?>
<? endif; // End Edit. ?>
<? endif; ?>
<?= $theme->custom_header(); ?>
</div>
<? if (($theme->page_subtype != "login") and ($theme->page_subtype != "reauthenticate") and ($theme->sidebarvisible == "top")): ?>

View File

@ -59,7 +59,7 @@
endfor;
else:
// End rWatcher Mod.
switch ($page_type) {
case "collection":
if (isset($item)):
@ -189,7 +189,7 @@
<? if (isset($parent_url)): ?>
<a title="<?= t("up") ?>" id="g-navi-parent" href="<?= $parent_url ?>"><span class="ui-icon ui-icon-parent">&nbsp;</span></a>
<? elseif (isset($parent)): ?>
<a title="<?= t("up") ?>" id="g-navi-parent" href="<?= $parent->url() ?>"><span class="ui-icon ui-icon-parent">&nbsp;</span></a>
<a title="<?= t("up") ?>" id="g-navi-parent" href="<?= $parent->url("show={$item->id}"); ?>"><span class="ui-icon ui-icon-parent">&nbsp;</span></a>
<? else: ?>
<span class="ui-icon ui-icon-parent-d">&nbsp;</span>
<? endif ?>

View File

@ -56,8 +56,8 @@
<div id="g-photo">
<?= $theme->resize_top($item) ?>
<? $_resizewidth = $item->resize_width;
// rWatcher Modification.
//ORIGINAL LINE $siblings = $item->parent()->children();
$siblings = "";
if (isset($dynamic_siblings)) {
$siblings = $dynamic_siblings;
@ -66,7 +66,7 @@
}
// End rWatcher Modification
?>
<div class="g-resize" style="margin-left: -<?= intval($_resizewidth / 2); ?>px; ">
<? $script = "<script type=\"text/javascript\">\n";
$script .= " if (document.images) {\n";

View File

@ -0,0 +1,239 @@
<?php defined("SYSPATH") or die("No direct script access."); ?>
<?
// Used album.html.php as starting point.
// The g-info block was taken from album.html.php and $theme->album_top() was changed to $theme->dynamic_top().
// $item->title and $item->description have been changed to $title and $description.
//
// The g-album-grid block was also taken from album.html.php. The section for uploading new photos to an empty album
// has been removed. Also, $theme->context_menu has been removed as well (it was crashing the page).
?>
<div id="g-album-header">
<?= $theme->dynamic_top() ?>
<h1><?= $theme->bb2html(html::purify($title), 1) ?></h1>
</div>
<?= $theme->add_paginator("top"); ?>
<? if (($theme->album_descmode == "top") and ($description)): ?>
<div id="g-info"><div class="g-description"><?= $theme->bb2html(html::purify($description), 1) ?></div></div>
<? endif; ?>
<? if (isset($filter_text) && (module::get_var("tag_albums", "tag_index_filter"))): ?>
<div id="g-tags-filter">
<br/ >
<center><?= $filter_text; ?></center>
</div>
<? endif ?>
<div class="g-album-grid-container">
<ul id="g-album-grid" class="<?= $theme->get_grid_column_class(); ?>">
<?
if (count($children)):
$siblings = $all_siblings;
if (($theme->disablephotopage) && (count($siblings) > count($children))):
$j = 0;
foreach ($siblings as $i => $sibling):
//if ($sibling->rand_key == $children[$j]->rand_key):
if ($sibling->id == $children[$j]->item_id):
//echo $theme->get_thumb_element($sibling, !$theme->hidecontextmenu);
echo rw_get_thumb_element($children[$j], $theme);
if ($j + 1 < count($children)):
$j++;
endif;
else:
echo $theme->get_thumb_link($sibling);
//echo rw_get_thumb_link($sibling, $theme);
endif;
endforeach;
else:
foreach ($children as $i => $child):
//echo $theme->get_thumb_element($child, !$theme->hidecontextmenu);
echo rw_get_thumb_element($child, $theme);
endforeach;
endif;
else: ?>
<li><?= t("There aren't any photos here yet!") ?></li>
<? endif; ?>
</ul>
</div>
<?= $theme->dynamic_bottom() ?>
<? if (($theme->album_descmode == "bottom") and ($description)): ?>
<div id="g-info"><div class="g-description"><?= $theme->bb2html(html::purify($description), 1) ?></div></div>
<? endif; ?>
<?= $theme->add_paginator("bottom"); ?>
<?
function rw_get_thumb_link($item, $theme) {
// This code is based on grey dragon's get_thumb_link function.
// Change all $this to $theme
if ($item->is_album()):
return "";
endif;
/*
if (access::can("view_full", $item)):
$direct_link = $item->file_url();
else:
$direct_link = $item->resize_url();
endif;*/
$direct_link = $child->full_or_resize_url();
return '<a title="' . $theme->bb2html(html::purify($item->title), 2) . '" style="display: none;" class="g-sb-preview" rel="g-preview" href="' . $direct_link . '">&nbsp;</a>';
}
function rw_get_thumb_element($child, $theme) {
// This code is based on grey dragon's get_thumb_element function.
// Change all $item to $child
// Change all $this to $theme
$thumb_item = $child;
if ($theme->thumb_random):
if ($child->is_album() && ($rnd = item::random_query()->where("parent_id", "=", $child->id)->find()) && $rnd->loaded()):
$thumb_item = $rnd;
endif;
endif;
$item_class = $child->is_album() ? "g-album" : "g-photo";
$content = '<li id="g-item-id-' . $child->id . '" class="g-item ' . $item_class . ' ' . $theme->thumb_type;
if ($child->is_album()):
$_thumb_descmode = $theme->thumb_descmode_a;
else:
$_thumb_descmode = $theme->thumb_descmode;
endif;
$content .= ($_thumb_descmode == "bottom")? " g-expanded" : " g-default";
if ($thumb_item->has_thumb()):
$is_portrait = ($thumb_item->thumb_height > $thumb_item->thumb_width);
$_shift = "";
switch ($theme->thumb_imgalign):
case "center":
if (($theme->crop_factor == 1) and (!$is_portrait)):
$_shift = 'style="margin-top: ' . intval(($theme->_thumb_size_y - $thumb_item->thumb_height) / 2) . 'px;"';
elseif ($theme->crop_factor > 0):
$_shift = 'style="margin-top: -' . intval(($thumb_item->thumb_height - $theme->_thumb_size_y) / 2) . 'px;"';
endif;
break;
case "bottom":
if (($theme->crop_factor == 1) and (!$is_portrait)):
$_shift = 'style="margin-top: ' . intval($theme->_thumb_size_y - $thumb_item->thumb_height) . 'px;"';
elseif ($theme->crop_factor > 0):
$_shift = 'style="margin-top: -' . intval($thumb_item->thumb_height - $theme->_thumb_size_y) . 'px;"';
endif;
break;
case "fit":
break;
case "top":
default:
break;
endswitch;
else:
$is_portrait = FALSE;
$_shift = 'style="margin-top: 0px;"';
endif;
$content .= ($is_portrait)? " g-portrait" : " g-landscape";
$content .= '">' . $theme->thumb_top($child);
$content .= '<div class="g-thumbslide">';
$thumb_content = '<p class="g-thumbcrop">';
$use_direct_link = (($theme->disablephotopage) && (!$child->is_album()));
$class_name = "g-thumblink";
if ($use_direct_link):
$class_name .= ' g-sb-preview" rel="g-preview';
//if (access::can("view_full", $child)):
//$direct_link = $child->file_url();
//else:
$direct_link = $child->full_or_resize_url();
//endif;
else:
$direct_link = $child->url();
endif;
if ($use_direct_link && module::is_active("exif") && module::info("exif")):
$thumb_content .= '<a class="g-meta-exif-link g-dialog-link" href="' . url::site("exif/show/{$child->id}") . '" title="' . t("Photo details")->for_html_attr() . '">&nbsp;</a>';
endif;
$thumb_content .= '<a title="' . $theme->bb2html(html::purify($child->title), 2) . '" '. $_shift . ' class="' . $class_name . '" href="' . $direct_link . '">';
if ($thumb_item->has_thumb()):
if (($theme->crop_factor > 1) && ($theme->thumb_imgalign == "fit")):
if ($thumb_item->thumb_height > $theme->_thumb_size_y):
if ($is_portrait):
$_max = $theme->_thumb_size_y;
else:
$_max = intval($theme->_thumb_size_x * ($theme->_thumb_size_y / $thumb_item->thumb_height));
endif;
else:
$_max = $theme->_thumb_size_x;
endif;
$_max = min($thumb_item->thumb_width, $_max);
$thumb_content .= $thumb_item->thumb_img(array(), $_max);
else:
$thumb_content .= $thumb_item->thumb_img();
endif;
else:
$thumb_content .= '<img title="No Image" alt="No Image" src="' . $theme->url("images/missing-img.png") . '"/>';
endif;
$thumb_content .= '</a></p>';
if (($theme->thumb_metamode != "hide") and ($_thumb_descmode == "overlay_bottom")):
$_thumb_metamode = "merged";
else:
$_thumb_metamode = $theme->thumb_metamode;
endif;
if (($_thumb_descmode == "overlay") or ($_thumb_descmode == "overlay_top") or ($_thumb_descmode == "overlay_bottom")):
$thumb_content .= '<ul class="g-description ';
if ($_thumb_descmode == "overlay_top"):
$thumb_content .= 'g-overlay-top';
endif;
if ($_thumb_descmode == "overlay_bottom"):
$thumb_content .= 'g-overlay-bottom';
endif;
$thumb_content .= '"><li class="g-title">' . $theme->bb2html(html::purify($child->title), 2) . '</li>';
if ($_thumb_metamode == "merged"):
$thumb_content .= $theme->thumb_info($child);
endif;
$thumb_content .= '</ul>';
endif;
if (($_thumb_metamode == "default") and ($_thumb_descmode != "overlay_bottom")):
$thumb_content .= '<ul class="g-metadata">' . $theme->thumb_info($child) . '</ul>';
endif;
if ($_thumb_descmode == "bottom"):
$thumb_content .= '<ul class="g-description">';
$thumb_content .= '<li class="g-title">' . $theme->bb2html(html::purify($child->title), 2) . '</li>';
if ($_thumb_metamode == "merged"):
$thumb_content .= $theme->thumb_info($item);
endif;
$thumb_content .= '</ul>';
endif;
/*
if ($addcontext):
$_text = $this->context_menu($item, "#g-item-id-{$item->id} .g-thumbnail");
$thumb_content .= (stripos($_text, '<li>'))? $_text : null;
endif;
*/
try {
$view = new View("frame.html");
$view->thumb_content = $thumb_content;
$content .= $view;
} catch (Exception $e) {
$content .= $thumb_content;
}
$content .= '</div>';
$content .= $theme->thumb_bottom($child);
$content .= '</li>';
return $content;
//print $content;
// End of modified function code.
}
?>

View File

@ -71,7 +71,11 @@ class tag_albums_Controller extends Controller {
$index = $this->_get_position($child->$sort_page_field, $child->id, $tag_ids, "items." . $sort_page_field, $sort_page_direction, $album_tags_search_type, true);
if ($index) {
$page = ceil($index / $page_size);
url::redirect($str_page_url . "?page=$page");
if ($page == 1) {
url::redirect($str_page_url);
} else {
url::redirect($str_page_url . "?page=$page");
}
}
}
@ -98,17 +102,18 @@ class tag_albums_Controller extends Controller {
// Figure out which items to display on this page and store their details in $children.
$tag_children = $this->_get_records($tag_ids, $page_size, $offset, "items." . $sort_page_field, $sort_page_direction, $album_tags_search_type, true);
$children = Array();
$children_array = Array();
foreach ($tag_children as $one_child) {
$child_tag = new Tag_Albums_Item($one_child->title, url::site("tag_albums/show/" . $one_child->id . "/0/" . $id . "/" . urlencode($one_child->name)), $one_child->type);
$child_tag = new Tag_Albums_Item($one_child->title, url::site("tag_albums/show/" . $one_child->id . "/0/" . $id . "/" . urlencode($one_child->name)), $one_child->type, $one_child->id);
$child_tag->id = $one_child->id;
$child_tag->view_count = $one_child->view_count;
$child_tag->owner = identity::lookup_user($one_child->owner_id);
if ($one_child->has_thumb()) {
$child_tag->set_thumb($one_child->thumb_url(), $one_child->thumb_width, $one_child->thumb_height);
}
$children[] = $child_tag;
$children_array[] = $child_tag;
}
$children = new Tag_Albums_Children($children_array);
// Set up the previous and next page buttons.
if ($page > 1) {
@ -141,6 +146,7 @@ class tag_albums_Controller extends Controller {
$template->set_global("page_size", $page_size);
$template->set_global("max_pages", $max_pages);
$template->set_global("children", $children);
$template->set_global("all_siblings", $this->_get_records($tag_ids, $count, 0, "items." . $sort_page_field, $sort_page_direction, $album_tags_search_type, false));
$template->set_global("children_count", $count);
$template->set_global("parent_url", $parent_album->url()); // Used by Grey Dragon.
$template->content = new View("tag_albums_album.html");
@ -185,7 +191,7 @@ class tag_albums_Controller extends Controller {
->where("id", "=", $id)
->find_all();
if (count($album_tags) == 0) {
$id = "";
$id = 0;
}
// Inherit permissions, title and description from the album that linked to this page,
@ -194,7 +200,7 @@ class tag_albums_Controller extends Controller {
$page_title = module::get_var("tag_albums", "tag_page_title", "All Tags");
$page_description = "";
$str_page_url = "";
if ($id == "") {
if ($id == 0) {
$album = ORM::factory("item", 1);
access::required("view", $album);
$str_page_url = "tag_albums/";
@ -239,7 +245,11 @@ class tag_albums_Controller extends Controller {
}
if ($index) {
$page = ceil($index / $page_size);
url::redirect("$str_page_url?page=$page");
if ($page == 1) {
url::redirect("$str_page_url");
} else {
url::redirect("$str_page_url?page=$page");
}
}
}
@ -309,7 +319,7 @@ class tag_albums_Controller extends Controller {
// Generate an arry of "fake" items, one for each tag on the page.
// Grab thumbnails from the most recently uploaded item for each tag, if available.
$children = Array();
$children_array = Array();
foreach ($display_tags as $one_tag) {
$tag_item = ORM::factory("item")
->viewable()
@ -317,19 +327,20 @@ class tag_albums_Controller extends Controller {
->where("items_tags.tag_id", "=", $one_tag->id)
->order_by("items.id", "DESC")
->find_all(1, 0);
$child_tag = new Tag_Albums_Item($one_tag->name, url::site("tag_albums/tag/" . $one_tag->id . "/" . $id . "/" . urlencode($one_tag->name)), "album");
$child_tag = new Tag_Albums_Item($one_tag->name, url::site("tag_albums/tag/" . $one_tag->id . "/" . $id . "/" . urlencode($one_tag->name)), "album", 0);
if (count($tag_item) > 0) {
if ($tag_item[0]->has_thumb()) {
$child_tag->set_thumb($tag_item[0]->thumb_url(), $tag_item[0]->thumb_width, $tag_item[0]->thumb_height);
}
}
$children[] = $child_tag;
$children_array[] = $child_tag;
}
$children = new Tag_Albums_Children($children_array);
// Set up breadcrumbs.
$tag_album_breadcrumbs = Array();
$parent_url = "";
if ($id != "") {
if ($id > 0) {
$counter = 0;
$tag_album_breadcrumbs[$counter++] = new Tag_Albums_Breadcrumb($album->title, "");
$parent_item = ORM::factory("item", $album->parent_id);
@ -375,7 +386,7 @@ class tag_albums_Controller extends Controller {
->where("id", "=", $album_id)
->find_all();
if (count($album_tags) == 0) {
$album_id = "";
$album_id = 0;
}
// Load the current tag.
@ -398,7 +409,11 @@ class tag_albums_Controller extends Controller {
$index = $this->_get_position($child->$sort_page_field, $child->id, Array($id), "items." . $sort_page_field, $sort_page_direction, "OR", true);
if ($index) {
$page = ceil($index / $page_size);
url::redirect($str_page_url . "?page=$page");
if ($page == 1) {
url::redirect($str_page_url);
} else {
url::redirect($str_page_url . "?page=$page");
}
}
}
@ -428,18 +443,19 @@ class tag_albums_Controller extends Controller {
$tag_children = $this->_get_records(Array($id), $page_size, $offset, "items." . $sort_page_field, $sort_page_direction, "OR", true);
// Create an array of "fake" items to display on the page.
$children = Array();
$children_array = Array();
foreach ($tag_children as $one_child) {
$child_tag = new Tag_Albums_Item($one_child->title, url::site("tag_albums/show/" . $one_child->id . "/" . $id . "/" . $album_id . "/" . urlencode($one_child->name)), $one_child->type);
$child_tag = new Tag_Albums_Item($one_child->title, url::site("tag_albums/show/" . $one_child->id . "/" . $id . "/" . $album_id . "/" . urlencode($one_child->name)), $one_child->type, $one_child->id);
$child_tag->id = $one_child->id;
$child_tag->view_count = $one_child->view_count;
$child_tag->owner = identity::lookup_user($one_child->owner_id);
if ($one_child->has_thumb()) {
$child_tag->set_thumb($one_child->thumb_url(), $one_child->thumb_width, $one_child->thumb_height);
}
$children[] = $child_tag;
$children_array[] = $child_tag;
}
$children = new Tag_Albums_Children($children_array);
// Set up the previous and next page buttons.
if ($page > 1) {
$previous_page = $page - 1;
@ -453,7 +469,7 @@ class tag_albums_Controller extends Controller {
// Set up breadcrumbs for the page.
$tag_album_breadcrumbs = Array();
$parent_url = "";
if ($album_id != "") {
if ($album_id > 0) {
$counter = 0;
$tag_album_breadcrumbs[$counter++] = new Tag_Albums_Breadcrumb($display_tag->name, "");
$parent_item = ORM::factory("item", $album_tags[0]->album_id);
@ -491,6 +507,7 @@ class tag_albums_Controller extends Controller {
$template->set_global("page_size", $page_size);
$template->set_global("max_pages", $max_pages);
$template->set_global("children", $children);
$template->set_global("all_siblings", $this->_get_records(Array($id), $count, 0, "items." . $sort_page_field, $sort_page_direction, "OR", false));
$template->set_global("children_count", $count);
$template->set_global("parent_url", $parent_url); // Used by Grey Dragon.
$template->content = new View("tag_albums_album.html");
@ -508,7 +525,7 @@ class tag_albums_Controller extends Controller {
->where("id", "=", $album_id)
->find_all();
if (count($album_tags) == 0) {
$album_id = "";
$album_id = 0;
}
// Load the tag and item, make sure the user has access to the item.
@ -542,12 +559,12 @@ class tag_albums_Controller extends Controller {
if ($position > 1) {
$previous_item_object = $this->_get_records(Array($tag_id), 1, $position-2, "items." . $sort_page_field, $sort_page_direction, $album_tags_search_type, false);
if (count($previous_item_object) > 0) {
$previous_item = new Tag_Albums_Item($previous_item_object[0]->title, url::site("tag_albums/show/" . $previous_item_object[0]->id . "/" . $tag_id . "/" . $album_id . "/" . urlencode($previous_item_object[0]->name)), $previous_item_object[0]->type);
$previous_item = new Tag_Albums_Item($previous_item_object[0]->title, url::site("tag_albums/show/" . $previous_item_object[0]->id . "/" . $tag_id . "/" . $album_id . "/" . urlencode($previous_item_object[0]->name)), $previous_item_object[0]->type, $previous_item_object[0]->id);
}
}
$next_item_object = $this->_get_records(Array($tag_id), 1, $position, "items." . $sort_page_field, $sort_page_direction, $album_tags_search_type, false);
if (count($next_item_object) > 0) {
$next_item = new Tag_Albums_Item($next_item_object[0]->title, url::site("tag_albums/show/" . $next_item_object[0]->id . "/" . $tag_id . "/" . $album_id . "/" . urlencode($next_item_object[0]->name)), $next_item_object[0]->type);
$next_item = new Tag_Albums_Item($next_item_object[0]->title, url::site("tag_albums/show/" . $next_item_object[0]->id . "/" . $tag_id . "/" . $album_id . "/" . urlencode($next_item_object[0]->name)), $next_item_object[0]->type, $next_item_object[0]->id);
}
$dynamic_siblings = $this->_get_records(Array($tag_id), null, null, "items." . $sort_page_field, $sort_page_direction, $album_tags_search_type, false);
} else {
@ -576,7 +593,7 @@ class tag_albums_Controller extends Controller {
// Set up breadcrumbs
$tag_album_breadcrumbs = Array();
if ($album_id != "") {
if ($album_id > 0) {
$counter = 0;
$tag_album_breadcrumbs[$counter++] = new Tag_Albums_Breadcrumb($item->title, "");
if ($album_tags[0]->tags == "*") {

View File

@ -0,0 +1,48 @@
<?php defined("SYSPATH") or die("No direct script access.");
/**
* Gallery - a web based photo album viewer and editor
* Copyright (C) 2000-2011 Bharat Mediratta
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
*/
class Tag_Albums_Children_Core implements Iterator {
public $array = Array();
private $position = 0;
public function __construct($children) {
$this->position = 0;
$this->array = $children;
}
function rewind() {
$this->position = 0;
}
function current() {
return $this->array[$this->position];
}
function key() {
return $this->position;
}
function next() {
++$this->position;
}
function valid() {
return isset($this->array[$this->position]);
}
}

View File

@ -20,6 +20,7 @@
class Tag_Albums_Item_Core {
public $title = "";
public $id = -1;
public $item_id = 0;
public $url = "#";
public $thumb_url = "";
public $thumb_width = 0;
@ -45,6 +46,19 @@ class Tag_Albums_Item_Core {
}
}
public function full_or_resize_url() {
if ($this->item_id > 0) {
$item = ORM::factory("item", $this->item_id);
if (access::can("view_full", $item)) {
return $item->file_url();
} else {
return $item->resize_url();
}
} else {
return "";
}
}
public function thumb_img($extra_attrs=array(), $max=null, $center_vertically=false) {
list ($height, $width) = $this->scale_dimensions($max);
if ($center_vertically && $max) {
@ -105,10 +119,11 @@ class Tag_Albums_Item_Core {
$this->thumb_height = $new_height;
}
public function __construct($new_title, $new_url, $new_type) {
public function __construct($new_title, $new_url, $new_type, $new_id) {
$this->title = $new_title;
$this->url = $new_url;
$this->item_type = $new_type;
$this->type = $new_type;
$this->item_id = $new_id;
}
}