summaryrefslogtreecommitdiff
path: root/data
diff options
context:
space:
mode:
authoryorhel <yorhel@1fe2e327-d9db-4752-bcf7-ef0cb4a1748b>2008-07-16 07:34:49 +0000
committeryorhel <yorhel@1fe2e327-d9db-4752-bcf7-ef0cb4a1748b>2008-07-16 07:34:49 +0000
commitee40f5605e50b1d421e3456f672a324360aff5a7 (patch)
tree3c0b8b491da00c20d1f4b38a634d5be12e13cee4 /data
parent94e9da6f6c654f45bc7efb7a4e6591c64f0553c5 (diff)
Accounts can be deleted, home page now shows age of last post instead of user, removed the /u+/pending URL, and small bugfix in dump.sql
git-svn-id: svn://vndb.org/vndb@69 1fe2e327-d9db-4752-bcf7-ef0cb4a1748b
Diffstat (limited to 'data')
-rw-r--r--data/tpl/defs.pl34
-rw-r--r--data/tpl/hist2
-rw-r--r--data/tpl/home2
-rw-r--r--data/tpl/tindex4
-rw-r--r--data/tpl/ttag4
-rw-r--r--data/tpl/tthread2
-rw-r--r--data/tpl/vnpage_stats6
7 files changed, 30 insertions, 24 deletions
diff --git a/data/tpl/defs.pl b/data/tpl/defs.pl
index 039c6507..ef5b3a67 100644
--- a/data/tpl/defs.pl
+++ b/data/tpl/defs.pl
@@ -62,14 +62,19 @@ sub wraplong { # text, margin
}
sub age {
my $a = time-$_[0];
- return sprintf '%d %s',
- $a > 60*60*24*365*2 ? ( $a/60/60/24/365, 'years ago' ) :
- $a > 60*60*24*(365/12)*2 ? ( $a/60/60/24/(365/12), 'months ago' ) :
- $a > 60*60*24*7*2 ? ( $a/60/60/24/7, 'weeks ago' ) :
- $a > 60*60*24*2 ? ( $a/60/60/24, 'days ago' ) :
- $a > 60*60*2 ? ( $a/60/60, 'hours ago' ) :
- $a > 60*2 ? ( $a/60, 'min ago' ) :
- ( $a, 'sec ago' ) ;
+ return sprintf '%d %s%s',
+ $a > 60*60*24*365*2 ? ( $a/60/60/24/365, 'years' ) :
+ $a > 60*60*24*(365/12)*2 ? ( $a/60/60/24/(365/12), 'months' ) :
+ $a > 60*60*24*7*2 ? ( $a/60/60/24/7, 'weeks' ) :
+ $a > 60*60*24*2 ? ( $a/60/60/24, 'days' ) :
+ $a > 60*60*2 ? ( $a/60/60, 'hours' ) :
+ $a > 60*2 ? ( $a/60, 'min' ) :
+ ( $a, 'sec' ),
+ $_[1]?'':' ago';
+}
+sub userstr { # [ uid, username ] or a hashref containing those keys
+ my($id,$n) = ref($_[0])eq'HASH'?($_[0]{uid}||$_[0]{requester}, $_[0]{username}):@_;
+ return !$id ? '[deleted]' : '<a href="/u'.$id.'">'.$n.'</a>';
}
@@ -104,7 +109,7 @@ sub cdiff { # obj1, obj2, @items->[ short, name, serialise, diff, [parsed_x, par
qq|<a href="/$type$$y{id}" id="revmain">$type$$y{id}</a>&nbsp;</div>|;
if(!$x) { # just show info about the revision if there is no previous edit
- return $pre.qq|<div id="tmc"><b>Revision $$y{rev}</b> (<a href="/$type$$y{id}/edit?rev=$$y{rev}">edit</a>)<br />By <a href="/u$$y{requester}">$$y{username}</a> on |.
+ return $pre.qq|<div id="tmc"><b>Revision $$y{rev}</b> (<a href="/$type$$y{id}/edit?rev=$$y{rev}">edit</a>)<br />By |.userstr($y).q| on |.
formatdate('%Y-%m-%d at %R', $$y{added}).'<br /><b>Edit summary:</b><br /><br />'.
summary($$y{comments}, 0, '[no summary]').'</div>';
}
@@ -132,8 +137,8 @@ sub cdiff { # obj1, obj2, @items->[ short, name, serialise, diff, [parsed_x, par
}
}
return $pre.'<table id="tmc"><thead><tr><td class="tc1">&nbsp;</td>'.
- qq|<td class="tc2"><b>Revision $$x{rev}</b> (<a href="/$type$$y{id}/edit?rev=$$x{rev}">edit</a>)<br />By <a href="/u$$x{requester}">$$x{username}</a> on |.formatdate('%Y-%m-%d at %R', $$x{added}).'</td>'.
- qq|<td class="tc3"><b>Revision $$y{rev}</b> (<a href="/$type$$y{id}/edit?rev=$$y{rev}">edit</a>)<br />By <a href="/u$$y{requester}">$$y{username}</a> on |.formatdate('%Y-%m-%d at %R', $$y{added}).'</td>'.
+ qq|<td class="tc2"><b>Revision $$x{rev}</b> (<a href="/$type$$y{id}/edit?rev=$$x{rev}">edit</a>)<br />By |.userstr($x).' on '.formatdate('%Y-%m-%d at %R', $$x{added}).'</td>'.
+ qq|<td class="tc3"><b>Revision $$y{rev}</b> (<a href="/$type$$y{id}/edit?rev=$$y{rev}">edit</a>)<br />By |.userstr($y).' on '.formatdate('%Y-%m-%d at %R', $$y{added}).'</td>'.
'</tr><tr></tr><tr><td>&nbsp;</td><td colspan="2"><b>Edit summary of revision '.$$y{rev}.'</b><br /><br />'.summary($$y{comments}, 0, '[no summary]').'<br /><br /></td></tr></thead>'.
join('',map{
'<tr><td class="tc1">'.$_->[1].'</td><td class="tc2">'.$_->[4].'</td><td class="tc3">'.$_->[5].'</td></tr>'
@@ -203,9 +208,10 @@ sub ttabs { # [vrpu], obj, sel
$p{Authlock} && $t ne 'u' ?
sprintf('<a href="/%%s/lock">%s</a>', $$o{locked} ? 'unlock' : 'lock') : (),
$p{Authdel} && $t ne 'u' ? (
- sprintf('<a href="/%%s/hide"%s>%s</a>', $t eq 'v' ? ' id="vhide"' : '', $$o{hidden} ? 'unhide' : 'hide')
- ) : (),
- ($t eq 'u' && $p{Authuseredit}) || ($t ne 'u' && (!$$o{locked} && !$$o{hidden}) || ($p{Authedit} && $p{Authlock})) ?
+ sprintf('<a href="/%%s/hide"%s>%s</a>', $t eq 'v' ? ' id="vhide"' : '', $$o{hidden} ? 'unhide' : 'hide') ) : (),
+ $t eq 'u' && $p{Authusermod} ? (
+ '<a href="/%s/del" id="userdel">del</a>' ) : (),
+ ($t eq 'u' && $p{Authusermod}) || ($t ne 'u' && (!$$o{locked} && !$$o{hidden}) || ($p{Authedit} && $p{Authlock})) ?
($s eq 'edit' ? 'edit' : '<a href="'.($p{Authedit}?'/%s/edit':'/u/register?n=1').'" '.($t eq 'v' || $t eq 'r' ? 'class="dropdown" rel="nofollow editDD"':'').'>edit</a>') : (),
$t eq 'u' ? (
diff --git a/data/tpl/hist b/data/tpl/hist
index 77acb6c2..1b9412cd 100644
--- a/data/tpl/hist
+++ b/data/tpl/hist
@@ -82,7 +82,7 @@
<td class="tc1_2"><a href="/[[= $t.$_->{iid}.'.'.$_->{rev} ]]">.[[= $_->{rev} == 1 ? '<b>'.$_->{rev}.'</b>' : $_->{rev} ]]</a></td>
<td class="tc2">[[= formatdate('%Y-%m-%d %R', $_->{added}, 'dh') ]]</td>
[[ if($d{type} ne 'u' || $d{act}) { ]]-
- <td class="tc3"><a href="/u[[= $_->{requester} ]]">[[: $_->{username} ]]</a></td>[[ } ]]-
+ <td class="tc3">[[= userstr $_ ]]</td>[[ } ]]-
[[ if(!$d{type} || $d{type} eq 'u' || $d{act}) { ]]-
<td class="tc4"><a href="/[[= $t.$_->{iid} ]].[[= $_->{rev} ]]" title="[[: $_->{ititle} ]]">[[: shorten $_->{ititle}, 30 ]]</a></td>[[ } ]]-
[[ if($d{type} && !$d{act}) { ]]-
diff --git a/data/tpl/home b/data/tpl/home
index 1d041841..338044e1 100644
--- a/data/tpl/home
+++ b/data/tpl/home
@@ -33,7 +33,7 @@
<ul class="home">
<li><b>Recent posts</b></li>
[[ for (@{$d{recentposts}}) { ]]-
- <li><a href="/t[[= $_->{id}.'.'.$_->{count} ]]" title="[[: $_->{title} ]]">[[: shorten $_->{title}, 25 ]]</a> <i>[[: $_->{lusername} ]]</i></li>
+ <li><a href="/t[[= $_->{id}.'.'.$_->{count} ]]" title="[[: $_->{title} ]]">[[: shorten $_->{title}, 25 ]]</a> <i>[[= age $_->{ldate}, 1 ]]</i></li>
[[ } ]]-
</ul>
diff --git a/data/tpl/tindex b/data/tpl/tindex
index ae5625b3..89608b11 100644
--- a/data/tpl/tindex
+++ b/data/tpl/tindex
@@ -34,8 +34,8 @@
[[ if($_->{locked}) { ]]- <b>[locked]</b>[[ } ]]
</td>
<td class="tc2">[[= $_->{count}-1 ]]</td>
- <td class="tc3"><a href="/u[[= $_->{uid} ]]">[[= $_->{username} ]]</a></td>
- <td class="tc4"><a href="/u[[= $_->{luid} ]]">[[= $_->{lusername} ]]</a> @
+ <td class="tc3">[[= userstr $_ ]]</td>
+ <td class="tc4">[[= userstr $_->{luid}, $_->{lusername} ]]- @
<a href="/t[[= $_->{id}.($_->{count}>$d{ppp}?'/'.ceil($_->{count}/$d{ppp}):'').'#'.$_->{count} ]]">
[[= age $_->{ldate} ]]</a></td>
</tr>
diff --git a/data/tpl/ttag b/data/tpl/ttag
index 6ddee459..0fe641b7 100644
--- a/data/tpl/ttag
+++ b/data/tpl/ttag
@@ -38,8 +38,8 @@
[[ if($_->{locked}) { ]]- <b>[locked]</b>[[ } ]]
</td>
<td class="tc2">[[= $_->{count}-1 ]]</td>
- <td class="tc3"><a href="/u[[= $_->{uid} ]]">[[= $_->{username} ]]</a></td>
- <td class="tc4"><a href="/u[[= $_->{luid} ]]">[[= $_->{lusername} ]]</a> @
+ <td class="tc3">[[= userstr $_ ]]</td>
+ <td class="tc4">[[= userstr $_->{luid}, $_->{lusername} ]]- @
<a href="/t[[= $_->{id}.($_->{count}>$d{ppp}?'/'.ceil($_->{count}/$d{ppp}):'').'#'.$_->{count} ]]">
[[= age $_->{ldate} ]]</a></td>
</tr>
diff --git a/data/tpl/tthread b/data/tpl/tthread
index 915474f7..f3e2a9a3 100644
--- a/data/tpl/tthread
+++ b/data/tpl/tthread
@@ -39,7 +39,7 @@
<td class="tc1">
<a href="/t[[= $d{t}{id} ]].[[= $_->{num} ]]" name="[[= $_->{num} ]]">#[[= $_->{num} ]]</a>
[[ if(!$_->{hidden}) { ]]-
- by <a href="/u[[= $_->{uid} ]]">[[: $_->{username} ]]</a><br />
+ by -[[= userstr $_ ]]<br />
<i>[[= formatdate('%Y-%m-%d %R', $_->{date}) ]]</i>
[[ } ]]
</td>
diff --git a/data/tpl/vnpage_stats b/data/tpl/vnpage_stats
index 841fce37..653987a1 100644
--- a/data/tpl/vnpage_stats
+++ b/data/tpl/vnpage_stats
@@ -10,7 +10,7 @@
]]
[[ if(!$d{user} || ($d{pv} && $d{user}{votes})) { ]]-
<li><h3>Vote graph <p class="actions">[[= $total ]]- vote[[= $total==1?'':'s' ]]- total
- [[= $total ? sprintf(', average: %.1f.', $sum/$total) : '' ]]</p></h3>
+ [[= $total && $d{user} ? sprintf(', average: %.1f.', $sum/$total) : '' ]]</p></h3>
<table id="tvg">
[[ for (0..$#{$d{votes}{graph}}) { ]]-
<tr>
@@ -26,7 +26,7 @@
[[ for (@{$d{votes}{latest}}) { ]]-
<tr>
[[ if(!$d{user}) { ]]-
- <td class="tc1"><a href="/u[[= $_->{uid} ]]">[[: $_->{username} ]]</a></td>
+ <td class="tc1">[[= userstr $_ ]]</td>
[[ } else { ]]-
<td class="tc1"><a href="/v[[= $_->{vid} ]]">[[: length($_->{title})>30?substr($_->{title},0,27).'...':$_->{title} ]]</a></td>
[[ } ]]-
@@ -56,7 +56,7 @@
[[ for (@{$d{lists}{latest}}) { ]]-
<tr>
[[ if(!$d{user}) { ]]-
- <td class="tc1"><a href="/u[[= $_->{uid} ]]">[[: $_->{username} ]]</a></td>
+ <td class="tc1">[[= userstr $_ ]]</td>
[[ } else { ]]-
<td class="tc1"><a href="/v[[= $_->{vid} ]]">[[: length($_->{title})>25?substr($_->{title},0,23).'...':$_->{title} ]]</a></td>
[[ } ]]-