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

[dw-free] age restriction settings don't show on site schemes

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

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

Show age restriction icon in site scheme entry and reply pages.

Patch by [personal profile] fu.

Files modified:
  • bin/upgrading/en.dat
  • cgi-bin/imageconf.pl
  • htdocs/talkpost.bml
  • htdocs/talkread.bml
--------------------------------------------------------------------------------
diff -r 1d5cfe1a8dab -r 64626eb6ccee bin/upgrading/en.dat
--- a/bin/upgrading/en.dat	Tue Apr 19 17:05:23 2011 +0800
+++ b/bin/upgrading/en.dat	Tue Apr 19 17:47:18 2011 +0800
@@ -3734,6 +3734,10 @@ taglib.error.mergetoexisting=The tag nam
 
 taglib.error.toomany2=This would make you exceed your maximum of [[max]] tags.  Please remove at least [[excess]] of the following new tags: [[tags]].
 
+talk.agerestriction.18plus=18+
+
+talk.agerestriction.nsfw=NSFW
+
 talk.anonwrote=Someone wrote,
 
 talk.anonwrote_comm=Someone wrote in [[commlink]],
diff -r 1d5cfe1a8dab -r 64626eb6ccee cgi-bin/imageconf.pl
--- a/cgi-bin/imageconf.pl	Tue Apr 19 17:05:23 2011 +0800
+++ b/cgi-bin/imageconf.pl	Tue Apr 19 17:47:18 2011 +0800
@@ -371,14 +371,14 @@ our %img;
     src => '/icon_nsfw.png',
     width => 16,
     height => 16,
-    alt => '',  # S2::PROPS
+    alt => 'talk.agerestriction.nsfw',  # overridden by S2::PROPS
 };
 
 $img{'adult-18'} = {
     src => '/icon_18.png',
     width => 16,
     height => 16,
-    alt => '',  # S2::PROPS
+    alt => 'talk.agerestriction.18plus',  # overridden by S2::PROPS
 };
 
 $img{'sticky-entry'} = {
diff -r 1d5cfe1a8dab -r 64626eb6ccee htdocs/talkpost.bml
--- a/htdocs/talkpost.bml	Tue Apr 19 17:05:23 2011 +0800
+++ b/htdocs/talkpost.bml	Tue Apr 19 17:47:18 2011 +0800
@@ -303,8 +303,17 @@ body<=
         }
     }
 
-    $sec .= "<br />\n" unless $sec eq "" or $parpost->{'subject'};
-    $ret .= $sec;
+    # age restriction settings
+    my $age_restriction = "";
+    my $entry_age_prop = $item->{props}->{adult_content} || "";
+    if ( $entry_age_prop eq "explicit" ) {
+        $age_restriction = LJ::img( "adult-18" );
+    } elsif ( $entry_age_prop eq "concepts" ) {
+        $age_restriction = LJ::img( "adult-nsfw" );
+    }
+
+    $ret .= $sec . $age_restriction;
+    $ret .= "<br />\n" unless ( $sec eq "" && $age_restriction eq "" ) or $parpost->{subject};
 
     ###
     if ($parpost->{'subject'}) {
diff -r 1d5cfe1a8dab -r 64626eb6ccee htdocs/talkread.bml
--- a/htdocs/talkread.bml	Tue Apr 19 17:05:23 2011 +0800
+++ b/htdocs/talkread.bml	Tue Apr 19 17:47:18 2011 +0800
@@ -309,8 +309,17 @@ body<=
         }
     }
 
-    $sec .= "<br />\n" unless $sec eq "" or $item->{'subject'};
-    $ret .= $sec;
+    # age restriction settings
+    my $age_restriction = "";
+    my $entry_age_prop = $item->{props}->{adult_content} || "";
+    if ( $entry_age_prop eq "explicit" ) {
+        $age_restriction = LJ::img( "adult-18" );
+    } elsif ( $entry_age_prop eq "concepts" ) {
+        $age_restriction = LJ::img( "adult-nsfw" );
+    }
+
+    $ret .= $sec . $age_restriction;
+    $ret .= "<br />\n" unless ( $sec eq "" && $age_restriction eq "" ) or $item->{subject};
 
     ###
     if ($item->{'subject'}) {
--------------------------------------------------------------------------------