Committer: ailyin
LJINT-385U trunk/cgi-bin/LJ/PartnerSite.pm
Modified: trunk/cgi-bin/LJ/PartnerSite.pm =================================================================== --- trunk/cgi-bin/LJ/PartnerSite.pm 2011-02-10 08:46:35 UTC (rev 10011) +++ trunk/cgi-bin/LJ/PartnerSite.pm 2011-02-10 08:52:22 UTC (rev 10012) @@ -893,6 +893,39 @@ =item * +$partner->ljuser_html($u): return a piece of HTML code related to the user; +it displays pretty much the same information as LJ::User::ljuser_display, +but this project needed different HTML coding for it, so here we go. + +=cut + +sub ljuser_html { + my ( $self, $u ) = @_; + + return unless $u; + + my $pattern = qq[<span class="lj3-user lj3-{journal_type_classname} vcard"><a title="Profile" target="_blank" href="{profile_url}"><img alt="" src="{statprefix}/gadgets/i/0.gif"></a> <a title="Journal" target="_blank" href="{journal_url}" class="fn nickname url">{display_name}</a></span>]; + + my $journal_url = $u->is_identity ? $u->identity->url($u) + : $u->journal_base . '/'; + + my %map = ( + 'journal_type_classname' + => $u->is_identity ? $u->identity->short_code : 'livejournal', + + 'profile_url' => $u->profile_url, + 'statprefix' => $LJ::STATPREFIX, + 'journal_url' => $journal_url, + 'display_name' => $u->display_name, + ); + + $pattern =~ s/\{(\w+)\}/$map{$1}/eg; + + return $pattern; +} + +=item * + $partner->needs_sync_comments_count: returns a boolean value indicating whether we need to ping the partner's site to notify them of any changes of comments count to their entries