1 # HighSlide JS Theme for MJ's Photo Gallery
2 # (c) 2012 Martin Mares <mj@ucw.cz>; GPL'ed
4 package UCW::Gallery::Web::HighSlide;
10 use UCW::Gallery::Web;
12 our @ISA = qw(UCW::Gallery::Web);
14 sub theme_head_extras($) {
16 my $hsdir = $self->get('ThemeUrlPrefix') . "highslide";
18 <script type="text/javascript" src="$hsdir/highslide-with-gallery.js"></script>
19 <script type="text/javascript" src="$hsdir/custom.js" charset="utf-8"></script>
20 <script type="text/javascript">
21 hs.graphicsDir = '$hsdir/graphics/';
23 <link rel="stylesheet" type="text/css" href="$hsdir/highslide.css">
24 <link rel="stylesheet" type="text/css" href="$hsdir/custom.css">
26 <link rel="stylesheet" type="text/css" href="$hsdir/highslide-ie6.css">
31 sub show_links($$$$) {
32 my ($self, $prev, $up, $next) = @_;
33 my $nav = $self->get('ThemeUrlPrefix') . "highslide/nav";
34 print "<p class=parent>";
35 print "<a href='$prev'><img class=back prev src='$nav/prev.png'></a>" if $prev ne "";
36 printf "<a href='$next'><img class=fwd src='$nav/next.png'></a>" if $next ne "";
37 printf "<a href='$up'><img class=up src='$nav/back.png'></a>" if $up ne "";
40 sub show_pre_thumbs($) {
42 print "\n<div class='highslide-gallery'><ul>\n";
43 $self->{hs_thumb_counter} = 0;
46 sub show_post_thumbs($) {
48 print "</ul></div>\n\n";
52 my ($self, $meta, $photo_id, $click_url) = @_;
53 my $m = $meta->{photo}->{$photo_id};
54 my $annot = UCW::CGI::html_escape($m->{title});
55 my $tf = $self->get('ThumbFormats')->[0];
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 # HighSlide requires title either for all images, or for none
61 my $tit = " title=\"$annot\"";
62 my $aid = $self->{hs_thumb_counter}++ ? "" : " id=thumb1";
63 my $photo_url = $self->get('PhotoUrlPrefix') . "$photo_id.jpg";
64 print "<li><a$aid href='$click_url' class=highslide onclick='return hs.expand(this, { src: \"$photo_url\" })'>";
65 print "<img src='$thumb' width=$tw height=$th alt='Photo'$tit></a>\n";
69 my ($class, $gal) = @_;
70 my $self = $class->SUPER::attach($gal);