]> mj.ucw.cz Git - gallery.git/commitdiff
Gallery2: Plain theme
authorMartin Mares <mj@ucw.cz>
Wed, 26 Dec 2012 19:50:02 +0000 (20:50 +0100)
committerMartin Mares <mj@ucw.cz>
Sun, 8 Feb 2015 20:14:09 +0000 (21:14 +0100)
gal2/Makefile
gal2/UCW/Gallery/Web.pm
gal2/UCW/Gallery/Web/NrtBlue.pm
gal2/UCW/Gallery/Web/Plain.pm [new file with mode: 0644]
gal2/plain/back.png [new file with mode: 0644]
gal2/plain/next.png [new file with mode: 0644]
gal2/plain/prev.png [new file with mode: 0644]
gal2/plain/style.css [new file with mode: 0644]

index e19fbcfa6d011d7627559b317044adc0b08be2de..69b7e1259395d38670c1522582662d258e99e572 100644 (file)
@@ -1,5 +1,6 @@
 $(eval $(dir-setup))
 
-$(call lib-copy, UCW/Gallery.pm UCW/Gallery/Web.pm UCW/Gallery/Web/NrtBlue.pm)
+$(call lib-copy, UCW/Gallery.pm UCW/Gallery/Web.pm UCW/Gallery/Web/NrtBlue.pm UCW/Gallery/Web/Plain.pm)
 
 $(call copy, $(addprefix nrt-blue/,back.png bot.png left.png next.png prev.png right.png top.png style.css))
+$(call copy, $(addprefix plain/,back.png next.png prev.png style.css))
index 63a7568fe2f544c5b6502f6808f74b2248273e39..34a76916dc8c16558015b41980550cb9c07243be 100644 (file)
@@ -37,9 +37,7 @@ Content-Type: text/html
 
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
 <html><head>
-$hextras
-$theme_hextras
-<title>$title</title>
+$hextras$theme_hextras<title>$title</title>
 </head><body>
 $textras
 EOF
