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