[dw-free] change alt text of userhead
[commit: http://hg.dwscoalition.org/dw-free/rev/413eb3c1c25f]
http://bugs.dwscoalition.org/show_bug.cgi?id=1038
Make alt text for userhead more descriptive
Patch by
wyntarvox.
Files modified:
http://bugs.dwscoalition.org/show_bug.cgi?id=1038
Make alt text for userhead more descriptive
Patch by
![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png)
Files modified:
- cgi-bin/DW/External/User.pm
- cgi-bin/LJ/User.pm
-------------------------------------------------------------------------------- diff -r 63b750aa4b58 -r 413eb3c1c25f cgi-bin/DW/External/User.pm --- a/cgi-bin/DW/External/User.pm Mon May 11 13:58:54 2009 +0000 +++ b/cgi-bin/DW/External/User.pm Mon May 11 14:36:56 2009 +0000 @@ -69,9 +69,10 @@ sub ljuser_display { my $journal_url = $self->site->journal_url( $self ); my $badge_image_url = $self->site->badge_image_url( $self ); my $display_class = $opts{no_ljuser_class} ? "" : "class='ljuser'"; + my $domain = $self->site->{domain} ? $self->site->{domain} : $self->site->{hostname}; return "<span $display_class style='white-space: nowrap;'><a href='$profile_url'>" . - "<img src='$badge_image_url' alt='[info]' style='vertical-align: bottom; border: 0; padding-right: 1px;' />" . + "<img src='$badge_image_url' alt='[info] - $domain' style='vertical-align: bottom; border: 0; padding-right: 1px;' />" . "</a><a href='$journal_url'><b>$user</b></a></span>"; } diff -r 63b750aa4b58 -r 413eb3c1c25f cgi-bin/LJ/User.pm --- a/cgi-bin/LJ/User.pm Mon May 11 13:58:54 2009 +0000 +++ b/cgi-bin/LJ/User.pm Mon May 11 14:36:56 2009 +0000 @@ -2295,6 +2295,7 @@ sub ljuser_display { my $profile_url = $opts->{'profile_url'} || ''; my $journal_url = $opts->{'journal_url'} || ''; my $display_class = $opts->{no_ljuser_class} ? "" : "class='ljuser'"; + my $type = $u->journaltype_readable; my ($url, $name); @@ -2326,7 +2327,7 @@ sub ljuser_display { my $profile = $profile_url ne '' ? $profile_url : "$LJ::SITEROOT/userinfo.bml?userid=$u->{userid}&t=I$andfull"; - return "<span $display_class lj:user='$name' style='white-space: nowrap;$strike'><a href='$profile'><img src='$imgurl' alt='[info]' width='$width' height='$height' style='vertical-align: bottom; border: 0; padding-right: 1px;' /></a><a href='$url' rel='nofollow'><b>$name</b></a></span>"; + return "<span $display_class lj:user='$name' style='white-space: nowrap;$strike'><a href='$profile'><img src='$imgurl' alt='[info] - $type' width='$width' height='$height' style='vertical-align: bottom; border: 0; padding-right: 1px;' /></a><a href='$url' rel='nofollow'><b>$name</b></a></span>"; } else { return "<b>????</b>"; @@ -6571,13 +6572,15 @@ sub ljuser my $profile; my $make_tag = sub { - my ($fil, $url, $x, $y) = @_; + my ($fil, $url, $x, $y, $type) = @_; $y ||= $x; # make square if only one dimension given my $strike = $opts->{'del'} ? ' text-decoration: line-through;' : ''; # Backwards check, because we want it to default to on my $bold = (exists $opts->{'bold'} and $opts->{'bold'} == 0) ? 0 : 1; my $ljusername = $bold ? "<b>$user</b>" : "$user"; + + my $alttext = $type ? " - $type" : ""; my $link_color = ""; # Make sure it's really a color @@ -6588,7 +6591,7 @@ sub ljuser $profile = $profile_url ne '' ? $profile_url : $profile . $andfull; $url = $journal_url ne '' ? $journal_url : $url; - return "<span $display_class lj:user='$user' style='white-space: nowrap;$strike'><a href='$profile'><img src='$img/$fil' alt='[info]' width='$x' height='$y' style='vertical-align: bottom; border: 0; padding-right: 1px;' /></a><a href='$url'$link_color>$ljusername</a></span>"; + return "<span $display_class lj:user='$user' style='white-space: nowrap;$strike'><a href='$profile'><img src='$img/$fil' alt='[info]$alttext' width='$x' height='$y' style='vertical-align: bottom; border: 0; padding-right: 1px;' /></a><a href='$url'$link_color>$ljusername</a></span>"; }; my $u = isu($user) ? $user : LJ::load_user($user); @@ -6608,6 +6611,7 @@ sub ljuser $profile = $u->profile_url; my $type = $u->{'journaltype'}; + my $type_readable = $u->journaltype_readable; # Mark accounts as deleted that aren't visible, memorial, locked, or read-only $opts->{'del'} = 1 unless $u->is_visible || $u->is_memorial || $u->is_locked || $u->is_readonly; @@ -6620,25 +6624,25 @@ sub ljuser return $make_tag->($icon, $url, $size || 16) if $icon; } - if ($type eq 'C') { - return $make_tag->("comm_${head_size}.gif", $url, $head_size) if $head_size; - return $make_tag->('silk/identity/community.png', $url, 16); - } elsif ($type eq 'Y') { - return $make_tag->("syn_${head_size}.gif", $url, $head_size) if $head_size; - return $make_tag->('silk/identity/feed.png', $url, 16); - } elsif ($type eq 'N') { - return $make_tag->("news_${head_size}.gif", $url, $head_size) if $head_size; - return $make_tag->('silk/identity/news.png', $url, 16); - } elsif ($type eq 'I') { + if ( $type eq 'C' ) { + return $make_tag->( "comm_${head_size}.gif", $url, $head_size, '', $type_readable ) if $head_size; + return $make_tag->( 'silk/identity/community.png', $url, 16, '', $type_readable ); + } elsif ( $type eq 'Y' ) { + return $make_tag->( "syn_${head_size}.gif", $url, $head_size, '', $type_readable ) if $head_size; + return $make_tag->( 'silk/identity/feed.png', $url, 16, , $type_readable ); + } elsif ( $type eq 'N' ) { + return $make_tag->( "news_${head_size}.gif", $url, $head_size, '', $type_readable ) if $head_size; + return $make_tag->( 'silk/identity/news.png', $url, 16, '', $type_readable ); + } elsif ( $type eq 'I' ) { return $u->ljuser_display($opts); } else { if ( $u->get_cap( 'staff_headicon' ) == 1 ) { - return $make_tag->( "staff_${head_size}.gif", $url, $head_size ) if $head_size; - return $make_tag->( 'silk/identity/user_staff.png', $url, 17 ); + return $make_tag->( "staff_${head_size}.gif", $url, $head_size, '', 'staff' ) if $head_size; + return $make_tag->( 'silk/identity/user_staff.png', $url, 17, '', 'staff' ); } else { - return $make_tag->( "user_${head_size}.gif", $url, $head_size ) if $head_size; - return $make_tag->( 'silk/identity/user.png', $url, 17 ); + return $make_tag->( "user_${head_size}.gif", $url, $head_size, '', $type_readable ) if $head_size; + return $make_tag->( 'silk/identity/user.png', $url, 17, '', $type_readable ); } } } --------------------------------------------------------------------------------