summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--data/docs/917
-rw-r--r--data/global.pl2
-rw-r--r--data/style.css4
-rw-r--r--lib/VNDB/DB/Discussions.pm54
-rw-r--r--lib/VNDB/Handler/Discussions.pm68
-rw-r--r--lib/VNDB/Util/FormHTML.pm4
-rw-r--r--util/updates/update_2.3.sql5
7 files changed, 80 insertions, 74 deletions
diff --git a/data/docs/9 b/data/docs/9
index fd6da75e..f5ee46ab 100644
--- a/data/docs/9
+++ b/data/docs/9
@@ -5,29 +5,30 @@
:SUB:Introduction
<p>
VNDB has a nicely integrated discussion board which can be used for, well,
- discussions. As we're not using any popular and freely available forum software
+ discussions. As we're not using any popular or freely available forum software
and have instead written something by ourselves, this discussion board has a
few slight differences with the popular boards you're used to.
</p>
-:SUB:Tags
+:SUB:Boards
<p>
- To make sure interested people can find your post, all threads have 'tags'
- that define what the discussion is about. It's possible to add more than
- one tag to a thread. The following tags can be used:
+ To make sure interested people can find your post, all threads have relations
+ to one or more 'boards' that define what the discussion is about. This is similar
+ to boards on other forums, but here every item in the DB has its own board, and
+ it's possible to link a thread to more than one board. The following boards can be used:
</p>
<dl>
<dt>db</dt><dd>
- VNDB Discussions. This is a general tag for threads not about any specific
+ VNDB Discussions. This is a general board for threads not about any specific
entry in the database.
</dd><dt>v#</dt><dd>
- For discussions about a particular visual novel. The tag <i>v17</i>, for example,
+ For discussions about a particular visual novel. The board <i>v17</i>, for example,
is used for all threads related to <a href="/v17">v17</a>.
</dd><dt>p#</dt><dd>
Same as <i>v#</i>, but for producers.
</dd><dt>u#</dt><dd>
- The <i>u#</i> tag can be used to notify a user on this site about something
+ The <i>u#</i> board can be used to notify a user on this site about something
he/she must see or to discuss about an edit he/she has made. This is similar
to the 'private message' feature of most sites, except it's not 'private'...
</dd><dt>an</dt><dd>
diff --git a/data/global.pl b/data/global.pl
index 0a67bef8..739578bf 100644
--- a/data/global.pl
+++ b/data/global.pl
@@ -58,7 +58,7 @@ our %S = (%S,
in => 'Individual',
ng => 'Amateur group',
},
- discussion_tags => {
+ discussion_boards => {
an => 'Announcements', # 0 - usage restricted to boardmods
db => 'VNDB Discussions', # 0
v => 'Visual novels', # vid
diff --git a/data/style.css b/data/style.css
index 679ca282..152b2746 100644
--- a/data/style.css
+++ b/data/style.css
@@ -509,11 +509,11 @@ div.mainbox.discussions td.tc4 {
div.mainbox.discussions a.locked {
text-decoration: line-through;
}
-div.mainbox.discussions td.tags {
+div.mainbox.discussions td.boards {
padding-top: 0;
padding-left: 60px;
}
-div.mainbox.discussions td.tags a {
+div.mainbox.discussions td.boards a {
color: $grayedout$!important
}
div.discussions td.tc2 { width: 50px; }
diff --git a/lib/VNDB/DB/Discussions.pm b/lib/VNDB/DB/Discussions.pm
index 1e626c57..7daf2f25 100644
--- a/lib/VNDB/DB/Discussions.pm
+++ b/lib/VNDB/DB/Discussions.pm
@@ -9,7 +9,7 @@ our @EXPORT = qw|dbThreadGet dbThreadEdit dbThreadAdd dbPostGet dbPostEdit dbPos
# Options: id, type, iid, results, page, what
-# What: tags, tagtitles, firstpost, lastpost
+# What: boards, boardtitles, firstpost, lastpost
sub dbThreadGet {
my($self, %o) = @_;
$o{results} ||= 50;
@@ -23,9 +23,9 @@ sub dbThreadGet {
!$o{id} ? (
't.hidden = FALSE' => 0 ) : (),
$o{type} && !$o{iid} ? (
- 't.id IN(SELECT tid FROM threads_tags WHERE type = ?)' => $o{type} ) : (),
+ 't.id IN(SELECT tid FROM threads_boards WHERE type = ?)' => $o{type} ) : (),
$o{type} && $o{iid} ? (
- 'tt.type = ?' => $o{type}, 'tt.iid = ?' => $o{iid} ) : (),
+ 'tb.type = ?' => $o{type}, 'tb.iid = ?' => $o{iid} ) : (),
);
my @select = (
@@ -44,7 +44,7 @@ sub dbThreadGet {
'JOIN users ul ON ul.id = tpl.uid'
) : (),
$o{type} && $o{iid} ?
- 'JOIN threads_tags tt ON tt.tid = t.id' : (),
+ 'JOIN threads_boards tb ON tb.tid = t.id' : (),
);
my($r, $np) = $self->dbPage(\%o, q|
@@ -56,30 +56,30 @@ sub dbThreadGet {
join(', ', @select), join(' ', @join), \%where, $o{order}
);
- if($o{what} =~ /(tags|tagtitles)/ && $#$r >= 0) {
+ if($o{what} =~ /(boards|boardtitles)/ && $#$r >= 0) {
my %r = map {
- $r->[$_]{tags} = [];
+ $r->[$_]{boards} = [];
($r->[$_]{id}, $_)
} 0..$#$r;
- if($o{what} =~ /tags/) {
- ($_->{type}=~s/ +//||1) && push(@{$r->[$r{$_->{tid}}]{tags}}, [ $_->{type}, $_->{iid} ]) for (@{$self->dbAll(q|
+ if($o{what} =~ /boards/) {
+ ($_->{type}=~s/ +//||1) && push(@{$r->[$r{$_->{tid}}]{boards}}, [ $_->{type}, $_->{iid} ]) for (@{$self->dbAll(q|
SELECT tid, type, iid
- FROM threads_tags
+ FROM threads_boards
WHERE tid IN(!l)|,
[ keys %r ]
)});
}
- if($o{what} =~ /tagtitles/) {
- ($_->{type}=~s/ +//||1) && push(@{$r->[$r{$_->{tid}}]{tags}}, $_) for (@{$self->dbAll(q|
- SELECT tt.tid, tt.type, tt.iid, COALESCE(u.username, vr.title, pr.name) AS title, COALESCE(u.username, vr.original, pr.original) AS original
- FROM threads_tags tt
- LEFT JOIN vn v ON tt.type = 'v' AND v.id = tt.iid
+ if($o{what} =~ /boardtitles/) {
+ ($_->{type}=~s/ +//||1) && push(@{$r->[$r{$_->{tid}}]{boards}}, $_) for (@{$self->dbAll(q|
+ SELECT tb.tid, tb.type, tb.iid, COALESCE(u.username, vr.title, pr.name) AS title, COALESCE(u.username, vr.original, pr.original) AS original
+ FROM threads_boards tb
+ LEFT JOIN vn v ON tb.type = 'v' AND v.id = tb.iid
LEFT JOIN vn_rev vr ON vr.id = v.latest
- LEFT JOIN producers p ON tt.type = 'p' AND p.id = tt.iid
+ LEFT JOIN producers p ON tb.type = 'p' AND p.id = tb.iid
LEFT JOIN producers_rev pr ON pr.id = p.latest
- LEFT JOIN users u ON tt.type = 'u' AND u.id = tt.iid
- WHERE tt.tid IN(!l)|,
+ LEFT JOIN users u ON tb.type = 'u' AND u.id = tb.iid
+ WHERE tb.tid IN(!l)|,
[ keys %r ]
)});
}
@@ -89,7 +89,7 @@ sub dbThreadGet {
}
-# id, %options->( title locked hidden tags }
+# id, %options->( title locked hidden boards }
sub dbThreadEdit {
my($self, $id, %o) = @_;
@@ -105,18 +105,18 @@ sub dbThreadEdit {
WHERE id = ?|,
\%set, $id);
- if($o{tags}) {
- $self->dbExec('DELETE FROM threads_tags WHERE tid = ?', $id);
+ if($o{boards}) {
+ $self->dbExec('DELETE FROM threads_boards WHERE tid = ?', $id);
$self->dbExec(q|
- INSERT INTO threads_tags (tid, type, iid)
+ INSERT INTO threads_boards (tid, type, iid)
VALUES (?, ?, ?)|,
$id, $_->[0], $_->[1]||0
- ) for (@{$o{tags}});
+ ) for (@{$o{boards}});
}
}
-# %options->{ title hidden locked tags }
+# %options->{ title hidden locked boards }
sub dbThreadAdd {
my($self, %o) = @_;
@@ -128,22 +128,22 @@ sub dbThreadAdd {
)->{id};
$self->dbExec(q|
- INSERT INTO threads_tags (tid, type, iid)
+ INSERT INTO threads_boards (tid, type, iid)
VALUES (?, ?, ?)|,
$id, $_->[0], $_->[1]||0
- ) for (@{$o{tags}});
+ ) for (@{$o{boards}});
return $id;
}
-# Returns thread count of a specific item tag
+# Returns thread count of a specific item board
# Arguments: type, iid
sub dbThreadCount {
my($self, $type, $iid) = @_;
return $self->dbRow(q|
SELECT COUNT(*) AS cnt
- FROM threads_tags
+ FROM threads_boards
WHERE type = ? AND iid = ?|,
$type, $iid)->{cnt};
}
diff --git a/lib/VNDB/Handler/Discussions.pm b/lib/VNDB/Handler/Discussions.pm
index 06693590..ea3367d8 100644
--- a/lib/VNDB/Handler/Discussions.pm
+++ b/lib/VNDB/Handler/Discussions.pm
@@ -11,7 +11,7 @@ use VNDB::Func;
YAWF::register(
qr{t([1-9]\d*)(?:/([1-9]\d*))?} => \&thread,
qr{t([1-9]\d*)\.([1-9]\d*)} => \&redirect,
- qr{t/(db|an|[vpu])([1-9]\d*)?} => \&tagbrowse,
+ qr{t/(db|an|[vpu])([1-9]\d*)?} => \&board,
qr{t([1-9]\d*)/reply} => \&edit,
qr{t([1-9]\d*)\.([1-9]\d*)/edit} => \&edit,
qr{t/(db|an|[vpu])([1-9]\d*)?/new} => \&edit,
@@ -23,7 +23,7 @@ sub thread {
my($self, $tid, $page) = @_;
$page ||= 1;
- my $t = $self->dbThreadGet(id => $tid, what => 'tagtitles')->[0];
+ my $t = $self->dbThreadGet(id => $tid, what => 'boardtitles')->[0];
return 404 if !$t->{id} || $t->{hidden} && !$self->authCan('boardmod');
my $p = $self->dbPostGet(tid => $tid, results => 25, page => $page);
@@ -35,9 +35,9 @@ sub thread {
h1 $t->{title};
h2 'Posted in';
ul;
- for (sort { $a->{type}.$a->{iid} cmp $b->{type}.$b->{iid} } @{$t->{tags}}) {
+ for (sort { $a->{type}.$a->{iid} cmp $b->{type}.$b->{iid} } @{$t->{boards}}) {
li;
- a href => "/t/$_->{type}", $self->{discussion_tags}{$_->{type}};
+ a href => "/t/$_->{type}", $self->{discussion_boards}{$_->{type}};
if($_->{iid}) {
txt ' > ';
a style => 'font-weight: bold', href => "/t/$_->{type}$_->{iid}", "$_->{type}$_->{iid}";
@@ -129,17 +129,17 @@ sub edit {
my($self, $tid, $num) = @_;
$num ||= 0;
- # in case we start a new thread, parse tag
- my $tag = '';
+ # in case we start a new thread, parse boards
+ my $board = '';
if($tid !~ /^\d+$/) {
return 404 if $tid =~ /(db|an)/ && $num || $tid =~ /[vpu]/ && !$num;
- $tag = $tid.($num||'');
+ $board = $tid.($num||'');
$tid = 0;
$num = 0;
}
# get thread and post, if any
- my $t = $tid && $self->dbThreadGet(id => $tid, what => 'tags')->[0];
+ my $t = $tid && $self->dbThreadGet(id => $tid, what => 'boards')->[0];
return 404 if $tid && !$t->{id};
my $p = $num && $self->dbPostGet(tid => $tid, num => $num)->[0];
@@ -156,7 +156,7 @@ sub edit {
$frm = $self->formValidate(
!$tid || $num == 1 ? (
{ name => 'title', maxlength => 50 },
- { name => 'tags', maxlength => 50 },
+ { name => 'boards', maxlength => 50 },
) : (),
$self->authCan('boardmod') ? (
{ name => 'locked', required => 0 },
@@ -166,14 +166,14 @@ sub edit {
{ name => 'msg', maxlenght => 5000 },
);
- # parse and validate the tags
- my @tags;
- if(!$frm->{_err} && $frm->{tags}) {
- for (split /[ ,]/, $frm->{tags}) {
+ # parse and validate the boards
+ my @boards;
+ if(!$frm->{_err} && $frm->{boards}) {
+ for (split /[ ,]/, $frm->{boards}) {
my($ty, $id) = ($1, $2) if /^([a-z]{1,2})([0-9]*)$/;
- push @tags, [ $ty, $id ];
- push @{$frm->{_err}}, [ 'tags', 'wrongtag', $_ ] if
- !$ty || !$self->{discussion_tags}{$ty}
+ push @boards, [ $ty, $id ];
+ push @{$frm->{_err}}, [ 'boards', 'wrongboard', $_ ] if
+ !$ty || !$self->{discussion_boards}{$ty}
|| $ty eq 'an' && ($id || !$self->authCan('boardmod'))
|| $ty eq 'db' && $id
|| $ty eq 'v' && (!$id || !$self->dbVNGet(id => $id)->[0]{id})
@@ -189,7 +189,7 @@ sub edit {
if(!$tid || $num == 1) {
my %thread = (
title => $frm->{title},
- tags => \@tags,
+ boards => \@boards,
hidden => $frm->{hidden},
locked => $frm->{locked},
);
@@ -217,27 +217,27 @@ sub edit {
$frm->{msg} ||= $p->{msg};
$frm->{hidden} = $p->{hidden} if $num != 1 && !exists $frm->{hidden};
if($num == 1) {
- $frm->{tags} ||= join ' ', sort map $_->[1]?$_->[0].$_->[1]:$_->[0], @{$t->{tags}};
+ $frm->{boards} ||= join ' ', sort map $_->[1]?$_->[0].$_->[1]:$_->[0], @{$t->{boards}};
$frm->{title} ||= $t->{title};
$frm->{locked} = $t->{locked} if !exists $frm->{locked};
$frm->{hidden} = $t->{hidden} if !exists $frm->{hidden};
}
}
- $frm->{tags} ||= $tag;
+ $frm->{boards} ||= $board;
$frm->{nolastmod} = 1 if $num && $self->authCan('boardmod') && !exists $frm->{nolastmod};
# generate html
my $title = !$tid ? 'Start new thread' :
!$num ? 'Reply to '.$t->{title} :
'Edit post';
- my $url = !$tid ? "/t/$tag/new" : !$num ? "/t$tid/reply" : "/t$tid.$num/edit";
+ my $url = !$tid ? "/t/$board/new" : !$num ? "/t$tid/reply" : "/t$tid.$num/edit";
$self->htmlHeader(title => $title, noindex => 1);
$self->htmlForm({ frm => $frm, action => $url }, $title => [
[ static => label => 'Username', content => userstr($self->authInfo->{id}, $self->authInfo->{username}) ],
!$tid || $num == 1 ? (
[ input => short => 'title', name => 'Thread title' ],
- [ input => short => 'tags', name => 'Tags' ],
- [ static => content => 'Read <a href="/d9.2">d9.2</a> for information about how to use tags' ],
+ [ input => short => 'boards', name => 'Board(s)' ],
+ [ static => content => 'Read <a href="/d9.2">d9.2</a> for information about how to specify boards' ],
$self->authCan('boardmod') ? (
[ check => name => 'Locked', short => 'locked' ],
) : (),
@@ -257,7 +257,7 @@ sub edit {
}
-sub tagbrowse {
+sub board {
my($self, $type, $iid) = @_;
$iid ||= '';
return 404 if $type =~ /(db|an)/ && $iid;
@@ -273,14 +273,14 @@ sub tagbrowse {
$self->dbVNGet(id => $iid)->[0];
return 404 if $iid && !$obj;
my $ititle = $obj && ($obj->{title}||$obj->{name}||$obj->{username});
- my $title = !$obj ? $self->{discussion_tags}{$type} : 'Related discussions for '.$ititle;
+ my $title = !$obj ? $self->{discussion_boards}{$type} : 'Related discussions for '.$ititle;
my($list, $np) = $self->dbThreadGet(
type => $type,
$iid ? (iid => $iid) : (),
results => 50,
page => $f->{p},
- what => 'firstpost lastpost tagtitles',
+ what => 'firstpost lastpost boardtitles',
order => $type eq 'an' ? 't.id DESC' : 'tpl.date DESC',
);
@@ -292,7 +292,7 @@ sub tagbrowse {
p;
a href => '/t', 'Discussion board';
txt ' > ';
- a href => "/t/$type", $self->{discussion_tags}{$type};
+ a href => "/t/$type", $self->{discussion_boards}{$type};
if($iid) {
txt ' > ';
a style => 'font-weight: bold', href => "/t/$type$iid", "$type$iid";
@@ -324,7 +324,7 @@ sub index {
div class => 'mainbox';
h1 'Discussion board index';
p class => 'browseopts';
- a href => '/t/'.$_, $self->{discussion_tags}{$_}
+ a href => '/t/'.$_, $self->{discussion_boards}{$_}
for (qw|an db v p u|);
end;
end;
@@ -334,11 +334,11 @@ sub index {
type => $_,
results => 5,
page => 1,
- what => 'firstpost lastpost tagtitles',
+ what => 'firstpost lastpost boardtitles',
order => 'tpl.date DESC',
);
h1 class => 'boxtitle';
- a href => "/t/$_", $self->{discussion_tags}{$_};
+ a href => "/t/$_", $self->{discussion_boards}{$_};
end;
_threadlist($self, $list, {p=>1}, 0, "/t");
}
@@ -377,17 +377,17 @@ sub _threadlist {
end;
end;
Tr $n % 2 ? ( class => 'odd' ) : ();
- td colspan => 4, class => 'tags';
+ td colspan => 4, class => 'boards';
txt ' > ';
my $i = 1;
- for(sort { $a->{type}.$a->{iid} cmp $b->{type}.$b->{iid} } @{$o->{tags}}) {
+ for(sort { $a->{type}.$a->{iid} cmp $b->{type}.$b->{iid} } @{$o->{boards}}) {
last if $i++ > 5;
txt ', ' if $i > 2;
a href => "/t/$_->{type}".($_->{iid}||''),
- title => $_->{original}||$self->{discussion_tags}{$_->{type}},
- shorten $_->{title}||$self->{discussion_tags}{$_->{type}}, 30;
+ title => $_->{original}||$self->{discussion_boards}{$_->{type}},
+ shorten $_->{title}||$self->{discussion_boards}{$_->{type}}, 30;
}
- txt ', ...' if @{$o->{tags}} > 5;
+ txt ', ...' if @{$o->{boards}} > 5;
end;
end;
}
diff --git a/lib/VNDB/Util/FormHTML.pm b/lib/VNDB/Util/FormHTML.pm
index b14f83fa..2440187e 100644
--- a/lib/VNDB/Util/FormHTML.pm
+++ b/lib/VNDB/Util/FormHTML.pm
@@ -34,7 +34,7 @@ my %formerr_names = (
platforms => 'Platforms',
producers => 'Producers',
released => 'Release date',
- tags => 'Tags',
+ boards => 'Boards',
title => 'Title',
type => 'Type',
usrname => 'Username',
@@ -80,7 +80,7 @@ sub htmlFormError {
li sprintf '%s should have at least %d characters', $field, $rule if $type eq 'minlength';
li sprintf '%s: only %d characters allowed', $field, $rule if $type eq 'maxlength';
li sprintf '%s must be one of the following: %s', $field, join ', ', @$rule if $type eq 'enum';
- li sprintf 'Wrong tag: %s', $rule if $type eq 'wrongtag';
+ li sprintf 'Wrong board: %s', $rule if $type eq 'wrongboard';
if($type eq 'tagexists') {
li;
lit $rule->{state} != 1 ? qq|Tag <a href="/g$rule->{id}">$rule->{name}</a> already exists!|
diff --git a/util/updates/update_2.3.sql b/util/updates/update_2.3.sql
index 79625714..3853bac1 100644
--- a/util/updates/update_2.3.sql
+++ b/util/updates/update_2.3.sql
@@ -195,3 +195,8 @@ $$ LANGUAGE 'plpgsql';
CREATE TRIGGER users_tags_update AFTER INSERT OR DELETE ON tags_vn FOR EACH ROW EXECUTE PROCEDURE update_users_cache();
+
+
+-- rename threads tags to boards
+ALTER TABLE threads_tags RENAME TO threads_boards;
+