App-MaMGal
view release on metacpan or search on metacpan
lib/App/MaMGal/Formatter.pm view on Meta::CPAN
if ($entry->description and not $suppress_description) {
$ret .= sprintf('<br><span class="desc">%s</span>', $entry->description);
} else {
$ret .= sprintf('<br><span class="filename">[%s]</span><br>', $self->LINK($path, $entry->name));
}
$ret .= '</td>';
return $ret;
}
sub format_slide
{
my $self = shift;
my $pic = shift or croak "No pic";
croak "Only one arg required." if @_;
ref $pic and $pic->isa('App::MaMGal::Entry::Picture') or croak "Arg is not a pic";
my ($prev, $next) = map { defined $_ ? $_->name : '' } $pic->neighbours;
my @containers = $pic->containers;
my $down_dots = join('/', map { ".." } @containers);
my $r = $self->HEADER('<link rel="stylesheet" href="'.$down_dots.'/.mamgal-style.css" type="text/css">')."\n";
$r .= '<div style="float:left">';
$r .= $self->MAYBE_LINK($prev, $self->PREV);
$r .= ' | ';
# TRANSLATORS: This is the text of the link from a slide page to the index page.
$r .= $self->LINK('../index.html', gettext('index'));
$r .= ' | ';
$r .= $self->MAYBE_LINK($next, $self->NEXT);
$r .= '</div>';
$r .= '<div style="float:right">[ ';
$r .= join(' / ', map { $self->CURDIR($_->name) } @containers);
$r .= " ]</div><br>\n";
$r .= "<p>\n";
if ($pic->description) {
$r .= sprintf('<span class="slide_desc">%s</span>', $pic->description);
} else {
$r .= sprintf('[<span class="slide_filename">%s</span>]', $pic->name);
}
$r .= "</p>\n";
if ($pic->isa('App::MaMGal::Entry::Picture::Film')) {
$r .= $self->MAYBE_EMBED('../'.$pic->name);
$r .= '<br>';
$r .= $self->LINK('../'.$pic->name, gettext('Download'));
} else {
$r .= $self->LINK('../'.$pic->name, $self->MAYBE_IMG('../'.$pic->medium_dir.'/'.$pic->name));
}
my $time = $pic->creation_time();
$r .= sprintf('<br><span class="date">%s</span> <span class="time">%s</span><br>', $self->{locale_env}->format_date($time), $self->{locale_env}->format_time($time));
$r .= $self->FOOTER;
return $r;
}
sub stylesheet
{
my $t = <<END;
table.index { width: 100% }
.entry_cell { text-align: center }
.slide_desc { font-weight: bold }
.slide_filename { font-family: monospace }
.filename { font-family: monospace }
.curdir { font-size: xx-large; font-weight: normal }
.date { font-size: small }
.time { font-size: small }
END
return $t;
}
1;
( run in 1.337 second using v1.01-cache-2.11-cpan-cdf2f3d4e48 )