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";
18 my $interior_margin = 4;
26 return $self->get('ThemeUrlPrefix') . $theme_name;
29 sub theme_head_extras($) {
31 my $stylesheet = $self->theme_dir . "/style.css";
32 return "<link rel=stylesheet href='$stylesheet' type='text/css' media=all>\n";
35 sub show_links($$$$) {
36 my ($self, $prev, $up, $next) = @_;
37 my $theme = $self->theme_dir;
38 print "<p class=parent>";
39 print "<span class=back style='width: ${navw}px; height: ${navh}px'>";
40 print "<a href='$prev'><img src='$theme/prev.png' width=${navw} height=${navh} alt='Back'></a>" if $prev ne "";
42 printf "<span class=fwd style='width: ${navw}px; height: ${navh}px'>";
43 printf "<a href='$next'><img src='$theme/next.png' width=${navw} height=${navh} alt='Forward'></a>" if $next ne "";
45 printf "<a href='$up'><img src='$theme/back.png' width=${navw} height=${navh} alt='Up'></a>" if $up ne "";
49 my ($self, $meta, $photo_id, $click_url) = @_;
50 my $theme = $self->theme_dir;
51 my $m = $meta->{photo}->{$photo_id};
52 my $annot = UCW::CGI::html_escape($m->{title});
53 my $tf = $self->get('ThumbFormats')->[0];
54 my ($thumb_w, $thumb_h) = $self->{gal}->thumb_fmt_to_size($tf);
55 my $tm = $meta->{thumb}->{$tf}->{$photo_id} or die "No thumbnails for format $tf found!\n";
58 my $thumb = $self->get('ThumbUrlPrefix') . "$tf/$photo_id.jpg";
59 my $side_w = $thumb_w + 2*$interior_margin;
60 my $side_h = $thumb_h + 2*$interior_margin;
61 my $box_w = $left_w + $side_w + $right_w;
62 my $box_h = $top_h + $side_h + $bot_h;
63 print "<div class=thf><div class=thumb>\n";
64 print "<img src='$theme/top.png' width=$box_w height=$top_h alt='' class=tt>\n";
65 print "<img src='$theme/left.png' width=$left_w height=$side_h alt='' class=tl>\n";
66 my $ol = $left_w + $interior_margin + int(($thumb_w - $tw)/2);
67 my $ot = $top_h + $interior_margin + int(($thumb_h - $th)/2);
68 my $tit = ($annot ne "") ? " title=\"$annot\"" : "";
69 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";
70 print "<img src='$theme/right.png' width=$right_w height=$side_h alt='' class=tr>\n";
71 print "<img src='$theme/bot.png' width=$box_w height=$bot_h alt='' class=tb>\n";
72 print "</div></div>\n\n";
76 my ($class, $gal) = @_;
77 my $self = $class->SUPER::attach($gal);