From 12338003bde24a3a263abe8caca71b1836ecee83 Mon Sep 17 00:00:00 2001 From: morkt <> Date: Mon, 22 Dec 2014 11:49:08 +0100 Subject: bbcode: Replace [vcpgi][0-9]+ links with a [url] tag Patch from https://vndb.org/t5564.13 --- lib/VNDB/DB/Chars.pm | 12 +++++++- lib/VNDB/DB/Discussions.pm | 4 ++- lib/VNDB/DB/Producers.pm | 13 ++++++++- lib/VNDB/DB/VN.pm | 13 ++++++++- lib/VNDB/Util/Misc.pm | 71 +++++++++++++++++++++++++++++++++++++++++++++- lib/VNDBUtil.pm | 2 +- 6 files changed, 109 insertions(+), 6 deletions(-) diff --git a/lib/VNDB/DB/Chars.pm b/lib/VNDB/DB/Chars.pm index 86b3a859..f387b044 100644 --- a/lib/VNDB/DB/Chars.pm +++ b/lib/VNDB/DB/Chars.pm @@ -5,7 +5,7 @@ use strict; use warnings; use Exporter 'import'; -our @EXPORT = qw|dbCharGet dbCharRevisionInsert dbCharImageId|; +our @EXPORT = qw|dbCharGet dbCharRevisionInsert dbCharImageId dbCharNames|; # options: id rev instance tagspoil trait_inc trait_exc char what results page gender bloodt @@ -138,6 +138,16 @@ sub dbCharImageId { } +sub dbCharNames { + my ($self, @ids) = @_; + return $self->dbAll(q| + SELECT c.id, cr.name + FROM chars c + JOIN chars_rev cr ON cr.id = c.latest + WHERE c.id IN (!l)|, \@ids + ); +} + 1; diff --git a/lib/VNDB/DB/Discussions.pm b/lib/VNDB/DB/Discussions.pm index 9da25384..d1462249 100644 --- a/lib/VNDB/DB/Discussions.pm +++ b/lib/VNDB/DB/Discussions.pm @@ -4,6 +4,7 @@ package VNDB::DB::Discussions; use strict; use warnings; use Exporter 'import'; +use VNDB::Util::Misc 'bbSubstLinks'; our @EXPORT = qw|dbThreadGet dbThreadEdit dbThreadAdd dbPostGet dbPostEdit dbPostAdd dbThreadCount|; @@ -214,7 +215,7 @@ sub dbPostEdit { my($self, $tid, $num, %o) = @_; my %set = ( - 'msg = ?' => $o{msg}, + 'msg = ?' => bbSubstLinks($self, $o{msg}), 'edited = to_timestamp(?)' => $o{lastmod}, 'hidden = ?' => $o{hidden}?1:0, ); @@ -236,6 +237,7 @@ sub dbPostAdd { my $num = $self->dbRow('SELECT num FROM threads_posts WHERE tid = ? ORDER BY num DESC LIMIT 1', $tid)->{num}; $num = $num ? $num+1 : 1; $o{uid} ||= $self->authInfo->{id}; + $o{msg} = bbSubstLinks($self, $o{msg}); $self->dbExec(q| INSERT INTO threads_posts (tid, num, uid, msg) diff --git a/lib/VNDB/DB/Producers.pm b/lib/VNDB/DB/Producers.pm index ad6f22b2..7d4b6897 100644 --- a/lib/VNDB/DB/Producers.pm +++ b/lib/VNDB/DB/Producers.pm @@ -5,7 +5,7 @@ use strict; use warnings; use Exporter 'import'; -our @EXPORT = qw|dbProducerGet dbProducerRevisionInsert|; +our @EXPORT = qw|dbProducerGet dbProducerRevisionInsert dbProducerNames|; # options: results, page, id, search, char, rev @@ -94,5 +94,16 @@ sub dbProducerRevisionInsert { } +sub dbProducerNames { + my($self, @ids) = @_; + return $self->dbAll(q| + SELECT p.id, pr.name + FROM producers p + JOIN producers_rev pr ON pr.id = p.latest + WHERE p.id IN (!l)|, \@ids + ); +} + + 1; diff --git a/lib/VNDB/DB/VN.pm b/lib/VNDB/DB/VN.pm index 090f9ecb..ecf49f96 100644 --- a/lib/VNDB/DB/VN.pm +++ b/lib/VNDB/DB/VN.pm @@ -7,7 +7,7 @@ use Exporter 'import'; use VNDB::Func 'gtintype', 'normalize_query'; use Encode 'decode_utf8'; -our @EXPORT = qw|dbVNGet dbVNRevisionInsert dbVNImageId dbScreenshotAdd dbScreenshotGet dbScreenshotRandom dbVNHasChar|; +our @EXPORT = qw|dbVNGet dbVNRevisionInsert dbVNImageId dbScreenshotAdd dbScreenshotGet dbScreenshotRandom dbVNHasChar dbVNTitles|; # Options: id, rev, char, search, length, lang, olang, plat, tag_inc, tag_exc, tagspoil, @@ -290,5 +290,16 @@ sub dbVNHasChar { )->{exists}; } + +sub dbVNTitles { + my ($self, @vids) = @_; + return $self->dbAll(q| + SELECT v.id, vr.title + FROM vn v + JOIN vn_rev vr ON vr.id = v.latest + WHERE v.id IN (!l)|, \@vids + ); +} + 1; diff --git a/lib/VNDB/Util/Misc.pm b/lib/VNDB/Util/Misc.pm index 48bc226d..a3a156d3 100644 --- a/lib/VNDB/Util/Misc.pm +++ b/lib/VNDB/Util/Misc.pm @@ -7,7 +7,7 @@ use Exporter 'import'; use TUWF ':html'; use VNDB::Func; -our @EXPORT = qw|filFetchDB ieCheck|; +our @EXPORT = qw|filFetchDB ieCheck bbSubstLinks|; my %filfields = ( @@ -143,5 +143,74 @@ sub ieCheck { return 0; } + +sub bbSubstLinks { + my ($self, $msg) = @_; + + # pre-parse vndb links within message body + my (%lookup, %links); + while ($msg =~ m/(?:^|\s)\K([vcpgi])([1-9][0-9]*)(?=$|\b[^.])/g) { + $lookup{$1}{$2} = 1; + } + return $msg unless %lookup; + # lookup parsed links + if ($lookup{v}) { + $links{"v$_->{id}"} = $_->{title} for (@{$self->dbVNTitles(keys %{$lookup{v}})}); + } + if ($lookup{c}) { + $links{"c$_->{id}"} = $_->{name} for (@{$self->dbCharNames(keys %{$lookup{c}})}); + } + if ($lookup{p}) { + $links{"p$_->{id}"} = $_->{name} for (@{$self->dbProducerNames(keys %{$lookup{p}})}); + } + if ($lookup{g}) { + $links{"g$_->{id}"} = $_->{name} for (@{$self->dbTagGet(id => [keys %{$lookup{g}}])}); + } + if ($lookup{i}) { + $links{"i$_->{id}"} = $_->{name} for (@{$self->dbTraitGet(id => [keys %{$lookup{i}}])}); + } + return $msg unless %links; + my($result, @open) = ('', 'first'); + + while($msg =~ m{ + (\b[tdvprcugi][1-9][0-9]*(?=$|\b[^.])) | # 1. id + (\[[^\s\]]+\]) | # 2. tag + ((?:https?|ftp)://[^><"\n\s\]\[]+[\d\w=/-]) # 3. url + }x) { + my($match, $id, $tag) = ($&, $1, $2); + $result .= $`; + $msg = $'; + + if($open[$#open] ne 'raw' && $open[$#open] ne 'code') { + # handle tags + if($tag) { + $tag = lc $tag; + if($tag eq '[raw]') { + push @open, 'raw'; + } elsif($tag eq '[quote]') { + push @open, 'quote'; + } elsif($tag eq '[code]') { + push @open, 'code'; + } elsif($tag eq '[/quote]' && $open[$#open] eq 'quote') { + pop @open; + } elsif($match =~ m{\[url=((https?://|/)[^\]>]+)\]}i) { + push @open, 'url'; + } elsif($tag eq '[/url]' && $open[$#open] eq 'url') { + pop @open; + } + } elsif($id && !grep(/^(?:quote|url)/, @open) && $links{$match}) { + $match = sprintf '[url=/%s]%s[/url]', $match, $links{$match}; + } + } + pop @open if($tag && $open[$#open] eq 'raw' && lc$tag eq '[/raw]'); + pop @open if($tag && $open[$#open] eq 'code' && lc$tag eq '[/code]'); + + $result .= $match; + } + $result .= $msg; + + return $result; +} + 1; diff --git a/lib/VNDBUtil.pm b/lib/VNDBUtil.pm index c864fda9..e81971a6 100644 --- a/lib/VNDBUtil.pm +++ b/lib/VNDBUtil.pm @@ -116,7 +116,7 @@ sub bb2html { next; } # id - if(($id || $exid || $longid) && (!$result || substr($raw, $last-1-length($match), 1) !~ /[\w]/) && substr($raw, $last, 1) !~ /[\w]/) { + if(($id || $exid || $longid) && !grep(/url/, @open) && (!$result || substr($raw, $last-1-length($match), 1) !~ /[\w]/) && substr($raw, $last, 1) !~ /[\w]/) { (my $lnk = $match) =~ s/^d(\d+)\.(\d+)\.(\d+)$/d$1#$2.$3/; $length += length $lnk; last if $maxlength && $length > $maxlength; -- cgit v1.2.3 From b646361f63e066c6859a1f05e29af7d9c812a13a Mon Sep 17 00:00:00 2001 From: Yorhel Date: Mon, 22 Dec 2014 12:06:55 +0100 Subject: DB: Merge name/title fetching in main fetching functions And call bbSubstLinks() from Handler::Discussions rather than DB::Discussions - it's not a transformation that the DB layer should do, IMO. --- lib/VNDB/DB/Chars.pm | 16 +++------------- lib/VNDB/DB/Discussions.pm | 4 +--- lib/VNDB/DB/Producers.pm | 15 ++------------- lib/VNDB/DB/VN.pm | 14 ++------------ lib/VNDB/Handler/Discussions.pm | 2 +- lib/VNDB/Util/Misc.pm | 6 +++--- lib/VNDBUtil.pm | 3 +++ 7 files changed, 15 insertions(+), 45 deletions(-) diff --git a/lib/VNDB/DB/Chars.pm b/lib/VNDB/DB/Chars.pm index f387b044..0f4120fd 100644 --- a/lib/VNDB/DB/Chars.pm +++ b/lib/VNDB/DB/Chars.pm @@ -5,7 +5,7 @@ use strict; use warnings; use Exporter 'import'; -our @EXPORT = qw|dbCharGet dbCharRevisionInsert dbCharImageId dbCharNames|; +our @EXPORT = qw|dbCharGet dbCharRevisionInsert dbCharImageId|; # options: id rev instance tagspoil trait_inc trait_exc char what results page gender bloodt @@ -25,7 +25,8 @@ sub dbCharGet { my %where = ( !$o{id} && !$o{rev} ? ( 'c.hidden = FALSE' => 1 ) : (), - $o{id} ? ( 'c.id = ?' => $o{id} ) : (), + $o{id} ? ( + 'c.id IN(!l)' => [ ref $o{id} ? $o{id} : [$o{id}] ] ) : (), $o{rev} ? ( 'h.rev = ?' => $o{rev} ) : (), $o{notid} ? ( 'c.id <> ?' => $o{notid} ) : (), $o{instance} ? ( 'cr.main = ?' => $o{instance} ) : (), @@ -138,16 +139,5 @@ sub dbCharImageId { } -sub dbCharNames { - my ($self, @ids) = @_; - return $self->dbAll(q| - SELECT c.id, cr.name - FROM chars c - JOIN chars_rev cr ON cr.id = c.latest - WHERE c.id IN (!l)|, \@ids - ); -} - - 1; diff --git a/lib/VNDB/DB/Discussions.pm b/lib/VNDB/DB/Discussions.pm index d1462249..9da25384 100644 --- a/lib/VNDB/DB/Discussions.pm +++ b/lib/VNDB/DB/Discussions.pm @@ -4,7 +4,6 @@ package VNDB::DB::Discussions; use strict; use warnings; use Exporter 'import'; -use VNDB::Util::Misc 'bbSubstLinks'; our @EXPORT = qw|dbThreadGet dbThreadEdit dbThreadAdd dbPostGet dbPostEdit dbPostAdd dbThreadCount|; @@ -215,7 +214,7 @@ sub dbPostEdit { my($self, $tid, $num, %o) = @_; my %set = ( - 'msg = ?' => bbSubstLinks($self, $o{msg}), + 'msg = ?' => $o{msg}, 'edited = to_timestamp(?)' => $o{lastmod}, 'hidden = ?' => $o{hidden}?1:0, ); @@ -237,7 +236,6 @@ sub dbPostAdd { my $num = $self->dbRow('SELECT num FROM threads_posts WHERE tid = ? ORDER BY num DESC LIMIT 1', $tid)->{num}; $num = $num ? $num+1 : 1; $o{uid} ||= $self->authInfo->{id}; - $o{msg} = bbSubstLinks($self, $o{msg}); $self->dbExec(q| INSERT INTO threads_posts (tid, num, uid, msg) diff --git a/lib/VNDB/DB/Producers.pm b/lib/VNDB/DB/Producers.pm index 7d4b6897..86ed124e 100644 --- a/lib/VNDB/DB/Producers.pm +++ b/lib/VNDB/DB/Producers.pm @@ -5,7 +5,7 @@ use strict; use warnings; use Exporter 'import'; -our @EXPORT = qw|dbProducerGet dbProducerRevisionInsert dbProducerNames|; +our @EXPORT = qw|dbProducerGet dbProducerRevisionInsert|; # options: results, page, id, search, char, rev @@ -25,7 +25,7 @@ sub dbProducerGet { !$o{id} && !$o{rev} ? ( 'p.hidden = FALSE' => 1 ) : (), $o{id} ? ( - 'p.id = ?' => $o{id} ) : (), + 'p.id IN(!l)' => [ ref $o{id} ? $o{id} : [$o{id}] ] ) : (), $o{search} ? ( '(pr.name ILIKE ? OR pr.original ILIKE ? OR pr.alias ILIKE ?)', [ map '%%'.$o{search}.'%%', 1..3 ] ) : (), $o{char} ? ( @@ -94,16 +94,5 @@ sub dbProducerRevisionInsert { } -sub dbProducerNames { - my($self, @ids) = @_; - return $self->dbAll(q| - SELECT p.id, pr.name - FROM producers p - JOIN producers_rev pr ON pr.id = p.latest - WHERE p.id IN (!l)|, \@ids - ); -} - - 1; diff --git a/lib/VNDB/DB/VN.pm b/lib/VNDB/DB/VN.pm index ecf49f96..aaca4da5 100644 --- a/lib/VNDB/DB/VN.pm +++ b/lib/VNDB/DB/VN.pm @@ -7,7 +7,7 @@ use Exporter 'import'; use VNDB::Func 'gtintype', 'normalize_query'; use Encode 'decode_utf8'; -our @EXPORT = qw|dbVNGet dbVNRevisionInsert dbVNImageId dbScreenshotAdd dbScreenshotGet dbScreenshotRandom dbVNHasChar dbVNTitles|; +our @EXPORT = qw|dbVNGet dbVNRevisionInsert dbVNImageId dbScreenshotAdd dbScreenshotGet dbScreenshotRandom dbVNHasChar|; # Options: id, rev, char, search, length, lang, olang, plat, tag_inc, tag_exc, tagspoil, @@ -32,7 +32,7 @@ sub dbVNGet { my @where = ( $o{id} ? ( - 'v.id = ?' => $o{id} ) : (), + 'v.id IN(!l)' => [ ref $o{id} ? $o{id} : [$o{id}] ] ) : (), $o{rev} ? ( 'c.rev = ?' => $o{rev} ) : (), $o{char} ? ( @@ -291,15 +291,5 @@ sub dbVNHasChar { } -sub dbVNTitles { - my ($self, @vids) = @_; - return $self->dbAll(q| - SELECT v.id, vr.title - FROM vn v - JOIN vn_rev vr ON vr.id = v.latest - WHERE v.id IN (!l)|, \@vids - ); -} - 1; diff --git a/lib/VNDB/Handler/Discussions.pm b/lib/VNDB/Handler/Discussions.pm index 477e6bfa..e1645fd5 100644 --- a/lib/VNDB/Handler/Discussions.pm +++ b/lib/VNDB/Handler/Discussions.pm @@ -215,7 +215,7 @@ sub edit { # create/edit post my %post = ( - msg => $frm->{msg}, + msg => $self->bbSubstLinks($frm->{msg}), hidden => $num != 1 && $frm->{hidden}, lastmod => !$num || $frm->{nolastmod} ? 0 : time, ); diff --git a/lib/VNDB/Util/Misc.pm b/lib/VNDB/Util/Misc.pm index a3a156d3..612178c3 100644 --- a/lib/VNDB/Util/Misc.pm +++ b/lib/VNDB/Util/Misc.pm @@ -155,13 +155,13 @@ sub bbSubstLinks { return $msg unless %lookup; # lookup parsed links if ($lookup{v}) { - $links{"v$_->{id}"} = $_->{title} for (@{$self->dbVNTitles(keys %{$lookup{v}})}); + $links{"v$_->{id}"} = $_->{title} for (@{$self->dbVNGet(id => [keys %{$lookup{v}}])}); } if ($lookup{c}) { - $links{"c$_->{id}"} = $_->{name} for (@{$self->dbCharNames(keys %{$lookup{c}})}); + $links{"c$_->{id}"} = $_->{name} for (@{$self->dbCharGet(id => [keys %{$lookup{c}}])}); } if ($lookup{p}) { - $links{"p$_->{id}"} = $_->{name} for (@{$self->dbProducerNames(keys %{$lookup{p}})}); + $links{"p$_->{id}"} = $_->{name} for (@{$self->dbProducerGet(id => [keys %{$lookup{p}}])}); } if ($lookup{g}) { $links{"g$_->{id}"} = $_->{name} for (@{$self->dbTagGet(id => [keys %{$lookup{g}}])}); diff --git a/lib/VNDBUtil.pm b/lib/VNDBUtil.pm index e81971a6..0c3d5eb3 100644 --- a/lib/VNDBUtil.pm +++ b/lib/VNDBUtil.pm @@ -27,6 +27,9 @@ sub shorten { # [code] .. [/code] # v+, v+.+ # http://../ +# XXX: Make sure to sync any changes in the formating with +# VNDB::Util::Misc::bbSubstLinks() if necessary. Or, alternatively, abstract +# parsing into a separate function as per http://beta.vndb.org/t5564.12 sub bb2html { my($raw, $maxlength, $charspoil) = @_; $raw =~ s/\r//g; -- cgit v1.2.3 From 2401c43c686a5222b75b7cf587591312c77f6017 Mon Sep 17 00:00:00 2001 From: Yorhel Date: Mon, 22 Dec 2014 12:14:20 +0100 Subject: d7: Credits update --- data/docs/7 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/data/docs/7 b/data/docs/7 index f5046101..21def6c4 100644 --- a/data/docs/7 +++ b/data/docs/7 @@ -51,8 +51,9 @@
Yorhel
Main developer.
QCyph
Contributed the character filters.
-
3dB
Contributed the current user authentication code and post throttling on the discussion board.
+
3dB
Contributed an improved user authentication code and post throttling on the discussion board.
SpaceRanger
Contributed the visual novel release comparison page, userlist columns to the VN list and dx.x.x link formatting.
+
morkt
Contributed improvements to the BBCode used on the forums.

