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";
22 return $self->get('ThemeUrlPrefix') . $theme_name;
25 sub theme_head_extras($) {
27 my $stylesheet = $self->theme_dir . "/style.css";
28 return "<link rel=stylesheet href='$stylesheet' type='text/css' media=all>\n";
31 sub show_links($$$$) {
32 my ($self, $prev, $up, $next) = @_;
33 my $theme = $self->theme_dir;
34 print "<p class=parent>";
35 print "<span class=back style='width: ${navw}px; height: ${navh}px'>";
36 print "<a href='$prev'><img src='$theme/prev.png' width=${navw} height=${navh} alt='Back'></a>" if $prev ne "";
38 printf "<span class=fwd style='width: ${navw}px; height: ${navh}px'>";
39 printf "<a href='$next'><img src='$theme/next.png' width=${navw} height=${navh} alt='Forward'></a>" if $next ne "";
41 printf "<a href='$up'><img src='$theme/back.png' width=${navw} height=${navh} alt='Up'></a>" if $up ne "";
45 my ($self, $meta, $photo_id, $click_url) = @_;
46 my $theme = $self->theme_dir;
47 my $m = $meta->{photo}->{$photo_id};
48 my $annot = UCW::CGI::html_escape($m->{title});
49 my $tf = $self->get('ThumbFormats')->[0];
50 my ($thumb_w, $thumb_h) = $self->{gal}->thumb_fmt_to_size($tf);
51 my $tm = $meta->{thumb}->{$tf}->{$photo_id} or die "No thumbnails for format $tf found!\n";
54 my $thumb = $self->get('ThumbUrlPrefix') . "$tf/$photo_id.jpg";
55 print "<div class=thf><div class=thumb>\n";
56 my $ol = int(($box_w - $tw)/2);
57 my $ot = int(($box_h - $th)/2);
58 my $tit = ($annot ne "") ? " title=\"$annot\"" : "";
59 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";
60 print "</div></div>\n\n";
64 my ($class, $gal) = @_;
65 my $self = $class->SUPER::attach($gal);