summaryrefslogtreecommitdiff
path: root/lib/VNDB/Handler/Misc.pm
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2010-01-24 15:04:02 +0100
committerYorhel <git@yorhel.nl>2010-01-24 15:07:00 +0100
commitd7815efc3a99aecc61c5ac1d9833de0f448b697f (patch)
tree50e8082f67f360eff12c434723784d9069df4109 /lib/VNDB/Handler/Misc.pm
parentb04c46baec8aef93d21898ef7f52b9d6d2442ce3 (diff)
Automatically generate the skin credits on d7
Added a userid field in the skin config files, from which the credits are loaded. Now I don't have to constantly update d7 for every language when something changes in the skin files.
Diffstat (limited to 'lib/VNDB/Handler/Misc.pm')
-rw-r--r--lib/VNDB/Handler/Misc.pm17
1 files changed, 13 insertions, 4 deletions
diff --git a/lib/VNDB/Handler/Misc.pm b/lib/VNDB/Handler/Misc.pm
index 7d2bd78c..e2fdaa62 100644
--- a/lib/VNDB/Handler/Misc.pm
+++ b/lib/VNDB/Handler/Misc.pm
@@ -288,24 +288,33 @@ sub docpage {
$sec++;
$subsec = 0;
qq|<h3><a href="#$sec" name="$sec">$sec. $1</a></h3>\n|
- }eg;
+ }e;
s{^:SUBSUB:(.+)\r?\n$}{
$subsec++;
qq|<h4><a href="#$sec.$subsec" name="$sec.$subsec">$sec.$subsec. $1</a></h4>\n|
- }eg;
+ }e;
s{^:INC:(.+)\r?\n$}{
$f = sprintf('%s/data/docs/%s', $VNDB::ROOT, $1);
open($F, '<:utf8', $f.$l) or open($F, '<:utf8', $f) or die $!;
my $ii = join('', <$F>);
close $F;
$ii;
- }eg;
+ }e;
s{^:TOP5CONTRIB:$}{
my $l = $self->dbUserGet(results => 6, sort => 'changes', reverse => 1);
'<dl>'.join('', map $_->{id} == 1 ? () :
sprintf('<dt><a href="/u%d">%s</a></dt><dd>%d</dd>', $_->{id}, $_->{username}, $_->{c_changes}),
@$l).'</dl>';
- }eg;
+ }e;
+ s{^:SKINCONTRIB:$}{
+ my %users;
+ push @{$users{ $self->{skins}{$_}[1] }}, [ $_, $self->{skins}{$_}[0] ]
+ for sort { $self->{skins}{$a}[0] cmp $self->{skins}{$b}[0] } keys %{$self->{skins}};
+ my $u = $self->dbUserGet(uid => [ keys %users ]);
+ '<dl>'.join('', map sprintf('<dt><a href="/u%d">%s</a></dt><dd>%s</dd>',
+ $_->{id}, $_->{username}, join(', ', map sprintf('<a href="?skin=%s">%s</a>', $_->[0], $_->[1]), @{$users{$_->{id}}})
+ ), @$u).'</dl>';
+ }e;
}
$self->htmlHeader(title => $title);