diff options
author | Yorhel <git@yorhel.nl> | 2008-12-09 13:40:48 +0100 |
---|---|---|
committer | Yorhel <git@yorhel.nl> | 2008-12-09 13:40:48 +0100 |
commit | 3ddfef35d69d78074c30793012a9f9fea8ca8f73 (patch) | |
tree | 5c476a0dee0a1df51f2a372f9af5def68400e2d0 /lib/VNDB/Func.pm | |
parent | 66bc1533761ae28c0c8cbcea91b80c0319d86b39 (diff) |
VNList status indicator on VN pages
Diffstat (limited to 'lib/VNDB/Func.pm')
-rw-r--r-- | lib/VNDB/Func.pm | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/lib/VNDB/Func.pm b/lib/VNDB/Func.pm index bf0a871f..52aa16a4 100644 --- a/lib/VNDB/Func.pm +++ b/lib/VNDB/Func.pm @@ -5,7 +5,7 @@ use strict; use warnings; use Exporter 'import'; use POSIX 'strftime'; -our @EXPORT = qw| shorten date datestr monthstr userstr bb2html gtintype |; +our @EXPORT = qw| shorten date datestr monthstr userstr bb2html gtintype liststat |; # I would've done this as a #define if this was C... @@ -171,5 +171,20 @@ sub gtintype { } +# Argument: hashref with rstat and vstat +# Returns: empty string if not in list, otherwise colour-encoded list status +sub liststat { + my $l = shift; + return '' if !$l; + my $rs = $YAWF::OBJ->{vn_rstat}[$l->{rstat}]; + $rs = qq|<b class="done">$rs</b>| if $l->{rstat} == 2; # Obtained + $rs = qq|<b class="todo">$rs</b>| if $l->{rstat} < 2; # Unknown/pending + my $vs = $YAWF::OBJ->{vn_vstat}[$l->{vstat}]; + $vs = qq|<b class="done">$vs</b>| if $l->{vstat} == 2; # Finished + $vs = qq|<b class="todo">$vs</b>| if $l->{vstat} == 0 || $l->{vstat} == 4; # Unknown/dropped + return "$rs / $vs"; +} + + 1; |