fu: Close-up of Fu, bringing a scoop of water to her mouth (Default)
fu ([personal profile] fu) wrote in [site community profile] changelog2010-07-08 07:17 am

[dw-free] Investigate using cgi-bin/imageconf.pl instead of scattering image URLs all over the place

[commit: http://hg.dwscoalition.org/dw-free/rev/cfedf2f1aa06]

http://bugs.dwscoalition.org/show_bug.cgi?id=1207

Refactoring of images for userhead icons and images in the site scheme (the
nouserpic image)

Patch by [personal profile] kareila.

Files modified:
  • bin/upgrading/en.dat
  • cgi-bin/LJ/Entry.pm
  • cgi-bin/LJ/User.pm
  • cgi-bin/bml/scheme/blueshift.look
  • cgi-bin/bml/scheme/gradation-horizontal.look
  • cgi-bin/bml/scheme/gradation-vertical.look
  • cgi-bin/imageconf.pl
--------------------------------------------------------------------------------
diff -r ac0cbbfed53d -r cfedf2f1aa06 bin/upgrading/en.dat
--- a/bin/upgrading/en.dat	Thu Jul 08 15:08:27 2010 +0800
+++ b/bin/upgrading/en.dat	Thu Jul 08 15:23:28 2010 +0800
@@ -2023,6 +2023,10 @@ img.hourglass=Waiting...
 
 img.id_anonymous=Anonymous
 
+img.id_community=Community
+
+img.id_feed=Syndicated Feed
+
 img.id_openid=OpenID
 
 img.id_user=User
@@ -2034,6 +2038,8 @@ img.memadd=Add to memories!
 img.memadd=Add to memories!
 
 img.next_entry=Next Entry
+
+img.nouserpic=No default icon
 
 img.placeholder=Image
 
@@ -2414,8 +2420,6 @@ search.user.journal=Journal:
 search.user.journal=Journal:
 
 search.user.name=Name:
-
-search.user.nopic=no default userpic
 
 search.user.update.last=Updated [[time]]
 
diff -r ac0cbbfed53d -r cfedf2f1aa06 cgi-bin/LJ/Entry.pm
--- a/cgi-bin/LJ/Entry.pm	Thu Jul 08 15:08:27 2010 +0800
+++ b/cgi-bin/LJ/Entry.pm	Thu Jul 08 15:23:28 2010 +0800
@@ -530,7 +530,7 @@ sub comment_info {
         ( $journal->{opt_showtalklinks} eq "Y" && !$self->comments_disabled ) ) ? 1 : 0;
     my $has_screened = ( $self->props->{hasscreened} && $remote && $journal
                          && $remote->can_manage( $journal ) ) ? 1 : 0;
-    my $replycount = $self->reply_count;
+    my $replycount = $comments_enabled ? $self->reply_count : 0;
     my $nc = "";
     $nc .= "nc=$replycount" if $replycount && $remote && $remote->{opt_nctalklinks};
 
diff -r ac0cbbfed53d -r cfedf2f1aa06 cgi-bin/LJ/User.pm
--- a/cgi-bin/LJ/User.pm	Thu Jul 08 15:08:27 2010 +0800
+++ b/cgi-bin/LJ/User.pm	Thu Jul 08 15:23:28 2010 +0800
@@ -2479,29 +2479,19 @@ sub large_journal_icon {
         unless LJ::isu($u);
 
     my $wrap_img = sub {
-        return "<img src='$LJ::IMGPREFIX/silk/24x24/$_[0]' border='0' height='24' " .
-            "width='24' style='padding: 0px 2px 0px 0px' />";
-    };
-
-    # hook will return image to use if it cares about
-    # the $u it's been passed
-    my $hook_img = LJ::Hooks::run_hook("large_journal_icon", $u);
-    return $wrap_img->($hook_img) if $hook_img;
-
-    if ($u->is_comm) {
-        return $wrap_img->("community.png");
-    }
-
-    if ($u->is_syndicated) {
-        return $wrap_img->("feed.png");
-    }
-
-    if ($u->is_identity) {
-        return $wrap_img->("openid.png");
-    }
+        my $type = $_[0];
+        return LJ::img( "id_$type-24", "",
+                        { border => 0, style => 'padding: 0px 2px 0px 0px' } );
+    };
+
+    return $wrap_img->( "community" ) if $u->is_comm;
+
+    return $wrap_img->( "feed" ) if $u->is_syndicated;
+
+    return $wrap_img->( "openid" ) if $u->is_identity;
 
     # personal or unknown fallthrough
-    return $wrap_img->("user.png");
+    return $wrap_img->( "user" );
 }
 
 
@@ -7599,8 +7589,8 @@ sub user_search_display {
             $ret .= "<img src='$LJ::USERPIC_ROOT/$picid/" . $u->userid . "' alt='";
             $ret .= $u->user . " userpic' style='border: 1px solid #000;' />";
         } else {
-            $ret .= "<img src='$LJ::IMGPREFIX/nouserpic.png' alt='" . BML::ml( 'search.user.nopic' );
-            $ret .= "' style='border: 1px solid #000;' width='100' height='100' />";
+            $ret .= LJ::img( "nouserpic", "",
+                             { style => 'border: 1px solid #000;' } );
         }
         $ret .= "</a>";
 
