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

[dw-free] http://username.dreamwidth.org/security

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

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

Add a title to the page on both success and failure, tweak wording.. Also
fix some comments / attribution and tweak spacing a bit.

Patch by [personal profile] ninetydegrees.

Files modified:
  • bin/upgrading/en.dat
  • cgi-bin/LJ/User.pm
  • views/journal/security.tt
  • views/journal/security.tt.text
--------------------------------------------------------------------------------
diff -r 2dc90bd1cc0c -r ff2375f5dfd3 bin/upgrading/en.dat
--- a/bin/upgrading/en.dat	Wed Dec 28 16:47:04 2011 +0800
+++ b/bin/upgrading/en.dat	Wed Dec 28 17:18:13 2011 +0800
@@ -944,17 +944,13 @@
 
 error.purged.title=Purged Account
 
-error.security.disabled=Sorry, the security-filtering system is currently disabled.
-
-error.security.invalid=You have specified an invalid security setting, the access group you specified does not exist, or you are not a member of that group.
-
-error.security.name2=Security Filter Error
-
-error.security.noarg=You must provide a security level to filter by.
-
-error.security.nocap=This feature is not available for your account level.
-
-error.security.s1=Sorry, security filtering is not supported within S1 styles.
+error.security.disabled2=Error: Sorry, the security-filtering system is currently disabled.
+
+error.security.invalid2=Error: You have specified an invalid security setting, the access group you specified does not exist, or you are not a member of that group.
+
+error.security.nocap2=Error: This feature is not available for your account level.
+
+error.security.s1.2=Error: Sorry, security filtering is not supported within S1 styles.
 
 error.support.invalid_category=Invalid support category
 
diff -r 2dc90bd1cc0c -r ff2375f5dfd3 cgi-bin/LJ/User.pm
--- a/cgi-bin/LJ/User.pm	Wed Dec 28 16:47:04 2011 +0800
+++ b/cgi-bin/LJ/User.pm	Wed Dec 28 17:18:13 2011 +0800
@@ -9598,7 +9598,6 @@
         my $r = DW::Request->get;
         my $security_err = sub {
             my ( $args, %opts ) = @_;
-            $args->{header} ||= "error.security.name2";
 
             my $status = $opts{status} || $r->NOT_FOUND;
 
@@ -9640,25 +9639,27 @@
             }
 
             ${$opts->{handle_with_siteviews_ref}} = 1;
-            return DW::Template->template_string( "journal/security.tt",
+            my $ret = DW::Template->template_string( "journal/security.tt",
                 $args,
                 {
                     status => $status,
                 }
             );
+            $opts->{siteviews_extra_content} = $args->{sections};
+            return $ret;
         };
 
-        return $security_err->( { message => undef, header => "/journal/security.tt.header" }, show_list => 1 )
+        return $security_err->( { message => undef }, show_list => 1 )
             unless $securityfilter;
 
-        return $security_err->( { message => "error.security.nocap" }, status => $r->FORBIDDEN )
+        return $security_err->( { message => "error.security.nocap2" }, status => $r->FORBIDDEN )
             unless LJ::get_cap( $remote, "security_filter" ) || LJ::get_cap( $u, "security_filter" );
 
-        return $security_err->( { message => "error.security.disabled" } )
+        return $security_err->( { message => "error.security.disabled2" } )
             unless LJ::is_enabled( "security_filter" );
 
         # throw an error if we're rendering in S1, but not for renamed accounts
-        return $security_err->( { message => "error.security.s1" } )
+        return $security_err->( { message => "error.security.s1.2" } )
             if $stylesys == 1 && $view ne 'data' && ! $u->is_redirect;
 
         # check the filter itself
@@ -9677,7 +9678,7 @@
             }
         }
 
-        return $security_err->( { message => "error.security.invalid" }, show_list => 1 )
+        return $security_err->( { message => "error.security.invalid2" }, show_list => 1 )
             unless defined $opts->{securityfilter};
     }
 
diff -r 2dc90bd1cc0c -r ff2375f5dfd3 views/journal/security.tt
--- a/views/journal/security.tt	Wed Dec 28 16:47:04 2011 +0800
+++ b/views/journal/security.tt	Wed Dec 28 17:18:13 2011 +0800
@@ -1,20 +1,35 @@
-[% IF header %]<h1>[% header | ml %]</h1>[% END %]
+[%# journal/security.tt
+
+Index page to filter by security level
+
+Authors:
+    Afuna <coder.dw@afunamatata.com>
+
+This program is free software; you may redistribute it and/or modify it under
+the same terms as Perl itself.  For a copy of the license, please reference
+'perldoc perlartistic' or 'perldoc perlgpl'.
+%]
+
+[%- sections.title = '.title' | ml -%]
+
 [% IF message %]<p>[% message | ml %]</p> [% END %]
 
 [% IF levels.size > 0 %]
-<p>[% ".filter.levels" | ml %]</p>
+<p>[% ".filter.levels" | ml %]
 <ul>
     [% FOREACH level IN levels %]
         <li><a href="[%level.link%]">[% level.name_ml | ml %]</a></li>
     [% END %]
 </ul>
+</p>
 [% END %]
 
 [% IF groups.size > 0 %]
-<p>[% ".filter.custom" | ml %]</p>
+<p>[% ".filter.custom" | ml %]
 <ul>
     [% FOREACH group IN groups %]
     <li><a href="[%group.link%]">[%group.name%]</a></li>
     [% END %]
 </ul>
+</p>
 [% END %]
diff -r 2dc90bd1cc0c -r ff2375f5dfd3 views/journal/security.tt.text
--- a/views/journal/security.tt.text	Wed Dec 28 16:47:04 2011 +0800
+++ b/views/journal/security.tt.text	Wed Dec 28 17:18:13 2011 +0800
@@ -2,4 +2,4 @@
 
 .filter.levels=You can filter entries by the following security level:
 
-.header=Filter by security
+.title=Journal Security Filters
--------------------------------------------------------------------------------