# This code was forked from the LiveJournal project owned and operated # by Live Journal, Inc. The code has been modified and expanded by # Dreamwidth Studios, LLC. These files were originally licensed under # the terms of the license supplied by Live Journal, Inc, which can # currently be found at: # # http://code.livejournal.org/trac/livejournal/browser/trunk/LICENSE-LiveJournal.txt # # In accordance with the original license, this code and all its # modifications are provided under the GNU General Public License. # A copy of that license can be found in the LICENSE file included as # part of this distribution. package LJ::Widget::InboxFolderNav; use strict; use base qw(LJ::Widget); use Carp qw(croak); sub need_res { return qw( js/6alib/core.js js/6alib/dom.js js/6alib/hourglass.js stc/esn.css stc/lj_base.css ); } sub render_body { my $class = shift; my %opts = @_; my @errors; my $body; my $unread_html = sub { my $count = shift || 0; return $count ? " ($count)" : " "; }; my $subfolder_link = sub { my $link_view = shift; my $link_label = shift; my $class = shift || ""; my $unread = shift || ""; my $img = shift || 0; $class .= " selected" if $opts{view} && $opts{view} eq $link_view; my $link = qq{}; $link .= BML::ml($link_label); $link .= $unread if $unread; $link .= " $img" if $img; $link .= qq{\n}; return $link; }; my $remote = LJ::get_remote() or return ""; my $inbox = $remote->notification_inbox or return LJ::error_list( BML::ml( 'inbox.error.couldnt_retrieve_inbox', { 'user' => $remote->{user} } ) ); # print number of new alerts my $unread_count = $inbox->all_event_count; my $alert_plural = $unread_count == 1 ? 'inbox.message' : 'inbox.messages'; $alert_plural .= $unread_count ? '!' : '.'; my $message_button = ""; $message_button = qq{
} if LJ::is_enabled('user_messaging'); $body .= qq{ $message_button