summaryrefslogtreecommitdiff
path: root/lib/VNDB/Func.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/VNDB/Func.pm')
-rw-r--r--lib/VNDB/Func.pm17
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;