summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2010-12-19 19:07:27 +0100
committerYorhel <git@yorhel.nl>2010-12-19 19:09:10 +0100
commit234864cf99fd0eb30cdc561e29dda14a1536cacc (patch)
tree2cec80793a8bb82922d53dd4f8fcb0b9fab9c785 /lib
parent1f49d025fb74006d811ab8f39cb6b70d2c0aa447 (diff)
RFC-01: Code/DB cleanup and renamed some stuff for consistency
Diffstat (limited to 'lib')
-rw-r--r--lib/VNDB/DB/ULists.pm8
-rw-r--r--lib/VNDB/Func.pm17
-rw-r--r--lib/VNDB/Handler/Releases.pm6
-rw-r--r--lib/VNDB/Handler/ULists.pm20
-rw-r--r--lib/VNDB/Handler/VNPage.pm6
5 files changed, 21 insertions, 36 deletions
diff --git a/lib/VNDB/DB/ULists.pm b/lib/VNDB/DB/ULists.pm
index 1aedfe80..934cfe84 100644
--- a/lib/VNDB/DB/ULists.pm
+++ b/lib/VNDB/DB/ULists.pm
@@ -23,7 +23,7 @@ sub dbRListGet {
);
return $self->dbAll(q|
- SELECT uid, rid, rstat AS status
+ SELECT uid, rid, status
FROM rlists
!W|,
\%where
@@ -88,7 +88,7 @@ sub dbVNListList {
} @$r;
my $rel = $self->dbAll(q|
- SELECT rv.vid, rr.rid, r.latest, rr.title, rr.original, rr.released, rr.type, rl.rstat AS status
+ SELECT rv.vid, rr.rid, r.latest, rr.title, rr.original, rr.released, rr.type, rl.status
FROM rlists rl
JOIN releases r ON rl.rid = r.id
JOIN releases_rev rr ON rr.id = r.latest
@@ -150,12 +150,12 @@ sub dbVNListDel {
sub dbRListAdd {
my($self, $uid, $rid, $stat) = @_;
$self->dbExec(
- 'UPDATE rlists SET rstat = ? WHERE uid = ? AND rid IN(!l)',
+ 'UPDATE rlists SET status = ? WHERE uid = ? AND rid IN(!l)',
$stat, $uid, ref($rid) ? $rid : [ $rid ]
)
||
$self->dbExec(
- 'INSERT INTO rlists (uid, rid, rstat) VALUES(?, ?, ?)',
+ 'INSERT INTO rlists (uid, rid, status) VALUES(?, ?, ?)',
$uid, $rid, $stat
);
}
diff --git a/lib/VNDB/Func.pm b/lib/VNDB/Func.pm
index dcec9e8f..bb8ad775 100644
--- a/lib/VNDB/Func.pm
+++ b/lib/VNDB/Func.pm
@@ -7,7 +7,7 @@ use YAWF ':html';
use Exporter 'import';
use POSIX 'strftime', 'ceil', 'floor';
use VNDBUtil;
-our @EXPORT = (@VNDBUtil::EXPORT, qw| liststat clearfloat cssicon tagscore mt minage fil_parse fil_serialize |);
+our @EXPORT = (@VNDBUtil::EXPORT, qw| clearfloat cssicon tagscore mt minage fil_parse fil_serialize |);
# three ways to represent the same information
@@ -16,21 +16,6 @@ our @fil_escape = split //, $fil_escape;
our %fil_escape = map +($fil_escape[$_], sprintf '%02d', $_), 0..$#fil_escape;
-# Argument: hashref with rstat and vstat
-# Returns: empty string if not in list, otherwise colour-encoded list status
-sub liststat {
- my $l = shift;
- return '' if !$l;
- my $rs = mt('_rlst_rstat_'.$l->{rstat});
- $rs = qq|<b class="done">$rs</b>| if $l->{rstat} == 2; # Obtained
- $rs = qq|<b class="todo">$rs</b>| if $l->{rstat} < 2; # Unknown/pending
- my $vs = mt('_rlst_vstat_'.$l->{vstat});
- $vs = qq|<b class="done">$vs</b>| if $l->{vstat} == 2; # Finished
- $vs = qq|<b class="todo">$vs</b>| if $l->{vstat} == 0 || $l->{vstat} == 4; # Unknown/dropped
- return "$rs / $vs";
-}
-
-
# Clears a float, to make sure boxes always have the correct height
sub clearfloat {
div class => 'clearfloat', '';
diff --git a/lib/VNDB/Handler/Releases.pm b/lib/VNDB/Handler/Releases.pm
index 6b9dbd8f..5a040b22 100644
--- a/lib/VNDB/Handler/Releases.pm
+++ b/lib/VNDB/Handler/Releases.pm
@@ -242,10 +242,10 @@ sub _infotable {
td;
Select id => 'listsel', name => $self->authGetCode("/r$r->{id}/list");
option value => -2,
- mt !$rl ? '_relinfo_user_notlist' : ('_relinfo_user_inlist', mt('_rlst_stat_'.$rl->{status}));
+ mt !$rl ? '_relinfo_user_notlist' : ('_relinfo_user_inlist', mt('_rlist_status_'.$rl->{status}));
optgroup label => mt '_relinfo_user_setstatus';
- option value => $_, mt '_rlst_stat_'.$_
- for (@{$self->{rlst_rstat}});
+ option value => $_, mt '_rlist_status_'.$_
+ for (@{$self->{rlist_status}});
end;
option value => -1, mt '_relinfo_user_del' if $rl;
end;
diff --git a/lib/VNDB/Handler/ULists.pm b/lib/VNDB/Handler/ULists.pm
index f89e5e56..d13c63cb 100644
--- a/lib/VNDB/Handler/ULists.pm
+++ b/lib/VNDB/Handler/ULists.pm
@@ -65,7 +65,7 @@ sub vnlist_e {
return if !$self->authCheckCode;
my $f = $self->formValidate(
- { name => 'e', enum => [ -1, @{$self->{rlst_vstat}} ] }
+ { name => 'e', enum => [ -1, @{$self->{vnlist_status}} ] }
);
return 404 if $f->{_err};
@@ -93,7 +93,7 @@ sub rlist_e {
return if !$self->authCheckCode;
my $f = $self->formValidate(
- { name => 'e', required => 1, enum => [ -1, @{$self->{rlst_rstat}} ] }
+ { name => 'e', required => 1, enum => [ -1, @{$self->{rlist_status}} ] }
);
return 404 if $f->{_err};
@@ -294,8 +294,8 @@ sub vnlist {
my $frm = $self->formValidate(
{ name => 'vid', required => 0, default => 0, multi => 1, template => 'int' },
{ name => 'rid', required => 0, default => 0, multi => 1, template => 'int' },
- { name => 'vns', required => 1, enum => [ -2, -1, @{$self->{rlst_vstat}} ] },
- { name => 'rel', required => 1, enum => [ -2, -1, @{$self->{rlst_rstat}} ] },
+ { name => 'vns', required => 1, enum => [ -2, -1, @{$self->{vnlist_status}} ] },
+ { name => 'rel', required => 1, enum => [ -2, -1, @{$self->{rlist_status}} ] },
);
my @vid = grep $_ > 0, @{$frm->{vid}};
my @rid = grep $_ > 0, @{$frm->{rid}};
@@ -388,7 +388,7 @@ sub _vnlist_browse {
td class => 'tc3_5', colspan => 3;
a href => "/v$i->{vid}", title => $i->{original}||$i->{title}, shorten $i->{title}, 70;
end;
- td class => 'tc6', $i->{status} ? mt '_vnlst_stat_'.$i->{status} : '';
+ td class => 'tc6', $i->{status} ? mt '_vnlist_status_'.$i->{status} : '';
td class => 'tc7';
my $obtained = grep $_->{status}==2, @{$i->{rels}};
my $total = scalar @{$i->{rels}};
@@ -414,7 +414,7 @@ sub _vnlist_browse {
td class => 'tc5';
a href => "/r$_->{rid}", title => $_->{original}||$_->{title}, shorten $_->{title}, 50;
end;
- td class => 'tc6', $_->{status} ? mt '_rlst_stat_'.$_->{status} : '';
+ td class => 'tc6', $_->{status} ? mt '_rlist_status_'.$_->{status} : '';
td class => 'tc7_8', colspan => 2, '';
end;
}
@@ -428,16 +428,16 @@ sub _vnlist_browse {
Select id => 'vns', name => 'vns';
option value => -2, mt '_rlist_withvn';
optgroup label => mt '_rlist_changestat';
- option value => $_, mt "_vnlst_stat_$_"
- for (@{$self->{rlst_vstat}});
+ option value => $_, mt "_vnlist_status_$_"
+ for (@{$self->{vnlist_status}});
end;
option value => -1, mt '_rlist_del';
end;
Select id => 'rel', name => 'rel';
option value => -2, mt '_rlist_withrel';
optgroup label => mt '_rlist_changestat';
- option value => $_, mt "_rlst_stat_$_"
- for (@{$self->{rlst_rstat}});
+ option value => $_, mt "_rlist_status_$_"
+ for (@{$self->{rlist_status}});
end;
option value => -1, mt '_rlist_del';
end;
diff --git a/lib/VNDB/Handler/VNPage.pm b/lib/VNDB/Handler/VNPage.pm
index 5a925711..ab10f5e9 100644
--- a/lib/VNDB/Handler/VNPage.pm
+++ b/lib/VNDB/Handler/VNPage.pm
@@ -361,9 +361,9 @@ sub _useroptions {
}
Select id => 'listsel', name => $self->authGetCode("/v$v->{id}/list");
- option $list ? mt '_vnpage_uopt_vnlisted', mt '_vnlst_stat_'.$list->{status} : mt '_vnpage_uopt_novn';
+ option $list ? mt '_vnpage_uopt_vnlisted', mt '_vnlist_status_'.$list->{status} : mt '_vnpage_uopt_novn';
optgroup label => $list ? mt '_vnpage_uopt_changevn' : mt '_vnpage_uopt_addvn';
- option value => $_, mt "_vnlst_stat_$_" for (@{$self->{rlst_vstat}});
+ option value => $_, mt "_vnlist_status_$_" for (@{$self->{rlist_status}});
end;
option value => -1, mt '_vnpage_uopt_delvn' if $list;
end;
@@ -432,7 +432,7 @@ sub _releases {
td class => 'tc5';
if($self->authInfo->{id}) {
a href => "/r$rel->{id}", id => "rlsel_$rel->{id}", class => 'vnrlsel',
- $rel->{ulist} ? mt '_rlst_stat_'.$rel->{ulist}{status} : '--';
+ $rel->{ulist} ? mt '_rlist_status_'.$rel->{ulist}{status} : '--';
} else {
txt ' ';
}