$(eval $(dir-setup))
-$(call lib-copy, UCW/Gallery.pm UCW/Gallery/Web.pm UCW/Gallery/Web/NrtBlue.pm)
+$(call lib-copy, UCW/Gallery.pm UCW/Gallery/Web.pm UCW/Gallery/Web/NrtBlue.pm UCW/Gallery/Web/Plain.pm)
$(call copy, $(addprefix nrt-blue/,back.png bot.png left.png next.png prev.png right.png top.png style.css))
+$(call copy, $(addprefix plain/,back.png next.png prev.png style.css))
# NRT Theme for MJ's Photo Gallery
-# (c) 2003--2004 Martin Mares <mj@ucw.cz>; GPL'ed
+# (c) 2003--2012 Martin Mares <mj@ucw.cz>; GPL'ed
# Theme images taken from the cthumb package (c) Carlos Puchol
package UCW::Gallery::Web::NrtBlue;
sub theme_dir($) {
my ($self) = @_;
- return $self->get('ThemeUrlPrefix') . "/" . $theme_name;
+ return $self->get('ThemeUrlPrefix') . $theme_name;
}
sub theme_head_extras($) {
my ($self) = @_;
my $stylesheet = $self->theme_dir . "/style.css";
- return "<link rel=stylesheet href='$stylesheet' type='text/css' media=all>";
+ return "<link rel=stylesheet href='$stylesheet' type='text/css' media=all>\n";
}
sub show_links($$$$) {
print "<a href='$click_url'><img src='$thumb' width=$tw height=$th alt='Photo'$tit class=ti style='left: ${ol}px; top: ${ot}px'></a>\n";
print "<img src='$theme/right.png' width=$right_w height=$side_h alt='' class=tr>\n";
print "<img src='$theme/bot.png' width=$box_w height=$bot_h alt='' class=tb>\n";
- print "</div>\n";
- print "</div>\n\n";
+ print "</div></div>\n\n";
}
sub attach($$) {
--- /dev/null
+# Plain Theme for MJ's Photo Gallery
+# (c) 2012 Martin Mares <mj@ucw.cz>; GPL'ed
+
+package UCW::Gallery::Web::Plain;
+
+use strict;
+use warnings;
+
+use UCW::Gallery;
+use UCW::Gallery::Web;
+
+our @ISA = qw(UCW::Gallery::Web);
+
+my $theme_name = "plain";
+my $navw = 48;
+my $navh = 48;
+my $box_w = 130;
+my $box_h = 110;
+my $thumb_w = 114;
+my $thumb_h = 94;
+
+sub theme_dir($) {
+ my ($self) = @_;
+ return $self->get('ThemeUrlPrefix') . $theme_name;
+}
+
+sub theme_head_extras($) {
+ my ($self) = @_;
+ my $stylesheet = $self->theme_dir . "/style.css";
+ return "<link rel=stylesheet href='$stylesheet' type='text/css' media=all>\n";
+}
+
+sub show_links($$$$) {
+ my ($self, $prev, $up, $next) = @_;
+ my $theme = $self->theme_dir;
+ print "<p class=parent>";
+ print "<span class=back style='width: ${navw}px; height: ${navh}px'>";
+ print "<a href='$prev'><img src='$theme/prev.png' width=${navw} height=${navh} alt='Back'></a>" if $prev ne "";
+ print "</span>\n";
+ printf "<span class=fwd style='width: ${navw}px; height: ${navh}px'>";
+ printf "<a href='$next'><img src='$theme/next.png' width=${navw} height=${navh} alt='Forward'></a>" if $next ne "";
+ print "</span>\n";
+ printf "<a href='$up'><img src='$theme/back.png' width=${navw} height=${navh} alt='Up'></a>" if $up ne "";
+}
+
+sub show_thumb($) {
+ my ($self, $meta, $photo_id, $click_url) = @_;
+ my $theme = $self->theme_dir;
+ my $m = $meta->{photo}->{$photo_id};
+ my $annot = UCW::CGI::html_escape($m->{title});
+ my $tf = $self->{thumb_fmt};
+ my $tm = $meta->{thumb}->{$tf}->{$photo_id} or die "No thumbnails for format $tf found!\n";
+ my $tw = $tm->{w};
+ my $th = $tm->{h};
+ my $thumb = $self->get('ThumbUrlPrefix') . "$tf/$photo_id.jpg";
+ print "<div class=thf><div class=thumb>\n";
+ my $ol = int(($box_w - $tw)/2);
+ my $ot = int(($box_h - $th)/2);
+ my $tit = ($annot ne "") ? " title=\"$annot\"" : "";
+ print "<a href='$click_url'><img src='$thumb' width=$tw height=$th alt='Photo'$tit class=ti style='left: ${ol}px; top: ${ot}px'></a>\n";
+ print "</div></div>\n\n";
+}
+
+sub attach($$) {
+ my ($class, $gal) = @_;
+ my $self = $class->SUPER::attach($gal);
+ $self->{thumb_fmt} = $gal->require_thumbnails($thumb_w, $thumb_h);
+ return $self;
+}
+
+1;
--- /dev/null
+.thf { margin: 0 0 0 0; padding: 0 0 0 0; float: left; border: none; }
+.thumb { position: relative; width: 130px; height: 110px; }
+.ti { position: absolute; border: 1px solid #505; }
+IMG { border: none; }
+H1 { text-align: center; }
+H2 { text-align: center; margin-bottom: 3ex; }
+P { clear: both; }
+H2 { clear: both; }
+.parent { text-align: center; }
+.large { text-align: center; }
+.back { float: left; }
+.fwd { float: right; }
+A[href]:hover { background-color: #11001d; }