diff options
author | yorhel <yorhel@1fe2e327-d9db-4752-bcf7-ef0cb4a1748b> | 2008-05-20 17:46:52 +0000 |
---|---|---|
committer | yorhel <yorhel@1fe2e327-d9db-4752-bcf7-ef0cb4a1748b> | 2008-05-20 17:46:52 +0000 |
commit | c2615af845fef85c048d3d1b2e0fd83b701dc4e1 (patch) | |
tree | ffd38c74eee923eedbb6cec3294165dcd5fa733f | |
parent | 2ce770e7e5817f8838fdaf7bc7eda2a8da972962 (diff) |
Several bugfixes, xml extention to rss feeds, noindex on user forms, client side filter selection, and how the fuck did the "Finished" status get lost!?
git-svn-id: svn://vndb.org/vndb@14 1fe2e327-d9db-4752-bcf7-ef0cb4a1748b
-rw-r--r-- | data/tpl/hist | 2 | ||||
-rw-r--r-- | data/tpl/main | 8 | ||||
-rw-r--r-- | data/tpl/vnbrowse | 12 | ||||
-rw-r--r-- | lib/ChangeLog | 5 | ||||
-rw-r--r-- | lib/Multi/IRC.pm | 2 | ||||
-rw-r--r-- | lib/Multi/Sitemap.pm | 18 | ||||
-rw-r--r-- | lib/VNDB.pm | 23 | ||||
-rw-r--r-- | lib/VNDB/HomePages.pm | 4 | ||||
-rw-r--r-- | lib/VNDB/Util/DB.pm | 8 | ||||
-rw-r--r-- | lib/VNDB/VN.pm | 4 | ||||
-rw-r--r-- | lib/global.pl | 1 | ||||
-rw-r--r-- | static/files/def.js | 2 | ||||
-rw-r--r-- | util/multi.pl | 3 |
13 files changed, 59 insertions, 33 deletions
diff --git a/data/tpl/hist b/data/tpl/hist index e02a149f..4160ef52 100644 --- a/data/tpl/hist +++ b/data/tpl/hist @@ -12,7 +12,7 @@ my $furl = $url.'?e='.$d{sele}.';t='; my $eurl = $url.'?t='.$d{selt}.';e='; my $purl = !$d{type}?$eurl.$d{sele}:$d{type} eq 'v' && $d{seli} ? $url.'?i=1' : $url; - my $rurl = $url.'/rss'.(!$d{type}?'?t='.$d{selt}.';e='.$d{sele}:$d{type} eq 'v' && $d{seli} ? '?i=1' : ''); + my $rurl = $url.'/rss.xml'.(!$d{type}?'?t='.$d{selt}.';e='.$d{sele}:$d{type} eq 'v' && $d{seli} ? '?i=1' : ''); local $_ = $d{selt}; my @fil = ( /a/ ? 'all items' : '<a href="%sa">all items</a>', diff --git a/data/tpl/main b/data/tpl/main index 5c009297..8204df80 100644 --- a/data/tpl/main +++ b/data/tpl/main @@ -16,14 +16,15 @@ <script src="[[: $p{st} ]]/files/def.js?[[= $VNDB::VERSION ]]" type="text/javascript"></script> [[ if($p{devshit}) { ]]- <meta name="robots" content="noindex, nofollow" /> -[[ } elsif($p{userlist} || $p{userpage} || $p{myvotes} || $p{vnlist} || $p{hist} || ($p{vnpage} && $p{vnpage}{page} eq 'stats') +[[ } elsif($p{userlist} || $p{userpage} || $p{userlogin} || $p{userreg} || $p{userpass} || $p{myvotes} + || $p{vnlist} || $p{hist} || ($p{vnpage} && $p{vnpage}{page} eq 'stats') || grep { $p{$_} && $p{$_}{change} } qw|vnpage ppage rpage|) { ]]- <meta name="robots" content="noindex, follow" /> [[ }]]- [[if($p{hist}){ ]] <link rel="alternate" type="application/rss+xml" title="Recent changes" href=" - [[= (!$p{hist}{type}?'/hist':'/'.$p{hist}{type}.$p{hist}{id}.'/hist').'/rss'.(!$p{hist}{type}?'?t='.$p{hist}{selt}.';e='.$p{hist}{sele}:$p{hist}{type} eq 'v' && $p{hist}{seli} ? '?i=1':'') ]]" /> + [[= (!$p{hist}{type}?'/hist':'/'.$p{hist}{type}.$p{hist}{id}.'/hist').'/rss.xml'.(!$p{hist}{type}?'?t='.$p{hist}{selt}.';e='.$p{hist}{sele}:$p{hist}{type} eq 'v' && $p{hist}{seli} ? '?i=1':'') ]]" /> [[ } ]]- </head> @@ -73,9 +74,8 @@ <h2>Menu</h2> <ul> <li><a href="/">Home</a></li> - <li><a href="/v">Visual Novels</a></li> + <li><a href="/v">Browse</a> | <a href="/v/search">Search</a></li> <li><a href="/p">Producers</a></li> - <li><a href="/v/search">Search</a></li> <li><a href="/u/list">Users</a></li> <li><a href="/hist">Recent changes</a></li> <li><a href="/d6">FAQ</a></li> diff --git a/data/tpl/vnbrowse b/data/tpl/vnbrowse index fef795a3..9adaa113 100644 --- a/data/tpl/vnbrowse +++ b/data/tpl/vnbrowse @@ -12,13 +12,13 @@ </form> <div id="adsearch" [[= !$p{searchquery} ? '' : ' style="display: none"' ]]> - <b>Categories</b> (inclusive, selecting more gives less results) + <b>Categories</b> (boolean and, selecting more gives less results) <ul id="cat"> [[ for my $c (qw| e g p t l s |) { ]]- -[[= $c ne 'l' && $c ne 'p' ? '<li>' : '<br />' ]][[: $VNDB::CAT->{$c}[0] ]]- <ul> [[ for (sort keys %{$VNDB::CAT->{$c}[1]}) { my $ca = $c.$_; ]]- - <li[[= (grep /$ca/, @{$d{incl}}) ? ' class="inc"' : (grep /$ca/, @{$d{excl}}) ? ' class="exc"' : '' ]]- id="cat_[[= $ca ]]"> + <li id="cat_[[= $ca ]]"> [[: $VNDB::CAT->{$c}[1]{$_} ]]- ([[= $d{cat}{$ca} || 0 ]])</li> [[ } ]] </ul>[[= $c ne 't' && $c ne 'g' ? '</li>' : '' ]]- @@ -27,20 +27,20 @@ <br style="clear: both" /> <br /> - <b>Languages</b> (exclusive, selecting more gives more results)<br /> + <b>Languages</b> (boolean or, selecting more gives more results)<br /> <ul class="filter" id="lfilter"> [[ for (sort keys %{$d{langc}}) { next if !$d{langc}{$_}; my $l=$_; ]]- - <li><input type="checkbox" name="lang_[[= $l ]]" id="lang_[[= $l ]]" value="[[: $VNDB::LANG->{$l} ]]" [[= (grep /$l/, @{$d{lang}}) ? ' checked="checked"' : '' ]]- /> + <li><input type="checkbox" name="lang_[[= $l ]]" id="lang_[[= $l ]]" value="[[: $VNDB::LANG->{$l} ]]" /> <label for="lang_[[= $l ]]"><acronym class="icons lang -[[= $l ]]" title="[[: $VNDB::LANG->{$l} ]]"> </acronym>([[= $d{langc}{$l} ]])</label></li> [[ } ]]- </ul> <br style="clear: both" /> <br /> - <b>Platforms</b> (exclusive, selecting more gives more results)<br /> + <b>Platforms</b> (boolean or, selecting more gives more results)<br /> <ul class="filter" id="pfilter"> [[ for (sort keys %$VNDB::PLAT) { next if /oth/; my $l=$_; ]]- - <li><input type="checkbox" name="plat_[[= $l ]]" id="plat_[[= $l ]]" value="[[: $VNDB::PLAT->{$l} ]]" [[= (grep /$l/, @{$d{plat}}) ? ' checked="checked"' : '' ]]- /> + <li><input type="checkbox" name="plat_[[= $l ]]" id="plat_[[= $l ]]" value="[[: $VNDB::PLAT->{$l} ]]" /> <label for="plat_[[= $l ]]"><acronym class="icons -[[= $l ]]" title="[[: $VNDB::PLAT->{$l} ]]"> </acronym></label></li> [[ } ]]- </ul> diff --git a/lib/ChangeLog b/lib/ChangeLog index a9969ac5..43bfbf1b 100644 --- a/lib/ChangeLog +++ b/lib/ChangeLog @@ -18,7 +18,10 @@ TODO: - Grouped producers, user stats and general information on the VN page - Added language icons to producer browser - A little CSS cleanup - - Grouped category browser into one advanced search + - Grouped category browser and search into one advanced search + - Updated sitemap generator + - Pattern matching bug fixes in Multi::IRC, and better handling of commands + - Added .xml extention to all RSS URLs 1.15 - 2008-05-04 - Relation graph now also updated on VN title change diff --git a/lib/Multi/IRC.pm b/lib/Multi/IRC.pm index 58789675..5611c3cf 100644 --- a/lib/Multi/IRC.pm +++ b/lib/Multi/IRC.pm @@ -148,7 +148,7 @@ sub vndbid { # dest, msg my @id; push @id, [$1,$2,$3,$4] while $m =~ s/^(.*)([duvpr])([0-9]+)(.*)$/ $1 $4 /i; for (reverse @id) { - next if $$_[0] =~ /[a-z0-9%/]$/i || $$_[3] =~ /^[a-z]/i; + next if $$_[0] =~ /[a-z0-9%\/]$/i || $$_[3] =~ /^[a-z.]/i; my($t, $id, $ext) = (lc($$_[1]), $$_[2], $$_[3]); next if $_[HEAP]{log}{$t.$id}; diff --git a/lib/Multi/Sitemap.pm b/lib/Multi/Sitemap.pm index 991244fd..d21d7fb9 100644 --- a/lib/Multi/Sitemap.pm +++ b/lib/Multi/Sitemap.pm @@ -67,11 +67,13 @@ sub cmd_sitemap { sub staticpages { $_[KERNEL]->call(core => log => 3, 'Adding static pages'); - $_[KERNEL]->call(sitemap => addurl => '', 'd'); - $_[KERNEL]->call(sitemap => addurl => 'faq', 'm'); + $_[KERNEL]->call(sitemap => addurl => '', 'daily'); - $_[KERNEL]->call(sitemap => addurl => $_, 'w') - for ( (map { 'v/'.$_ } 'a'..'z'), 'v/all', 'v/cat', (map { 'p/'.$_ } 'a'..'z'), 'p/all'); + /([0-9]+)$/ && $_[KERNEL]->call(sitemap => addurl => 'd'.$1, 'monthly') + for ( (</www/vndb/data/docs/*>) ); + + $_[KERNEL]->call(sitemap => addurl => $_, 'weekly') + for ( (map { 'v/'.$_ } 'a'..'z'), 'v/all', 'v/search', (map { 'p/'.$_ } 'a'..'z'), 'p/all'); $_[KERNEL]->yield('vnpages'); } @@ -88,8 +90,8 @@ sub vnpages { |); $q->execute; while(local $_ = $q->fetchrow_arrayref) { - $_[KERNEL]->call(sitemap => addurl => 'v'.$_->[0], 'w', $_->[1], 0.7); - $_[KERNEL]->call(sitemap => addurl => 'v'.$_->[0].'/rg', 'w', $_->[1], 0.7) if $_->[2]; + $_[KERNEL]->call(sitemap => addurl => 'v'.$_->[0], 'weekly', $_->[1], 0.7); + $_[KERNEL]->call(sitemap => addurl => 'v'.$_->[0].'/rg', 'weekly', $_->[1], 0.7) if $_->[2]; } $_[KERNEL]->yield('releasepages'); @@ -107,7 +109,7 @@ sub releasepages { |); $q->execute; while(local $_ = $q->fetchrow_arrayref) { - $_[KERNEL]->call(sitemap => addurl => 'r'.$_->[0], 'w', $_->[1], 0.3); + $_[KERNEL]->call(sitemap => addurl => 'r'.$_->[0], 'weekly', $_->[1], 0.3); } $_[KERNEL]->yield('producerpages'); @@ -125,7 +127,7 @@ sub producerpages { |); $q->execute; while(local $_ = $q->fetchrow_arrayref) { - $_[KERNEL]->call(sitemap => addurl => 'p'.$_->[0], 'w', $_->[1]); + $_[KERNEL]->call(sitemap => addurl => 'p'.$_->[0], 'weekly', $_->[1]); } $_[KERNEL]->yield('finish'); diff --git a/lib/VNDB.pm b/lib/VNDB.pm index 93f9e190..5ac3bc87 100644 --- a/lib/VNDB.pm +++ b/lib/VNDB.pm @@ -79,7 +79,6 @@ my %VNDBuris = ( # wildcards: * -> (.+), + -> ([0-9]+) v => { '/' => sub { shift->VNBrowse }, new => sub { shift->VNEdit(0); }, - #search => sub { shift->VNSearch }, '*' => sub { $_[2] =~ /^([a-z0]|all|search)$/ ? shift->VNBrowse($_[1]) : shift->ResNotFound; }, }, 'v+' => { @@ -135,10 +134,21 @@ my %OLDuris = ( '*' => sub { shift->ResRedirect('/v/'.$_[1], 'perm') }, }, v => { - cat => sub { }, + cat => sub { + my $f = $_[0]->FormCheck({name=>'i',required=>0},{name=>'e',required=>0},{name=>'l',required=>0}, + {name=>'p',required=>0},{name=>'o',required=>0},{name=>'s',required=>0}); + my %f; + $f{$_} = $f->{$_} for (qw|p o s|); + $f{q} = join ' ', (map $VNDB::CAT->{substr($_,0,1)}[1]{substr($_,1,2)}, split /,/, $f->{i}), + (map '-'.$VNDB::CAT->{substr($_,0,1)}[1]{substr($_,1,2)}, split /,/, $f->{e}), + (map $VNDB::LANG->{$_}, split /,/, $f->{l}); + !$f{$_}&&delete $f{$_} for keys %f; + $_[0]->ResRedirect('/v/search'.(!(keys %f)?'':'?'.join(';', map $_.'='.$f{$_}, keys %f) ), 'perm'); + }, }, 'v+' => { votes => sub { shift->ResRedirect('/v'.(shift).'/stats', 'perm') }, + hist=>{rss => sub { shift->ResRedirect('/v'.(shift).'/hist/rss.xml', 'perm') } }, }, u => { '*' => { @@ -151,7 +161,14 @@ my %OLDuris = ( } }, } - } + }, + 'u+' => { + hist=>{rss => sub { shift->ResRedirect('/u'.(shift).'/hist/rss.xml', 'perm') } }, + }, + 'p+' => { + hist=>{rss => sub { shift->ResRedirect('/p'.(shift).'/hist/rss.xml', 'perm') } }, + }, + hist=>{rss => sub { shift->ResRedirect('/hist/rss.xml', 'perm') } }, ); diff --git a/lib/VNDB/HomePages.pm b/lib/VNDB/HomePages.pm index 0e99f517..7ce07983 100644 --- a/lib/VNDB/HomePages.pm +++ b/lib/VNDB/HomePages.pm @@ -62,13 +62,13 @@ sub DocPage { } -sub History { # type(p,v,r,u), id, [rss|/] +sub History { # type(p,v,r,u), id, [rss.xml|/] my($self, $type, $id, $fmt) = @_; $type ||= ''; $id ||= 0; $fmt = undef if !$fmt || $fmt eq '/'; - return $self->ResNotFound if $fmt && $fmt ne 'rss'; + return $self->ResNotFound if $fmt && $fmt ne 'rss.xml'; my $f = $self->FormCheck( { name => 'p', required => 0, default => 1, template => 'int' }, diff --git a/lib/VNDB/Util/DB.pm b/lib/VNDB/Util/DB.pm index a2b4a035..87b7ba89 100644 --- a/lib/VNDB/Util/DB.pm +++ b/lib/VNDB/Util/DB.pm @@ -108,6 +108,7 @@ sub DBCategoryCount { SELECT cat, COUNT(vid) AS cnt FROM vn_categories vc JOIN vn v ON v.latest = vc.vid + WHERE v.hidden = 0 GROUP BY cat ORDER BY cnt| )} @@ -119,10 +120,15 @@ sub DBCategoryCount { sub DBLanguageCount { return { (map { $_ => 0 } keys %$VNDB::LANG ), map { $_->{language} => $_->{count} } @{shift->DBAll(q| - SELECT rr.language, COUNT(DISTINCT rv.vid) AS count + SELECT rr.language, COUNT(DISTINCT v.id) AS count FROM releases_rev rr JOIN releases r ON r.latest = rr.id JOIN releases_vn rv ON rv.rid = rr.id + JOIN vn v ON v.id = rv.vid + WHERE r.hidden = 0 + AND v.hidden = 0 + AND rr.type <> 2 + AND rr.released <= TO_CHAR('today'::timestamp, 'YYYYMMDD')::integer GROUP BY rr.language|)} }; } diff --git a/lib/VNDB/VN.pm b/lib/VNDB/VN.pm index fd46672c..5436f07e 100644 --- a/lib/VNDB/VN.pm +++ b/lib/VNDB/VN.pm @@ -286,12 +286,8 @@ sub VNBrowse { page => $f->{p}, chr => $chr, $chr eq 'search' ? ( - incl => \@cati, - excl => \@cate, cat => $self->DBCategoryCount, langc => $self->DBLanguageCount, - lang => \@lang, - plat => \@plat, ) : (), order => [ $f->{s}, $f->{o} ], }, diff --git a/lib/global.pl b/lib/global.pl index cf8d02db..a169abc8 100644 --- a/lib/global.pl +++ b/lib/global.pl @@ -102,6 +102,7 @@ our $LSTAT = [ 'Wishlist', 'Blacklist', 'Playing', + 'Finished', 'Stalled', 'Dropped', 'Other', # XXX: hardcoded at 6 diff --git a/static/files/def.js b/static/files/def.js index ed7e1f41..39772b9a 100644 --- a/static/files/def.js +++ b/static/files/def.js @@ -160,6 +160,8 @@ function adsearch() { ad_plat[ l[i].name.substring(5) ] = l[i].value.toLowerCase(); l[i].onclick = function() { ad_update(0, this.value) }; } + + ad_update(); } function ad_update(add, term) { diff --git a/util/multi.pl b/util/multi.pl index 93c4fe44..888dbd4f 100644 --- a/util/multi.pl +++ b/util/multi.pl @@ -56,7 +56,6 @@ our $LOGDIR = '/www/vndb/data/log'; our $LOGLVL = 3; # 3:DEBUG, 2:ACTIONS, 1:WARN our $STOP = 0; our $DAEMONIZE = (grep /^-c$/, @ARGV) ? 1 : (grep /^-s$/, @ARGV) ? 2 : 0; -our %MODULES = (); if(grep /^-a$/, @ARGV) { @@ -80,7 +79,7 @@ Multi::Image->spawn(); Multi::Sitemap->spawn(); Multi::Anime->spawn(); Multi::Maintenance->spawn(); -Multi::IRC->spawn(user => 'Multi_test', channel => '#vndb_test') if !$VNDB::DEBUG; +Multi::IRC->spawn() if !$VNDB::DEBUG; $SIG{__WARN__} = sub {(local$_=shift)=~s/\r?\n//;$poe_kernel->call(core=>log=>1,'__WARN__: '.$_)}; |