-- cgit v1.2.3 From 91aeed49a83a36660708b9eb3665d45fa3eb3c3d Mon Sep 17 00:00:00 2001 From: morkt <> Date: Tue, 23 Dec 2014 09:07:03 +0100 Subject: bbSubstLinks: Fix minor parsing issue Patch from https://vndb.org/t5564.18 --- lib/VNDB/Util/Misc.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/VNDB/Util/Misc.pm b/lib/VNDB/Util/Misc.pm index 612178c3..79ac8edc 100644 --- a/lib/VNDB/Util/Misc.pm +++ b/lib/VNDB/Util/Misc.pm @@ -149,7 +149,7 @@ sub bbSubstLinks { # pre-parse vndb links within message body my (%lookup, %links); - while ($msg =~ m/(?:^|\s)\K([vcpgi])([1-9][0-9]*)(?=$|\b[^.])/g) { + while ($msg =~ m/(?:^|\s)\K([vcpgi])([1-9][0-9]*)\b/g) { $lookup{$1}{$2} = 1; } return $msg unless %lookup; @@ -173,7 +173,7 @@ sub bbSubstLinks { my($result, @open) = ('', 'first'); while($msg =~ m{ - (\b[tdvprcugi][1-9][0-9]*(?=$|\b[^.])) | # 1. id + (\b[tdvprcugi][1-9][0-9]*(?:\.[1-9][0-9]*)?\b)| # 1. id (\[[^\s\]]+\]) | # 2. tag ((?:https?|ftp)://[^><"\n\s\]\[]+[\d\w=/-]) # 3. url }x) { -- cgit v1.2.3 From efecd717150a6ee8acdaf87b72bf2e5d0c8b3d1a Mon Sep 17 00:00:00 2001 From: morkt <> Date: Mon, 12 Jan 2015 09:34:15 +0100 Subject: bbSubstLinks: Increase titles to fetch to 50 + tweak matching pattern Patch from https://vndb.org/t2520.116 --- lib/VNDB/Util/Misc.pm | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/lib/VNDB/Util/Misc.pm b/lib/VNDB/Util/Misc.pm index 79ac8edc..2ffd7827 100644 --- a/lib/VNDB/Util/Misc.pm +++ b/lib/VNDB/Util/Misc.pm @@ -153,27 +153,28 @@ sub bbSubstLinks { $lookup{$1}{$2} = 1; } return $msg unless %lookup; + my @opt = (results => 50); # lookup parsed links if ($lookup{v}) { - $links{"v$_->{id}"} = $_->{title} for (@{$self->dbVNGet(id => [keys %{$lookup{v}}])}); + $links{"v$_->{id}"} = $_->{title} for (@{$self->dbVNGet(id => [keys %{$lookup{v}}], @opt)}); } if ($lookup{c}) { - $links{"c$_->{id}"} = $_->{name} for (@{$self->dbCharGet(id => [keys %{$lookup{c}}])}); + $links{"c$_->{id}"} = $_->{name} for (@{$self->dbCharGet(id => [keys %{$lookup{c}}], @opt)}); } if ($lookup{p}) { - $links{"p$_->{id}"} = $_->{name} for (@{$self->dbProducerGet(id => [keys %{$lookup{p}}])}); + $links{"p$_->{id}"} = $_->{name} for (@{$self->dbProducerGet(id => [keys %{$lookup{p}}], @opt)}); } if ($lookup{g}) { - $links{"g$_->{id}"} = $_->{name} for (@{$self->dbTagGet(id => [keys %{$lookup{g}}])}); + $links{"g$_->{id}"} = $_->{name} for (@{$self->dbTagGet(id => [keys %{$lookup{g}}], @opt)}); } if ($lookup{i}) { - $links{"i$_->{id}"} = $_->{name} for (@{$self->dbTraitGet(id => [keys %{$lookup{i}}])}); + $links{"i$_->{id}"} = $_->{name} for (@{$self->dbTraitGet(id => [keys %{$lookup{i}}], @opt)}); } return $msg unless %links; my($result, @open) = ('', 'first'); while($msg =~ m{ - (\b[tdvprcugi][1-9][0-9]*(?:\.[1-9][0-9]*)?\b)| # 1. id + (?:\b([tdvprcugi][1-9]\d*)(?:\.[1-9]\d*)?\b) | # 1. id (\[[^\s\]]+\]) | # 2. tag ((?:https?|ftp)://[^><"\n\s\]\[]+[\d\w=/-]) # 3. url }x) { @@ -198,8 +199,8 @@ sub bbSubstLinks { } elsif($tag eq '[/url]' && $open[$#open] eq 'url') { pop @open; } - } elsif($id && !grep(/^(?:quote|url)/, @open) && $links{$match}) { - $match = sprintf '[url=/%s]%s[/url]', $match, $links{$match}; + } elsif($id && !grep(/^(?:quote|url)/, @open) && $links{$id}) { + $match = sprintf '[url=/%s]%s[/url]', $match, $links{$id}; } } pop @open if($tag && $open[$#open] eq 'raw' && lc$tag eq '[/raw]'); -- cgit v1.2.3 From 28756f1de306982adedbc4197519125506009a4b Mon Sep 17 00:00:00 2001 From: Yorhel Date: Thu, 15 Jan 2015 08:02:49 +0100 Subject: Double the limit of number of traits to a character As per t2520.119 and t2520.120. --- data/script.js | 2 +- lib/VNDB/Handler/Traits.pm | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/data/script.js b/data/script.js index ce66bc02..026d30f4 100644 --- a/data/script.js +++ b/data/script.js @@ -1732,7 +1732,7 @@ function ctrLoad() { } } if(q.length > 0) - ajax('/xml/traits.xml?r=100;'+q.join(';'), function (ht) { + ajax('/xml/traits.xml?r=200;'+q.join(';'), function (ht) { var t = ht.responseXML.getElementsByTagName('item'); for(var i=0; iformValidate( { get => 'q', required => 0, maxlength => 500 }, { get => 'id', required => 0, multi => 1, template => 'int' }, - { get => 'r', required => 0, default => 15, template => 'int', min => 1, max => 100 }, + { get => 'r', required => 0, default => 15, template => 'int', min => 1, max => 200 }, ); return $self->resNotFound if $f->{_err} || (!$f->{q} && !$f->{id} && !$f->{id}[0]); -- cgit v1.2.3 From 33840a99712a157dd07887648fc4b10226a6dc84 Mon Sep 17 00:00:00 2001 From: morkt <> Date: Sat, 17 Jan 2015 10:27:58 +0100 Subject: Fix placing of add/edit tabs on VN pages when tags are hidden --- lib/VNDB/Handler/VNPage.pm | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/VNDB/Handler/VNPage.pm b/lib/VNDB/Handler/VNPage.pm index 7d170ce8..3995ce2a 100644 --- a/lib/VNDB/Handler/VNPage.pm +++ b/lib/VNDB/Handler/VNPage.pm @@ -647,6 +647,7 @@ sub page { my $haschar = $self->dbVNHasChar($v->{id}); if($haschar || $self->authCan('edit')) { + clearfloat; # fix tabs placement when tags are hidden ul class => 'maintabs notfirst'; if($haschar) { li class => 'left '.(!$char ? ' tabselected' : ''); a href => "/v$v->{id}#main", name => 'main', mt '_vnpage_tab_main'; end; -- cgit v1.2.3 From 9426bf6f7ffdea07fe354cc7eda38843226e36c2 Mon Sep 17 00:00:00 2001 From: morkt <> Date: Sat, 17 Jan 2015 10:32:45 +0100 Subject: Fix bug with language icon not being displayed for release in user list This happened when a release was linked to multiple visual novel entries, the language icon would show on one VN but not on the other. --- lib/VNDB/DB/ULists.pm | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/lib/VNDB/DB/ULists.pm b/lib/VNDB/DB/ULists.pm index a0cf4f18..6831e579 100644 --- a/lib/VNDB/DB/ULists.pm +++ b/lib/VNDB/DB/ULists.pm @@ -101,18 +101,17 @@ sub dbVNListList { ); if(@$rel) { - my %rel = map { - $_->{languages}=[]; - $_->{latest}, $_->{languages} - } @$rel; - + my %rel = map { $_->{latest} => [] } @$rel; push(@{$rel{$_->{rid}}}, $_->{lang}) for (@{$self->dbAll(q| SELECT rid, lang FROM releases_lang WHERE rid IN(!l)|, [ keys %rel ] )}); - push @{$vns{$_->{vid}}}, $_ for @$rel; + for(@$rel) { + $_->{languages} = $rel{$_->{latest}}; + push @{$vns{$_->{vid}}}, $_; + } } } -- cgit v1.2.3 From 8c2472ce6009f828027a43cf8ac9490c9f05307d Mon Sep 17 00:00:00 2001 From: morkt <> Date: Sat, 17 Jan 2015 10:35:44 +0100 Subject: js: Fix table striping on chars with hidden trait categories --- data/script.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/data/script.js b/data/script.js index 026d30f4..f61805bf 100644 --- a/data/script.js +++ b/data/script.js @@ -2841,6 +2841,7 @@ if(byId('expandall')) { if(byId('charspoil_sel')) { var k = byClass('charspoil'); var h = byName(byId('charspoil_sel'), 'a'); + var t = byClass('table', 'stripe'); var setall = function(spoil) { for(var i=0; i Date: Sat, 17 Jan 2015 10:38:15 +0100 Subject: Handler::VNPage: Conditionally disable warnings for smartmatch Only recent perl versions need it, on older versions the 'no warnings' line would cause an error. --- lib/VNDB/Handler/VNPage.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/VNDB/Handler/VNPage.pm b/lib/VNDB/Handler/VNPage.pm index 3995ce2a..0f8f71ba 100644 --- a/lib/VNDB/Handler/VNPage.pm +++ b/lib/VNDB/Handler/VNPage.pm @@ -3,7 +3,7 @@ package VNDB::Handler::VNPage; use strict; use warnings; -no warnings 'experimental::smartmatch'; +no if $] >= 5.018, warnings => 'experimental::smartmatch'; use feature qw{ switch }; use TUWF ':html', 'xml_escape'; use VNDB::Func; -- cgit v1.2.3