summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--data/global.pl1
-rw-r--r--data/lang.txt12
-rw-r--r--data/script.js6
-rw-r--r--lib/VNDB/Handler/Users.pm7
-rw-r--r--lib/VNDB/Handler/VNPage.pm5
-rw-r--r--util/sql/all.sql2
-rw-r--r--util/updates/update_2.25.sql1
7 files changed, 26 insertions, 8 deletions
diff --git a/data/global.pl b/data/global.pl
index 4aa2f200..ef368d61 100644
--- a/data/global.pl
+++ b/data/global.pl
@@ -37,6 +37,7 @@ our %S = (%S,
# bit flags (Flag 8 was used for staffedit)
permissions => {qw| board 1 boardmod 2 edit 4 staffedit 4 tag 16 dbmod 32 tagmod 64 usermod 128 affiliate 256 |},
default_perm => 1+4+16, # Keep synchronised with the default value of users.perm
+ default_tags_cat=> 'cont,tech',
languages => [qw|ar ca cs da de en es fi fr he hu id it ja ko nl no pl pt-br pt-pt ro ru sk sv tr uk vi zh|],
producer_types => [qw|co in ng|],
discussion_boards => [qw|an db ge v p u|], # <- note that some properties of these boards are hard-coded
diff --git a/data/lang.txt b/data/lang.txt
index 9626176d..bb4a1a13 100644
--- a/data/lang.txt
+++ b/data/lang.txt
@@ -12556,6 +12556,18 @@ tr*:
uk*:
it*:
+:_usere_tagcats
+en : Tag categories
+ru*:
+cs*:
+hu*:
+nl*:
+de*:
+es*:
+tr*:
+uk*:
+it*:
+
:_usere_skin
en : Preferred skin
ru : Предпочитаемая шкурка
diff --git a/data/script.js b/data/script.js
index a1e74608..f3e97985 100644
--- a/data/script.js
+++ b/data/script.js
@@ -495,7 +495,7 @@ function tvsInit() {
var l = byName(byId('tagops'), 'a');
for(var i=0;i<l.length; i++)
l[i].onclick = tvsClick;
- tvsSet(getCookie('tagspoil'), hasClass(l[6], 'tsel'), (getCookie('tagcat')||'cont,tech').split(','));
+ tvsSet(getCookie('tagspoil'));
}
function tvsClick() {
@@ -505,8 +505,7 @@ function tvsClick() {
if(l[i] == this) {
if(i < 3) { /* categories */
setClass(l[i], 'tsel', !hasClass(l[i], 'tsel'));
- var c = tvsSet();
- setCookie('tagcat', c.length ? c.join(',') : '-');
+ tvsSet();
} else if(i < 6) { /* spoiler level */
tvsSet(i-3, null);
setCookie('tagspoil', i-3);
@@ -556,7 +555,6 @@ function tvsSet(lvl, lim, cats) {
} else
setClass(l[i], 'hidden', true);
}
- return cat;
}
tvsInit();
diff --git a/lib/VNDB/Handler/Users.pm b/lib/VNDB/Handler/Users.pm
index 32b1d205..0068768d 100644
--- a/lib/VNDB/Handler/Users.pm
+++ b/lib/VNDB/Handler/Users.pm
@@ -375,6 +375,7 @@ sub edit {
{ post => 'hide_list', required => 0, default => 0, enum => [0,1] },
{ post => 'show_nsfw', required => 0, default => 0, enum => [0,1] },
{ post => 'tags_all', required => 0, default => 0, enum => [0,1] },
+ { post => 'tags_cat', required => 0, multi => 1, enum => [qw|cont ero tech|] },
{ post => 'skin', required => 0, default => $self->{skin_default}, enum => [ keys %{$self->{skins}} ] },
{ post => 'customcss', required => 0, maxlength => 2000, default => '' },
);
@@ -383,6 +384,9 @@ sub edit {
if(!$frm->{_err}) {
$frm->{skin} = '' if $frm->{skin} eq $self->{skin_default};
$self->dbUserPrefSet($uid, $_ => $frm->{$_}) for (qw|skin customcss show_nsfw tags_all hide_list |);
+
+ my $tags_cat = join(',', sort @{$frm->{tags_cat}}) || 'none';
+ $self->dbUserPrefSet($uid, tags_cat => $tags_cat eq $self->{default_tags_cat} ? '' : $tags_cat);
my %o;
if($self->authCan('usermod')) {
$o{username} = $frm->{usrname} if $frm->{usrname};
@@ -402,6 +406,7 @@ sub edit {
$frm->{mail} ||= $u->{mail};
$frm->{perms} ||= [ grep $u->{perm} & $self->{permissions}{$_}, keys %{$self->{permissions}} ];
$frm->{$_} //= $u->{prefs}{$_} for(qw|skin customcss show_nsfw tags_all hide_list|);
+ $frm->{tags_cat} ||= [ split /,/, $u->{prefs}{tags_cat}||$self->{default_tags_cat} ];
$frm->{ign_votes} = $u->{ign_votes} if !defined $frm->{ign_votes};
$frm->{skin} ||= $self->{skin_default};
@@ -437,6 +442,8 @@ sub edit {
[ check => short => 'hide_list', name => mt '_usere_flist', "/u$uid/list", "/u$uid/votes", "/u$uid/wish" ],
[ check => short => 'show_nsfw', name => mt '_usere_fnsfw' ],
[ check => short => 'tags_all', name => mt '_usere_ftags' ],
+ [ select => short => 'tags_cat', name => mt('_usere_tagcats'), multi => 1, size => 3, options => [
+ map [ $_, mt '_tagcat_'.$_ ], qw|cont ero tech| ] ],
[ select => short => 'skin', name => mt('_usere_skin'), width => 300, options => [
map [ $_, $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' ],
diff --git a/lib/VNDB/Handler/VNPage.pm b/lib/VNDB/Handler/VNPage.pm
index ef808d82..669ea7b7 100644
--- a/lib/VNDB/Handler/VNPage.pm
+++ b/lib/VNDB/Handler/VNPage.pm
@@ -625,9 +625,8 @@ sub page {
if(@$t) {
div id => 'tagops';
# NOTE: order of these links is hardcoded in JS
- a href => '#cont', lc mt '_tagcat_cont';
- a href => '#ero', lc mt '_tagcat_ero';
- a href => '#tech', lc mt '_tagcat_tech';
+ my $tags_cat = $self->authPref('tags_cat') || $self->{default_tags_cat};
+ a href => "#$_", $tags_cat =~ /\Q$_/ ? (class => 'tsel') : (), lc mt "_tagcat_$_" for qw|cont ero tech|;
a href => '#', class => 'sec tsel', mt '_vnpage_tags_spoil0';
a href => '#', mt '_vnpage_tags_spoil1';
a href => '#', mt '_vnpage_tags_spoil2';
diff --git a/util/sql/all.sql b/util/sql/all.sql
index fc32d3c4..e87c6e28 100644
--- a/util/sql/all.sql
+++ b/util/sql/all.sql
@@ -15,7 +15,7 @@ CREATE TYPE medium AS ENUM ('cd', 'dvd', 'gdr', 'blr', 'flp', 'mrt',
CREATE TYPE notification_ntype AS ENUM ('pm', 'dbdel', 'listdel', 'dbedit', 'announce');
CREATE TYPE notification_ltype AS ENUM ('v', 'r', 'p', 'c', 't', 's');
CREATE TYPE platform AS ENUM ('win', 'dos', 'lin', 'mac', 'ios', 'and', 'dvd', 'bdp', 'fmt', 'gba', 'gbc', 'msx', 'nds', 'nes', 'p88', 'p98', 'pce', 'pcf', 'psp', 'ps1', 'ps2', 'ps3', 'ps4', 'psv', 'drc', 'sat', 'sfc', 'wii', 'n3d', 'x68', 'xb1', 'xb3', 'xbo', 'web', 'oth');
-CREATE TYPE prefs_key AS ENUM ('l10n', 'skin', 'customcss', 'filter_vn', 'filter_release', 'show_nsfw', 'hide_list', 'notify_nodbedit', 'notify_announce', 'vn_list_own', 'vn_list_wish', 'tags_all');
+CREATE TYPE prefs_key AS ENUM ('l10n', 'skin', 'customcss', 'filter_vn', 'filter_release', 'show_nsfw', 'hide_list', 'notify_nodbedit', 'notify_announce', 'vn_list_own', 'vn_list_wish', 'tags_all', 'tags_cat');
CREATE TYPE producer_relation AS ENUM ('old', 'new', 'sub', 'par', 'imp', 'ipa', 'spa', 'ori');
CREATE TYPE release_type AS ENUM ('complete', 'partial', 'trial');
CREATE TYPE tag_category AS ENUM('cont', 'ero', 'tech');
diff --git a/util/updates/update_2.25.sql b/util/updates/update_2.25.sql
index 05839565..ef1917ef 100644
--- a/util/updates/update_2.25.sql
+++ b/util/updates/update_2.25.sql
@@ -40,4 +40,5 @@ UPDATE stats_cache SET count = (SELECT COUNT(*) FROM staff WHERE hidden = FA
-- New preferences
ALTER TYPE prefs_key ADD VALUE 'tags_all';
+ALTER TYPE prefs_key ADD VALUE 'tags_cat';