diff options
author | Yorhel <git@yorhel.nl> | 2010-01-24 15:04:02 +0100 |
---|---|---|
committer | Yorhel <git@yorhel.nl> | 2010-01-24 15:07:00 +0100 |
commit | d7815efc3a99aecc61c5ac1d9833de0f448b697f (patch) | |
tree | 50e8082f67f360eff12c434723784d9069df4109 | |
parent | b04c46baec8aef93d21898ef7f52b9d6d2442ce3 (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.
-rw-r--r-- | ChangeLog | 2 | ||||
-rw-r--r-- | data/docs/7 | 25 | ||||
-rw-r--r-- | data/docs/7.cs | 25 | ||||
-rw-r--r-- | data/docs/7.hu | 25 | ||||
-rw-r--r-- | data/docs/7.ru | 25 | ||||
-rw-r--r-- | lib/SkinFile.pm | 1 | ||||
-rw-r--r-- | lib/VNDB/DB/Users.pm | 4 | ||||
-rw-r--r-- | lib/VNDB/Handler/Misc.pm | 17 | ||||
-rw-r--r-- | lib/VNDB/Handler/Users.pm | 2 | ||||
-rw-r--r-- | static/s/angel/conf | 1 | ||||
-rw-r--r-- | static/s/aselia_01/conf | 1 | ||||
-rw-r--r-- | static/s/carnevale/conf | 1 | ||||
-rw-r--r-- | static/s/eiel/conf | 1 | ||||
-rw-r--r-- | static/s/ever17_01/conf | 1 | ||||
-rw-r--r-- | static/s/fate_01/conf | 1 | ||||
-rw-r--r-- | static/s/fate_02/conf | 1 | ||||
-rw-r--r-- | static/s/grey/conf | 1 | ||||
-rw-r--r-- | static/s/higu/conf | 1 | ||||
-rw-r--r-- | static/s/lb/conf | 1 | ||||
-rw-r--r-- | static/s/lb_02/conf | 1 | ||||
-rw-r--r-- | static/s/primitive/conf | 1 | ||||
-rw-r--r-- | static/s/saya/conf | 1 | ||||
-rw-r--r-- | static/s/seinarukana/conf | 1 | ||||
-rw-r--r-- | static/s/taka/conf | 1 | ||||
-rw-r--r-- | static/s/term/conf | 1 | ||||
-rw-r--r-- | static/s/tsukihime/conf | 1 | ||||
-rw-r--r-- | static/s/tsukihime_02/conf | 1 | ||||
-rwxr-xr-x | util/vndb.pl | 4 |
28 files changed, 44 insertions, 104 deletions
@@ -5,6 +5,8 @@ git - ? - Made the release date a required field - Versioned the deleting and locking of database entries - Multi's announcements are colored in blue + - Abstracted parsing skin config files into a SkinFile module + - Automatically generate the skin credits on d7, by reading the skin files 2.10 - 2010-01-10 - VN score on tag pages use plain averages instead of bayesian rating diff --git a/data/docs/7 b/data/docs/7 index 66a708f2..7a527a0d 100644 --- a/data/docs/7 +++ b/data/docs/7 @@ -63,30 +63,7 @@ <br /> <b>Skins</b> - <dl> - <dt>applehq</dt><dd> - <a href="?skin=lb">Little Busters! (pink)</a>, - <a href="?skin=term">Neon (black)</a> - </dd><dt>EchoMateria</dt><dd> - <a href="?skin=aselia_01">Eien no Aselia (falu red)</a>, - <a href="?skin=carnevale">Gekkou no Carnevale (black)</a>, - <a href="?skin=eiel">Jingai Makyo (peach-orange)</a>, - <a href="?skin=ever17_01">Ever17 (bondi blue)</a>, - <a href="?skin=fate_01">Fate/stay night (seal brown)</a>, - <a href="?skin=fate_02">Fate/stay night (pale carmine)</a>, - <a href="?skin=higu">Higurashi no Naku Koro ni (orange)</a>, - <a href="?skin=lb_02">Little Busters! (lemon chiffon)</a>, - <a href="?skin=primitive">Primitive Link (pale chestnut)</a>, - <a href="?skin=saya">Saya no Uta (dark scarlet)</a>, - <a href="?skin=seinarukana">Seinarukana (white)</a>, - <a href="?skin=taka">Sora no Iro, Mizu no Iro (turquoise)</a>, - <a href="?skin=tsukihime">Tsukihime (midnight blue)</a>, - <a href="?skin=tsukihime_02">Tsukihime (black)</a> - </dd><dt>Yorhel</dt><dd> - <a href="?skin=angel">Angelic Serenade (dark blue)</a>, - <a href="?skin=grey">Touhou (grey)</a> - </dd> - </dl> +:SKINCONTRIB: <br /> <b>Top 5 Contributors</b> diff --git a/data/docs/7.cs b/data/docs/7.cs index 2c81139c..820772a6 100644 --- a/data/docs/7.cs +++ b/data/docs/7.cs @@ -60,30 +60,7 @@ <br /> <b>Skiny</b> - <dl> - <dt>applehq</dt><dd> - <a href="?skin=lb">Little Busters! (pink)</a>, - <a href="?skin=term">Neon (black)</a> - </dd><dt>EchoMateria</dt><dd> - <a href="?skin=aselia_01">Eien no Aselia (falu red)</a>, - <a href="?skin=carnevale">Gekkou no Carnevale (black)</a>, - <a href="?skin=eiel">Jingai Makyo (peach-orange)</a>, - <a href="?skin=ever17_01">Ever17 (bondi blue)</a>, - <a href="?skin=fate_01">Fate/stay night (seal brown)</a>, - <a href="?skin=fate_02">Fate/stay night (pale carmine)</a>, - <a href="?skin=higu">Higurashi no Naku Koro ni (orange)</a>, - <a href="?skin=lb_02">Little Busters! (lemon chiffon)</a>, - <a href="?skin=primitive">Primitive Link (pale chestnut)</a>, - <a href="?skin=saya">Saya no Uta (dark scarlet)</a>, - <a href="?skin=seinarukana">Seinarukana (white)</a>, - <a href="?skin=taka">Sora no Iro, Mizu no Iro (turquoise)</a>, - <a href="?skin=tsukihime">Tsukihime (midnight blue)</a>, - <a href="?skin=tsukihime_02">Tsukihime (black)</a> - </dd><dt>Yorhel</dt><dd> - <a href="?skin=angel">Angelic Serenade (dark blue)</a>, - <a href="?skin=grey">Touhou (grey)</a> - </dd> - </dl> +:SKINCONTRIB: <br /> <b>5 nejaktivnějších přispívajících</b> diff --git a/data/docs/7.hu b/data/docs/7.hu index 66153c16..db68d515 100644 --- a/data/docs/7.hu +++ b/data/docs/7.hu @@ -62,30 +62,7 @@ is növekszik. <br /> <b>Témák</b> - <dl> - <dt>applehq</dt><dd> - <a href="?skin=lb">Little Busters! (pink)</a>, - <a href="?skin=term">Neon (black)</a> - </dd><dt>EchoMateria</dt><dd> - <a href="?skin=aselia_01">Eien no Aselia (falu red)</a>, - <a href="?skin=carnevale">Gekkou no Carnevale (black)</a>, - <a href="?skin=eiel">Jingai Makyo (peach-orange)</a>, - <a href="?skin=ever17_01">Ever17 (bondi blue)</a>, - <a href="?skin=fate_01">Fate/stay night (seal brown)</a>, - <a href="?skin=fate_02">Fate/stay night (pale carmine)</a>, - <a href="?skin=higu">Higurashi no Naku Koro ni (orange)</a>, - <a href="?skin=lb_02">Little Busters! (lemon chiffon)</a>, - <a href="?skin=primitive">Primitive Link (pale chestnut)</a>, - <a href="?skin=saya">Saya no Uta (dark scarlet)</a>, - <a href="?skin=seinarukana">Seinarukana (white)</a>, - <a href="?skin=taka">Sora no Iro, Mizu no Iro (turquoise)</a>, - <a href="?skin=tsukihime">Tsukihime (midnight blue)</a>, - <a href="?skin=tsukihime_02">Tsukihime (black)</a> - </dd><dt>Yorhel</dt><dd> - <a href="?skin=angel">Angelic Serenade (dark blue)</a>, - <a href="?skin=grey">Touhou (grey)</a> - </dd> - </dl> +:SKINCONTRIB: <br /> <b>Top 5 hozzájáruló</b> diff --git a/data/docs/7.ru b/data/docs/7.ru index dc5309e7..da5bf322 100644 --- a/data/docs/7.ru +++ b/data/docs/7.ru @@ -69,30 +69,7 @@ <br /> <b>Дизайнеры шкурок</b> - <dl> - <dt>applehq</dt><dd> - <a href="?skin=lb">Little Busters! (розовый)</a>, - <a href="?skin=term">Neon (чёрный)</a> - </dd><dt>EchoMateria</dt><dd> - <a href="?skin=aselia_01">Eien no Aselia (бордовый)</a>, - <a href="?skin=carnevale">Gekkou no Carnevale (черный)</a>, - <a href="?skin=eiel">Jingai Makyo (персиковый)</a>, - <a href="?skin=ever17_01">Ever17 (вода пляжа Бонди)</a>, - <a href="?skin=fate_01">Fate/stay night (серо-коричневый)</a>, - <a href="?skin=fate_02">Fate/stay night (бледно-карминный)</a>, - <a href="?skin=higu">Higurashi no Naku Koro ni (оранжевый)</a>, - <a href="?skin=lb_02">Little Busters! (желто-персиковый)</a>, - <a href="?skin=primitive">Primitive Link (бледно-каштановый)</a>, - <a href="?skin=saya">Saya no Uta (алый)</a>, - <a href="?skin=seinarukana">Seinarukana (белый)</a>, - <a href="?skin=taka">Sora no Iro, Mizu no Iro (бирюзовый)</a>, - <a href="?skin=tsukihime">Tsukihime (полуночно-синий)</a>, - <a href="?skin=tsukihime_02">Tsukihime (чёрный)</a> - </dd><dt>Yorhel</dt><dd> - <a href="?skin=angel">Angelic Serenade (тёмно-синий)</a>, - <a href="?skin=grey">Touhou (серый)</a> - </dd> - </dl> +:SKINCONTRIB: <br /> <b>Пятёрка лучших контрибьютеров</b> diff --git a/lib/SkinFile.pm b/lib/SkinFile.pm index b8d0c4fb..78608f89 100644 --- a/lib/SkinFile.pm +++ b/lib/SkinFile.pm @@ -26,6 +26,7 @@ sub open { open my $F, '<:utf8', "$self->{root}/$dir/conf" or die $!; flock $F, LOCK_SH or die $!; seek $F, 0, SEEK_SET or die $!; + local $_; while(<$F>) { chomp; s/\r//g; diff --git a/lib/VNDB/DB/Users.pm b/lib/VNDB/DB/Users.pm index f8fdfe3f..36f589ac 100644 --- a/lib/VNDB/DB/Users.pm +++ b/lib/VNDB/DB/Users.pm @@ -30,8 +30,10 @@ sub dbUserGet { 'ASCII(username) < 97 OR ASCII(username) > 122' => 1 ) : (), $o{mail} ? ( 'mail = ?' => $o{mail} ) : (), - $o{uid} ? ( + $o{uid} && !ref($o{uid}) ? ( 'id = ?' => $o{uid} ) : (), + $o{uid} && ref($o{uid}) ? ( + 'id IN(!l)' => [ $o{uid} ]) : (), !$o{uid} && !$o{username} ? ( 'id > 0' => 1 ) : (), $o{ip} ? ( 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); diff --git a/lib/VNDB/Handler/Users.pm b/lib/VNDB/Handler/Users.pm index 386fcda1..75ce411e 100644 --- a/lib/VNDB/Handler/Users.pm +++ b/lib/VNDB/Handler/Users.pm @@ -346,7 +346,7 @@ sub edit { [ check => short => 'flags_list', name => mt '_usere_flist', "/u$uid/list", "/u$uid/wish" ], [ check => short => 'flags_nsfw', name => mt '_usere_fnsfw' ], [ select => short => 'skin', name => mt('_usere_skin'), width => 300, options => [ - map [ $_ eq $self->{skin_default} ? '' : $_, $self->{skins}{$_}.($self->debug?" [$_]":'') ], sort { $self->{skins}{$a} cmp $self->{skins}{$b} } keys %{$self->{skins}} ] ], + map [ $_ eq $self->{skin_default} ? '' : $_, $self->{skins}{$_}[0].($self->debug?" [$_]":'') ], sort { $self->{skins}{$a}[0] cmp $self->{skins}{$b}[0] } keys %{$self->{skins}} ] ], [ textarea => short => 'customcss', name => mt '_usere_css' ], ]); $self->htmlFooter; diff --git a/static/s/angel/conf b/static/s/angel/conf index 94a9e96b..eb858770 100644 --- a/static/s/angel/conf +++ b/static/s/angel/conf @@ -1,4 +1,5 @@ name Angelic Serenade (dark blue) +userid 2 // text maintext #ddd // primary text color (also used for the menu links) diff --git a/static/s/aselia_01/conf b/static/s/aselia_01/conf index 5b45a0ee..b07657c7 100644 --- a/static/s/aselia_01/conf +++ b/static/s/aselia_01/conf @@ -1,4 +1,5 @@ name Eien no Aselia (falu red) +userid 51 // Eien no Aselia skin made using Minitokyo.Eien.no.Aselia.Scans_373967 // created: 09/27/2009 by echomateria diff --git a/static/s/carnevale/conf b/static/s/carnevale/conf index 5a735ff2..84ba8940 100644 --- a/static/s/carnevale/conf +++ b/static/s/carnevale/conf @@ -1,4 +1,5 @@ name Gekkou no Carnevale (black) +userid 51 // Gekkou no Carnevale skin made using a wallpaper comes with the game // created: 22/01/2009 by echomateria diff --git a/static/s/eiel/conf b/static/s/eiel/conf index a7bf333a..fd00320c 100644 --- a/static/s/eiel/conf +++ b/static/s/eiel/conf @@ -1,4 +1,5 @@ name Jingai Makyo (peach-orange) +userid 51 // A skin made using an image I had for a long time without knowing it's source, // thankfully this skin finally brought out the answer that it was from Jingai Makyo. diff --git a/static/s/ever17_01/conf b/static/s/ever17_01/conf index a82493d0..e7c7ff1c 100644 --- a/static/s/ever17_01/conf +++ b/static/s/ever17_01/conf @@ -1,4 +1,5 @@ name Ever17 (bondi blue) +userid 51 // Ever 17 skin made using the images from the extras section of the game // created: 01/01/2009 by echomateria diff --git a/static/s/fate_01/conf b/static/s/fate_01/conf index f55260ec..f749ed0e 100644 --- a/static/s/fate_01/conf +++ b/static/s/fate_01/conf @@ -1,4 +1,5 @@ name Fate/stay night (seal brown) +userid 51 // FSN skin skin made using a popular fanart // created: 12/31/2008 by echomateria diff --git a/static/s/fate_02/conf b/static/s/fate_02/conf index b58a24b6..0c0ddc96 100644 --- a/static/s/fate_02/conf +++ b/static/s/fate_02/conf @@ -1,4 +1,5 @@ name Fate/stay night (pale carmine) +userid 51 // FSN skin made using a popular fanart // created: 01/01/2009 by echomateria diff --git a/static/s/grey/conf b/static/s/grey/conf index 9de205ad..ef3ca505 100644 --- a/static/s/grey/conf +++ b/static/s/grey/conf @@ -1,4 +1,5 @@ name Touhou (grey) +userid 2 // text maintext #222 diff --git a/static/s/higu/conf b/static/s/higu/conf index 74108144..9c860379 100644 --- a/static/s/higu/conf +++ b/static/s/higu/conf @@ -1,4 +1,5 @@ name Higurashi no Naku Koro ni (orange) +userid 51 // Higurashi no Naku Koro ni skin made using an image I found in MiniTokyo // created: 22/01/2009 by echomateria diff --git a/static/s/lb/conf b/static/s/lb/conf index b56996dc..a1e317a0 100644 --- a/static/s/lb/conf +++ b/static/s/lb/conf @@ -1,4 +1,5 @@ name Little Busters! (pink) +userid 93 // text maintext #408 diff --git a/static/s/lb_02/conf b/static/s/lb_02/conf index 73bd4bb0..e0fd96c2 100644 --- a/static/s/lb_02/conf +++ b/static/s/lb_02/conf @@ -1,4 +1,5 @@ name Little Busters! (lemon chiffon) +userid 51 // Little Busters! skin made using the Minitokyo.Little.Busters.Scans_316439 // created: 09/27/2009 by echomateria diff --git a/static/s/primitive/conf b/static/s/primitive/conf index 11e92be6..6f3b4b8f 100644 --- a/static/s/primitive/conf +++ b/static/s/primitive/conf @@ -1,4 +1,5 @@ name Primitive Link (pale chestnut) +userid 51 // Primitive Link skin made using an image that I liked without knowing what it's based on for a long time // created: 23/01/2009 by echomateria diff --git a/static/s/saya/conf b/static/s/saya/conf index 1f70e590..fd4408d7 100644 --- a/static/s/saya/conf +++ b/static/s/saya/conf @@ -1,4 +1,5 @@ name Saya no Uta (dark scarlet) +userid 51 // Saya no Uta skin made using a criminally cute fanart // created: 22/01/2009 by echomateria diff --git a/static/s/seinarukana/conf b/static/s/seinarukana/conf index bca7746b..1a2a833d 100644 --- a/static/s/seinarukana/conf +++ b/static/s/seinarukana/conf @@ -1,4 +1,5 @@ name Seinarukana (white) +userid 51 // Seinarukana skin made using a callendar image // created: 12/31/2008 by echomateria diff --git a/static/s/taka/conf b/static/s/taka/conf index dba52d26..37f0993e 100644 --- a/static/s/taka/conf +++ b/static/s/taka/conf @@ -1,4 +1,5 @@ name Sora no Iro, Mizu no Iro (turquoise) +userid 51 // A Sora no Iro, Mizu no Iro skin based on a wallpaper named My Perfect Day // created: 23/01/2009 by echomateria diff --git a/static/s/term/conf b/static/s/term/conf index 921e3566..d6fa1d52 100644 --- a/static/s/term/conf +++ b/static/s/term/conf @@ -1,4 +1,5 @@ name Neon (black) +userid 93 // text maintext #0f0 diff --git a/static/s/tsukihime/conf b/static/s/tsukihime/conf index 4dab95bf..c44a063a 100644 --- a/static/s/tsukihime/conf +++ b/static/s/tsukihime/conf @@ -1,4 +1,5 @@ name Tsukihime (midnight blue) +userid 51 // Tsukihime skin made using an image from the Tsukihime Plus+Disc // created: 02/01/2009 by echomateria diff --git a/static/s/tsukihime_02/conf b/static/s/tsukihime_02/conf index a5db55f2..e9866c8d 100644 --- a/static/s/tsukihime_02/conf +++ b/static/s/tsukihime_02/conf @@ -1,4 +1,5 @@ name Tsukihime (black) +userid 51 // Tsukihime skin made with an awesome Akiha artwork from Tsukihime PLUS disc // created: 23/01/2009 by echomateria diff --git a/util/vndb.pl b/util/vndb.pl index 07ad20aa..ee617caa 100755 --- a/util/vndb.pl +++ b/util/vndb.pl @@ -107,8 +107,8 @@ sub readskins { my $lasttemplate = [stat "$ROOT/data/style.css"]->[9]; my $skin = SkinFile->new("$ROOT/static/s"); for my $n ($skin->list) { - $skins{$n} = $skin->get($n, 'name'); - next if !$skins{$n}; + $skins{$n} = [ $skin->get($n, 'name'), $skin->get($n, 'userid') ]; + next if !$skins{$n}[0]; my $f = "$ROOT/static/s/$n"; my $css = -f "$f/style.css" && [stat "$f/style.css"]->[9] || 0; |