From e58e857ec3b3d15e220b665e818f9f29b9ecc48a Mon Sep 17 00:00:00 2001 From: Yorhel Date: Sat, 8 Aug 2009 14:59:33 +0200 Subject: Removed last traces of the category system --- ChangeLog | 1 + data/global.pl | 51 ---------------------------------------------- data/style.css | 33 ------------------------------ lib/VNDB/DB/VN.pm | 23 +++------------------ lib/VNDB/Handler/VNEdit.pm | 7 +++---- lib/VNDB/Handler/VNPage.pm | 48 ++----------------------------------------- static/s/angel/conf | 3 --- static/s/carnevale/conf | 3 --- static/s/ever17_01/conf | 3 --- static/s/fate_01/conf | 3 --- static/s/fate_02/conf | 3 --- static/s/grey/conf | 3 --- static/s/higu/conf | 3 --- static/s/lb/conf | 3 --- static/s/seinarukana/conf | 3 --- static/s/taka/conf | 3 --- static/s/term/conf | 3 --- static/s/tsukihime/conf | 3 --- static/s/tsukihime_02/conf | 3 --- 19 files changed, 9 insertions(+), 193 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0e293f8b..ae8e9380 100644 --- a/ChangeLog +++ b/ChangeLog @@ -11,6 +11,7 @@ - Added OpenSearch plugin + autodetection - Converted font size units to px in the css - Added double-post prevention + - Converted old categories to tags and removed last traces of the category system 2.5 - 2009-07-09 - Hide NSFW images in diff viewer (unless NSFW warnings are disabled) diff --git a/data/global.pl b/data/global.pl index a4cf9fbf..673c3777 100644 --- a/data/global.pl +++ b/data/global.pl @@ -74,57 +74,6 @@ our %S = (%S, [ 'Long', '30 - 50 hours', 'Tsukihime' ], [ 'Very long', '> 50 hours', 'Clannad' ], ], - categories => { - g => [ 'Gameplay', { - aa => 'NVL', # 0..1 - ab => 'ADV', # 0..1 - ac => "Action", - rp => 'RPG', - st => 'Strategy', - si => 'Simulation', - }, 2 ], - p => [ 'Plot', { # 0..1 - li => 'Linear', - br => 'Branching', - }, 3 ], - e => [ 'Elements', { - ac => 'Action', - co => 'Comedy', - dr => 'Drama', - fa => 'Fantasy', - ho => 'Horror', - my => 'Mystery', - ro => 'Romance', - sc => 'School Life', - sf => 'SciFi', - sj => 'Shoujo Ai', - sn => 'Shounen Ai', - }, 1 ], - t => [ 'Time', { # 0..1 - fu => 'Future', - pa => 'Past', - pr => 'Present', - }, 4 ], - l => [ 'Place', { # 0..1 - ea => 'Earth', - fa => "Fantasy world", - sp => 'Space', - }, 5 ], - h => [ 'Protagonist', { # 0..1 - fa => 'Male', - fe => "Female", - }, 6 ], - s => [ 'Sexual content', { - aa => 'Sexual content', - be => 'Bestiality', - in => 'Incest', - lo => 'Lolicon', - sh => 'Shotacon', - ya => 'Yaoi', - yu => 'Yuri', - ra => 'Rape', - }, 7 ], - }, anime_types => [ # AniDB anime type starts counting at 1, 0 = unknown # we start counting at 0, with NULL being unknown diff --git a/data/style.css b/data/style.css index e272ea7f..95a7c81e 100644 --- a/data/style.css +++ b/data/style.css @@ -602,11 +602,6 @@ div.vndetails table dd { margin-left: 90px; } -.catlvl_0, .catlvl_1, .catlvl_2, .catlvl_3 { font-style: normal; } -.catlvl_1 { color: $catlevel1$!important } -.catlvl_2 { color: $catlevel2$!important } -.catlvl_3 { color: $catlevel3$!important } - div.vndetails td.relations dt { float: none; font-style: normal; @@ -802,34 +797,6 @@ a.addnew { margin-right: 3px; } -ul#catselect, ul#catselect ul { - list-style-type: none; - padding: 0; - margin: 0; -} -ul#catselect li { - display: block; - width: 170px; - float: left; - clear: none; - font-weight: bold; -} -ul#catselect li li { - display: list-item; - width: auto; - float: none; - clear: left; - font-weight: normal; - padding: 0 0 0 18px; - margin: 0; - cursor: pointer; - list-style-type: none; - background: url(/f/select.png) no-repeat; -} -ul#catselect li li.inc { background-position: 0px -16px; color: $statok$; } -ul#catselect li li.exc { background-position: 0px -33px; color: $statnok$; } - - diff --git a/lib/VNDB/DB/VN.pm b/lib/VNDB/DB/VN.pm index 254e24e1..23961987 100644 --- a/lib/VNDB/DB/VN.pm +++ b/lib/VNDB/DB/VN.pm @@ -10,7 +10,7 @@ our @EXPORT = qw|dbVNGet dbVNAdd dbVNEdit dbVNImageId dbVNCache dbScreenshotAdd # Options: id, rev, char, search, lang, platform, tags_include, tags_exclude, results, page, order, what -# What: extended categories anime relations screenshots relgraph ranking changes +# What: extended anime relations screenshots relgraph ranking changes sub dbVNGet { my($self, %o) = @_; $o{results} ||= 10; @@ -101,24 +101,14 @@ sub dbVNGet { join(', ', @select), join(' ', @join), \%where, $o{order}, ); - if(@$r && $o{what} =~ /(categories|anime|relations|screenshots)/) { + if(@$r && $o{what} =~ /(anime|relations|screenshots)/) { my %r = map { - $r->[$_]{categories} = []; $r->[$_]{anime} = []; $r->[$_]{relations} = []; $r->[$_]{screenshots} = []; ($r->[$_]{cid}, $_) } 0..$#$r; - if($o{what} =~ /categories/) { - push(@{$r->[$r{$_->{vid}}]{categories}}, [ $_->{cat}, $_->{lvl} ]) for (@{$self->dbAll(q| - SELECT vid, cat, lvl - FROM vn_categories - WHERE vid IN(!l)|, - [ keys %r ] - )}); - } - if($o{what} =~ /anime/) { push(@{$r->[$r{$_->{vid}}]{anime}}, $_) && delete $_->{vid} for (@{$self->dbAll(q| SELECT va.vid, a.* @@ -182,8 +172,7 @@ sub dbVNAdd { # helper function, inserts a producer revision -# Arguments: global revision, item id, { columns in producers_rev + categories + anime + relations + screenshots } -# categories = [ [ catid, level ], .. ] +# Arguments: global revision, item id, { columns in producers_rev + anime + relations + screenshots } # screenshots = [ [ scrid, nsfw, rid ], .. ] # relations = [ [ rel, vid ], .. ] # anime = [ aid, .. ] @@ -196,12 +185,6 @@ sub insert_rev { VALUES (!l)|, [ $cid, $vid, @$o{qw|title original desc alias image img_nsfw length l_wp l_encubed l_renai l_vnn|} ]); - $self->dbExec(q| - INSERT INTO vn_categories (vid, cat, lvl) - VALUES (?, ?, ?)|, - $cid, $_->[0], $_->[1] - ) for (@{$o->{categories}}); - $self->dbExec(q| INSERT INTO vn_screenshots (vid, scr, nsfw, rid) VALUES (?, ?, ?, ?)|, diff --git a/lib/VNDB/Handler/VNEdit.pm b/lib/VNDB/Handler/VNEdit.pm index 2b6e4ac5..feca72d6 100644 --- a/lib/VNDB/Handler/VNEdit.pm +++ b/lib/VNDB/Handler/VNEdit.pm @@ -17,7 +17,7 @@ YAWF::register( sub edit { my($self, $vid, $rev) = @_; - my $v = $vid && $self->dbVNGet(id => $vid, what => 'extended screenshots relations anime categories changes', $rev ? (rev => $rev) : ())->[0]; + my $v = $vid && $self->dbVNGet(id => $vid, what => 'extended screenshots relations anime changes', $rev ? (rev => $rev) : ())->[0]; return 404 if $vid && !$v->{id}; $rev = undef if !$vid || $v->{cid} == $v->{latest}; @@ -72,7 +72,6 @@ sub edit { my %args = ( (map { $_ => $frm->{$_} } qw|title original alias desc length l_wp l_encubed l_renai l_vnn editsum img_nsfw|), anime => [ keys %$anime ], - categories => $v->{categories}, relations => $relations, image => $image, screenshots => $screenshots, @@ -281,7 +280,7 @@ sub _updreverse { # edit all related VNs for my $i (keys %upd) { - my $r = $self->dbVNGet(id => $i, what => 'extended relations categories anime screenshots')->[0]; + my $r = $self->dbVNGet(id => $i, what => 'extended relations anime screenshots')->[0]; my @newrel = map $_->{id} != $vid ? [ $_->{relation}, $_->{id} ] : (), @{$r->{relations}}; push @newrel, [ $upd{$i}, $vid ] if $upd{$i} != -1; $self->dbVNEdit($i, @@ -291,7 +290,7 @@ sub _updreverse { uid => 1, # Multi - hardcoded anime => [ map $_->{id}, @{$r->{anime}} ], screenshots => [ map [ $_->{id}, $_->{nsfw}, $_->{rid} ], @{$r->{screenshots}} ], - ( map { $_ => $r->{$_} } qw| title original desc alias categories img_nsfw length l_wp l_encubed l_renai l_vnn image | ) + ( map { $_ => $r->{$_} } qw| title original desc alias img_nsfw length l_wp l_encubed l_renai l_vnn image | ) ); } } diff --git a/lib/VNDB/Handler/VNPage.pm b/lib/VNDB/Handler/VNPage.pm index ed8ad7c0..0563c1dc 100644 --- a/lib/VNDB/Handler/VNPage.pm +++ b/lib/VNDB/Handler/VNPage.pm @@ -37,7 +37,7 @@ sub page { my $v = $self->dbVNGet( id => $vid, - what => 'extended categories anime relations screenshots ranking'.($rev ? ' changes' : ''), + what => 'extended anime relations screenshots ranking'.($rev ? ' changes' : ''), $rev ? (rev => $rev) : (), )->[0]; return 404 if !$v->{id}; @@ -120,7 +120,6 @@ sub page { } _producers($self, \$i, $r); - _categories($self, \$i, $v) if @{$v->{categories}}; _relations($self, \$i, $v) if @{$v->{relations}}; _anime($self, \$i, $v) if @{$v->{anime}}; _useroptions($self, \$i, $v) if $self->authInfo->{id}; @@ -173,7 +172,7 @@ sub _revision { return if !$rev; my $prev = $rev && $rev > 1 && $self->dbVNGet( - id => $v->{id}, rev => $rev-1, what => 'extended categories anime relations screenshots changes' + id => $v->{id}, rev => $rev-1, what => 'extended anime relations screenshots changes' )->[0]; $self->htmlRevision('v', $prev, $v, @@ -194,10 +193,6 @@ sub _revision { [ l_vnn => 'V-N.net link', htmlize => sub { $_[0] ? sprintf '%1$d', xml_escape $_[0] : '[no link]' }], - [ categories => 'Categories', join => ', ', split => sub { - my @r = map $self->{categories}{substr($_->[0],0,1)}[1]{substr($_->[0],1,2)}."($_->[1])", sort { $a->[0] cmp $b->[0] } @{$_[0]}; - return @r ? @r : ('[no categories selected]'); - }], [ relations => 'Relations', join => '
', split => sub { my @r = map sprintf('%s: %s', $self->{vn_relations}[$_->{relation}][0], $_->{id}, xml_escape($_->{original}||$_->{title}), xml_escape shorten $_->{title}, 40 @@ -254,45 +249,6 @@ sub _producers { } -sub _categories { - my($self, $i, $v) = @_; - - # create an ordered list of selected categories in the form of: [ parent, [ p, sub, lvl ], .. ], .. - my @cat; - my %nolvl = (map {$_=>1} qw| pli pbr gaa gab hfa hfe |); - for my $cp (qw|e s g p h|) { - my $thisparent = 0; - my @sel = sort { $a->[0] cmp $b->[0] } grep substr($_->[0], 0, 1) eq $cp, @{$v->{categories}}; - if(@sel) { - push @cat, [ $self->{categories}{$cp}[0] ]; - push @{$cat[$#cat]}, map [ $cp, substr($_->[0],1,2), $nolvl{$_->[0]} ? 0 : $_->[1] ], @sel; - } - } - my @placetime = grep $_->[0] =~ /^[tl]/, @{$v->{categories}}; - if(@placetime) { - push @cat, [ 'Place/Time' ]; - push @{$cat[$#cat]}, map [ substr($_->[0],0,1), substr($_->[0],1,2), 0], sort { $a->[0] cmp $b->[0] } @placetime; - } - - # format & output categories - Tr ++$$i % 2 ? (class => 'odd') : (); - td 'Categories'; - td; - dl id => 'vncats', style => 'display: none'; - dt 'Note:'; dd "The category system is outdated, please use tags instead.\n\n"; - for (@cat) { - dt shift(@$_).':'; - dd; - lit join ', ', map qq|$self->{categories}{$_->[0]}[1]{$_->[1]}|, @$_; - end; - } - end; - a href => '#', onclick => "document.getElementById('vncats').style.display='';this.style.display='none';return false", 'Show categories'; - end; - end; -} - - sub _relations { my($self, $i, $v) = @_; diff --git a/static/s/angel/conf b/static/s/angel/conf index 88c96699..94a9e96b 100644 --- a/static/s/angel/conf +++ b/static/s/angel/conf @@ -27,9 +27,6 @@ imglefttop bg.jpg imgrighttop bgright.jpg // misc colors -catlevel1 #444 // category levels -catlevel2 #777 -catlevel3 #fff diffadd #354 // background color of changes in the diff viewer diffdel #534 warnbg #534 // background color of a warning box diff --git a/static/s/carnevale/conf b/static/s/carnevale/conf index 62df7753..5a735ff2 100644 --- a/static/s/carnevale/conf +++ b/static/s/carnevale/conf @@ -30,9 +30,6 @@ imglefttop 0 imgrighttop bgright.jpg // misc colors -catlevel1 #677c6d // category levels -catlevel2 #b9c7ae -catlevel3 #dab0fc diffadd #76a3b8 // background color of changes in the diff viewer diffdel #354554 warnbg #5d182b // background color of a warning box diff --git a/static/s/ever17_01/conf b/static/s/ever17_01/conf index bbfdbcc2..817bc04c 100644 --- a/static/s/ever17_01/conf +++ b/static/s/ever17_01/conf @@ -30,9 +30,6 @@ imglefttop 0 imgrighttop bgright.jpg // misc colors -catlevel1 #785a5b // category levels -catlevel2 #3c363f -catlevel3 #ff9013 diffadd #f1a361 // background color of changes in the diff viewer diffdel #9a7071 warnbg #c43f5c // background color of a warning box diff --git a/static/s/fate_01/conf b/static/s/fate_01/conf index 976397d8..142a60d6 100644 --- a/static/s/fate_01/conf +++ b/static/s/fate_01/conf @@ -29,9 +29,6 @@ boxbg #4d3c3abc // RGBA, background color of the boxes, stacked for menu imglefttop bg.jpg // misc colors -catlevel1 #200b0c // category levels -catlevel2 #ab928d -catlevel3 #d56243 diffadd #4d2c25 // background color of changes in the diff viewer diffdel #6f5347 warnbg #882f27 // background color of a warning box diff --git a/static/s/fate_02/conf b/static/s/fate_02/conf index bca1371d..6e31716c 100644 --- a/static/s/fate_02/conf +++ b/static/s/fate_02/conf @@ -29,9 +29,6 @@ boxbg #c6093366 // RGBA, background color of the boxes, stacked for menu imglefttop bg.jpg // misc colors -catlevel1 #ab928d // category levels -catlevel2 #fcfbfb -catlevel3 #48b2c1 diffadd #3d3231 // background color of changes in the diff viewer diffdel #01023f warnbg #772446 // background color of a warning box diff --git a/static/s/grey/conf b/static/s/grey/conf index 19d5aced..9de205ad 100644 --- a/static/s/grey/conf +++ b/static/s/grey/conf @@ -27,9 +27,6 @@ imglefttop bg.jpg imgrighttop bgright.jpg // misc colors -catlevel1 #555 -catlevel2 #333 -catlevel3 #000 diffadd #cfc diffdel #fcc warnbg #fcc diff --git a/static/s/higu/conf b/static/s/higu/conf index 8d5e2864..74108144 100644 --- a/static/s/higu/conf +++ b/static/s/higu/conf @@ -29,9 +29,6 @@ boxbg #f7c7bb80 // RGBA, background color of the boxes, stacked for menu imglefttop bg.jpg // misc colors -catlevel1 #8c5b3b // category levels -catlevel2 #2c1a18 -catlevel3 #c24857 diffadd #c2bcc6 // background color of changes in the diff viewer diffdel #8c5b3b warnbg #ae6866 // background color of a warning box diff --git a/static/s/lb/conf b/static/s/lb/conf index cb80e24e..b56996dc 100644 --- a/static/s/lb/conf +++ b/static/s/lb/conf @@ -27,9 +27,6 @@ imglefttop bg.jpg imgrighttop 0 // misc colors -catlevel1 #999 -catlevel2 #444 -catlevel3 #000 diffadd #cfc diffdel #fcc warnbg #fff diff --git a/static/s/seinarukana/conf b/static/s/seinarukana/conf index 11f1f145..bca7746b 100644 --- a/static/s/seinarukana/conf +++ b/static/s/seinarukana/conf @@ -29,9 +29,6 @@ boxbg #fde9e688 // RGBA, background color of the boxes, stacked for menu imglefttop bg.jpg // misc colors -catlevel1 #a69497 // category levels -catlevel2 #131838 -catlevel3 #f288a4 diffadd #3689b5 // background color of changes in the diff viewer diffdel #b7adc6 warnbg #ee3970 // background color of a warning box diff --git a/static/s/taka/conf b/static/s/taka/conf index c58e35ee..11b0a402 100644 --- a/static/s/taka/conf +++ b/static/s/taka/conf @@ -31,9 +31,6 @@ imglefttop 0 imgrighttop bgright.jpg // misc colors -catlevel1 #4b2427 // category levels -catlevel2 #fefefc -catlevel3 #ffaa88 diffadd #5ed8e5 // background color of changes in the diff viewer diffdel #4b2427 warnbg #008278 // background color of a warning box diff --git a/static/s/term/conf b/static/s/term/conf index 64530d2c..921e3566 100644 --- a/static/s/term/conf +++ b/static/s/term/conf @@ -27,9 +27,6 @@ imglefttop 0 imgrighttop 0 // misc colors -catlevel1 #444 -catlevel2 #777 -catlevel3 #999 diffadd #cfc diffdel #fcc warnbg #000 diff --git a/static/s/tsukihime/conf b/static/s/tsukihime/conf index da41d64c..47519700 100644 --- a/static/s/tsukihime/conf +++ b/static/s/tsukihime/conf @@ -30,9 +30,6 @@ imglefttop bg.jpg imgrighttop bgright.jpg // misc colors -catlevel1 #240f21 // category levels -catlevel2 #ffffff -catlevel3 #dd0b48 diffadd #87705c // background color of changes in the diff viewer diffdel #374d77 warnbg #76a1cd // background color of a warning box diff --git a/static/s/tsukihime_02/conf b/static/s/tsukihime_02/conf index d395025b..a5db55f2 100644 --- a/static/s/tsukihime_02/conf +++ b/static/s/tsukihime_02/conf @@ -29,9 +29,6 @@ boxbg #35020990 // RGBA, background color of the boxes, stacked for menu imglefttop bg.jpg // misc colors -catlevel1 #412651 // category levels -catlevel2 #e25e52 -catlevel3 #d79a7e diffadd #d79a7e // background color of changes in the diff viewer diffdel #412651 warnbg #46285a // background color of a warning box -- cgit v1.2.3