diff -r ac0cbbfed53d -r cfedf2f1aa06 cgi-bin/bml/scheme/blueshift.look
--- a/cgi-bin/bml/scheme/blueshift.look	Thu Jul 08 15:08:27 2010 +0800
+++ b/cgi-bin/bml/scheme/blueshift.look	Thu Jul 08 15:23:28 2010 +0800
@@ -72,7 +72,7 @@ accountlinks<=
             my $wh = $userpic->img_fixedsize( width => 80, height => 80 );
             $ret .= "<img src='" . $userpic->url . "' $wh alt=\"$ML{'sitescheme.accountlinks.userpic.alt'}\" />";
         } else {
-            $ret .= "<img src='$LJ::IMGPREFIX/nouserpic.png' width='80' height='80' alt=\"$ML{'sitescheme.accountlinks.userpic.alt'}\" />";
+            $ret .= LJ::img( "nouserpic_sitescheme", "" );
         }
         $ret .= "</a></div>";
         $ret .= "<div id='account-links-text'>";
diff -r ac0cbbfed53d -r cfedf2f1aa06 cgi-bin/bml/scheme/gradation-horizontal.look
--- a/cgi-bin/bml/scheme/gradation-horizontal.look	Thu Jul 08 15:08:27 2010 +0800
+++ b/cgi-bin/bml/scheme/gradation-horizontal.look	Thu Jul 08 15:23:28 2010 +0800
@@ -73,7 +73,7 @@ accountlinks<=
             my $wh = $userpic->img_fixedsize( width => 80, height => 80 );
             $ret .= "<img src='" . $userpic->url . "' $wh alt=\"$ML{'sitescheme.accountlinks.userpic.alt'}\" />";
         } else {
-            $ret .= "<img src='$LJ::IMGPREFIX/nouserpic.png' width='80' height='80' alt=\"$ML{'sitescheme.accountlinks.userpic.alt'}\" />";
+            $ret .= LJ::img( "nouserpic_sitescheme", "" );
         }
         $ret .= "</a></div>";
         $ret .= "<div id='account-links-text'>";
diff -r ac0cbbfed53d -r cfedf2f1aa06 cgi-bin/bml/scheme/gradation-vertical.look
--- a/cgi-bin/bml/scheme/gradation-vertical.look	Thu Jul 08 15:08:27 2010 +0800
+++ b/cgi-bin/bml/scheme/gradation-vertical.look	Thu Jul 08 15:23:28 2010 +0800
@@ -71,7 +71,7 @@ accountlinks<=
             my $wh = $userpic->img_fixedsize( width => 80, height => 80 );
             $ret .= "<img src='" . $userpic->url . "' $wh alt=\"$ML{'sitescheme.accountlinks.userpic.alt'}\" />";
         } else {
-            $ret .= "<img src='$LJ::IMGPREFIX/nouserpic.png' width='80' height='80' alt=\"$ML{'sitescheme.accountlinks.userpic.alt'}\" />";
+            $ret .= LJ::img( "nouserpic_sitescheme", "" );
         }
         $ret .= "</a></div>";
         $ret .= "<div id='account-links-text'>";
diff -r ac0cbbfed53d -r cfedf2f1aa06 cgi-bin/imageconf.pl
--- a/cgi-bin/imageconf.pl	Thu Jul 08 15:08:27 2010 +0800
+++ b/cgi-bin/imageconf.pl	Thu Jul 08 15:23:28 2010 +0800
@@ -227,6 +227,20 @@ use vars qw(%img);
     alt => 'img.us_map',
 };
 
+$img{nouserpic} = {
+    src => '/nouserpic.png',
+    width => 100,
+    height => 100,
+    alt => 'img.nouserpic',
+};
+
+$img{nouserpic_sitescheme} = {
+    src => '/nouserpic.png',
+    width => 80,
+    height => 80,
+    alt => 'sitescheme.accountlinks.userpic.alt',
+};
+
 $img{circle_yes} = {
     src => '/silk/site/tick.png',
     width => 16,
@@ -318,6 +332,34 @@ use vars qw(%img);
     alt => 'img.id_user',
 };
 
+$img{'id_community-24'} = {
+    src => '/silk/24x24/community.png',
+    width => 24,
+    height => 24,
+    alt => 'img.id_community',
+};
+
+$img{'id_feed-24'} = {
+    src => '/silk/24x24/feed.png',
+    width => 24,
+    height => 24,
+    alt => 'img.id_feed',
+};
+
+$img{'id_openid-24'} = {
+    src => '/silk/24x24/openid.png',
+    width => 24,
+    height => 24,
+    alt => 'img.id_openid',
+};
+
+$img{'id_user-24'} = {
+    src => '/silk/24x24/user.png',
+    width => 24,
+    height => 24,
+    alt => 'img.id_user',
+};
+
 $img{'poll_left'} = {
     src => '/poll/leftbar.gif',
     width => 7,
--------------------------------------------------------------------------------

Post a comment in response:

This account has disabled anonymous posting.
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting

If you are unable to use this captcha for any reason, please contact us by email at support@dreamwidth.org