1 # NRT Theme for MJ's Photo Gallery
2 # (c) 2003--2012 Martin Mares <mj@ucw.cz>; GPL'ed
3 # Theme images taken from the cthumb package (c) Carlos Puchol
5 package UCW::Gallery::Web::NrtBlue;
11 use UCW::Gallery::Web;
13 our @ISA = qw(UCW::Gallery::Web);
15 my $theme_name = "nrt-blue";
20 my $interior_margin = 4;
28 return $self->get('ThemeUrlPrefix') . $theme_name;
31 sub theme_head_extras($) {
33 my $stylesheet = $self->theme_dir . "/style.css";
34 return "<link rel=stylesheet href='$stylesheet' type='text/css' media=all>\n";
37 sub show_links($$$$) {
38 my ($self, $prev, $up, $next) = @_;
39 my $theme = $self->theme_dir;
40 print "<p class=parent>";
41 print "<span class=back style='width: ${navw}px; height: ${navh}px'>";
42 print "<a href='$prev'><img src='$theme/prev.png' width=${navw} height=${navh} alt='Back'></a>" if $prev ne "";
44 printf "<span class=fwd style='width: ${navw}px; height: ${navh}px'>";
45 printf "<a href='$next'><img src='$theme/next.png' width=${navw} height=${navh} alt='Forward'></a>" if $next ne "";
47 printf "<a href='$up'><img src='$theme/back.png' width=${navw} height=${navh} alt='Up'></a>" if $up ne "";
51 my ($self, $meta, $photo_id, $click_url) = @_;
52 my $theme = $self->theme_dir;
53 my $m = $meta->{photo}->{$photo_id};
54 my $annot = UCW::CGI::html_escape($m->{title});
55 my $tf = $self->{thumb_fmt};
56 my $tm = $meta->{thumb}->{$tf}->{$photo_id} or die "No thumbnails for format $tf found!\n";
59 my $thumb = $self->get('ThumbUrlPrefix') . "$tf/$photo_id.jpg";
60 my $side_w = $thumb_w + 2*$interior_margin;
61 my $side_h = $thumb_h + 2*$interior_margin;
62 my $box_w = $left_w + $side_w + $right_w;
63 my $box_h = $top_h + $side_h + $bot_h;
64 print "<div class=thf><div class=thumb>\n";
65 print "<img src='$theme/top.png' width=$box_w height=$top_h alt='' class=tt>\n";
66 print "<img src='$theme/left.png' width=$left_w height=$side_h alt='' class=tl>\n";
67 my $ol = $left_w + $interior_margin + int(($thumb_w - $tw)/2);
68 my $ot = $top_h + $interior_margin + int(($thumb_h - $th)/2);
69 my $tit = ($annot ne "") ? " title=\"$annot\"" : "";
70 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";
71 print "<img src='$theme/right.png' width=$right_w height=$side_h alt='' class=tr>\n";
72 print "<img src='$theme/bot.png' width=$box_w height=$bot_h alt='' class=tb>\n";
73 print "</div></div>\n\n";
77 my ($class, $gal) = @_;
78 my $self = $class->SUPER::attach($gal);
79 $self->{thumb_fmt} = $gal->require_thumbnails($thumb_w, $thumb_h);