1 # Plain Theme for MJ's Photo Gallery
2 # (c) 2012 Martin Mares <mj@ucw.cz>; GPL'ed
4 package UCW::Gallery::Web::Plain;
10 use UCW::Gallery::Web;
12 our @ISA = qw(UCW::Gallery::Web);
14 my $theme_name = "plain";
24 return $self->get('ThemeUrlPrefix') . $theme_name;
27 sub theme_head_extras($) {
29 my $stylesheet = $self->theme_dir . "/style.css";
30 return "<link rel=stylesheet href='$stylesheet' type='text/css' media=all>\n";
33 sub show_links($$$$) {
34 my ($self, $prev, $up, $next) = @_;
35 my $theme = $self->theme_dir;
36 print "<p class=parent>";
37 print "<span class=back style='width: ${navw}px; height: ${navh}px'>";
38 print "<a href='$prev'><img src='$theme/prev.png' width=${navw} height=${navh} alt='Back'></a>" if $prev ne "";
40 printf "<span class=fwd style='width: ${navw}px; height: ${navh}px'>";
41 printf "<a href='$next'><img src='$theme/next.png' width=${navw} height=${navh} alt='Forward'></a>" if $next ne "";
43 printf "<a href='$up'><img src='$theme/back.png' width=${navw} height=${navh} alt='Up'></a>" if $up ne "";
47 my ($self, $meta, $photo_id, $click_url) = @_;
48 my $theme = $self->theme_dir;
49 my $m = $meta->{photo}->{$photo_id};
50 my $annot = UCW::CGI::html_escape($m->{title});
51 my $tf = $self->{thumb_fmt};
52 my $tm = $meta->{thumb}->{$tf}->{$photo_id} or die "No thumbnails for format $tf found!\n";
55 my $thumb = $self->get('ThumbUrlPrefix') . "$tf/$photo_id.jpg";
56 print "<div class=thf><div class=thumb>\n";
57 my $ol = int(($box_w - $tw)/2);
58 my $ot = int(($box_h - $th)/2);
59 my $tit = ($annot ne "") ? " title=\"$annot\"" : "";
60 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";
61 print "</div></div>\n\n";
65 my ($class, $gal) = @_;
66 my $self = $class->SUPER::attach($gal);
67 $self->{thumb_fmt} = $gal->require_thumbnails($thumb_w, $thumb_h);