diff options
-rw-r--r-- | lib/VNWeb/HTML.pm | 7 | ||||
-rw-r--r-- | lib/VNWeb/Reviews/Edit.pm | 2 | ||||
-rw-r--r-- | lib/VNWeb/Reviews/Page.pm | 47 | ||||
-rw-r--r-- | lib/VNWeb/VN/Page.pm | 6 |
4 files changed, 29 insertions, 33 deletions
diff --git a/lib/VNWeb/HTML.pm b/lib/VNWeb/HTML.pm index 496427ad..e2d68033 100644 --- a/lib/VNWeb/HTML.pm +++ b/lib/VNWeb/HTML.pm @@ -342,7 +342,7 @@ sub _maintabs_ { return if !$t || !$o; return if $t eq 'g' && !auth->permTagmod; - my $id = $t.$o->{id}; + my $id = $o->{id} =~ /^[0-9]$/ ? $t.$o->{id} : $o->{id}; my sub t { my($tabname, $url, $text) = @_; @@ -766,14 +766,15 @@ sub searchbox_ { sub itemmsg_ { my($type, $obj) = @_; p_ class => 'itemmsg', sub { - if($type ne 'd') { + if($type ne 'd' && $type ne 'w') { if($obj->{entry_locked}) { txt_ 'Locked for editing. '; } elsif(auth && !can_edit $type => $obj) { txt_ 'You can not edit this page. '; } } - a_ href => "/report/$type$obj->{id}", 'Report an issue on this page.'; + my $id = $obj->{id} =~ /^[0-9]*$/ ? "$type$obj->{id}" : $obj->{id}; + a_ href => "/report/$id", 'Report an issue on this page.'; }; } diff --git a/lib/VNWeb/Reviews/Edit.pm b/lib/VNWeb/Reviews/Edit.pm index f32b6b8d..3472d790 100644 --- a/lib/VNWeb/Reviews/Edit.pm +++ b/lib/VNWeb/Reviews/Edit.pm @@ -43,7 +43,7 @@ TUWF::get qr{/$RE{wid}/edit}, sub { return tuwf->resDenied if !can_edit w => $e; $e->{releases} = releases_by_vn $e->{vid}; - framework_ title => "Edit review for $e->{vntitle}", sub { + framework_ title => "Edit review for $e->{vntitle}", type => 'w', dbobj => $e, tab => 'edit', sub { elm_ 'Reviews.Edit' => $FORM_OUT, $e; }; }; diff --git a/lib/VNWeb/Reviews/Page.pm b/lib/VNWeb/Reviews/Page.pm index 27f10920..9d7e894f 100644 --- a/lib/VNWeb/Reviews/Page.pm +++ b/lib/VNWeb/Reviews/Page.pm @@ -31,6 +31,19 @@ sub review_ { my @spoil = $w->{spoiler} ? (class => 'reviewspoil') : (); table_ class => 'fullreview', sub { tr_ sub { + td_ 'Subject'; + td_ sub { + a_ href => "/v$w->{vid}", $w->{title}; + if($w->{rid}) { + br_; + abbr_ class => "icons $_", title => $PLATFORM{$_}, '' for grep $_ ne 'oth', $w->{platforms}->@*; + abbr_ class => "icons lang $_", title => $LANGUAGE{$_}, '' for $w->{lang}->@*; + abbr_ class => "icons rt$w->{rtype}", title => $w->{rtype}, ''; + a_ href => "/r$w->{rid}", title => $w->{roriginal}||$w->{rtitle}, $w->{rtitle}; + } + }; + }; + tr_ sub { td_ 'By'; td_ sub { b_ style => 'float: right', 'Vote: '.fmtvote($w->{vote}) if $w->{vote}; @@ -40,15 +53,6 @@ sub review_ { b_ class => 'grayedout', " last updated on $lastmod" if $lastmod && $date ne $lastmod; } }; - tr_ sub { - td_ 'Release'; - td_ sub { - abbr_ class => "icons $_", title => $PLATFORM{$_}, '' for grep $_ ne 'oth', $w->{platforms}->@*; - abbr_ class => "icons lang $_", title => $LANGUAGE{$_}, '' for $w->{lang}->@*; - abbr_ class => "icons rt$w->{rtype}", title => $w->{rtype}, ''; - a_ href => "/r$w->{rid}", title => $w->{roriginal}||$w->{rtitle}, $w->{rtitle}; - }; - } if $w->{rid}; tr_ class => 'reviewnotspoil', sub { td_ ''; td_ sub { @@ -72,9 +76,10 @@ TUWF::get qr{/$RE{wid}(?:(?<sep>[\./])$RE{num})?}, sub { my($id, $sep, $num) = (tuwf->capture('id'), tuwf->capture('sep')||'', tuwf->capture('num')); my $w = tuwf->dbRowi( 'SELECT r.id, r.vid, r.rid, r.isfull, r.text, r.spoiler, COALESCE(c.count,0) AS count, r.c_up, r.c_down, uv.vote, rm.id IS NULL AS can - , rel.title AS rtitle, rel.original AS roriginal, rel.type AS rtype, rv.vote AS my + , v.title, rel.title AS rtitle, rel.original AS roriginal, rel.type AS rtype, rv.vote AS my , ', sql_user(), ',', sql_totime('r.date'), 'AS date,', sql_totime('r.lastmod'), 'AS lastmod FROM reviews r + JOIN vn v ON v.id = r.vid LEFT JOIN releases rel ON rel.id = r.rid LEFT JOIN users u ON u.id = r.uid LEFT JOIN ulist_vns uv ON uv.uid = r.uid AND uv.vid = r.vid @@ -103,23 +108,13 @@ TUWF::get qr{/$RE{wid}(?:(?<sep>[\./])$RE{num})?}, sub { ORDER BY rp.num' ); - my $v = db_entry v => $w->{vid}; - VNWeb::VN::Page::enrich_vn($v); - - framework_ title => "Review of $v->{title}", index => 1, type => 'v', dbobj => $v, hiddenmsg => 1, - pagevars => {sethash=>$num?$num:$page>1?'threadstart':'review'}, + my $title = "Review of $w->{title}"; + framework_ title => $title, index => 1, type => 'w', dbobj => $w, + $num||$page>1 ? (pagevars => {sethash=>$num?$num:'threadstart'}) : (), sub { - VNWeb::VN::Page::infobox_($v); - VNWeb::VN::Page::tabs_($v, $w->{isfull}?'reviews':'minireviews'); - div_ class => 'mainbox', id => 'review', sub { - p_ class => 'mainopts', sub { - if(can_edit w => $w) { - a_ href => "/$w->{id}/edit", 'Edit'; - b_ class => 'grayedout', ' | '; - } - a_ href => "/report/$w->{id}", 'Report'; - }; - h1_ 'Review'; + div_ class => 'mainbox', sub { + itemmsg_ w => $w; + h1_ $title; review_ $w; }; if(grep !$_->{hidden}, @$posts) { diff --git a/lib/VNWeb/VN/Page.pm b/lib/VNWeb/VN/Page.pm index ace37546..435f02c2 100644 --- a/lib/VNWeb/VN/Page.pm +++ b/lib/VNWeb/VN/Page.pm @@ -8,7 +8,7 @@ use POSIX 'strftime'; # Enrich everything necessary to at least render infobox_(). -# Also used by Chars::VNTab & Reviews::{Page,VNTab} +# Also used by Chars::VNTab & Reviews::VNTab sub enrich_vn { my($v) = @_; enrich_merge id => 'SELECT id, c_votecount, c_olang::text[] AS c_olang FROM vn WHERE id IN', $v; @@ -328,7 +328,7 @@ sub infobox_useroptions_ { } -# Also used by Chars::VNTab & Reviews::{Page,VNTab} +# Also used by Chars::VNTab & Reviews::VNTab sub infobox_ { my($v) = @_; div_ class => 'mainbox', sub { @@ -386,7 +386,7 @@ sub infobox_ { } -# Also used by Chars::VNTab & Reviews::{Page,VNTab} +# Also used by Chars::VNTab & Reviews::VNTab sub tabs_ { my($v, $tab) = @_; my $chars = tuwf->dbVali('SELECT COUNT(DISTINCT c.id) FROM chars c JOIN chars_vns cv ON cv.id = c.id WHERE NOT c.hidden AND cv.vid =', \$v->{id}); |