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

[dw-free] Add option to not display userpic on entries

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

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

Choose not to display all icons in all styles except Brittle and Skittlish
Dreams.

Patch by [personal profile] ninetydegrees.

Files modified:
  • bin/upgrading/s2layers/core2.s2
  • cgi-bin/LJ/S2.pm
  • cgi-bin/LJ/S2/EntryPage.pm
--------------------------------------------------------------------------------
diff -r 773dc3f8551d -r bfb3fb449d90 bin/upgrading/s2layers/core2.s2
--- a/bin/upgrading/s2layers/core2.s2	Mon Jun 06 15:24:18 2011 +0800
+++ b/bin/upgrading/s2layers/core2.s2	Mon Jun 06 16:30:20 2011 +0800
@@ -1316,8 +1316,8 @@
 }
 
 property string userpics_position {
-   des = "Place icons on left or right of entry";
-   values = "left|Left|right|Right";
+   des = "Place of icons in entries and comments";
+   values = "none|None (don't show)|left|Left|right|Right";
    }
 
 property string entry_metadata_position {
diff -r 773dc3f8551d -r bfb3fb449d90 cgi-bin/LJ/S2.pm
--- a/cgi-bin/LJ/S2.pm	Mon Jun 06 15:24:18 2011 +0800
+++ b/cgi-bin/LJ/S2.pm	Mon Jun 06 16:30:20 2011 +0800
@@ -2042,16 +2042,21 @@
 
     # loading S2 Userpic
     my $userpic;
-    my ( $pic, $kw ) = $entry_obj->userpic;
-
-    # if the post was made in a community, use either the userpic it was posted with or the community pic depending on the style setting
-    if ( $posterid == $journalid || !S2::get_property_value($opts->{ctx}, 'use_shared_pic') ) {
-        $userpic = Image_userpic( $poster, $pic->picid, $kw ) if $pic;
-    } else {
-        $userpic = Image_userpic( $journal, $journal->userpic->picid ) if $journal->userpic;
+    my $userpic_position = S2::get_property_value( $opts->{ctx}, 'userpics_position' );
+    my $userpic_style;
+
+    unless ( $userpic_position eq "none" ) {
+        # if the post was made in a community, use either the userpic it was posted with or the community pic depending on the style setting
+        if ( $posterid == $journalid || !S2::get_property_value($opts->{ctx}, 'use_shared_pic') ) {
+            my ( $pic, $kw ) = $entry_obj->userpic;
+            $userpic = Image_userpic( $poster, $pic->picid, $kw ) if $pic;
+        } else {
+            $userpic = Image_userpic( $journal, $journal->userpic->picid ) if $journal->userpic;
+        }
+
+        $userpic_style = S2::get_property_value( $opts->{ctx}, 'entry_userpic_style' );
     }
 
-    my $userpic_style = S2::get_property_value( $opts->{ctx}, 'entry_userpic_style' );
 
     # override used moodtheme if necessary
     my $moodthemeid = $u->prop( 'opt_forcemoodtheme' ) eq 'Y' ?
diff -r 773dc3f8551d -r bfb3fb449d90 cgi-bin/LJ/S2/EntryPage.pm
--- a/cgi-bin/LJ/S2/EntryPage.pm	Mon Jun 06 15:24:18 2011 +0800
+++ b/cgi-bin/LJ/S2/EntryPage.pm	Mon Jun 06 16:30:20 2011 +0800
@@ -175,21 +175,25 @@
             }
 
             my $comment_userpic;
+
+            my $userpic_position = S2::get_property_value( $opts->{ctx}, 'userpics_position' );
             my $comment_userpic_style = S2::get_property_value( $opts->{ctx}, 'comment_userpic_style' ) || "";
-            if ( defined $com->{picid} && ( my $pic = $userpic{$com->{picid}} ) )  {
-                my $width = $pic->{width};
-                my $height = $pic->{height};
+            unless ( $userpic_position eq "none" ) {
+                if ( defined $com->{picid} && ( my $pic = $userpic{$com->{picid}} ) )  {
+                    my $width = $pic->{width};
+                    my $height = $pic->{height};
                 
-                if ( $comment_userpic_style eq 'small' ) {
-                    $width = $width * 3 / 4;
-                    $height = $height * 3 / 4;
-                } elsif ( $comment_userpic_style eq 'smaller' ) {
-                    $width = $width / 2;
-                    $height = $height / 2;
+                    if ( $comment_userpic_style eq 'small' ) {
+                        $width = $width * 3 / 4;
+                        $height = $height * 3 / 4;
+                    } elsif ( $comment_userpic_style eq 'smaller' ) {
+                        $width = $width / 2;
+                        $height = $height / 2;
+                    }
+
+                    $comment_userpic = Image_userpic( $com->{upost}, $com->{picid}, $com->{pickw},
+                                                    $width, $height );
                 }
-
-                $comment_userpic = Image_userpic( $com->{upost}, $com->{picid}, $com->{pickw}, 
-                                                  $width, $height );
             }
 
             my $reply_url = LJ::Talk::talkargs($permalink, "replyto=$dtalkid", $style_arg);
@@ -501,11 +505,16 @@
     }
 
     my $style_args = LJ::viewing_style_args( %$get );
+
+    my $userpic_position = S2::get_property_value( $opts->{ctx}, 'userpics_position' );
     
     # load the userpic; include the keyword selected by the user
     # as a backup for the alttext
-    my ( $pic, $pickw ) = $entry->userpic;
-    my $userpic = Image_userpic($pu, $pic ? $pic->picid : 0, $pickw);
+    my $userpic;
+    unless ( $userpic_position eq "none" ) {
+        my ( $pic, $pickw ) = $entry->userpic;
+        $userpic = Image_userpic( $pu, $pic ? $pic->picid : 0, $pickw );
+    }
 
     my $comments = CommentInfo( $entry->comment_info(
         u => $u, remote => $remote, style_args => $style_args, viewall => $viewall
--------------------------------------------------------------------------------