@@ -48,7 +46,7 @@ EOF
 
 sub html_bot($) {
        my ($self) = @_;
-       print $self->get('WebBotExtras'), "\n</body></html>\n";
+       print $self->get('WebBotExtras'), "</body></html>\n";
 }
 
 sub show_img($) {
index de05937643dbb0331edf8623deaeb51de0e00987..0d327f157459c4f36de01ac74f36ccb2cc33f9a7 100644 (file)
@@ -1,5 +1,5 @@
 # NRT Theme for MJ's Photo Gallery
-# (c) 2003--2004 Martin Mares <mj@ucw.cz>; GPL'ed
+# (c) 2003--2012 Martin Mares <mj@ucw.cz>; GPL'ed
 # Theme images taken from the cthumb package (c) Carlos Puchol
 
 package UCW::Gallery::Web::NrtBlue;
@@ -25,13 +25,13 @@ my $bot_h = 18;
 
 sub theme_dir($) {
        my ($self) = @_;
-       return $self->get('ThemeUrlPrefix') . "/" . $theme_name;
+       return $self->get('ThemeUrlPrefix') . $theme_name;
 }
 
 sub theme_head_extras($) {
        my ($self) = @_;
        my $stylesheet = $self->theme_dir . "/style.css";
-       return "<link rel=stylesheet href='$stylesheet' type='text/css' media=all>";
+       return "<link rel=stylesheet href='$stylesheet' type='text/css' media=all>\n";
 }
 
 sub show_links($$$$) {
@@ -70,8 +70,7 @@ sub show_thumb($) {
        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";
        print "<img src='$theme/right.png' width=$right_w height=$side_h alt='' class=tr>\n";
        print "<img src='$theme/bot.png' width=$box_w height=$bot_h alt='' class=tb>\n";
-       print "</div>\n";
-       print "</div>\n\n";
+       print "</div></div>\n\n";
 }
 
 sub attach($$) {
diff --git a/gal2/UCW/Gallery/Web/Plain.pm b/gal2/UCW/Gallery/Web/Plain.pm
new file mode 100644 (file)
index 0000000..885095b
--- /dev/null
@@ -0,0 +1,71 @@
+# Plain Theme for MJ's Photo Gallery
+# (c) 2012 Martin Mares <mj@ucw.cz>; GPL'ed
+
+package UCW::Gallery::Web::Plain;
+
+use strict;
+use warnings;
+
+use UCW::Gallery;
+use UCW::Gallery::Web;
+
+our @ISA = qw(UCW::Gallery::Web);
+
+my $theme_name = "plain";
+my $navw = 48;
+my $navh = 48;
+my $box_w = 130;
+my $box_h = 110;
+my $thumb_w = 114;
+my $thumb_h = 94;
+
+sub theme_dir($) {
+       my ($self) = @_;
+       return $self->get('ThemeUrlPrefix') . $theme_name;
+}
+
+sub theme_head_extras($) {
+       my ($self) = @_;
+       my $stylesheet = $self->theme_dir . "/style.css";
+       return "<link rel=stylesheet href='$stylesheet' type='text/css' media=all>\n";
+}
+
+sub show_links($$$$) {
+       my ($self, $prev, $up, $next) = @_;
+       my $theme = $self->theme_dir;
+       print "<p class=parent>";
+       print "<span class=back style='width: ${navw}px; height: ${navh}px'>";
+       print "<a href='$prev'><img src='$theme/prev.png' width=${navw} height=${navh} alt='Back'></a>" if $prev ne "";
+       print "</span>\n";
+       printf "<span class=fwd style='width: ${navw}px; height: ${navh}px'>";
+       printf "<a href='$next'><img src='$theme/next.png' width=${navw} height=${navh} alt='Forward'></a>" if $next ne "";
+       print "</span>\n";
+       printf "<a href='$up'><img src='$theme/back.png' width=${navw} height=${navh} alt='Up'></a>" if $up ne "";
+}
+
+sub show_thumb($) {
+       my ($self, $meta, $photo_id, $click_url) = @_;
+       my $theme = $self->theme_dir;
+       my $m = $meta->{photo}->{$photo_id};
+       my $annot = UCW::CGI::html_escape($m->{title});
+       my $tf = $self->{thumb_fmt};
+       my $tm = $meta->{thumb}->{$tf}->{$photo_id} or die "No thumbnails for format $tf found!\n";
+       my $tw = $tm->{w};
+       my $th = $tm->{h};
+       my $thumb = $self->get('ThumbUrlPrefix') . "$tf/$photo_id.jpg";
+       print "<div class=thf><div class=thumb>\n";
+       my $ol = int(($box_w - $tw)/2);
+       my $ot = int(($box_h - $th)/2);
+       my $tit = ($annot ne "") ? " title=\"$annot\"" : "";
+       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";
+       print "</div></div>\n\n";
+}
+
+sub attach($$) {
+       my ($class, $gal) = @_;
+       my $self = $class->SUPER::attach($gal);
+       $self->{thumb_fmt} = $gal->require_thumbnails($thumb_w, $thumb_h);
+       return $self;
+}
+
+1;
diff --git a/gal2/plain/back.png b/gal2/plain/back.png
new file mode 100644 (file)
index 0000000..501909c
Binary files /dev/null and b/gal2/plain/back.png differ
diff --git a/gal2/plain/next.png b/gal2/plain/next.png
new file mode 100644 (file)
index 0000000..bdd1011
Binary files /dev/null and b/gal2/plain/next.png differ
diff --git a/gal2/plain/prev.png b/gal2/plain/prev.png
new file mode 100644 (file)
index 0000000..68b2514
Binary files /dev/null and b/gal2/plain/prev.png differ
diff --git a/gal2/plain/style.css b/gal2/plain/style.css
new file mode 100644 (file)
index 0000000..4e86e31
--- /dev/null
@@ -0,0 +1,13 @@
+.thf    { margin: 0 0 0 0; padding: 0 0 0 0; float: left; border: none; }
+.thumb  { position: relative; width: 130px; height: 110px; }
+.ti     { position: absolute; border: 1px solid #505; }
+IMG     { border: none; }
+H1      { text-align: center; }
+H2      { text-align: center; margin-bottom: 3ex; }
+P      { clear: both; }
+H2     { clear: both; }
+.parent        { text-align: center; }
+.large { text-align: center; }
+.back  { float: left; }
+.fwd   { float: right; }
+A[href]:hover { background-color: #11001d; }