ljr/livejournal/htdocs/syn/list.bml

61 lines
2.1 KiB
Plaintext
Raw Permalink Normal View History

2019-02-05 21:49:12 +00:00
<?page
title=><?_ml .title _ml?>
body<=
<?_code
use strict;
use vars qw(%GET);
my $ret;
my $popsyn = LJ::Syn::get_popular_feeds();
my @data;
foreach (@$popsyn) {
my ($user, $name, $userid, $url, $count) = @$_;
push @data, { 'user' => $user, 'name' => $name, 'numreaders' => $count, 'synurl' => $url };
}
# Query already defaults to "numreaders" sort
if ($GET{'sort'} eq "username") {
@data = sort { $a->{'user'} cmp $b->{'user'} } @data;
}
if ($GET{'sort'} eq "feeddesc") {
@data = sort { $a->{'name'} cmp $b->{'name'} } @data;
}
return "<?p $ML{'.error.nofeeds'} p?>" unless @data;
my %items = BML::paging(\@data, $GET{'page'}, 100);
my $navbar = LJ::paging_bar($items{'page'}, $items{'pages'});
@data = @{$items{'items'}};
$ret .= $navbar . "<table id='synlist'><tr valign='bottom'>";
$ret .= $GET{'sort'} eq "username" ? "<th>" . $ML{'.username'} . "</th>":
"<th><a href='" . BML::self_link({ 'sort' => "username"}) . "'>" . $ML{'.username'} . "</a>";
$ret .= $GET{'sort'} eq "feeddesc" ? "<th>" . $ML{'.feeddesc'} . "</th>":
"<th><a href='" . BML::self_link({ 'sort' => "feeddesc"}) . "'>" . $ML{'.feeddesc'} . "</a>";
$ret .= $GET{'sort'} eq "numreaders" ? "<th>" . $ML{'.numreaders'} . "</th>":
"<th><a href='" . BML::self_link({ 'sort' => "numreaders"}) . "'>" . $ML{'.numreaders'} . "</a>";
$ret .= "</th><th>&nbsp;</th></tr>";
foreach (@data) {
$ret .= "<tr>";
$ret .= "<td>" . LJ::ljuser($_->{'user'}, { 'type' => 'Y' }) . "</td>";
$ret .= "<td>" . LJ::ehtml($_->{'name'}) . "</td>";
$ret .= "<td>" . $_->{'numreaders'} . "</td>";
$ret .= "<td><a href='" . LJ::ehtml($_->{'synurl'}) . "'>".
"<img src='$LJ::IMGPREFIX/xml.gif' width='36' height='14' align='middle' border='0' alt='$ML{'.xml_icon.alt'}' /></a></td>";
$ret .= "</tr>";
}
$ret .= "</table>" . $navbar;
return $ret;
_code?>
<=body
head<=
<style type="text/css">
#synlist { width: 100%; }
#synlist th { text-align: left; }
</style>
<=head
page?>