diff options
-rw-r--r-- | ChangeLog | 1 | ||||
-rw-r--r-- | lib/VNDB/DB/ULists.pm | 6 | ||||
-rw-r--r-- | lib/VNDB/Handler/ULists.pm | 14 |
3 files changed, 17 insertions, 4 deletions
@@ -6,6 +6,7 @@ - RFC-01: Added vnlists feature and removed rlists.vstat option - ULists::votelist: Don't give a 404 on /u+/votes when no votes found - Added tab and link for /u+/votes to user tabs & main menu + - ULists::votelist: Added first character selection 2.15 - 2010-12-15 - Removed expand/collapse from history browser and /u+/posts and switched to diff --git a/lib/VNDB/DB/ULists.pm b/lib/VNDB/DB/ULists.pm index 934cfe84..27594a91 100644 --- a/lib/VNDB/DB/ULists.pm +++ b/lib/VNDB/DB/ULists.pm @@ -186,6 +186,12 @@ sub dbVoteGet { $o{vid} ? ( 'n.vid = ?' => $o{vid} ) : (), $o{hide} ? ( 'u.show_list = TRUE' => 1 ) : (), $o{hide_ign} ? ( '(NOT u.ign_votes OR u.id = ?)' => $self->authInfo->{id}||0 ) : (), + $o{vn_char} ? ( 'LOWER(SUBSTR(vr.title, 1, 1)) = ?' => $o{vn_char} ) : (), + defined $o{vn_char} && !$o{vn_char} ? ( + '(ASCII(vr.title) < 97 OR ASCII(vr.title) > 122) AND (ASCII(vr.title) < 65 OR ASCII(vr.title) > 90)' => 1 ) : (), + $o{user_char} ? ( 'LOWER(SUBSTR(u.username, 1, 1)) = ?' => $o{user_char} ) : (), + defined $o{user_char} && !$o{user_char} ? ( + '(ASCII(u.username) < 97 OR ASCII(u.username) > 122) AND (ASCII(u.username) < 65 OR ASCII(u.username) > 90)' => 1 ) : (), ); my @select = ( diff --git a/lib/VNDB/Handler/ULists.pm b/lib/VNDB/Handler/ULists.pm index 660ece00..2ab2e985 100644 --- a/lib/VNDB/Handler/ULists.pm +++ b/lib/VNDB/Handler/ULists.pm @@ -122,6 +122,7 @@ sub votelist { { name => 'p', required => 0, default => 1, template => 'int' }, { name => 'o', required => 0, default => 'd', enum => ['a', 'd'] }, { name => 's', required => 0, default => 'date', enum => [qw|date title vote|] }, + { name => 'c', required => 0, default => 'all', enum => [ 'all', 'a'..'z', 0 ] }, ); my($list, $np) = $self->dbVoteGet( @@ -132,15 +133,20 @@ sub votelist { sort => $f->{s} eq 'title' && $type eq 'v' ? 'username' : $f->{s}, reverse => $f->{o} eq 'd', results => 50, - page => $f->{p} + page => $f->{p}, + $f->{c} ne 'all' ? ($type eq 'u' ? 'vn_char' : 'user_char', $f->{c}) : (), ); - return 404 if !@$list && $type eq 'v'; my $title = mt $type eq 'v' ? '_votelist_title_vn' : '_votelist_title_user', $obj->{title} || $obj->{username}; $self->htmlHeader(noindex => 1, title => $title); $self->htmlMainTabs($type => $obj, 'votes'); div class => 'mainbox'; h1 $title; + p class => 'browseopts'; + for ('all', 'a'..'z', 0) { + a href => "/$type$id/votes?c=$_", $_ eq $f->{c} ? (class => 'optselected') : (), $_ eq 'all' ? mt('_char_all') : $_ ? uc $_ : '#'; + } + end; p mt '_votelist_novotes' if !@$list; end; @@ -149,8 +155,8 @@ sub votelist { items => $list, options => $f, nextpage => $np, - pageurl => "/$type$id/votes?o=$f->{o};s=$f->{s}", - sorturl => "/$type$id/votes", + pageurl => "/$type$id/votes?c=$f->{c};o=$f->{o};s=$f->{s}", + sorturl => "/$type$id/votes?c=$f->{c}", header => [ [ mt('_votelist_col_date'), 'date' ], [ mt('_votelist_col_vote'), 'vote' ], |